[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-desktop/Plasma/5.4] kcms/keyboard: kded_keyboard: Fix restoring application/window specific 
From:       David Rosca <nowrep () gmail ! com>
Date:       2015-09-30 20:43:15
Message-ID: E1ZhODb-0008Bl-Lr () scm ! kde ! org
[Download RAW message or body]

Git commit 3768587fc6807e06dbf257dd51e2d9f2e42dd1b9 by David Rosca.
Committed on 30/09/2015 at 20:39.
Pushed by drosca into branch 'Plasma/5.4'.

kded_keyboard: Fix restoring application/window specific layout settings

This removes the check if user has restore session on start option
enabled, so the layout map is restored everytime.

It also checks in LayoutMemory::laoutChanged if the changed keyboard
layout is different from user configured to prevent clearing the layout
map on startup.

BUG: 325572
FIXED-IN: 5.4.2
REVIEW: 125256

M  +2    -3    kcms/keyboard/layout_memory.cpp
M  +11   -25   kcms/keyboard/layout_memory_persister.cpp

http://commits.kde.org/plasma-desktop/3768587fc6807e06dbf257dd51e2d9f2e42dd1b9

diff --git a/kcms/keyboard/layout_memory.cpp b/kcms/keyboard/layout_memory.cpp
index 454a67d..2a3ba73 100644
--- a/kcms/keyboard/layout_memory.cpp
+++ b/kcms/keyboard/layout_memory.cpp
@@ -135,11 +135,10 @@ void LayoutMemory::layoutMapChanged()
 		layoutChanged();	// to remember new map for active "window"
 	}
 	else {
-//		if( newLayoutList != keyboardConfig.getDefaultLayouts() ) {
-			//		layoutList = newLayoutList;
+		if (newLayoutList != keyboardConfig.getDefaultLayouts()) {
 			qCDebug(KCM_KEYBOARD, ) << "Layout map change from external source: clearing \
layout memory";  layoutMap.clear();
-//		}
+		}
 	}
 }
 
diff --git a/kcms/keyboard/layout_memory_persister.cpp \
b/kcms/keyboard/layout_memory_persister.cpp index 620a394..7407d75 100644
--- a/kcms/keyboard/layout_memory_persister.cpp
+++ b/kcms/keyboard/layout_memory_persister.cpp
@@ -97,39 +97,25 @@ QString LayoutMemoryPersister::getLayoutMapAsString()
 	return doc.toString();
 }
 
-static bool isRestoreSession()
-{
-    KConfigGroup c(KSharedConfig::openConfig("ksmserverrc", KConfig::NoGlobals), \
                "General");
-    qCDebug(KCM_KEYBOARD) << "loginMode:" << c.readEntry("loginMode");
-    QString loginMode = c.readEntry("loginMode");
-    return loginMode != "default" && loginMode != "restoreSavedSession";	// we don't \
                know how to restore saved session - only previous one
-}
-
 bool LayoutMemoryPersister::save()
 {
-	if( isRestoreSession() ) {
-        QFileInfo fileInfo(QStandardPaths::writableLocation(QStandardPaths::DataLocation) \
                + REL_SESSION_FILE_PATH);
-
-        QDir baseDir(fileInfo.absoluteDir());
-        if( ! baseDir.exists() ) {
-            if( ! QDir().mkpath(baseDir.absolutePath()) ) {
-                qWarning() << "Failed to create directory" << \
                baseDir.absolutePath();
-            }
-        }
+    QFileInfo fileInfo(QStandardPaths::writableLocation(QStandardPaths::DataLocation) \
+ REL_SESSION_FILE_PATH);  
-        QFile file(fileInfo.absoluteFilePath());
-    	return saveToFile(file);
+    QDir baseDir(fileInfo.absoluteDir());
+    if( ! baseDir.exists() ) {
+        if( ! QDir().mkpath(baseDir.absolutePath()) ) {
+            qWarning() << "Failed to create directory" << baseDir.absolutePath();
+        }
     }
-    return false;
+
+    QFile file(fileInfo.absoluteFilePath());
+    return saveToFile(file);
 }
 
 bool LayoutMemoryPersister::restore()
 {
-	if( isRestoreSession() ) {
-        QFile file(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + \
                REL_SESSION_FILE_PATH);
-    	return restoreFromFile(file);
-    }
-    return false;
+    QFile file(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + \
REL_SESSION_FILE_PATH); +    return restoreFromFile(file);
 }
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic