diff --git a/nde-screensaver-0.1.0/CMakeLists.txt b/nde-screensaver-0.1.0/CMakeLists.txt index 3af2aec14d3a69fb0909269bdd05dd63efbdd07e..05e2c048a66c39bda2d5cff0bc44479f2ae14064 100644 --- a/nde-screensaver-0.1.0/CMakeLists.txt +++ b/nde-screensaver-0.1.0/CMakeLists.txt @@ -111,12 +111,10 @@ if(NOT QT_IMPORTS_DIR) endif() # Uninstall target -if ("${ECM_VERSION}" VERSION_LESS "1.7.0") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) - add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") -endif() +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) +add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake") # systemd if(NOT NO_SYSTEMD AND NOT USE_ELOGIND) diff --git a/nde-screensaver-0.1.0/src/nde-screensaver/CMakeLists.txt b/nde-screensaver-0.1.0/src/nde-screensaver/CMakeLists.txt index 670830af364f114cab43c0844f1d7d89695b8994..e5e5530a4c542a7ab95bafa91bd721361b9acc4e 100644 --- a/nde-screensaver-0.1.0/src/nde-screensaver/CMakeLists.txt +++ b/nde-screensaver-0.1.0/src/nde-screensaver/CMakeLists.txt @@ -16,7 +16,9 @@ set(SCREENSAVER_SOURCES idlewatcher.cpp lockscreenshortcut.cpp lockscreenmanager.cpp + screensaver.cpp ) +qt5_add_dbus_adaptor(SCREENSAVER_SOURCES org.nde.screensaver.xml screensaver.h ScreenSaver) qt5_add_dbus_interface(SCREENSAVER_SOURCES ${CMAKE_SOURCE_DIR}/src/common/com.vm.daemon.xml vmdaemon_interface) add_executable(nde-screensaver ${SCREENSAVER_SOURCES}) target_link_libraries(nde-screensaver diff --git a/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.cpp b/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.cpp index 18e5aafb271c840ecf542067aab79507233b3633..47ec5339a6d75a1570c1012e6edeb5e51fd2953b 100644 --- a/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.cpp +++ b/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.cpp @@ -11,7 +11,7 @@ #include "idlewatcher.h" #include #include "MessageHandler.h" - +#include "screensaver.h" namespace NSS { ScreenSaverApp *ScreenSaverApp::self = nullptr; @@ -20,12 +20,13 @@ ScreenSaverApp::ScreenSaverApp(int &argc, char **argv) : m_auth(new Auth (this)), m_socketServer(new SocketServer (this)), mLockGreeter(new QProcess (this)), - mIdleTime(3 * 60), - mLockScreenManager(new LockScreenManager (this)) + mLockScreenManager(new LockScreenManager (this)), + mScreenSaver(new ScreenSaver (this) ) { self = this; qInstallMessageHandler(NSS::DaemonMessageHandler); - + QSettings setting("nde", "screensaver"); + mIdleTime = setting.value("idleTime", 10 * 60).toInt(); m_auth->setVerbose(true); connect(m_auth, SIGNAL(requestChanged()), this, SLOT(slotRequestChanged())); connect(m_auth, SIGNAL(authentication(QString,bool)), this, SLOT(slotAuthenticationFinished(QString,bool))); @@ -61,7 +62,11 @@ ScreenSaverApp::~ScreenSaverApp() m_socketServer->stop(); mShortcut->deleteLater(); } - +void ScreenSaverApp::setIdleTime(int secs) +{ + mIdleTime = secs; + mIdleWatcher->reset(mIdleTime); +} void ScreenSaverApp::lockSession() { mLockGreeter->start(QString("%1/nde-screensaver-greeter").arg(QStringLiteral(LIBEXEC_INSTALL_DIR)), @@ -130,11 +135,6 @@ void ScreenSaverApp::slotAuthError(const QString &message, Auth::Error error) { // TODO: handle more errors qWarning() << "Authentication error:" << message; emit loginFailed(m_socket); -// if (!m_socket) -// return; - -// if (error == Auth::ERROR_AUTHENTICATION) -// emit loginFailed(m_socket); } void ScreenSaverApp::slotHelperFinished(Auth::HelperExitStatus status) { diff --git a/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.h b/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.h index 882aa4d8f53538b83a8629063fd5dfa451c5f021..885aedab6aaf64bf13b4a8f465473677c7723481 100644 --- a/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.h +++ b/nde-screensaver-0.1.0/src/nde-screensaver/ScreenSaverApp.h @@ -8,12 +8,13 @@ class QLocalSocket; class IdleWatcher; class QProcess; - +class ScreenSaver; namespace NSS { class PowerManager; class SocketServer; class LockScreenShortcut; class LockScreenManager; + class ScreenSaverApp : public QGuiApplication { Q_OBJECT @@ -24,6 +25,7 @@ public: PowerManager *powerManager() const; bool locked() const; + void setIdleTime(int secs); signals: void stopped(); void loggingIn(QLocalSocket *socket); @@ -53,6 +55,7 @@ private: LockScreenShortcut *mShortcut; com::vm::daemon *daemonInterface; LockScreenManager *mLockScreenManager; + ScreenSaver *mScreenSaver; }; } #endif // SCREENSAVERAPP_H diff --git a/nde-screensaver.spec b/nde-screensaver.spec index f8f5576b39b71585b9c49922be458dc779d9ea9c..cd442ef7d88ca545725129cc389e04da05cce62d 100644 --- a/nde-screensaver.spec +++ b/nde-screensaver.spec @@ -1,6 +1,6 @@ Name: nde-screensaver Version: 0.1.0 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2+ Summary: QML based X11 screen saver and screen lock Source0: %{name}-%{version}.tar.gz @@ -42,6 +42,12 @@ Suggests: qt5-qtvirtualkeyboard%{?_isa} Requires(pre): shadow-utils +Provides: xscreensaver +Provides: xscreensaver-base +Provides: xscreensaver-gl-base +Provides: xscreensaver-gl-extras +Provides: xscreensaver-gl-extras + %description newstart desktop environment screen saver and lock