forked from openkylin/ukui-panel
feat(calender): 实现点击日历打开日历应用
This commit is contained in:
parent
c1c798c765
commit
d90297b114
|
@ -208,3 +208,11 @@ void Calendar::onStateChanged(const QString &module, const QVariantMap &data)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Calendar::activeCalendar()
|
||||
{
|
||||
QDBusInterface calendar(QStringLiteral("org.ukui.kylin_calendar"),
|
||||
QStringLiteral("/org/ukui/kylin_calendar"),
|
||||
QStringLiteral("org.ukui.kylin_calendar"));
|
||||
calendar.asyncCall("command_Control", QVariant(""));
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ public:
|
|||
QString notifyIconTooltipText();
|
||||
|
||||
Q_INVOKABLE void openSidebar();
|
||||
Q_INVOKABLE void activeCalendar();
|
||||
|
||||
Q_SIGNALS:
|
||||
void timeUpdated();
|
||||
|
|
|
@ -174,8 +174,10 @@ WidgetItem {
|
|||
onClicked: {
|
||||
// TODO: open calendar
|
||||
//console.log("onClicked:", dateText.contentWidth, dateText.contentHeight)
|
||||
if (mouse.button == Qt.RightButton) {
|
||||
if (mouse.button === Qt.RightButton) {
|
||||
calendarMenu.open();
|
||||
} else {
|
||||
calendar.activeCalendar();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,9 +252,9 @@ WidgetItem {
|
|||
}
|
||||
|
||||
onClicked: {
|
||||
if (mouse.button == Qt.LeftButton) {
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
calendar.openSidebar();
|
||||
} else if (mouse.button == Qt.RightButton) {
|
||||
} else if (mouse.button === Qt.RightButton) {
|
||||
notiMenu.open();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue