[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.
remotes/origin/Plasma/5.0
Martin Gräßlin 12 years ago
parent 876f8c67fa
commit c7cd886bd6
  1. 10
      screenedge.cpp

@ -40,6 +40,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "utils.h" #include "utils.h"
#include "workspace.h" #include "workspace.h"
#include "virtualdesktops.h" #include "virtualdesktops.h"
// DBus generated
#include "screenlocker_interface.h"
// Qt // Qt
#include <QTimer> #include <QTimer>
#include <QVector> #include <QVector>
@ -219,8 +221,12 @@ bool Edge::handleAction()
return true; return true;
} }
case ElectricActionLockScreen: { // Lock the screen case ElectricActionLockScreen: { // Lock the screen
QDBusInterface screenSaver(QStringLiteral("org.kde.screensaver"), QStringLiteral("/ScreenSaver")); OrgFreedesktopScreenSaverInterface interface(QStringLiteral("org.freedesktop.ScreenSaver"),
screenSaver.asyncCall(QStringLiteral("Lock")); QStringLiteral("/ScreenSaver"),
QDBusConnection::sessionBus());
if (interface.isValid()) {
interface.Lock();
}
return true; return true;
} }
default: default:

Loading…
Cancel
Save