From kde-commits Wed Sep 30 20:43:15 2015 From: David Rosca Date: Wed, 30 Sep 2015 20:43:15 +0000 To: kde-commits Subject: [plasma-desktop/Plasma/5.4] kcms/keyboard: kded_keyboard: Fix restoring application/window specific Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=144364580421957 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/3768587fc6807e06dbf257dd51e2d9f2e42dd= 1b9 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 !=3D keyboardConfig.getDefaultLayouts() ) { - // layoutList =3D newLayoutList; + if (newLayoutList !=3D keyboardConfig.getDefaultLayouts()) { qCDebug(KCM_KEYBOARD, ) << "Layout map change from external source: cle= aring layout memory"; layoutMap.clear(); -// } + } } } = diff --git a/kcms/keyboard/layout_memory_persister.cpp b/kcms/keyboard/layo= ut_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::NoGlo= bals), "General"); - qCDebug(KCM_KEYBOARD) << "loginMode:" << c.readEntry("loginMode"); - QString loginMode =3D c.readEntry("loginMode"); - return loginMode !=3D "default" && loginMode !=3D "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.abso= lutePath(); - } - } + QFileInfo fileInfo(QStandardPaths::writableLocation(QStandardPaths::Da= taLocation) + 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.absolute= Path(); + } } - return false; + + QFile file(fileInfo.absoluteFilePath()); + return saveToFile(file); } = bool LayoutMemoryPersister::restore() { - if( isRestoreSession() ) { - QFile file(QStandardPaths::writableLocation(QStandardPaths::DataLo= cation) + REL_SESSION_FILE_PATH); - return restoreFromFile(file); - } - return false; + QFile file(QStandardPaths::writableLocation(QStandardPaths::DataLocati= on) + REL_SESSION_FILE_PATH); + return restoreFromFile(file); } = =20