Commit graph

37 commits

Author SHA1 Message Date
Alexander Lohnau
e598a997e7 Use initializer list syntax where appropiate 2023-08-07 19:28:37 +02:00
Alexander Lohnau
405f61bf85 Discard unused params more elegantly
By commenting out the parameter name, we get compile-time checks
Also, we can omit them for slots and Qt will not forward the parameters.

In case we had TODOs next to the code, I kept the Q_UNUSED statements
for now.
2023-08-05 20:22:18 +00:00
Alexander Lohnau
2e67f95017 Add explicit moc includes to cpp files
The rationale is explained in https://planet.kde.org/friedrich-kossebau-2023-06-28-include-also-moc-files-of-headers/

In case of KDEConnect, it impressively speeds up compilation. Before it
took 390 seconds on a clean build and with this change it took 330 seconds.
This is due to the mocs_compilation having to include the header files
and thus all their headers. Due to the lots of small plugins we have,
this means that the same headers must be compiled plenty of times.
When we include the moc files directly in the C++ file, they are already
available.
2023-07-30 07:27:45 +00:00
Alexander Lohnau
f483c1449c Use simpler K_PLUGIN_CLASS macro for KCMs 2023-07-22 20:51:19 +00:00
Alexander Lohnau
ede9e37b40 Use KPluginMetaData::pluginId for getting config plugin name
By removing the postfix we consistently use, we get exactly the same string as before

However, all our pluginId logic is now done as part of the buildsystem.
Before, they were in the JSON metadata, the buildsystem and the string constructor parameter

KPluginFactory has the KPluginMetaData object in any case, do using it
doesn't create any overhead.
2023-07-22 20:51:19 +00:00
Alexander Lohnau
0b99c3a637 Remove unneeded destructors from plugins
We already have a destructor from the baseclass and don't need to clean
up any resources in the affected plugins
2023-07-22 16:01:21 +02:00
Alexander Lohnau
d50055ddb4 plugins/runcommand: Fix messed up layouting of KCM 2023-07-20 11:15:56 +03:00
Alexander Lohnau
52b6d57942 Qt6 build fixes in plugins and KCM 2023-07-20 11:15:46 +03:00
Albert Vaca Cintora
9c87393b28 clang-format pass 2023-07-16 16:20:34 +02:00
Albert Vaca Cintora
d925254e3a Run command settings: add import and export buttons
BUG: 409388
2023-03-30 10:54:00 +00:00
Albert Vaca Cintora
0d362169a8 Revert "Support init systems other than systemd with Run Command's samples"
Fix example commands. "suspend" is a command to halt the shell, not to
sleep the computer. Those are just example commands so people with exotic
init systems can still type their own commands.

This reverts commit 2dc5d53ec4.
2023-03-27 00:12:43 +02:00
Nicolas Fella
a918ffc0cb Add and make use of ECM's clang-format integration 2022-09-11 23:21:58 +00:00
Waldo Lemmer
2dc5d53ec4 Support init systems other than systemd with Run Command's samples
`systemctl reboot`, `systemctl poweroff` and `systemctl suspend` only work on Systemd

I replaced them with the more universal versions (`reboot`, `poweroff`, and `suspend`) which work on Systemd, OpenRC, runit, SysVinit, and GNU Shepherd. These commands show up here:

![image](/uploads/b10ae0397974c90971d8cd054d13e1b4/image.png)
2022-04-21 01:02:10 +00:00
Aleix Pol
21dbf0410f kcm: Fix showing plugins' configuration
We were using the plugin infrastructure to tell the name of the plugin
we were configuring.

Since this doesn't make any sense, just let the kcms themselves define
where they want their settings to be.

This fixes a regression from when we ported away from using KService to
list them. e365e1b35c
2022-03-21 18:03:45 +01:00
Yuri Chornoivan
596f648f6e Fix minor typo 2021-06-13 10:56:51 +03:00
Piyush Aggarwal
d5c1832eba runcommands: add sample commands for Windows 2021-06-12 16:22:31 +05:30
Nicolas Fella
400c800deb [app] Add plugin settings page
Include a page that allows (de)selecting and configuring plugins

