-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: special context menu for dummy apps
为占位包实现了仅有“安装”和“移除”的右键菜单。 Log: 为占位应用图标提供了简单版本的右键菜单。
- Loading branch information
1 parent
7539f1d
commit d5e05aa
Showing
3 changed files
with
98 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
import QtQuick 2.15 | ||
import QtQuick.Controls 2.15 | ||
import org.deepin.dtk 1.0 | ||
|
||
import org.deepin.launchpad 1.0 | ||
import org.deepin.launchpad.models 1.0 | ||
|
||
Loader { | ||
id: root | ||
|
||
property string desktopId | ||
|
||
signal closed() | ||
|
||
Component { | ||
id: contextMenuComp | ||
|
||
Menu { | ||
id: contextMenu | ||
modal: true | ||
|
||
MenuItem { | ||
text: qsTr("Install") | ||
onTriggered: { | ||
launchApp(root.desktopId) | ||
} | ||
} | ||
|
||
MenuItem { | ||
text: qsTr("Remove") | ||
onTriggered: { | ||
DesktopIntegration.uninstallApp(root.desktopId) | ||
} | ||
} | ||
|
||
onClosed: { | ||
root.closed() | ||
root.destroy() | ||
} | ||
} | ||
} | ||
|
||
Connections { | ||
target: LauncherController | ||
function onVisibleChanged(visible) { | ||
if (!LauncherController.visible) { | ||
item.close() | ||
} | ||
} | ||
} | ||
|
||
asynchronous: true | ||
sourceComponent: contextMenuComp | ||
|
||
function popup() { | ||
active = true | ||
} | ||
|
||
function close() { | ||
active = false | ||
} | ||
|
||
onStatusChanged: if (status == Loader.Ready) { | ||
item.popup() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters