bool PimSettingsBackupRestore::backupStart(const QString &filename)
{
    if (mStored.isEmpty()) {
        addDate();
        Q_EMIT addInfo(i18n("No data selected."));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    if (!openArchive(filename, true)) {
        Q_EMIT addError(i18n("Unable to open file \"%1\".", filename));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    Q_EMIT updateActions(true);
    mAction = Backup;
    mStoreIterator = mStored.constBegin();
    addDate();
    Q_EMIT addInfo(i18n("Starting to backup data in \'%1\'", mArchiveStorage->filename()));
    Q_EMIT addEndLine();
    //Add version
    Utils::addVersion(mArchiveStorage->archive());
    backupNextStep();
    return true;
}
bool PimSettingsBackupRestore::restoreStart(const QString &filename)
{
    if (mStored.isEmpty()) {
        addDate();
        Q_EMIT addInfo(i18n("No data selected."));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    if (!openArchive(filename, false)) {
        Q_EMIT addError(i18n("Unable to open file \"%1\".", filename));
        Q_EMIT jobFailed();
        deleteLater();
        return false;
    }
    Q_EMIT updateActions(true);
    mAction = Restore;
    mStoreIterator = mStored.constBegin();
    const int version = Utils::archiveVersion(mArchiveStorage->archive());
    if (version > Utils::currentArchiveVersion()) {
        if (!continueToRestore()) {
            return false;
        }
    }
    qCDebug(PIMSETTINGEXPORTERCORE_LOG) << " version " << version;
    AbstractImportExportJob::setArchiveVersion(version);

    addDate();

    Q_EMIT addInfo(i18n("Starting to restore data from \'%1\'", mArchiveStorage->filename()));
    Q_EMIT addEndLine();
    restoreNextStep();
    return true;
}
Exemple #3
0
void Client::updated() {
	stillAlive();
	// get the information in statusBuffer
	statusBuffer = client->status();
	// and deal with what it says
	if(statusBuffer.section("?", 0, 0) == "ERROR") {
		if (statusBuffer.section("?", 1, 1) == "FATAL") {
			emit disconnect(statusBuffer.section("?", 2, 2), thread);
		}
		else if (statusBuffer.section("?", 1, 1) == "RECOVERABLE") {
			emit couldntConnect(statusBuffer.section("?", 2, 2), thread);
		}
		else
			emit jobFailed("Bad plugin error string.", thread);
	}
	else if (statusBuffer.section("?", 0, 0) == "PROGRESS") {
		// here is the status update code
		emit changed(statusBuffer.section("?", 1, 1), thread, statusBuffer.section("?", 2, 2).toInt());
	}
	else if (statusBuffer.section("?", 0, 0) == "CONNECTED") {
		// yay!  It connected... now get to it, slacker
		emit connected(statusBuffer.section("?", 1, 1), thread);
	}
	else if (statusBuffer.section("?", 0, 0) == "RESULT") {
		if (statusBuffer.section("?", 1, 1) == "TRUE") {
			if (!Loaded) {
				Loaded = true;
				emit continueRender("Loaded file successfully", thread);
			}
		}
		else
			// emit to say that the result was bad
			emit jobFailed("Job Failed", thread);
	}
	else if (statusBuffer.section("?", 0, 0) == "ECHO") {
		emit echo(statusBuffer.section("?",1,-1), thread);
	}
	else if (statusBuffer.section("?", 0, 0) == "OUTPUT") {
		// can change later to check for successful creation of filename
		emit echo(statusBuffer.section("?", 1, 1), thread);
		emit jobDone("Job finished", thread);
	}
	else
		emit echo(statusBuffer, thread);
}
void PlotTableWidget::bagReaderReadingFailed(const QString& error) {
  pausePlots();
  
  for (size_t row = 0; row < plotWidgets_.count(); ++row)
    for (size_t column = 0; column < plotWidgets_[row].count(); ++column)
      plotWidgets_[row][column]->setBroker(registry_);
    
  emit jobFailed("Failed to read bag from [file://"+
    bagReader_->getFileName()+"]");
}
Exemple #5
0
void Client::connectStall() {
	client->halt();
	emit jobFailed("Apparent error on render client", thread);
}