Skip to content

Commit a6b9fa6

Browse files
committed
fix: Shutdown plugin miss menu function
as title Log: as title Bug: BUG-294875
1 parent 6ab1a7d commit a6b9fa6

File tree

9 files changed

+34
-37
lines changed

9 files changed

+34
-37
lines changed

applets/dde-shutdown/shutdownapplet.cpp

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,25 @@ bool ShutdownApplet::load()
3434
return true;
3535
}
3636

37-
bool ShutdownApplet::requestShutdown()
37+
bool ShutdownApplet::requestShutdown(const QString &type)
3838
{
39-
qDebug() << "request shutdown";
39+
qDebug() << "request shutdown:" << type;
4040
if (m_lockscreen) {
41-
m_lockscreen->shutdown();
41+
if (type.isEmpty()) {
42+
// TODO: left mouse clicked, show shutdown page
43+
m_lockscreen->shutdown();
44+
} else if (type == QStringLiteral("Shutdown")) {
45+
m_lockscreen->shutdown();
46+
} else if (type == QStringLiteral("Lock")) {
47+
m_lockscreen->lock();
48+
} else if (type == QStringLiteral("SwitchUser")) {
49+
m_lockscreen->switchUser();
50+
} else if (type == QStringLiteral("UpdateAndShutdown") || type == QStringLiteral("UpdateAndReboot") ||
51+
type == QStringLiteral("Suspend") || type == QStringLiteral("Hibernate") ||
52+
type == QStringLiteral("Restart") || type == QStringLiteral("Logout")) {
53+
// TODO: implement these types
54+
m_lockscreen->shutdown();
55+
}
4256
} else {
4357
DDBusSender()
4458
.service("org.deepin.dde.ShutdownFront1")
@@ -51,22 +65,6 @@ bool ShutdownApplet::requestShutdown()
5165
return true;
5266
}
5367

54-
bool ShutdownApplet::requestLock()
55-
{
56-
if (m_lockscreen) {
57-
m_lockscreen->lock();
58-
}
59-
return true;
60-
}
61-
62-
bool ShutdownApplet::requestSwitchUser()
63-
{
64-
if (m_lockscreen) {
65-
m_lockscreen->switchUser();
66-
}
67-
return true;
68-
}
69-
7068
D_APPLET_CLASS(ShutdownApplet)
7169
}
7270
DS_END_NAMESPACE

applets/dde-shutdown/shutdownapplet.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ class ShutdownApplet : public DApplet
1919
virtual bool load() override;
2020

2121
public Q_SLOTS:
22-
bool requestShutdown();
23-
bool requestLock();
24-
bool requestSwitchUser();
22+
bool requestShutdown(const QString &type);
2523

2624
private:
2725
QScopedPointer<TreeLandLockScreen> m_lockscreen;

debian/control

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Build-Depends:
3232
libqt6svg6,
3333
libdtk6declarative, qml6-module-qtquick-controls2-styles-chameleon, qt6-declarative-private-dev,
3434
libyaml-cpp-dev,
35-
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.6),
35+
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.8),
3636
dde-application-manager-api (>= 1.2.16), dde-control-center-dev (>= 6.0.73)
3737
Standards-Version: 3.9.8
3838
Homepage: http://www.deepin.org
@@ -60,7 +60,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libdde-shell( =${binary:Version}),
6060
libdtk6declarative, qml6-module-qtquick-controls2-styles-chameleon,
6161
qml6-module-qtquick-layouts, qml6-module-qtquick-window,
6262
qml6-module-qt-labs-platform, qml6-module-qt-labs-qmlmodels,
63-
dde-tray-loader (> 1.99.6)
63+
dde-tray-loader (> 1.99.8)
6464
Multi-Arch: same
6565
Description: An wrapper for developed based on dde-shell plugin system
6666

