void ArchiveJob::execute()
{
  if(mInfo) {
    MailCommon::BackupJob *backupJob = new MailCommon::BackupJob();
    Akonadi::Collection collection(mInfo->saveCollectionId());
    backupJob->setRootFolder( MailCommon::Util::updatedCollection(collection) );
    const QString realPath = MailCommon::Util::fullCollectionPath(collection);
    backupJob->setSaveLocation( mInfo->realUrl(realPath) );
    backupJob->setArchiveType( mInfo->archiveType() );
    backupJob->setDeleteFoldersAfterCompletion( false );
    backupJob->setRecursive( mInfo->saveSubCollection() );
    backupJob->setDisplayMessageBox(false);
    const QString summary = i18n("Start to archive %1",realPath );
    const QPixmap pixmap = KIcon( "kmail" ).pixmap( KIconLoader::SizeSmall, KIconLoader::SizeSmall );
    KNotification::event( QLatin1String("archivemailstarted"),
                          summary,
                          pixmap,
                          0,
                          KNotification::CloseOnTimeout,
                          KGlobal::mainComponent());
    connect(backupJob,SIGNAL(backupDone(QString)),this,SLOT(slotBackupDone(QString)));
    connect(backupJob,SIGNAL(error(QString)),this,SLOT(slotError(QString)));
    backupJob->start();

  }
}
Exemplo n.º 2
0
void PimSettingsBackupRestore::backupFinished()
{
    Q_EMIT addInfo(i18n("Backup in \'%1\' done.", mArchiveStorage->filename()));
    //At the end
    closeArchive();
    Q_EMIT backupDone();
    deleteLater();
}
Exemplo n.º 3
0
void MainWindow::on_btn_cancel_backup_clicked()
{
    // Kill backup thread
    bThread.terminate(); // Not pretty but does the job

    // Backup done...
    backupDone(1);
}
Exemplo n.º 4
0
void MainWindow::timerEvent(QTimerEvent *)
{
    // Animate progressbar
    if(this->pb_progress == 0)
    {
        // Set reverse false
        this->pb_reverse = false;

        // Undo inverse progressbar
        ui->progressBar->setInvertedAppearance(false);
    }
    else if(this->pb_progress == 100)
    {
        // Set reverse true
        this->pb_reverse = true;

        // Inverse progressbar
        ui->progressBar->setInvertedAppearance(true);
    }

    if(this->pb_reverse == true)
    {
        this->pb_progress--;
    }
    else if(this->pb_reverse == false)
    {
        this->pb_progress++;
    }

    // Update progressbar
    ui->progressBar->setValue(this->pb_progress);

    // Check if backup is done
    if(bThread.backupDone == true)
    {
        // Backup is done
        backupDone(0);
    }
}