[X2Go-Commits] [x2goplasmabindings] 03/11: /: add x2goplasmoidkf5.cpp, developed by Robert Tari, C++ part of a new KF5-based implementation.

git-admin at x2go.org git-admin at x2go.org
Thu Jun 29 22:45:06 CEST 2023


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goplasmabindings.

commit e9cfac93c663d170a8fcf11fb66f699312a7e501
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Thu Jun 29 22:19:17 2023 +0200

    /: add x2goplasmoidkf5.cpp, developed by Robert Tari, C++ part of a new KF5-based implementation.
---
 debian/changelog    |  2 ++
 x2goplasmoidkf5.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 8ce7e9c..d077040 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -34,6 +34,8 @@ x2goplasmabindings (3.0.2.3-0x2go1) UNRELEASED; urgency=medium
     - plasmoidhoveredicon.{cpp,h}: revert QFrame change. We will use a new
       QML-based plugin for KF5.
     - /: remove plasma_compat.h.
+    - /: add x2goplasmoidkf5.cpp, developed by Robert Tari, C++ part of a new
+      KF5-based implementation.
   * debian/control:
     + Adapt description to also mention KDE 5.
     + Build-Depend on libkf5plasma-dev and libkf5i18n-dev, with a fallback to
diff --git a/x2goplasmoidkf5.cpp b/x2goplasmoidkf5.cpp
new file mode 100644
index 0000000..35eed8b
--- /dev/null
+++ b/x2goplasmoidkf5.cpp
@@ -0,0 +1,71 @@
+/*
+* Copyright 2023 Robert Tari
+*
+* This program is free software: you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 3, as published
+* by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful, but
+* WITHOUT ANY WARRANTY; without even the implied warranties of
+* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
+* PURPOSE.  See the GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License along
+* with this program.  If not, see <http://www.gnu.org/licenses/>.
+*
+* Authors:
+*     Robert Tari <robert at tari.in>
+*/
+
+#include <QQmlExtensionPlugin>
+#include <QQmlEngine>
+#include <QProcess>
+
+class Helpers : public QObject
+{
+    Q_OBJECT
+
+public:
+
+    Q_INVOKABLE bool isSession ()
+    {
+        this->sSessionId = qgetenv("X2GO_SESSION");
+
+        if (this->sSessionId.isEmpty())
+        {
+            return false;
+        }
+
+        return true;
+    }
+
+    Q_INVOKABLE void suspendSession ()
+    {
+        QString sCommand = "x2gosuspend-session";
+        QStringList lAgs = {this->sSessionId};
+        QProcess *pProcess = new QProcess ();
+        pProcess->start (sCommand, lAgs);
+    }
+
+private:
+
+    QString sSessionId;
+};
+
+class X2GoPlasmoidPlugin : public QQmlExtensionPlugin
+{
+    Q_OBJECT
+    Q_PLUGIN_METADATA (IID "org.qt-project.Qt.QQmlExtensionInterface")
+
+public:
+
+    void registerTypes(const char *sUri) override
+    {
+        qmlRegisterSingletonType<Helpers> (sUri, 1, 0, "Helpers", [](QQmlEngine *, QJSEngine *)
+        {
+            return new Helpers();
+        });
+    }
+};
+
+#include "x2go-plasmoid-plugin.moc"

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goplasmabindings.git


More information about the x2go-commits mailing list