mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
correctly restore desktop icons
This commit is contained in:
parent
62de2cb1be
commit
72d2df24c7
3 changed files with 27 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ ApplicationListModel::ApplicationListModel(HomeScreen *parent)
|
|||
connect(KSycoca::self(), SIGNAL(databaseChanged(const QStringList &)),
|
||||
this, SLOT(sycocaDbChanged(const QStringList &)));
|
||||
m_favorites = m_homeScreen->config().readEntry("Favorites", QStringList());
|
||||
m_desktopItems = m_homeScreen->config().readEntry("DesktopItems", QStringList()).toSet();
|
||||
m_appOrder = m_homeScreen->config().readEntry("AppOrder", QStringList());
|
||||
int i = 0;
|
||||
for (auto app : m_appOrder) {
|
||||
|
|
@ -150,6 +151,8 @@ void ApplicationListModel::loadApplications()
|
|||
|
||||
if (m_favorites.contains(data.storageId)) {
|
||||
data.location = Favorites;
|
||||
} else if (m_desktopItems.contains(data.storageId)) {
|
||||
data.location = Desktop;
|
||||
}
|
||||
|
||||
auto it = m_appPositions.constFind(service->storageId());
|
||||
|
|
@ -245,6 +248,14 @@ void ApplicationListModel::setLocation(int row, LauncherLocation location)
|
|||
emit favoriteCountChanged();
|
||||
}
|
||||
|
||||
if (location == Desktop) {
|
||||
m_desktopItems.insert(data.storageId);
|
||||
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList());
|
||||
} else if (data.location == Favorites) {
|
||||
m_desktopItems.remove(data.storageId);
|
||||
m_homeScreen->config().writeEntry("DesktopItems", m_desktopItems.toList());
|
||||
}
|
||||
|
||||
data.location = location;
|
||||
|
||||
emit dataChanged(index(row, 0), index(row, 0));
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ private:
|
|||
HomeScreen *m_homeScreen = nullptr;
|
||||
QStringList m_appOrder;
|
||||
QStringList m_favorites;
|
||||
QSet<QString> m_desktopItems;
|
||||
QHash<QString, int> m_appPositions;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
import QtQuick 2.4
|
||||
import QtQuick.Layouts 1.1
|
||||
import QtQuick.Controls 2.3 as Controls
|
||||
import QtGraphicalEffects 1.6
|
||||
|
||||
import org.kde.plasma.plasmoid 2.0
|
||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||
|
|
@ -36,6 +37,9 @@ ContainmentLayoutManager.ItemContainer {
|
|||
|
||||
property var modelData: typeof model !== "undefined" ? model : null
|
||||
|
||||
Layout.minimumWidth: availableCellWidth + units.gridUnit
|
||||
Layout.minimumHeight: availableCellHeight + units.gridUnit
|
||||
|
||||
leftPadding: units.smallSpacing * 2
|
||||
topPadding: units.smallSpacing * 2
|
||||
rightPadding: units.smallSpacing * 2
|
||||
|
|
@ -43,6 +47,7 @@ ContainmentLayoutManager.ItemContainer {
|
|||
|
||||
opacity: dragging ? 0.4 : 1
|
||||
|
||||
key: model.ApplicationStorageIdRole
|
||||
property real dragCenterX
|
||||
property real dragCenterY
|
||||
|
||||
|
|
@ -113,7 +118,16 @@ ContainmentLayoutManager.ItemContainer {
|
|||
|
||||
text: modelData ? modelData.ApplicationNameRole : ""
|
||||
font.pixelSize: theme.defaultFont.pixelSize
|
||||
color: PlasmaCore.ColorScope.textColor
|
||||
color: model.ApplicationLocationRole == ApplicationListModel.Desktop ? "white" : PlasmaCore.Theme.textColor
|
||||
|
||||
layer.enabled: model.ApplicationLocationRole == ApplicationListModel.Desktop
|
||||
layer.effect: DropShadow {
|
||||
horizontalOffset: 0
|
||||
verticalOffset: 2
|
||||
radius: 8.0
|
||||
samples: 16
|
||||
color: Qt.rgba(0, 0, 0, 0.8)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue