Пример #1
0
void RKSaveAgent::rCommandDone (RCommand *command) {
	RK_TRACE (APP);
	if (command->hasError ()) {
		if (when_done != DoNothing) {
			int res;
			res = KMessageBox::warningYesNoCancel (0, i18n ("Saving to file '%1' failed. What do you want to do?").arg (save_url.path ()), i18n ("Save failed"), KGuiItem (i18n ("Try saving with a different filename")), KGuiItem (i18n ("Saving failed")));
			if (res == KMessageBox::Yes) {
				if (askURL ()) RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.path () + "\")", RCommand::App, QString::null, this), save_chain);
				return;
			} else if (res == KMessageBox::No) {
				done ();
				return;
			} else {
				when_done = DoNothing;
				done ();
				return;
			}
		} else {
			if (KMessageBox::warningYesNo (0, i18n ("Saving to file '%1' failed. Do you want to try saving to a different filename?").arg (save_url.path ())) == KMessageBox::Yes) {
				if (askURL ()) RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.path () + "\")", RCommand::App, QString::null, this), save_chain);
				return;
			} else {
				done ();
				return;
			}
		}
	} else {
		RObjectList::getObjectList ()->setWorkspaceURL (save_url);
		RKWardMainWindow::getMain ()->setCaption (QString::null);	// trigger update of caption
		done ();
		return;
	}
}
Пример #2
0
void RKSaveAgent::rCommandDone (RCommand *command) {
	RK_TRACE (APP);
	if (command->hasError ()) {
		RKWorkplace::mainWorkplace ()->setWorkspaceURL (previous_url);

		int res;
		if (when_done != DoNothing) {
			res = KMessageBox::warningYesNoCancel (0, i18n ("Saving to file '%1' failed. What do you want to do?", save_url.path ()), i18n ("Save failed"), KGuiItem (i18n ("Try saving with a different filename")), KGuiItem (i18n ("Saving failed")));
		} else {
			res = KMessageBox::warningYesNo (0, i18n ("Saving to file '%1' failed. Do you want to try saving to a different filename?", save_url.path ()));
		}

		if (res == KMessageBox::Yes) {
			if (askURL ()) {
				RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.toLocalFile () + "\")", RCommand::App, QString (), this), save_chain);
				return;
			}
		} else if (res == KMessageBox::No) {
			done ();
			return;
		}

		// else
		when_done = DoNothing;
	}
	done ();
}
Пример #3
0
RKSaveAgent::RKSaveAgent (KURL url, bool save_file_as, DoneAction when_done, KURL load_url) {
	RK_TRACE (APP);
	save_url = url;
	RKSaveAgent::when_done = when_done;
	RKSaveAgent::load_url = load_url;
	save_chain = 0;
	if (save_url.isEmpty () || save_file_as) {
		if (!askURL ()) return;
	}
	
	RKWorkplace::mainWorkplace ()->flushAllData ();
	save_chain = RKGlobals::rInterface ()->startChain (0);
	
	RKWorkplace::mainWorkplace ()->saveWorkplace (save_chain);
	RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.path () + "\")", RCommand::App, QString::null, this), save_chain);
	RKWorkplace::mainWorkplace ()->clearWorkplaceDescription (save_chain);
}
Пример #4
0
RKSaveAgent::RKSaveAgent (KUrl url, bool save_file_as, DoneAction when_done, KUrl load_url) : QObject () {
	RK_TRACE (APP);
	save_url = url;
	RKSaveAgent::when_done = when_done;
	RKSaveAgent::load_url = load_url;
	previous_url = RKWorkplace::mainWorkplace ()->workspaceURL ();
	save_chain = 0;
	if (save_url.isEmpty () || save_file_as) {
		if (!askURL ()) {
			deleteLater();
			return;
		}
	}
	
	RKWorkplace::mainWorkplace ()->flushAllData ();
	save_chain = RKGlobals::rInterface ()->startChain (0);
	
	RKWorkplace::mainWorkplace ()->setWorkspaceURL (save_url, true);
	RKWorkplace::mainWorkplace ()->saveWorkplace (save_chain);
	RKGlobals::rInterface ()->issueCommand (new RCommand ("save.image (\"" + save_url.toLocalFile () + "\")", RCommand::App, QString (), this), save_chain);
}