diff --git a/liblattedock/quickwindowsystem.cpp b/liblattedock/quickwindowsystem.cpp index 4bf66827..a8752b57 100644 --- a/liblattedock/quickwindowsystem.cpp +++ b/liblattedock/quickwindowsystem.cpp @@ -1,69 +1,82 @@ /* * Copyright 2016 Smith AR * Michail Vourlakos * * This file is part of Latte-Dock * * Latte-Dock is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Latte-Dock is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY 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 . */ #include "quickwindowsystem.h" #include "../app/config-latte.h" #include +#include +#include #include #if HAVE_X11 #include #endif namespace Latte { QuickWindowSystem::QuickWindowSystem(QObject *parent) : QObject(parent) { if (KWindowSystem::isPlatformWayland()) { //! TODO: Wayland compositing active m_compositing = true; } else { connect(KWindowSystem::self(), &KWindowSystem::compositingChanged , this, [&](bool enabled) { if (m_compositing == enabled) return; m_compositing = enabled; emit compositingChanged(); }); m_compositing = KWindowSystem::compositingActive(); } } QuickWindowSystem::~QuickWindowSystem() { qDebug() << staticMetaObject.className() << "destructed"; } bool QuickWindowSystem::compositingActive() const { return m_compositing; } uint QuickWindowSystem::frameworksVersion() const { return Plasma::version(); } +void QuickWindowSystem::activateLatteLauncherMenu() +{ + QDBusConnection::sessionBus().asyncCall( + QDBusMessage::createMethodCall(QStringLiteral("org.kde.lattedock"), + QStringLiteral("/Latte"), + QStringLiteral("org.kde.LatteDock"), + QStringLiteral("activateLauncherMenu") + ) + ); +} + } //end of namespace diff --git a/liblattedock/quickwindowsystem.h b/liblattedock/quickwindowsystem.h index a35ce10d..1264e664 100644 --- a/liblattedock/quickwindowsystem.h +++ b/liblattedock/quickwindowsystem.h @@ -1,66 +1,69 @@ /* * Copyright 2016 Smith AR * Michail Vourlakos * * This file is part of Latte-Dock * * Latte-Dock is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * Latte-Dock is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY 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 . */ #ifndef QUICKWINDOWSYSTEM_H #define QUICKWINDOWSYSTEM_H #include #include #include namespace Latte { /** * @brief The QuickWindowSystem class, * is a tiny class that provide basic information of WindowSystem */ class QuickWindowSystem final : public QObject { Q_OBJECT Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged FINAL) Q_PROPERTY(uint frameworksVersion READ frameworksVersion NOTIFY frameworksVersionChanged) public: explicit QuickWindowSystem(QObject *parent = nullptr); virtual ~QuickWindowSystem(); bool compositingActive() const; uint frameworksVersion() const; +public slots: + Q_INVOKABLE void activateLatteLauncherMenu(); + signals: void compositingChanged(); void frameworksVersionChanged(); private: bool m_compositing : 1; }; static QObject *windowsystem_qobject_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) { Q_UNUSED(engine) Q_UNUSED(scriptEngine) // NOTE: QML engine is the owner of this resource return new QuickWindowSystem; } } #endif // QUICKWINDOWSYSTEM_H