bool Transfer::assignSessions(Session *source, Session *destination)
{
  bool result = true;
  
  // We need a source session
  if (!m_sourceUrl.isLocalFile() && !m_srcConnection) {
    if (!source)
      m_srcSession = KFTPSession::Manager::self()->spawnRemoteSession(IgnoreSide, m_sourceUrl, 0);
    else
      m_srcSession = source;
    
    if (!(m_srcConnection = initializeSession(m_srcSession)))
      result = false;
  }
  
  // We need a destination session
  if (!m_destUrl.isLocalFile() && !m_dstConnection) {
    if (!destination)
      m_dstSession = KFTPSession::Manager::self()->spawnRemoteSession(m_srcSession ? oppositeSide(m_srcSession->getSide()) : IgnoreSide, m_destUrl, 0);
    else
      m_dstSession = destination;
    
    if (!(m_dstConnection = initializeSession(m_dstSession)))
      result = false;
  }
  
  return result;
}
QTDecompressionSession::QTDecompressionSession(unsigned long pixelFormat, size_t width, size_t height)
    : m_session(0)
    , m_pixelFormat(pixelFormat)
    , m_width(width)
    , m_height(height)
{
    initializeSession();
}
Exemple #3
0
int
connectBrailleResource (
  BrailleDisplay *brl,
  const char *identifier,
  const GioDescriptor *descriptor,
  BrailleSessionInitializer *initializeSession
) {
  if ((brl->gioEndpoint = gioConnectResource(identifier, descriptor))) {
    if (!initializeSession || initializeSession(brl)) {
      if (gioDiscardInput(brl->gioEndpoint)) {
        return 1;
      }
    }

    gioDisconnectResource(brl->gioEndpoint);
    brl->gioEndpoint = NULL;
  }

  return 0;
}