feat(calender): 实现点击日历打开日历应用

This commit is contained in:
hewenfei 2024-04-25 14:26:40 +08:00 committed by He Sir
parent c1c798c765
commit d90297b114
3 changed files with 14 additions and 3 deletions

View File

@ -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(""));
}

View File

@ -53,6 +53,7 @@ public:
QString notifyIconTooltipText();
Q_INVOKABLE void openSidebar();
Q_INVOKABLE void activeCalendar();
Q_SIGNALS:
void timeUpdated();

View File

@ -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();
}
}