Skip to content

Commit 97bcdbe

Browse files
committed
service/tray: add activate, secondaryActivate and scroll methods
1 parent 94a1140 commit 97bcdbe

File tree

5 files changed

+25
-6
lines changed

5 files changed

+25
-6
lines changed

src/core/popupwindow.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ void ProxyPopupWindow::completeWindow() {
2222
this->updateTransientParent();
2323
}
2424

25-
void ProxyPopupWindow::postCompleteWindow() {
26-
this->ProxyWindowBase::setVisible(this->mVisible);
27-
}
25+
void ProxyPopupWindow::postCompleteWindow() { this->ProxyWindowBase::setVisible(this->mVisible); }
2826

2927
bool ProxyPopupWindow::deleteOnInvisible() const {
3028
// Currently crashes in normal mode, do not have the time to debug it now.

src/services/status_notifier/item.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ QPixmap StatusNotifierItem::createPixmap(const QSize& size) const {
153153
return pixmap;
154154
}
155155

156+
void StatusNotifierItem::activate() { this->item->Activate(0, 0); }
157+
158+
void StatusNotifierItem::secondaryActivate() { this->item->SecondaryActivate(0, 0); }
159+
160+
void StatusNotifierItem::scroll(qint32 delta, bool horizontal) {
161+
this->item->Scroll(delta, horizontal ? "horizontal" : "vertical");
162+
}
163+
156164
void StatusNotifierItem::updateIcon() {
157165
this->iconIndex++;
158166
emit this->iconChanged();

src/services/status_notifier/item.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <qobject.h>
88
#include <qpixmap.h>
99
#include <qtmetamacros.h>
10+
#include <qtypes.h>
1011

1112
#include "../../dbus/dbusutil.hpp"
1213
#include "dbus_item.h"
@@ -27,6 +28,10 @@ class StatusNotifierItem: public QObject {
2728
[[nodiscard]] QString iconId() const;
2829
[[nodiscard]] QPixmap createPixmap(const QSize& size) const;
2930

31+
void activate();
32+
void secondaryActivate();
33+
void scroll(qint32 delta, bool horizontal);
34+
3035
// clang-format off
3136
dbus::DBusPropertyGroup properties;
3237
dbus::DBusProperty<QString> id {this->properties, "Id"};

src/services/status_notifier/qml.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ bool SystemTrayItem::onlyMenu() const {
8989
return this->item->isMenu.get();
9090
}
9191

92+
void SystemTrayItem::activate() { this->item->activate(); }
93+
94+
void SystemTrayItem::secondaryActivate() { this->item->secondaryActivate(); }
95+
96+
void SystemTrayItem::scroll(qint32 delta, bool horizontal) {
97+
this->item->scroll(delta, horizontal);
98+
}
99+
92100
SystemTray::SystemTray(QObject* parent): QObject(parent) {
93101
auto* host = StatusNotifierHost::instance();
94102

src/services/status_notifier/qml.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,13 @@ class SystemTrayItem: public QObject {
6969
);
7070

7171
// Primary activation action, generally triggered via a left click.
72-
//Q_INVOKABLE void activate();
72+
Q_INVOKABLE void activate();
7373

7474
// Secondary activation action, generally triggered via a middle click.
75-
//Q_INVOKABLE void secondaryActivate();
75+
Q_INVOKABLE void secondaryActivate();
7676

7777
// Scroll action, such as changing volume on a mixer.
78-
//Q_INVOKABLE void scroll(qint32 delta, bool horizontal);
78+
Q_INVOKABLE void scroll(qint32 delta, bool horizontal);
7979

8080
[[nodiscard]] QString id() const;
8181
[[nodiscard]] QString title() const;

0 commit comments

Comments
 (0)