Esempio n. 1
0
void MoveCollectionTask::onRenameDone(KJob *job)
{
    if (job->error()) {
        cancelTask(job->errorString());
    } else {
        // Automatically subscribe to the new mailbox name
        KIMAP::RenameJob *rename = static_cast<KIMAP::RenameJob *>(job);

        KIMAP::SubscribeJob *subscribe = new KIMAP::SubscribeJob(rename->session());
        subscribe->setMailBox(rename->destinationMailBox());

        connect(subscribe, &KIMAP::SubscribeJob::result, this, &MoveCollectionTask::onSubscribeDone);

        subscribe->start();
    }
}
Esempio n. 2
0
void testRename()
{
    QFETCH( QString, mailbox );
    QFETCH( QString, newname );
    QFETCH( QList<QByteArray>, scenario );

    FakeServer fakeServer;
    fakeServer.setScenario( scenario );
    fakeServer.startAndWait();

    KIMAP::Session session( "127.0.0.1", 5989 );

    KIMAP::RenameJob *job = new KIMAP::RenameJob( &session );
    job->setSourceMailBox( mailbox );
    job->setDestinationMailBox( newname );
    bool result = job->exec();
    QEXPECT_FAIL( "bad" , "Expected failure on BAD response", Continue );
    QEXPECT_FAIL( "no" , "Expected failure on NO response", Continue );
    QVERIFY( result );
    QCOMPARE( job->sourceMailBox(), mailbox );
    QCOMPARE( job->destinationMailBox(), newname );

    fakeServer.quit();
}