diff --git a/src/platformstatus/CMakeLists.txt b/src/platformstatus/CMakeLists.txt index 30e46c614..1181579a4 100644 --- a/src/platformstatus/CMakeLists.txt +++ b/src/platformstatus/CMakeLists.txt @@ -1,10 +1,27 @@ -set(kded_platformstatus_SRCS platformstatus.cpp ) +set( + kded_platformstatus_SRCS + platformstatus.cpp + ) -kde4_add_plugin(kded_platformstatus ${kded_platformstatus_SRCS}) +include_directories("../utils") -target_link_libraries(kded_platformstatus ${KDE4_KDECORE_LIBS} ${KCoreAddons_LIBRARIES} Qt5::DBus) +qt4_add_dbus_adaptor ( + kded_platformstatus_SRCS + org.kde.platformstatus.xml + platformstatus.h PlatformStatus + ) -install(TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} ) -install( FILES kded-platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) -install( FILES org.kde.platformstatus.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) +kde4_add_plugin( kded_platformstatus ${kded_platformstatus_SRCS} ) + +target_link_libraries( + kded_platformstatus + ${KDE4_KDECORE_LIBS} + ${KCoreAddons_LIBRARIES} + Qt5::DBus + Qt5::Quick + ) + +install( TARGETS kded_platformstatus DESTINATION ${PLUGIN_INSTALL_DIR} ) +install( FILES kded_platformstatus.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded ) +install( FILES org.kde.platformstatus.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR} ) diff --git a/src/platformstatus/kded-platformstatus.desktop b/src/platformstatus/kded_platformstatus.desktop similarity index 100% rename from src/platformstatus/kded-platformstatus.desktop rename to src/platformstatus/kded_platformstatus.desktop diff --git a/src/platformstatus/platformstatus.cpp b/src/platformstatus/platformstatus.cpp index fa466a781..d1164c405 100644 --- a/src/platformstatus/platformstatus.cpp +++ b/src/platformstatus/platformstatus.cpp @@ -8,6 +8,8 @@ #include #include +#include "platformstatusadaptor.h" + const char *defaultPackage = "org.kde.desktop"; K_PLUGIN_FACTORY(PlatformStatusFactory, registerPlugin();) @@ -16,10 +18,11 @@ K_EXPORT_PLUGIN(PlatformStatusFactory("platformstatus")) PlatformStatus::PlatformStatus(QObject *parent, const QVariantList &) : KDEDModule(parent) { - QDBusConnection::sessionBus().registerObject("/PlatformStatus", this, - QDBusConnection::ExportAllProperties | - QDBusConnection::ExportAllSignals); + new PlatformStatusAdaptor(this); + QDBusConnection::sessionBus().registerObject("/PlatformStatus", this); + findShellPackage(false); + const QString globalrcPath = QStandardPaths::locate(QStandardPaths::ConfigLocation, "kdeglobals"); connect(KDirWatch::self(), SIGNAL(dirty(QString)), this, SLOT(fileDirtied(QString))); KDirWatch::self()->addFile(globalrcPath); diff --git a/src/utils/d_ptr.h b/src/utils/d_ptr.h new file mode 100644 index 000000000..1eb476748 --- /dev/null +++ b/src/utils/d_ptr.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2012 Ivan Cukic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2, + * or (at your option) any later version, 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 warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef D_PTR_H +#define D_PTR_H + +#include + +namespace utils { + +template +class d_ptr { +private: + std::unique_ptr d; + +public: + d_ptr(); + + template + d_ptr(Args && ...); + + ~d_ptr(); + + T * operator->() const; + + T * get() const; +}; + +#define D_PTR \ + class Private; \ + friend class Private; \ + const ::utils::d_ptr d \ + +} // namespace utils + +#endif diff --git a/src/utils/d_ptr_implementation.h b/src/utils/d_ptr_implementation.h new file mode 100644 index 000000000..5380de722 --- /dev/null +++ b/src/utils/d_ptr_implementation.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2012 Ivan Cukic + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 2, + * or (at your option) any later version, 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 warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef D_PTR_IMPLEMENTATION_H +#define D_PTR_IMPLEMENTATION_H + +#include + +namespace utils { + +template +d_ptr::d_ptr() : d(new T()) +{ +} + +template +template +d_ptr::d_ptr(Args && ... args) + : d(new T(std::forward(args)... )) +{ +} + +template +d_ptr::~d_ptr() +{ +} + +template +T * d_ptr::operator->() const +{ + return d.get(); +} + +template +T * d_ptr::get() const +{ + return d.get(); +} + +} // namespace utils + +#endif +