Logo Search packages:      
Sourcecode: mailody version File versions  Download package

void Mailody::ImapManager::startConnection (  ) 

Reconnect to the Imap server. You can call this safely with changing from socket to secure socket and vice versa

Returns:
true when there is a new connection, false when there is no need for a new connection.

Definition at line 54 of file imapmanager.cpp.

References Mailody::Global::cryptoConnectionSupported(), loginOk(), mailBox(), mailBoxAdded(), mailBoxDeleted(), mailBoxList(), message(), messageCount(), saveDone(), Mailody::Imaplib::startConnection(), status(), statusError(), statusReady(), and unseenCount().

Referenced by Mailody::MainWindow::MainWindow().

{
    kapp->config()->setGroup("General");
    const QString imapServer = kapp->config()->readEntry("imapServer");
    int safe = kapp->config()->readNumEntry("safeImap",2);

    QString server = imapServer.section(":",0,0);
    int port = imapServer.section(":",1,1).toInt();

    m_imap = new Imaplib(this,"serverconnection");

    if ((safe == 1 || safe == 2) && !Global::cryptoConnectionSupported())
    {
        kdDebug() << "Crypto not supported!" << endl;
        slotError(i18n("You requested TLS/SSL, but your "
                       "system does not seem to be setup for that."));
        return;
    }

    m_imap->startConnection(server, port, (SocketSafe::Secure)safe);
    connect(m_imap,
            SIGNAL(login( Imaplib* )),
            SLOT( slotLogin( Imaplib* ) ));
    connect(m_imap,
            SIGNAL(loginOk( Imaplib* )),
            SIGNAL( loginOk() ));
    connect(m_imap,
            SIGNAL(status( const QString& )),
            SIGNAL(status( const QString& )));
    connect(m_imap,
            SIGNAL(statusReady()),
            SIGNAL(statusReady()));
    connect(m_imap,
            SIGNAL(statusError( const QString& )),
            SIGNAL(statusError( const QString& )));
    connect(m_imap,
            SIGNAL(saveDone()),
            SIGNAL(saveDone()));
    connect(m_imap,
            SIGNAL(error(const QString&)),
            SLOT(slotError(const QString&)));
    connect(m_imap,
            SIGNAL(disconnected()),
            SLOT(slotDisconnected()));
    connect(m_imap,
            SIGNAL(loginFailed( Imaplib* )),
            SLOT( slotLoginFailed( Imaplib* ) ));
    connect(m_imap,
            SIGNAL(alert( Imaplib*, const QString& )),
            SLOT( slotAlert( Imaplib*, const QString& ) ));
    connect(m_imap,
            SIGNAL(mailBoxList(const QStringList&)),
            SLOT( slotGetMailBoxList(const QStringList& ) ));
    connect(m_imap,
            SIGNAL(mailBox( Imaplib*, const QString&, const QStringList& )),
            SLOT( slotGetMailBox( Imaplib*, const QString&, const QStringList& ) ));
    connect(m_imap,
            SIGNAL(message( Imaplib*, const QString&, int, const QString& )),
            SLOT( slotGetMessage( Imaplib*, const QString&, int, const QString& ) ));
    connect(m_imap,
            SIGNAL(messageCount(Imaplib*, const QString&, int)),
            SLOT(slotMessagesInMailbox(Imaplib*, const QString&, int) ));
    connect(m_imap,
            SIGNAL(unseenCount(Imaplib*, const QString&, int)),
            SLOT(slotUnseenMessagesInMailbox(Imaplib*, const QString& , int ) ));
    connect(m_imap,
            SIGNAL(mailBoxAdded(const QString&)),
            SLOT(slotMailBoxAdded(const QString&)));
    connect(m_imap,
            SIGNAL(mailBoxDeleted(const QString&)),
            SLOT(slotMailBoxRemoved(const QString&)));
    connect(m_imap,
            SIGNAL(mailBoxRenamed(const QString&, const QString&)),
            SLOT(slotMailBoxRenamed(const QString&, const QString&)));
    connect(m_imap,
            SIGNAL(expungeCompleted(Imaplib*, const QString&)),
            SLOT(slotMailBoxExpunged(Imaplib*, const QString&)));
    connect(m_imap,
            SIGNAL(itemsInMailBox(Imaplib*,const QString&,const QStringList&)),
            SLOT(slotMailBoxItems(Imaplib*,const QString&,const QStringList&)));
    connect(m_imap,
            SIGNAL(integrity(const QString&, int, const QString&,
                   const QString&)),
            SLOT(slotIntegrity(const QString&, int, const QString&,
                 const QString&)));
}


Generated by  Doxygen 1.6.0   Back to index