This is one of the last missing pieces for feature parity with the KCM.
2020-09-08 20:33:20 +02:00
Nicolas Fella
87db95b22f Convert license headers to SPDX expressions 2020-08-17 09:48:10 +00:00
Himanshu Rajput
3ca55ad794 Update plugins/runcommand/runcommand_config.cpp 2020-07-24 11:55:18 +00:00
Nicolas Fella
bc5863f68f Add explanatory comment 2020-07-05 15:52:17 +02:00
Fabian Vogt
b699372d38 Prefer qdbus-qt5 if found
On some distros, this is how qdbus is called to allow for coinstallability
with Qt 4 and Qt 6+.
2020-07-05 13:45:28 +00:00
Nicolas Fella
0d7c504cf0 Rename DbusHelper => DBusHelper 2019-08-14 17:36:19 +02:00
Piyush Aggarwal
eb9417593f retain Header Labels when resetting commands list 2019-07-15 15:13:26 +00:00
Weixuan Xiao
5431073844 Add wrapper for macos dbus connection 2019-06-09 15:28:49 +00:00
Nicolas Fella
3b8fedea1a Replace http GNU urls with https 2019-03-23 17:29:26 +01:00
Nicolas Fella
ded463eb49 [clazy] Properly emit signals
Test Plan: Receive a file

Reviewers: #kde_connect, albertvaka

Reviewed By: #kde_connect, albertvaka

Subscribers: kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D17166
2018-11-26 13:25:16 +01:00
Albert Vaca
76ea0dd12d Remove characters from UUID that aren't legal in URLs 2018-08-01 11:10:14 +02:00
Ivan Čukić
f7a5c3220b Added a few useful 'Sample commands' for the Run Command plugin
Summary:
Added the following example commands for the Run Command plugin:

- Lock Screen
- Unlock Screen
- Close All Vaults
- Forcefully Close All Vaults

Reviewers: #plasma, ngraham, albertvaka, nicolasfella, #kde_connect

Reviewed By: nicolasfella, #kde_connect

Subscribers: ngraham, kdeconnect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D13136
2018-05-26 23:06:34 +02:00
Aleix Pol
47f6effe08 Introduce a Run command preset menu in the run command kcm
Summary:
It's a way for users to understand what it's supposed to do and offer
some useful features.

Reviewers: #kde_connect, mtijink

Reviewed By: #kde_connect, mtijink

Subscribers: mtijink

Differential Revision: https://phabricator.kde.org/D11656
2018-03-24 20:19:12 +01:00
Jean Vincent
72535ecf48 Make member variable names, & placement and * placement more coherent
Summary:
Change all member variables to the form m_fooBar because it is the preferred form in Qt (it was half and half between this and mFooBar, and a minority didn't have anything).
Place all references and pointers on the side of the type since it is the majority.

Basically:
 - mFoo -> m_foo
 - foo -> m_foo (if it is a member variable)
 - Type &ref -> Type& ref
 - Type *ptr -> Type* ptr

Reviewers: #kde_connect, nicolasfella, albertvaka

Reviewed By: #kde_connect, nicolasfella, albertvaka

Subscribers: albertvaka, #kde_connect

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D7312
2017-09-03 21:45:08 +02:00
Jean Vincent
c864267f04 Replace Q_FOREACH with C++11 range-for
Summary:
The use of Q_FOREACH is advised against (https://doc.qt.io/qt-5/qtglobal.html#Q_FOREACH) since Qt 5.7 and will eventually be removed from Qt.

I replaced all occurrences with the range-for loop introduced in C++11 (except for the one in daemon.cpp in deviceIdByName which might have a bug / typo in it).

I added const to the container or casted it with qAsConst when appropriate to avoid unnecessary copies.

(This is my first submission. I did all the unit tests, and they all passed but I don't know how to show it here.)

Reviewers: #kde_connect, nicolasfella, apol

Reviewed By: #kde_connect, nicolasfella, apol

Subscribers: albertvaka, apol, nicolasfella

Tags: #kde_connect

Differential Revision: https://phabricator.kde.org/D6724
2017-07-21 09:57:19 +02:00
Kiril Vladimiroff
71f8357e00 Use compact format when saving runcommand commands
REVIEW: 130018
2017-03-17 12:26:10 +01:00
Albert Vaca
60331ccbf1 Clazy says all this QStringLiteral and QLatin1String were missing/wrong 2016-11-26 16:21:29 +01:00
Thomas Posch
91cf466ee2 Sort commands by name, as we do on Android
BUG: 369239
REVIEW: 129076
2016-09-30 12:56:27 +02:00
Albert Vaca
e880e14ed5 Preffer Q_FOREACH to foreach 2016-06-21 14:50:17 +02:00
Aleix Pol
27302c0450 Improve RunCommand configuration display 2015-09-12 13:51:15 +02:00
Albert Vaca
cf4a9b8639 First implementation of runcommand plugin 2015-09-12 03:38:44 -07:00