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();
|
QString notifyIconTooltipText();
|
||||||
|
|
||||||
Q_INVOKABLE void openSidebar();
|
Q_INVOKABLE void openSidebar();
|
||||||
|
Q_INVOKABLE void activeCalendar();
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void timeUpdated();
|
void timeUpdated();
|
||||||
|
|
|
@ -174,8 +174,10 @@ WidgetItem {
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// TODO: open calendar
|
// TODO: open calendar
|
||||||
//console.log("onClicked:", dateText.contentWidth, dateText.contentHeight)
|
//console.log("onClicked:", dateText.contentWidth, dateText.contentHeight)
|
||||||
if (mouse.button == Qt.RightButton) {
|
if (mouse.button === Qt.RightButton) {
|
||||||
calendarMenu.open();
|
calendarMenu.open();
|
||||||
|
} else {
|
||||||
|
calendar.activeCalendar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -250,9 +252,9 @@ WidgetItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (mouse.button == Qt.LeftButton) {
|
if (mouse.button === Qt.LeftButton) {
|
||||||
calendar.openSidebar();
|
calendar.openSidebar();
|
||||||
} else if (mouse.button == Qt.RightButton) {
|
} else if (mouse.button === Qt.RightButton) {
|
||||||
notiMenu.open();
|
notiMenu.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue