You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.7 KiB
50 lines
1.7 KiB
On branch topic-session-save
|
|
Changes to be committed:
|
|
(use "git reset HEAD <file>..." to unstage)
|
|
|
|
modified: sm.cpp
|
|
|
|
diff --git a/sm.cpp b/sm.cpp
|
|
index 2098b7f..05a5d77 100644
|
|
--- a/sm.cpp
|
|
+++ b/sm.cpp
|
|
@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#include "workspace.h"
|
|
#include "client.h"
|
|
#include <QDebug>
|
|
+#include <QFile>
|
|
#include <QSocketNotifier>
|
|
#include <QSessionManager>
|
|
|
|
@@ -64,18 +65,30 @@ void Workspace::saveState(QSessionManager &sm)
|
|
// too late, as possible user interaction may change some things.
|
|
// Phase2 is still needed though (ICCCM 5.2)
|
|
KConfig *config = sessionConfig(sm.sessionId(), sm.sessionKey());
|
|
+
|
|
if (!sm.isPhase2()) {
|
|
KConfigGroup cg(config, "Session");
|
|
cg.writeEntry("AllowsInteraction", sm.allowsInteraction());
|
|
sessionSaveStarted();
|
|
if (gs_sessionManagerIsKSMServer) // save stacking order etc. before "save file?" etc. dialogs change it
|
|
storeSession(config, SMSavePhase0);
|
|
+ // don't save it to disk
|
|
+ config->markAsClean();
|
|
sm.release(); // Qt doesn't automatically release in this case (bug?)
|
|
sm.requestPhase2();
|
|
return;
|
|
}
|
|
storeSession(config, gs_sessionManagerIsKSMServer ? SMSavePhase2 : SMSavePhase2Full);
|
|
config->sync();
|
|
+
|
|
+ // generate discard command for new file
|
|
+ QString localFilePath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + QLatin1Char('/') + config->name();
|
|
+ if (QFile::exists(localFilePath)) {
|
|
+ QStringList discard;
|
|
+ discard << QLatin1String("rm");
|
|
+ discard << localFilePath;
|
|
+ sm.setDiscardCommand(discard);
|
|
+ }
|
|
}
|
|
|
|
// I bet this is broken, just like everywhere else in KDE
|