mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-02 15:45:21 +00:00
refactor(datetime_plugin): use DDBusSender
Change-Id: Ieb5d336fdff0bf14e575dbd0b853813092ceb3e9
This commit is contained in:
parent
61002cd350
commit
8c0cecfa3a
Notes:
gerrit
2018-04-17 14:41:45 +08:00
Code-Review+2: sbwtw <sbw@sbw.so> Verified+1: Anonymous Coward #1000004 Submitted-by: rekols <rekols@foxmail.com> Submitted-at: Tue, 17 Apr 2018 14:41:45 +0800 Reviewed-on: https://cr.deepin.io/33701 Project: dde/dde-dock Branch: refs/heads/master
@ -9,6 +9,7 @@ file(GLOB SRCS "*.h" "*.cpp")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Svg REQUIRED)
|
||||
find_package(Qt5DBus REQUIRED)
|
||||
find_package(DtkWidget REQUIRED)
|
||||
|
||||
add_definitions("${QT_DEFINITIONS} -DQT_PLUGIN")
|
||||
@ -16,9 +17,10 @@ add_library(${PLUGIN_NAME} SHARED ${SRCS} resources.qrc)
|
||||
set_target_properties(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ../)
|
||||
target_include_directories(${PLUGIN_NAME} PUBLIC ${DtkWidget_INCLUDE_DIRS} ../../interfaces)
|
||||
target_link_libraries(${PLUGIN_NAME} PRIVATE
|
||||
${DtkWidget_LIBRARIES}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5Svg_LIBRARIES}
|
||||
${Qt5DBus_LIBRARIES}
|
||||
${DtkWidget_LIBRARIES}
|
||||
${Qt5Widgets_LIBRARIES}
|
||||
${Qt5Svg_LIBRARIES}
|
||||
)
|
||||
|
||||
install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION lib/dde-dock/plugins)
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "datetimeplugin.h"
|
||||
|
||||
#include <DDBusSender>
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
|
||||
@ -152,10 +153,17 @@ void DatetimePlugin::invokedMenuItem(const QString &itemKey, const QString &menu
|
||||
Q_UNUSED(itemKey)
|
||||
Q_UNUSED(checked)
|
||||
|
||||
if (menuId == "open")
|
||||
QProcess::startDetached("dbus-send --print-reply --dest=com.deepin.dde.ControlCenter /com/deepin/dde/ControlCenter com.deepin.dde.ControlCenter.ShowModule \"string:datetime\"");
|
||||
else
|
||||
if (menuId == "open") {
|
||||
DDBusSender()
|
||||
.service("com.deepin.dde.ControlCenter")
|
||||
.interface("com.deepin.dde.ControlCenter")
|
||||
.path("/com/deepin/dde/ControlCenter")
|
||||
.method(QString("ShowModule"))
|
||||
.arg(QString("datetime"))
|
||||
.call();
|
||||
} else {
|
||||
m_centralWidget->toggleHourFormat();
|
||||
}
|
||||
}
|
||||
|
||||
void DatetimePlugin::updateCurrentTimeString()
|
||||
|
Loading…
x
Reference in New Issue
Block a user