Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Workspace
Commits
5efae6f4
Commit
5efae6f4
authored
Feb 26, 2021
by
David Redondo
🏎
Committed by
Nate Graham
Apr 30, 2021
Browse files
Add action to open the system monitor from the applet
It's also accessible by middle clicking on it
BUG:432588
FIXED-IN:5.22
parent
eb17117d
Changes
4
Hide whitespace changes
Inline
Side-by-side
applets/systemmonitor/systemmonitor/CMakeLists.txt
View file @
5efae6f4
...
...
@@ -16,6 +16,8 @@ target_link_libraries(plasma_applet_systemmonitor
KF5::ConfigCore
KF5::ConfigGui
KF5::Declarative
KF5::KIOGui
KF5::Notifications
KSysGuard::SysGuard
KSysGuard::Sensors
KSysGuard::SensorFaces
...
...
applets/systemmonitor/systemmonitor/package/contents/ui/main.qml
View file @
5efae6f4
...
...
@@ -52,4 +52,19 @@ Item {
}
Plasmoid.configurationRequired
:
plasmoid
.
nativeInterface
.
faceController
.
highPrioritySensorIds
.
length
==
0
&&
plasmoid
.
nativeInterface
.
faceController
.
lowPrioritySensorIds
.
length
==
0
&&
plasmoid
.
nativeInterface
.
faceController
.
totalSensor
.
length
==
0
MouseArea
{
parent
:
plasmoid
anchors.fill
:
plasmoid
acceptedButtons
:
Qt
.
MiddleButton
onClicked
:
action_openSystemMonitor
()
}
function
action_openSystemMonitor
()
{
Plasmoid
.
nativeInterface
.
openSystemMonitor
()
}
Component.onCompleted
:
{
Plasmoid
.
setAction
(
"
openSystemMonitor
"
,
i18nc
(
"
@action
"
,
"
Open System Monitor...
"
),
"
utilities-system-monitor
"
)
}
}
applets/systemmonitor/systemmonitor/systemmonitor.cpp
View file @
5efae6f4
...
...
@@ -31,7 +31,10 @@
#include <KConfigLoader>
#include <KDeclarative/QmlObjectSharedEngine>
#include <KIO/ApplicationLauncherJob>
#include <KLocalizedString>
#include <KNotifications/KNotificationJobUiDelegate>
#include <KService>
SystemMonitor
::
SystemMonitor
(
QObject
*
parent
,
const
QVariantList
&
args
)
:
Plasma
::
Applet
(
parent
,
args
)
...
...
@@ -91,6 +94,13 @@ void SystemMonitor::configChanged()
}
}
void
SystemMonitor
::
openSystemMonitor
()
{
auto
job
=
new
KIO
::
ApplicationLauncherJob
(
KService
::
serviceByDesktopName
(
"org.kde.plasma-systemmonitor"
));
job
->
setUiDelegate
(
new
KNotificationJobUiDelegate
(
KJobUiDelegate
::
AutoHandlingEnabled
));
job
->
start
();
}
K_EXPORT_PLASMA_APPLET_WITH_JSON
(
systemmonitor
,
SystemMonitor
,
"metadata.json"
)
#include "systemmonitor.moc"
applets/systemmonitor/systemmonitor/systemmonitor.h
View file @
5efae6f4
...
...
@@ -49,6 +49,7 @@ public:
~
SystemMonitor
()
override
;
void
init
()
override
;
Q_INVOKABLE
void
openSystemMonitor
();
KSysGuard
::
SensorFaceController
*
faceController
()
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment