[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:
Martin Gräßlin 2014-05-15 09:01:51 +02:00
parent 876f8c67fa
commit c7cd886bd6

View file

@ -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: