Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 17 additions & 19 deletions applets/dde-shutdown/shutdownapplet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,25 @@
return true;
}

bool ShutdownApplet::requestShutdown()
bool ShutdownApplet::requestShutdown(const QString &type)

Check warning on line 37 in applets/dde-shutdown/shutdownapplet.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

The function 'requestShutdown' is never used.
{
qDebug() << "request shutdown";
qDebug() << "request shutdown:" << type;
if (m_lockscreen) {
m_lockscreen->shutdown();
if (type.isEmpty()) {
// TODO: left mouse clicked, show shutdown page
m_lockscreen->shutdown();
} else if (type == QStringLiteral("Shutdown")) {
m_lockscreen->shutdown();
} else if (type == QStringLiteral("Lock")) {
m_lockscreen->lock();
} else if (type == QStringLiteral("SwitchUser")) {
m_lockscreen->switchUser();
} else if (type == QStringLiteral("UpdateAndShutdown") || type == QStringLiteral("UpdateAndReboot") ||
type == QStringLiteral("Suspend") || type == QStringLiteral("Hibernate") ||
type == QStringLiteral("Restart") || type == QStringLiteral("Logout")) {
// TODO: implement these types
m_lockscreen->shutdown();
}
} else {
DDBusSender()
.service("org.deepin.dde.ShutdownFront1")
Expand All @@ -51,22 +65,6 @@
return true;
}

bool ShutdownApplet::requestLock()
{
if (m_lockscreen) {
m_lockscreen->lock();
}
return true;
}

bool ShutdownApplet::requestSwitchUser()
{
if (m_lockscreen) {
m_lockscreen->switchUser();
}
return true;
}

D_APPLET_CLASS(ShutdownApplet)
}
DS_END_NAMESPACE
Expand Down
4 changes: 1 addition & 3 deletions applets/dde-shutdown/shutdownapplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class ShutdownApplet : public DApplet
virtual bool load() override;

public Q_SLOTS:
bool requestShutdown();
bool requestLock();
bool requestSwitchUser();
bool requestShutdown(const QString &type);

private:
QScopedPointer<TreeLandLockScreen> m_lockscreen;
Expand Down
4 changes: 2 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Build-Depends:
libqt6svg6,
libdtk6declarative, qml6-module-qtquick-controls2-styles-chameleon, qt6-declarative-private-dev,
libyaml-cpp-dev,
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.6),
qt6-l10n-tools, qt6-svg-dev, dde-tray-loader-dev (> 1.99.8),
dde-application-manager-api (>= 1.2.16), dde-control-center-dev (>= 6.0.73)
Standards-Version: 3.9.8
Homepage: http://www.deepin.org
Expand Down Expand Up @@ -60,7 +60,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libdde-shell( =${binary:Version}),
libdtk6declarative, qml6-module-qtquick-controls2-styles-chameleon,
qml6-module-qtquick-layouts, qml6-module-qtquick-window,
qml6-module-qt-labs-platform, qml6-module-qt-labs-qmlmodels,
dde-tray-loader (> 1.99.6)
dde-tray-loader (> 1.99.8)
Multi-Arch: same
Description: An wrapper for developed based on dde-shell plugin system

Expand Down
6 changes: 3 additions & 3 deletions example/lockscreen-example/package/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ AppletItem {
onClicked: {
let lockscreen = lockscreenApplet()
if (lockscreen) {
lockscreen.requestLock()
lockscreen.requestShutdown("Lock")
}
}
}
Expand All @@ -36,7 +36,7 @@ AppletItem {
onClicked: {
let lockscreen = lockscreenApplet()
if (lockscreen) {
lockscreen.requestShutdown()
lockscreen.requestShutdown("Shutdown")
}
}
}
Expand All @@ -45,7 +45,7 @@ AppletItem {
onClicked: {
let lockscreen = lockscreenApplet()
if (lockscreen) {
lockscreen.requestSwitchUser()
lockscreen.requestShutdown("SwitchUser")
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions panels/dock/DockCompositor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Item {

signal pluginSurfacesUpdated()
signal popupCreated(var popup)
signal requestShutdown()
signal requestShutdown(var type)

function removeDockPluginSurface(model, object) {
for (var i = 0; i < model.count; ++i) {
Expand Down Expand Up @@ -104,8 +104,8 @@ Item {
dockCompositor.popupCreated(popup)
}

onRequestShutdown: {
dockCompositor.requestShutdown()
onRequestShutdown: (type) => {
dockCompositor.requestShutdown(type)
}
}

Expand Down
4 changes: 2 additions & 2 deletions panels/dock/pluginmanagerextension.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ void PluginSurface::plugin_dcc_icon(Resource *resource, const QString &icon)
m_dccIcon = icon;
}

void PluginSurface::plugin_request_shutdown(Resource *resource)
void PluginSurface::plugin_request_shutdown(Resource *resource, const QString &type)
{
Q_UNUSED(resource);
Q_EMIT m_manager->requestShutdown();
Q_EMIT m_manager->requestShutdown(type);
}

void PluginSurface::plugin_destroy_resource(Resource *resource)
Expand Down
4 changes: 2 additions & 2 deletions panels/dock/pluginmanagerextension_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class PluginManager : public QWaylandCompositorExtensionTemplate<PluginManager>,
void pluginSurfaceDestroyed(PluginSurface*);
void messageRequest(PluginSurface *, const QString &msg);
void dockSizeChanged();
void requestShutdown();
void requestShutdown(const QString &type);

protected:
virtual void plugin_manager_v1_request_message(Resource *resource, const QString &plugin_id, const QString &item_key, const QString &msg) override;
Expand Down Expand Up @@ -169,7 +169,7 @@ class PluginSurface : public QWaylandShellSurfaceTemplate<PluginSurface>, public
protected:
virtual void plugin_mouse_event(Resource *resource, int32_t type) override;
virtual void plugin_dcc_icon(Resource *resource, const QString &icon) override;
virtual void plugin_request_shutdown(Resource *resource) override;
virtual void plugin_request_shutdown(Resource *resource, const QString &type) override;
virtual void plugin_destroy_resource(Resource *resource) override;
virtual void plugin_destroy(Resource *resource) override;
virtual void plugin_source_size(Resource *resource, int32_t width, int32_t height) override;
Expand Down
4 changes: 2 additions & 2 deletions panels/dock/tray/package/tray.qml
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,10 @@ AppletItem {
console.log("onPluginSurfacesUpdated", surfacesData.length)
}

function onRequestShutdown() {
function onRequestShutdown(type) {
var shutdown = DS.applet("org.deepin.ds.dde-shutdown")
if (shutdown) {
shutdown.requestShutdown()
shutdown.requestShutdown(type)
} else {
console.warn("shutdown applet not found")
}
Expand Down
3 changes: 2 additions & 1 deletion panels/dock/tray/quickpanel/PanelPluginPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ Item {
console.log("clicked shutdown")
var shutdown = DS.applet("org.deepin.ds.dde-shutdown")
if (shutdown) {
shutdown.requestShutdown()
// type is empty: just show shutdown page
shutdown.requestShutdown("")
} else {
console.warn("shutdown applet not found")
}
Expand Down
Loading