[screenedges] Use generated interface to lock the screen
We have the interface for the effects, so it's better to use the generated code instead of custom written code.
This commit is contained in:
parent
876f8c67fa
commit
c7cd886bd6
1 changed files with 8 additions and 2 deletions
|
@ -40,6 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
#include "utils.h"
|
||||
#include "workspace.h"
|
||||
#include "virtualdesktops.h"
|
||||
// DBus generated
|
||||
#include "screenlocker_interface.h"
|
||||
// Qt
|
||||
#include <QTimer>
|
||||
#include <QVector>
|
||||
|
@ -219,8 +221,12 @@ bool Edge::handleAction()
|
|||
return true;
|
||||
}
|
||||
case ElectricActionLockScreen: { // Lock the screen
|
||||
QDBusInterface screenSaver(QStringLiteral("org.kde.screensaver"), QStringLiteral("/ScreenSaver"));
|
||||
screenSaver.asyncCall(QStringLiteral("Lock"));
|
||||
OrgFreedesktopScreenSaverInterface interface(QStringLiteral("org.freedesktop.ScreenSaver"),
|
||||
QStringLiteral("/ScreenSaver"),
|
||||
QDBusConnection::sessionBus());
|
||||
if (interface.isValid()) {
|
||||
interface.Lock();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
|
|
Loading…
Reference in a new issue