Fix items pinned from launcher
This commit is contained in:
parent
cdc3ff2a0f
commit
8f887abad6
1 changed files with 12 additions and 3 deletions
|
@ -101,13 +101,17 @@ void ApplicationModel::addItem(const QString &desktopFile)
|
||||||
item->exec = desktopInfo.value("Exec");
|
item->exec = desktopInfo.value("Exec");
|
||||||
item->desktopPath = desktopFile;
|
item->desktopPath = desktopFile;
|
||||||
item->isPinned = true;
|
item->isPinned = true;
|
||||||
|
|
||||||
|
// First use exec as the id of the item.
|
||||||
|
item->id = desktopInfo.value("Exec");
|
||||||
|
|
||||||
m_appItems << item;
|
m_appItems << item;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
|
|
||||||
|
savePinAndUnPinList();
|
||||||
|
|
||||||
emit itemAdded();
|
emit itemAdded();
|
||||||
emit countChanged();
|
emit countChanged();
|
||||||
|
|
||||||
savePinAndUnPinList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ApplicationModel::removeItem(const QString &desktopFile)
|
void ApplicationModel::removeItem(const QString &desktopFile)
|
||||||
|
@ -452,10 +456,15 @@ void ApplicationModel::onWindowAdded(quint64 wid)
|
||||||
|
|
||||||
// Use desktop find
|
// Use desktop find
|
||||||
if (!desktopPath.isEmpty() && desktopItem != nullptr) {
|
if (!desktopPath.isEmpty() && desktopItem != nullptr) {
|
||||||
desktopItem->id = id;
|
|
||||||
desktopItem->wids.append(wid);
|
desktopItem->wids.append(wid);
|
||||||
// Need to update application active status.
|
// Need to update application active status.
|
||||||
desktopItem->isActive = info.value("active").toBool();
|
desktopItem->isActive = info.value("active").toBool();
|
||||||
|
|
||||||
|
if (desktopItem->id != id) {
|
||||||
|
desktopItem->id = id;
|
||||||
|
savePinAndUnPinList();
|
||||||
|
}
|
||||||
|
|
||||||
handleDataChangedFromItem(desktopItem);
|
handleDataChangedFromItem(desktopItem);
|
||||||
}
|
}
|
||||||
// Find from id
|
// Find from id
|
||||||
|
|
Loading…
Reference in a new issue