[rkward-cvs] [rkward] rkward: Mark workspace as clean on startup.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Fri Nov 28 19:10:07 UTC 2014


Git commit 56c59427668d59585077d2f79f208a9dea5a31ed by Thomas Friedrichsmeier.
Committed on 28/11/2014 at 19:09.
Pushed by tfry into branch 'master'.

Mark workspace as clean on startup.
However, do prompt for saving when opening a workspace while commands are still pending.

M  +6    -1    rkward/rkward.cpp
M  +1    -0    rkward/rkward.h

http://commits.kde.org/rkward/56c59427668d59585077d2f79f208a9dea5a31ed

diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp
index e73cb08..7d901d0 100644
--- a/rkward/rkward.cpp
+++ b/rkward/rkward.cpp
@@ -265,6 +265,11 @@ void RKWardMainWindow::doPostInit () {
 	}
 	setNoAskSave (false);
 
+	// up to this point, no "real" save-worthy stuff can be pending in the backend. So mark this point as "clean".
+	RCommand *command = new RCommand (QString (), RCommand::EmptyCommand | RCommand::Sync | RCommand::App);
+	connect (command->notifier (), SIGNAL (commandFinished(RCommand*)), this, SLOT (setWorkspaceUnmodified()));
+	RKGlobals::rInterface ()->issueCommand (command);
+
 	if (!evaluate_code.isEmpty ()) RKConsole::pipeUserCommand (evaluate_code);
 	RKDBusAPI *dbus = new RKDBusAPI (this);
 	connect (this, SIGNAL(aboutToQuitRKWard()), dbus, SLOT(deleteLater()));	// RKWard sometimes needs to wait for R to quit. We don't want it sticking
@@ -749,7 +754,7 @@ void RKWardMainWindow::slotNewDataFrame () {
 void RKWardMainWindow::askOpenWorkspace (const KUrl &url) {
 	RK_TRACE (APP);
 
-	if (!no_ask_save && !RObjectList::getGlobalEnv ()->isEmpty () && workspace_modified) {
+	if (!no_ask_save && ((!RObjectList::getGlobalEnv ()->isEmpty () && workspace_modified) || !RKGlobals::rInterface ()->backendIsIdle ())) {
 		int res;
 		res = KMessageBox::questionYesNoCancel (this, i18n ("Do you want to save the current workspace?"), i18n ("Save Workspace?"));
 		if (res == KMessageBox::Yes) {
diff --git a/rkward/rkward.h b/rkward/rkward.h
index 99d8228..2edb558 100644
--- a/rkward/rkward.h
+++ b/rkward/rkward.h
@@ -76,6 +76,7 @@ protected:
 signals:
 	void aboutToQuitRKWard ();
 public slots:
+	void setWorkspaceUnmodified () { setWorkspaceMightBeModified (false); };
 	/** open a workspace. If the current workspace is not empty, ask whether to save first.
     @see setNoAskSave ()
     @see setWorkspaceMightBeModified () */




More information about the rkward-tracker mailing list