example/lockscreen-example/package/main.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ AppletItem {
2727
onClicked: {
2828
let lockscreen = lockscreenApplet()
2929
if (lockscreen) {
30-
lockscreen.requestLock()
30+
lockscreen.requestShutdown("Lock")
3131
}
3232
}
3333
}
@@ -36,7 +36,7 @@ AppletItem {
3636
onClicked: {
3737
let lockscreen = lockscreenApplet()
3838
if (lockscreen) {
39-
lockscreen.requestShutdown()
39+
lockscreen.requestShutdown("Shutdown")
4040
}
4141
}
4242
}
@@ -45,7 +45,7 @@ AppletItem {
4545
onClicked: {
4646
let lockscreen = lockscreenApplet()
4747
if (lockscreen) {
48-
lockscreen.requestSwitchUser()
48+
lockscreen.requestShutdown("SwitchUser")
4949
}
5050
}
5151
}

panels/dock/DockCompositor.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Item {
2828

2929
signal pluginSurfacesUpdated()
3030
signal popupCreated(var popup)
31-
signal requestShutdown()
31+
signal requestShutdown(var type)
3232

3333
function removeDockPluginSurface(model, object) {
3434
for (var i = 0; i < model.count; ++i) {
@@ -104,8 +104,8 @@ Item {
104104
dockCompositor.popupCreated(popup)
105105
}
106106

107-
onRequestShutdown: {
108-
dockCompositor.requestShutdown()
107+
onRequestShutdown: (type) => {
108+
dockCompositor.requestShutdown(type)
109109
}
110110
}
111111

panels/dock/pluginmanagerextension.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,10 @@ void PluginSurface::plugin_dcc_icon(Resource *resource, const QString &icon)
186186
m_dccIcon = icon;
187187
}
188188

189-
void PluginSurface::plugin_request_shutdown(Resource *resource)
189+
void PluginSurface::plugin_request_shutdown(Resource *resource, const QString &type)
190190
{
191191
Q_UNUSED(resource);
192-
Q_EMIT m_manager->requestShutdown();
192+
Q_EMIT m_manager->requestShutdown(type);
193193
}
194194

195195
void PluginSurface::plugin_destroy_resource(Resource *resource)

panels/dock/pluginmanagerextension_p.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class PluginManager : public QWaylandCompositorExtensionTemplate<PluginManager>,
8282
void pluginSurfaceDestroyed(PluginSurface*);
8383
void messageRequest(PluginSurface *, const QString &msg);
8484
void dockSizeChanged();
85-
void requestShutdown();
85+
void requestShutdown(const QString &type);
8686

8787
protected:
8888
virtual void plugin_manager_v1_request_message(Resource *resource, const QString &plugin_id, const QString &item_key, const QString &msg) override;
@@ -169,7 +169,7 @@ class PluginSurface : public QWaylandShellSurfaceTemplate<PluginSurface>, public
169169
protected:
170170
virtual void plugin_mouse_event(Resource *resource, int32_t type) override;
171171
virtual void plugin_dcc_icon(Resource *resource, const QString &icon) override;
172-
virtual void plugin_request_shutdown(Resource *resource) override;
172+
virtual void plugin_request_shutdown(Resource *resource, const QString &type) override;
173173
virtual void plugin_destroy_resource(Resource *resource) override;
174174
virtual void plugin_destroy(Resource *resource) override;
175175
virtual void plugin_source_size(Resource *resource, int32_t width, int32_t height) override;

panels/dock/tray/package/tray.qml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ AppletItem {
157157
console.log("onPluginSurfacesUpdated", surfacesData.length)
158158
}
159159

160-
function onRequestShutdown() {
160+
function onRequestShutdown(type) {
161161
var shutdown = DS.applet("org.deepin.ds.dde-shutdown")
162162
if (shutdown) {
163-
shutdown.requestShutdown()
163+
shutdown.requestShutdown(type)
164164
} else {
165165
console.warn("shutdown applet not found")
166166
}

panels/dock/tray/quickpanel/PanelPluginPage.qml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ Item {
6060
console.log("clicked shutdown")
6161
var shutdown = DS.applet("org.deepin.ds.dde-shutdown")
6262
if (shutdown) {
63-
shutdown.requestShutdown()
63+
// type is empty: just show shutdown page
64+
shutdown.requestShutdown("")
6465
} else {
6566
console.warn("shutdown applet not found")
6667
}

0 commit comments

Comments
 (0)