diff --git a/containments/desktop/package/contents/config/main.xml b/containments/desktop/package/contents/config/main.xml --- a/containments/desktop/package/contents/config/main.xml +++ b/containments/desktop/package/contents/config/main.xml @@ -37,10 +37,6 @@ - - desktop:/ diff --git a/containments/desktop/package/contents/ui/FolderViewLayer.qml b/containments/desktop/package/contents/ui/FolderViewLayer.qml --- a/containments/desktop/package/contents/ui/FolderViewLayer.qml +++ b/containments/desktop/package/contents/ui/FolderViewLayer.qml @@ -188,18 +188,6 @@ onPositionsChanged: { folderView.positions = plasmoid.configuration.positions; } - - onScreenMappingChanged: { - Folder.ScreenMapper.screenMapping = plasmoid.configuration.screenMapping; - } - } - - Connections { - target: Folder.ScreenMapper - - onScreenMappingChanged: { - plasmoid.configuration.screenMapping = Folder.ScreenMapper.screenMapping; - } } PlasmaCore.ColorScope { @@ -239,7 +227,6 @@ } Component.onCompleted: { - Folder.ScreenMapper.screenMapping = plasmoid.configuration.screenMapping; folderView.sortMode = plasmoid.configuration.sortMode; folderView.positions = plasmoid.configuration.positions; } diff --git a/containments/desktop/plugins/folder/screenmapper.cpp b/containments/desktop/plugins/folder/screenmapper.cpp --- a/containments/desktop/plugins/folder/screenmapper.cpp +++ b/containments/desktop/plugins/folder/screenmapper.cpp @@ -24,6 +24,8 @@ #include #include +#include +#include ScreenMapper *ScreenMapper::instance() { @@ -39,6 +41,16 @@ connect(m_screenMappingChangedTimer, &QTimer::timeout, this, &ScreenMapper::screenMappingChanged); + connect(this, &ScreenMapper::screenMappingChanged, this, [this] { + if (!m_corona) + return; + + auto config = m_corona->config(); + KConfigGroup group(config, QLatin1String("ScreenMapping")); + group.writeEntry(QLatin1String("screenMapping"), screenMapping()); + config->sync(); + }); + // used to compress screenMappingChanged signals when addMapping is called multiple times, // eg. from FolderModel::filterAcceptRows. The timer interval is an arbitrary number, // that doesn't delay too much the signal, but still compresses as much as possible @@ -184,6 +196,11 @@ connect(m_corona, &Plasma::Corona::screenAdded, this, [this] (int screenId) { addScreen(screenId, {}); }); + + auto config = m_corona->config(); + KConfigGroup group(config, QLatin1String("ScreenMapping")); + QStringList mapping = group.readEntry(QLatin1String("screenMapping"), QStringList{}); + setScreenMapping(mapping); } } }