summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Proriol <fabien.proriol@kazoe.org>2025-05-25 17:02:01 +0200
committerFabien Proriol <fabien.proriol@kazoe.org>2025-05-26 16:35:23 +0200
commit5f85571d52e9f82486a379d017eb36eda2a9f30e (patch)
tree3a2ef9cfea0bdbb4872be48f2eb010d730937a90
parent1dbc0e3c88ba271ba35bc3f82e7864c4f35e1236 (diff)
Change module to org.kazoe.xdg
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt40
-rw-r--r--LICENSE21
-rw-r--r--README.md4
-rw-r--r--cmake/CPack.cmake8
-rw-r--r--cmake/Config.cmake.in5
-rw-r--r--qml/qmldir4
-rw-r--r--src/kzxdg_plugin.cpp27
-rw-r--r--src/kzxdg_plugin.h (renamed from src/kzxdgutils_plugin.h)2
-rw-r--r--src/kzxdgutils_plugin.cpp27
-rw-r--r--src/lib/debug.cpp4
-rw-r--r--src/lib/xdgautostart.cpp10
-rw-r--r--src/lib/xdgautostart.h4
-rw-r--r--src/lib/xdgbasedir.cpp14
-rw-r--r--src/lib/xdgbasedir.h2
-rw-r--r--src/lib/xdgdesktopentries.cpp54
-rw-r--r--src/lib/xdgdesktopentries.h4
-rw-r--r--src/lib/xdgdesktopfilter.cpp42
-rw-r--r--src/lib/xdgdesktopfilter.h4
-rw-r--r--src/lib/xdgentries.cpp30
-rw-r--r--src/lib/xdgentries.h6
-rw-r--r--src/lib/xdgentry.cpp32
-rw-r--r--src/lib/xdgentry.h6
-rw-r--r--src/lib/xdgnotificationactions.cpp12
-rw-r--r--src/lib/xdgnotificationactions.h2
-rw-r--r--src/lib/xdgnotificationmanager.cpp52
-rw-r--r--src/lib/xdgnotificationmanager.h2
-rw-r--r--src/lib/xdgnotificationmessage.cpp26
-rw-r--r--src/lib/xdgnotificationmessage.h2
-rw-r--r--src/lib/xdgstatusnotifierhost.cpp4
-rw-r--r--src/lib/xdgstatusnotifierhost.h2
-rw-r--r--src/lib/xdgstatusnotifieritem.cpp4
-rw-r--r--src/lib/xdgstatusnotifieritem.h2
-rw-r--r--src/lib/xdgstatusnotifierwatcher.cpp2
-rw-r--r--src/lib/xdgstatusnotifierwatcher.h2
-rw-r--r--src/test/test_xdg.cpp2
36 files changed, 248 insertions, 217 deletions
diff --git a/.gitignore b/.gitignore
index 378eac2..1b1295f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
build
+CMakeLists.txt.*
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f78ff11..10f41d8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14)
-project(KzXdgUtils VERSION 1.0.0 LANGUAGES CXX)
+project(KzXdg VERSION 1.0.0 LANGUAGES CXX)
include(GNUInstallDirs)
@@ -10,7 +10,6 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
-
if(NOT DEFINED QML_MODULE_INSTALL_PATH)
if(DEFINED OE_QMAKE_PATH_QML)
set(QML_MODULE_INSTALL_PATH ${OE_QMAKE_PATH_QML} )
@@ -22,7 +21,7 @@ endif()
find_package(Qt6 COMPONENTS Core Quick Qml DBus REQUIRED)
set(PLUGIN_SOURCES
- src/kzxdgutils_plugin.h src/kzxdgutils_plugin.cpp
+ src/kzxdg_plugin.h src/kzxdg_plugin.cpp
qml/qmldir
)
@@ -43,6 +42,7 @@ set(LIBRARY_SOURCES
src/lib/xdgstatusnotifieritem.cpp
src/lib/xdgstatusnotifierhost.cpp
src/lib/xdgstatusnotifierwatcher.cpp
+ cmake/CPack.cmake
)
set(LIBRARY_HEADERS_PRIVATE
@@ -72,29 +72,29 @@ qt_add_dbus_adaptor( DBUS_IFACE_SRCS api/org.freedesktop.Notifications.xml xd
qt_add_dbus_interface( DBUS_IFACE_SRCS api/org.freedesktop.Notifications.xml NotificationsIface)
list(APPEND DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierItem.xml)
-qt_add_dbus_adaptor( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierItem.xml xdgstatusnotifieritem.h xdg::StatusNotifierItem)
+qt_add_dbus_adaptor( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierItem.xml xdgstatusnotifieritem.h KaZoe::StatusNotifierItem)
qt_add_dbus_interface( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierItem.xml XdgStatusNotifierItemIface)
list(APPEND DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierWatcher.xml)
-qt_add_dbus_adaptor( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierWatcher.xml xdgstatusnotifierwatcher.h xdg::StatusNotifierWatcher)
+qt_add_dbus_adaptor( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierWatcher.xml xdgstatusnotifierwatcher.h KaZoe::StatusNotifierWatcher)
qt_add_dbus_interface( DBUS_IFACE_SRCS api/org.freedesktop.StatusNotifierWatcher.xml XdgStatusNotifierWatcherIface)
-add_library(KzXdgUtilsPlugin SHARED ${PLUGIN_SOURCES})
-add_library(kzxdgutils SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} ${LIBRARY_HEADERS_PRIVATE} ${DBUS_IFACE_SRCS} cmake/Config.cmake.in)
-set_target_properties(kzxdgutils PROPERTIES PUBLIC_HEADER "${LIBRARY_HEADERS}")
-set_target_properties(kzxdgutils PROPERTIES VERSION ${CMAKE_PROJECT_VERSION} SOVERSION 1)
+add_library(KzXdgPlugin SHARED ${PLUGIN_SOURCES})
+add_library(KzXdg SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS} ${LIBRARY_HEADERS_PRIVATE} ${DBUS_IFACE_SRCS} cmake/Config.cmake.in)
+set_target_properties(KzXdg PROPERTIES PUBLIC_HEADER "${LIBRARY_HEADERS}")
+set_target_properties(KzXdg PROPERTIES VERSION ${CMAKE_PROJECT_VERSION} SOVERSION 1)
-target_compile_definitions(KzXdgUtilsPlugin
+target_compile_definitions(KzXdgPlugin
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>
)
-target_link_libraries(KzXdgUtilsPlugin
+target_link_libraries(KzXdgPlugin
PRIVATE
Qt6::Qml
- kzxdgutils
+ KzXdg
)
-target_link_libraries(kzxdgutils
+target_link_libraries(KzXdg
PRIVATE
Qt6::Core
Qt6::Quick
@@ -102,16 +102,16 @@ target_link_libraries(kzxdgutils
)
add_executable(test_xdg src/test/test_xdg.cpp)
-target_link_libraries(test_xdg PRIVATE kzxdgutils Qt6::Core)
+target_link_libraries(test_xdg PRIVATE KzXdg Qt6::Core)
-install(TARGETS KzXdgUtilsPlugin DESTINATION ${QML_MODULE_INSTALL_PATH}/KaZoe/XdgUtils)
-install(FILES qml/qmldir DESTINATION ${QML_MODULE_INSTALL_PATH}/KaZoe/XdgUtils)
-install(TARGETS kzxdgutils PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kzxdgutils")
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/notificationsadaptor.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kzxdgutils" RENAME xdgnotificationsadaptor.h)
+install(TARGETS KzXdgPlugin DESTINATION ${QML_MODULE_INSTALL_PATH}/org/kazoe/xdg)
+install(FILES qml/qmldir DESTINATION ${QML_MODULE_INSTALL_PATH}/org/kazoe/xdg)
+install(TARGETS KzXdg PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/KaZoe/Xdg/")
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/notificationsadaptor.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/KaZoe/Xdg" RENAME xdgnotificationsadaptor.h)
# CMake Module
include(CMakePackageConfigHelpers)
-set(CMakeModuleName "KzXdgUtils")
+set(CMakeModuleName "KzXdg")
configure_package_config_file(
cmake/Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${CMakeModuleName}Config.cmake
@@ -125,3 +125,5 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMakeModuleName}Config.cmake
${CMAKE_CURRENT_BINARY_DIR}/${CMakeModuleName}ConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${CMakeModuleName}
)
+
+include(cmake/CPack.cmake)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..529eb62
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2025 Proriol Fabien
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
index cd27666..cbe2711 100644
--- a/README.md
+++ b/README.md
@@ -19,8 +19,8 @@ KzXdgUtils provide a library using Qt Core only, and a Qt Module to use it direc
# Build and deploy
```sh
-git clone https://kazoe.org/cgit/kazoe/kazoe-xdgutils.git
-cd xdgutils
+git clone https://kazoe.org/cgit/kazoe/KzXdg.git
+cd KzXdg
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr
diff --git a/cmake/CPack.cmake b/cmake/CPack.cmake
new file mode 100644
index 0000000..90c0ada
--- /dev/null
+++ b/cmake/CPack.cmake
@@ -0,0 +1,8 @@
+set(CPACK_GENERATOR "DEB")
+set(CPACK_PACKAGE_NAME "KzXdg")
+set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6core6t64, libqt6dbus6")
+set(CPACK_DEBIAN_FILE_NAME DEB-DEFAULT)
+set(CPACK_PACKAGE_VERSION_PATCH "${CMAKE_PROJECT_VERSION_PATCH}")
+set(CPACK_PACKAGE_DESCRIPTION "KaZoe XDG Qt library")
+set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Fabien Proriol <fabien.proriol@kazoe.org>")
+include(CPack)
diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
index 74bab40..c01466c 100644
--- a/cmake/Config.cmake.in
+++ b/cmake/Config.cmake.in
@@ -1,5 +1,4 @@
@PACKAGE_INIT@
-set(KZXDGUTILS_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@/kzxdgutils/")
-set(KZXDGUTILS_LIBRARIES "kzxdgutils")
-include_directories(${ZXDGUTILS_INCLUDE_DIR})
+set(KZXDG_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/@CMAKE_INSTALL_INCLUDEDIR@/KaZoe/Xdg/")
+set(KZXDG_LIBRARIES "KzXdg")
diff --git a/qml/qmldir b/qml/qmldir
index 73d2b63..9f289fc 100644
--- a/qml/qmldir
+++ b/qml/qmldir
@@ -1,2 +1,2 @@
-module kzxdgutils
-plugin KzXdgUtilsPlugin
+module org.kazoe.xdg
+plugin KzXdgPlugin
diff --git a/src/kzxdg_plugin.cpp b/src/kzxdg_plugin.cpp
new file mode 100644
index 0000000..c11ab9e
--- /dev/null
+++ b/src/kzxdg_plugin.cpp
@@ -0,0 +1,27 @@
+#include "kzxdg_plugin.h"
+
+#include "xdgentry.h"
+#include "xdgdesktopentries.h"
+#include "xdgdesktopfilter.h"
+#include "xdgautostart.h"
+#include "xdgnotificationmanager.h"
+#include "xdgnotificationactions.h"
+#include "xdgstatusnotifieritem.h"
+#include "xdgstatusnotifierhost.h"
+#include "xdgstatusnotifierwatcher.h"
+
+#include <qqml.h>
+
+void KzXdgPlugin::registerTypes(const char *uri)
+{
+ // @uri org.kazoe.xdg
+ qmlRegisterType<KaZoe::DesktopEntries>(uri, 1, 0, "DesktopEntries");
+ qmlRegisterType<KaZoe::Entry>(uri, 1, 0, "Entry");
+ qmlRegisterType<KaZoe::DesktopFilter>(uri, 1, 0, "DesktopFilter");
+ qmlRegisterType<KaZoe::AutoStart>(uri, 1, 0, "AutoStart");
+ qmlRegisterType<KaZoe::NotificationManager>(uri, 1, 0, "NotificationManager");
+ qmlRegisterType<KaZoe::NotificationActions>(uri, 1, 0, "NotificationActions");
+ qmlRegisterType<KaZoe::StatusNotifierItem>(uri, 1, 0, "StatusNotifierItem");
+ qmlRegisterType<KaZoe::StatusNotifierHost>(uri, 1, 0, "StatusNotifierHost");
+ qmlRegisterType<KaZoe::StatusNotifierWatcher>(uri, 1, 0, "StatusNotifierWatcher");
+}
diff --git a/src/kzxdgutils_plugin.h b/src/kzxdg_plugin.h
index ea44c7d..353c00e 100644
--- a/src/kzxdgutils_plugin.h
+++ b/src/kzxdg_plugin.h
@@ -3,7 +3,7 @@
#include <QQmlExtensionPlugin>
-class KzXdgUtilsPlugin : public QQmlExtensionPlugin
+class KzXdgPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
diff --git a/src/kzxdgutils_plugin.cpp b/src/kzxdgutils_plugin.cpp
deleted file mode 100644
index c68633c..0000000
--- a/src/kzxdgutils_plugin.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "kzxdgutils_plugin.h"
-
-#include "xdgentry.h"
-#include "xdgdesktopentries.h"
-#include "xdgdesktopfilter.h"
-#include "xdgautostart.h"
-#include "xdgnotificationmanager.h"
-#include "xdgnotificationactions.h"
-#include "xdgstatusnotifieritem.h"
-#include "xdgstatusnotifierhost.h"
-#include "xdgstatusnotifierwatcher.h"
-
-#include <qqml.h>
-
-void KzXdgUtilsPlugin::registerTypes(const char *uri)
-{
- // @uri xdgutils
- qmlRegisterType<xdg::DesktopEntries>(uri, 1, 0, "DesktopEntries");
- qmlRegisterType<xdg::Entry>(uri, 1, 0, "XdgEntry");
- qmlRegisterType<xdg::DesktopFilter>(uri, 1, 0, "DesktopFilter");
- qmlRegisterType<xdg::AutoStart>(uri, 1, 0, "AutoStart");
- qmlRegisterType<xdg::NotificationManager>(uri, 1, 0, "NotificationManager");
- qmlRegisterType<xdg::NotificationActions>(uri, 1, 0, "NotificationActions");
- qmlRegisterType<xdg::StatusNotifierItem>(uri, 1, 0, "StatusNotifierItem");
- qmlRegisterType<xdg::StatusNotifierHost>(uri, 1, 0, "StatusNotifierHost");
- qmlRegisterType<xdg::StatusNotifierWatcher>(uri, 1, 0, "StatusNotifierWatcher");
-}
diff --git a/src/lib/debug.cpp b/src/lib/debug.cpp
index 565bdbc..ba5f4b8 100644
--- a/src/lib/debug.cpp
+++ b/src/lib/debug.cpp
@@ -1,4 +1,4 @@
#include "debug.h"
-Q_LOGGING_CATEGORY(AUTO_START, "xdg.auto_start")
-Q_LOGGING_CATEGORY(SYSTEM_TRAY, "xdg.system_tray")
+Q_LOGGING_CATEGORY(AUTO_START, "org.kazoe.xdg.auto_start")
+Q_LOGGING_CATEGORY(SYSTEM_TRAY, "org.kazoe.xdg.system_tray")
diff --git a/src/lib/xdgautostart.cpp b/src/lib/xdgautostart.cpp
index bd71261..b78fe53 100644
--- a/src/lib/xdgautostart.cpp
+++ b/src/lib/xdgautostart.cpp
@@ -3,22 +3,22 @@
#include "xdgentry.h"
#include "debug.h"
-xdg::AutoStart::AutoStart(QObject *parent)
+KaZoe::AutoStart::AutoStart(QObject *parent)
: QObject{parent}
{
qCDebug(AUTO_START) << "Create Auto start";
- QStringList configdirs = xdg::configDirs();
+ QStringList configdirs = KaZoe::configDirs();
for (auto dir = configdirs.rbegin(); dir != configdirs.rend(); ++dir)
{
m_entries.addDirectory(*dir + "/autostart");
}
- m_entries.addDirectory(xdg::configHome() + "/autostart");
+ m_entries.addDirectory(KaZoe::configHome() + "/autostart");
}
-void xdg::AutoStart::start(QString key, QString value)
+void KaZoe::AutoStart::start(QString key, QString value)
{
qCDebug(AUTO_START) << "Start " << key << value;
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
if((!value.isNull()) && (!key.isNull()))
{
diff --git a/src/lib/xdgautostart.h b/src/lib/xdgautostart.h
index fc6c02d..e4fd63a 100644
--- a/src/lib/xdgautostart.h
+++ b/src/lib/xdgautostart.h
@@ -5,13 +5,13 @@
#include "xdgentries.h"
-namespace xdg {
+namespace KaZoe {
class AutoStart : public QObject
{
Q_OBJECT
public:
explicit AutoStart(QObject *parent = nullptr);
- xdg::Entries m_entries;
+ KaZoe::Entries m_entries;
public slots:
void start(QString key = QString(), QString value = QString());
diff --git a/src/lib/xdgbasedir.cpp b/src/lib/xdgbasedir.cpp
index 1f84109..d875cec 100644
--- a/src/lib/xdgbasedir.cpp
+++ b/src/lib/xdgbasedir.cpp
@@ -32,28 +32,28 @@ static inline QString envOrDefault(const char *name, const QString &def)
return env;
}
-QString xdg::dataHome()
+QString KaZoe::dataHome()
{
return envOrDefault("XDG_DATA_HOME", home() + "/.local/share");
}
-QString xdg::configHome()
+QString KaZoe::configHome()
{
return envOrDefault("XDG_CONFIG_HOME", home() + "/.config");
}
-QString xdg::cacheHome()
+QString KaZoe::cacheHome()
{
return envOrDefault("XDG_CACHE_HOME", home() + "/.cache");
}
-QString xdg::stateHome()
+QString KaZoe::stateHome()
{
return envOrDefault("XDG_STATE_HOME", home() + "/.local/state");
}
-QStringList xdg::dataDirs()
+QStringList KaZoe::dataDirs()
{
QString dataDirs = QString::fromUtf8(qgetenv("XDG_DATA_DIRS"));
if(dataDirs.isEmpty())
@@ -63,7 +63,7 @@ QStringList xdg::dataDirs()
return dataDirs.split(":");
}
-QStringList xdg::configDirs()
+QStringList KaZoe::configDirs()
{
QString configDirs = QString::fromUtf8(qgetenv("XDG_CONFIG_DIRS"));
if(configDirs.isEmpty())
@@ -73,7 +73,7 @@ QStringList xdg::configDirs()
return configDirs.split(":");
}
-QString xdg::runtimeDir()
+QString KaZoe::runtimeDir()
{
return envOrDefault("XDG_RUNTIME_DIR", QString("/run/user/%i").arg(user()));
}
diff --git a/src/lib/xdgbasedir.h b/src/lib/xdgbasedir.h
index bd7d688..df2ef18 100644
--- a/src/lib/xdgbasedir.h
+++ b/src/lib/xdgbasedir.h
@@ -11,7 +11,7 @@
#include <QString>
//! XDG basedir implementation
-namespace xdg {
+namespace KaZoe {
/*!
* \addtogroup XDG
* @{
diff --git a/src/lib/xdgdesktopentries.cpp b/src/lib/xdgdesktopentries.cpp
index d1a3f95..c1c83a1 100644
--- a/src/lib/xdgdesktopentries.cpp
+++ b/src/lib/xdgdesktopentries.cpp
@@ -8,46 +8,46 @@
-xdg::DesktopEntries::DesktopEntries(QObject *parent)
+KaZoe::DesktopEntries::DesktopEntries(QObject *parent)
: QAbstractListModel(parent)
{
- QStringList datadirs = xdg::dataDirs();
+ QStringList datadirs = KaZoe::dataDirs();
for (auto dir = datadirs.rbegin(); dir != datadirs.rend(); ++dir)
{
m_entries.addDirectory(*dir + "/applications");
}
- m_entries.addDirectory(xdg::dataHome() + "/applications");
- QObject::connect(&m_entries, &xdg::Entries::entryDataChanged, this, &xdg::DesktopEntries::_dataChanged);
- QObject::connect(&m_entries, &xdg::Entries::raiseProcess, this, &xdg::DesktopEntries::raiseProcess);
- QObject::connect(&m_entries, &xdg::Entries::startCreateEntry, [this](int i){
+ m_entries.addDirectory(KaZoe::dataHome() + "/applications");
+ QObject::connect(&m_entries, &KaZoe::Entries::entryDataChanged, this, &KaZoe::DesktopEntries::_dataChanged);
+ QObject::connect(&m_entries, &KaZoe::Entries::raiseProcess, this, &KaZoe::DesktopEntries::raiseProcess);
+ QObject::connect(&m_entries, &KaZoe::Entries::startCreateEntry, [this](int i){
beginInsertRows(QModelIndex(), i, i);
});
- QObject::connect(&m_entries, &xdg::Entries::startCreateEntry, [this](int i){
+ QObject::connect(&m_entries, &KaZoe::Entries::startCreateEntry, [this](int i){
endInsertRows();
emit categoriesChanged(categories());
});
- QObject::connect(&m_entries, &xdg::Entries::startRemoveEntry, [this](int i){
+ QObject::connect(&m_entries, &KaZoe::Entries::startRemoveEntry, [this](int i){
beginRemoveRows(QModelIndex(), i, i);
});
- QObject::connect(&m_entries, &xdg::Entries::startRemoveEntry, [this](int i){
+ QObject::connect(&m_entries, &KaZoe::Entries::startRemoveEntry, [this](int i){
endRemoveRows();
emit categoriesChanged(categories());
});
}
-int xdg::DesktopEntries::rowCount(const QModelIndex &parent) const
+int KaZoe::DesktopEntries::rowCount(const QModelIndex &parent) const
{
Q_UNUSED(parent);
return m_entries.count();
}
-QVariant xdg::DesktopEntries::data(const QModelIndex &index, int role) const
+QVariant KaZoe::DesktopEntries::data(const QModelIndex &index, int role) const
{
if(index.row() > m_entries.count())
return QVariant();
- const xdg::Entry *entry = m_entries.getEntry(index.row());
+ const KaZoe::Entry *entry = m_entries.getEntry(index.row());
switch(role) {
case Qt::DisplayRole:
@@ -80,7 +80,7 @@ QVariant xdg::DesktopEntries::data(const QModelIndex &index, int role) const
return QVariant();
}
-QHash<int, QByteArray> xdg::DesktopEntries::roleNames() const
+QHash<int, QByteArray> KaZoe::DesktopEntries::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
roles[IconRole] = "appIcon";
@@ -97,10 +97,10 @@ QHash<int, QByteArray> xdg::DesktopEntries::roleNames() const
return roles;
}
-QStringList xdg::DesktopEntries::categories()
+QStringList KaZoe::DesktopEntries::categories()
{
QStringList ret;
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
QString c = entry->data(XDG_CATEGORIES);
if(!ret.contains(c))
@@ -109,20 +109,20 @@ QStringList xdg::DesktopEntries::categories()
return ret;
}
-void xdg::DesktopEntries::start(QString path, const QStringList& args)
+void KaZoe::DesktopEntries::start(QString path, const QStringList& args)
{
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
if(entry->path() == path)
entry->start(args);
}
}
-void xdg::DesktopEntries::stop(QString path, const QStringList& args)
+void KaZoe::DesktopEntries::stop(QString path, const QStringList& args)
{
bool isPid;
int pid = path.toInt(&isPid, 10);
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
if((isPid && entry->pid() == pid) || (entry->path() == path))
{
@@ -133,9 +133,9 @@ void xdg::DesktopEntries::stop(QString path, const QStringList& args)
if(isPid) kill(pid, SIGTERM);
}
-QString xdg::DesktopEntries::appIdData(QString appid, QString key)
+QString KaZoe::DesktopEntries::appIdData(QString appid, QString key)
{
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
if(entry->appId() == appid)
return entry->data(key);
@@ -143,9 +143,9 @@ QString xdg::DesktopEntries::appIdData(QString appid, QString key)
return QString();
}
-bool xdg::DesktopEntries::_contains(QString path)
+bool KaZoe::DesktopEntries::_contains(QString path)
{
- for(const xdg::Entry *entry: m_entries.getEntries())
+ for(const KaZoe::Entry *entry: m_entries.getEntries())
{
if(entry->path() == path)
return true;
@@ -153,10 +153,10 @@ bool xdg::DesktopEntries::_contains(QString path)
return false;
}
-QStringList xdg::DesktopEntries::_getEntriesFrom(QString path)
+QStringList KaZoe::DesktopEntries::_getEntriesFrom(QString path)
{
QStringList entries;
- for(xdg::Entry *entry: m_entries.getEntries())
+ for(KaZoe::Entry *entry: m_entries.getEntries())
{
if(path == "" || entry->path().startsWith(path))
entries.append(entry->path());
@@ -164,7 +164,7 @@ QStringList xdg::DesktopEntries::_getEntriesFrom(QString path)
return entries;
}
-void xdg::DesktopEntries::_dataChanged(const QString appid, const QString item, const QString value)
+void KaZoe::DesktopEntries::_dataChanged(const QString appid, const QString item, const QString value)
{
if(item == XDG_CATEGORIES)
{
@@ -190,7 +190,7 @@ void xdg::DesktopEntries::_dataChanged(const QString appid, const QString item,
{
for(int i = 0; i < m_entries.count(); i++)
{
- const xdg::Entry *entry = m_entries.getEntry(i);
+ const KaZoe::Entry *entry = m_entries.getEntry(i);
if(entry->appId() == appid)
{
QVector<int> r;
diff --git a/src/lib/xdgdesktopentries.h b/src/lib/xdgdesktopentries.h
index 89aff08..305b928 100644
--- a/src/lib/xdgdesktopentries.h
+++ b/src/lib/xdgdesktopentries.h
@@ -5,12 +5,12 @@
#include <QObject>
#include "xdgentries.h"
-namespace xdg {
+namespace KaZoe {
class DesktopEntries : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(QStringList categories READ categories NOTIFY categoriesChanged)
- xdg::Entries m_entries;
+ KaZoe::Entries m_entries;
private slots:
bool _contains(QString path);
diff --git a/src/lib/xdgdesktopfilter.cpp b/src/lib/xdgdesktopfilter.cpp
index 78e2ca2..c394260 100644
--- a/src/lib/xdgdesktopfilter.cpp
+++ b/src/lib/xdgdesktopfilter.cpp
@@ -3,40 +3,40 @@
#include "xdgentry.h"
#include <qdebug.h>
-xdg::DesktopFilter::DesktopFilter(QObject *parent)
+KaZoe::DesktopFilter::DesktopFilter(QObject *parent)
: QSortFilterProxyModel(parent)
{
}
-QObject *xdg::DesktopFilter::model() const
+QObject *KaZoe::DesktopFilter::model() const
{
return static_cast<QObject*>(m_model);
}
-QString xdg::DesktopFilter::category() const
+QString KaZoe::DesktopFilter::category() const
{
return m_category;
}
-QString xdg::DesktopFilter::section() const
+QString KaZoe::DesktopFilter::section() const
{
return m_section;
}
-bool xdg::DesktopFilter::showAll() const
+bool KaZoe::DesktopFilter::showAll() const
{
return m_showAll;
}
-bool xdg::DesktopFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
+bool KaZoe::DesktopFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
- QVariant ventry = sourceModel()->data(index, xdg::DesktopEntries::EntryRole);
- const xdg::Entry *entry = qvariant_cast<const xdg::Entry *>(ventry);
+ QVariant ventry = sourceModel()->data(index, KaZoe::DesktopEntries::EntryRole);
+ const KaZoe::Entry *entry = qvariant_cast<const KaZoe::Entry *>(ventry);
if(!entry)
{
- qWarning() << "Can't retrive entry for " << sourceModel()->data(index, xdg::DesktopEntries::NameRole).toString();
+ qWarning() << "Can't retrive entry for " << sourceModel()->data(index, KaZoe::DesktopEntries::NameRole).toString();
return false;
}
@@ -55,29 +55,29 @@ bool xdg::DesktopFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sour
}
-QVariant xdg::DesktopFilter::data(const QModelIndex &index, int role) const
+QVariant KaZoe::DesktopFilter::data(const QModelIndex &index, int role) const
{
if(!m_section.isEmpty())
{
- const xdg::Entry *entry = QSortFilterProxyModel::data(index, xdg::DesktopEntries::EntryRole).value<const xdg::Entry *>();
+ const KaZoe::Entry *entry = QSortFilterProxyModel::data(index, KaZoe::DesktopEntries::EntryRole).value<const KaZoe::Entry *>();
if(entry)
{
QString res;
switch(role) {
case Qt::DisplayRole:
- case xdg::DesktopEntries::NameRole:
+ case KaZoe::DesktopEntries::NameRole:
res = entry->data(m_section + "/Name");
return (res.isEmpty())?(res):(entry->data(XDG_NAME));
- case xdg::DesktopEntries::ExecRole:
+ case KaZoe::DesktopEntries::ExecRole:
res = entry->data(m_section + "/Exec");
return (!res.isEmpty())?(res):(entry->data(XDG_EXEC));
- case xdg::DesktopEntries::IconRole:
+ case KaZoe::DesktopEntries::IconRole:
res = entry->data(m_section + "/Icon");
return (!res.isEmpty())?(res):(entry->data(XDG_ICON));
- case xdg::DesktopEntries::CategoryRole:
+ case KaZoe::DesktopEntries::CategoryRole:
res = entry->data(m_section + "/Categories");
return (!res.isEmpty())?(res):(entry->data(XDG_CATEGORIES));
- case xdg::DesktopEntries::KeywordsRole:
+ case KaZoe::DesktopEntries::KeywordsRole:
res = entry->data(m_section + "/Keywords");
return (!res.isEmpty())?(res):(entry->data(XDG_KEYWORDS));
}
@@ -86,12 +86,12 @@ QVariant xdg::DesktopFilter::data(const QModelIndex &index, int role) const
return QSortFilterProxyModel::data(index, role);
}
-void xdg::DesktopFilter::setModel(QObject *model)
+void KaZoe::DesktopFilter::setModel(QObject *model)
{
if (m_model == model)
return;
- xdg::DesktopEntries *entries = qobject_cast<xdg::DesktopEntries*>(model);
+ KaZoe::DesktopEntries *entries = qobject_cast<KaZoe::DesktopEntries*>(model);
if(entries)
{
m_model = entries;
@@ -100,7 +100,7 @@ void xdg::DesktopFilter::setModel(QObject *model)
}
}
-void xdg::DesktopFilter::setCategory(QString category)
+void KaZoe::DesktopFilter::setCategory(QString category)
{
if (m_category == category)
return;
@@ -110,7 +110,7 @@ void xdg::DesktopFilter::setCategory(QString category)
emit categoryChanged(m_category);
}
-void xdg::DesktopFilter::setSection(QString section)
+void KaZoe::DesktopFilter::setSection(QString section)
{
if (m_section == section)
return;
@@ -120,7 +120,7 @@ void xdg::DesktopFilter::setSection(QString section)
emit sectionChanged(m_section);
}
-void xdg::DesktopFilter::setShowAll(bool showall)
+void KaZoe::DesktopFilter::setShowAll(bool showall)
{
if (m_showAll == showall)
return;
diff --git a/src/lib/xdgdesktopfilter.h b/src/lib/xdgdesktopfilter.h
index abe2f06..f788e12 100644
--- a/src/lib/xdgdesktopfilter.h
+++ b/src/lib/xdgdesktopfilter.h
@@ -5,7 +5,7 @@
#include <QObject>
#include "xdgdesktopentries.h"
-namespace xdg {
+namespace KaZoe {
class DesktopEntries;
class DesktopFilter : public QSortFilterProxyModel
@@ -16,7 +16,7 @@ namespace xdg {
Q_PROPERTY(QString section READ section WRITE setSection NOTIFY sectionChanged)
Q_PROPERTY(bool showAll READ showAll WRITE setShowAll NOTIFY showAllChanged)
- xdg::DesktopEntries *m_model;
+ KaZoe::DesktopEntries *m_model;
QString m_category;
QString m_section;
bool m_showAll {false};
diff --git a/src/lib/xdgentries.cpp b/src/lib/xdgentries.cpp
index 790e472..4be8251 100644
--- a/src/lib/xdgentries.cpp
+++ b/src/lib/xdgentries.cpp
@@ -6,17 +6,17 @@
#include <set>
#include <algorithm>
-xdg::Entries::Entries(QObject *parent)
+KaZoe::Entries::Entries(QObject *parent)
: QObject(parent)
{
QObject::connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &Entries::_directoryChanged, Qt::QueuedConnection);
}
-void xdg::Entries::_directoryChanged(const QString &path)
+void KaZoe::Entries::_directoryChanged(const QString &path)
{
QDir directory(path);
QStringList old, now, removed, added;
- for(xdg::Entry *entry: m_entries)
+ for(KaZoe::Entry *entry: m_entries)
{
if(entry->path().startsWith(directory.absolutePath()))
{
@@ -43,25 +43,25 @@ void xdg::Entries::_directoryChanged(const QString &path)
}
}
-void xdg::Entries::_entryDataChanged(const QString key, const QString value)
+void KaZoe::Entries::_entryDataChanged(const QString key, const QString value)
{
- xdg::Entry* ent = qobject_cast<xdg::Entry*>(QObject::sender());
+ KaZoe::Entry* ent = qobject_cast<KaZoe::Entry*>(QObject::sender());
emit entryDataChanged(ent->appId(), key, value);
}
-void xdg::Entries::unregister(const QString &path)
+void KaZoe::Entries::unregister(const QString &path)
{
QFileInfo info(path);
QString id = info.completeBaseName();
int oldid = m_entries.keys().indexOf(id);
emit startRemoveEntry(oldid);
- xdg::Entry* old = m_entries[id];
+ KaZoe::Entry* old = m_entries[id];
m_watcher.removePath(old->path());
m_entries.remove(id);
emit endRemoveEntry(oldid);
}
-int xdg::Entries::add(const QString &path, bool replace)
+int KaZoe::Entries::add(const QString &path, bool replace)
{
QFileInfo info(path);
QString id = info.completeBaseName();
@@ -83,9 +83,9 @@ int xdg::Entries::add(const QString &path, bool replace)
}
}
- xdg::Entry* entry = new xdg::Entry(path);
- QObject::connect(entry, &xdg::Entry::dataChanged, this, &Entries::_entryDataChanged);
- QObject::connect(entry, &xdg::Entry::raiseProcess, this, &Entries::raiseProcess);
+ KaZoe::Entry* entry = new KaZoe::Entry(path);
+ QObject::connect(entry, &KaZoe::Entry::dataChanged, this, &Entries::_entryDataChanged);
+ QObject::connect(entry, &KaZoe::Entry::raiseProcess, this, &Entries::raiseProcess);
m_entries[id] = entry;
emit startCreateEntry(m_entries.keys().indexOf(id));
@@ -93,7 +93,7 @@ int xdg::Entries::add(const QString &path, bool replace)
return 0;
}
-int xdg::Entries::addDirectory(const QString &path, bool replace)
+int KaZoe::Entries::addDirectory(const QString &path, bool replace)
{
QFileInfo info(path.trimmed());
if(!info.isDir())
@@ -112,17 +112,17 @@ int xdg::Entries::addDirectory(const QString &path, bool replace)
return 0;
}
-qsizetype xdg::Entries::count() const
+qsizetype KaZoe::Entries::count() const
{
return m_entries.count();
}
-const xdg::Entry *xdg::Entries::getEntry(int i) const
+const KaZoe::Entry *KaZoe::Entries::getEntry(int i) const
{
return m_entries[m_entries.keys()[i]];
}
-QList<xdg::Entry *> xdg::Entries::getEntries()
+QList<KaZoe::Entry *> KaZoe::Entries::getEntries()
{
return m_entries.values();
}
diff --git a/src/lib/xdgentries.h b/src/lib/xdgentries.h
index fd0458a..587d67a 100644
--- a/src/lib/xdgentries.h
+++ b/src/lib/xdgentries.h
@@ -5,7 +5,7 @@
#include <QFileSystemWatcher>
#include <QMap>
-namespace xdg {
+namespace KaZoe {
class Entry;
class Entries : public QObject
@@ -13,7 +13,7 @@ namespace xdg {
Q_OBJECT
QString m_type;
QFileSystemWatcher m_watcher;
- QMap<QString, xdg::Entry*> m_entries;
+ QMap<QString, KaZoe::Entry*> m_entries;
private slots:
void _directoryChanged(const QString &path);
@@ -26,7 +26,7 @@ namespace xdg {
int addDirectory(const QString &path, bool replace = false);
qsizetype count() const;
const Entry *getEntry(int i) const;
- QList<xdg::Entry *> getEntries();
+ QList<KaZoe::Entry *> getEntries();
signals:
void entryDataChanged(const QString appid, const QString key, const QString value);
diff --git a/src/lib/xdgentry.cpp b/src/lib/xdgentry.cpp
index 83438dd..a07c8c5 100644
--- a/src/lib/xdgentry.cpp
+++ b/src/lib/xdgentry.cpp
@@ -106,7 +106,7 @@ static inline QStringList args_substitution(const QStringList &tokens, const QSt
}
-xdg::Entry::Entry(QString desktopfile, QObject *parent)
+KaZoe::Entry::Entry(QString desktopfile, QObject *parent)
: QObject(parent)
, m_path(desktopfile)
, m_file(new QSettings(desktopfile, QSettings::IniFormat, this))
@@ -120,7 +120,7 @@ xdg::Entry::Entry(QString desktopfile, QObject *parent)
QObject::connect(&m_process, &QProcess::stateChanged, this, &Entry::_processStateChanged);
}
-xdg::Entry::Entry(QObject *parent)
+KaZoe::Entry::Entry(QObject *parent)
: QObject(parent)
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
@@ -131,7 +131,7 @@ xdg::Entry::Entry(QObject *parent)
QObject::connect(&m_process, &QProcess::stateChanged, this, &Entry::_processStateChanged);
}
-xdg::Entry::Entry(const Entry &origin)
+KaZoe::Entry::Entry(const Entry &origin)
: QObject(origin.parent())
, m_path(origin.path())
, m_file(new QSettings(origin.path(), QSettings::IniFormat, this))
@@ -146,7 +146,7 @@ xdg::Entry::Entry(const Entry &origin)
}
-QString xdg::Entry::data(const QString &key) const
+QString KaZoe::Entry::data(const QString &key) const
{
if(!m_file)
return QString();
@@ -175,7 +175,7 @@ QString xdg::Entry::data(const QString &key) const
return m_file->value(key).toString();
}
-void xdg::Entry::start(QStringList args)
+void KaZoe::Entry::start(QStringList args)
{
QString exec = data(XDG_EXEC);
QString startExec = data(XDG_ACTION_START);
@@ -209,7 +209,7 @@ void xdg::Entry::start(QStringList args)
}
}
-void xdg::Entry::stop(QStringList args)
+void KaZoe::Entry::stop(QStringList args)
{
QString stopExec = data(XDG_ACTION_STOP);
@@ -229,28 +229,28 @@ void xdg::Entry::stop(QStringList args)
}
}
-QString xdg::Entry::path() const
+QString KaZoe::Entry::path() const
{
return m_path;
}
-QString xdg::Entry::appId() const
+QString KaZoe::Entry::appId() const
{
QFileInfo fi(path());
return fi.completeBaseName();
}
-QString xdg::Entry::icon() const
+QString KaZoe::Entry::icon() const
{
return data(XDG_ICON);
}
-int xdg::Entry::pid() const
+int KaZoe::Entry::pid() const
{
return m_process.processId();
}
-void xdg::Entry::setDesktopFile(QString desktopFile)
+void KaZoe::Entry::setDesktopFile(QString desktopFile)
{
m_path = desktopFile;
m_file = new QSettings(desktopFile, QSettings::IniFormat);
@@ -258,12 +258,12 @@ void xdg::Entry::setDesktopFile(QString desktopFile)
emit iconChanged(data(XDG_ICON));
}
-void xdg::Entry::setAppId(QString appId)
+void KaZoe::Entry::setAppId(QString appId)
{
/* Search for appid destopfile */
QString filename;
- filename = xdg::dataHome() + "/applications/" + appId + ".desktop";
+ filename = KaZoe::dataHome() + "/applications/" + appId + ".desktop";
if(filename.length())
{
QFileInfo info(filename);
@@ -274,7 +274,7 @@ void xdg::Entry::setAppId(QString appId)
}
}
- for(QString dir: xdg::dataDirs())
+ for(QString dir: KaZoe::dataDirs())
{
filename = dir + "/applications/" + appId + ".desktop";
QFileInfo info(filename);
@@ -288,7 +288,7 @@ void xdg::Entry::setAppId(QString appId)
}
-void xdg::Entry::_desktopFileChanged(const QString &path)
+void KaZoe::Entry::_desktopFileChanged(const QString &path)
{
if(!m_file)
return;
@@ -309,7 +309,7 @@ void xdg::Entry::_desktopFileChanged(const QString &path)
}
}
-void xdg::Entry::_processStateChanged(QProcess::ProcessState newState)
+void KaZoe::Entry::_processStateChanged(QProcess::ProcessState newState)
{
emit dataChanged(XDG_KEYWORDS, data(XDG_KEYWORDS));
}
diff --git a/src/lib/xdgentry.h b/src/lib/xdgentry.h
index 006d3ae..147072c 100644
--- a/src/lib/xdgentry.h
+++ b/src/lib/xdgentry.h
@@ -16,7 +16,7 @@
#define XDG_ACTION_START "Desktop Action Start/Exec"
#define XDG_ACTION_STOP "Desktop Action Stop/Exec"
-namespace xdg {
+namespace KaZoe {
class Entry: public QObject
{
Q_OBJECT
@@ -38,7 +38,7 @@ namespace xdg {
public:
explicit Entry(QString desktopfile, QObject *parent = nullptr);
explicit Entry(QObject *parent = nullptr);
- explicit Entry(const xdg::Entry& origin);
+ explicit Entry(const KaZoe::Entry& origin);
QString path() const;
QString appId() const;
@@ -62,6 +62,6 @@ namespace xdg {
};
}
-Q_DECLARE_METATYPE(const xdg::Entry*)
+Q_DECLARE_METATYPE(const KaZoe::Entry*)
#endif // XDGENTRY_H
diff --git a/src/lib/xdgnotificationactions.cpp b/src/lib/xdgnotificationactions.cpp
index afa7c19..8808a6f 100644
--- a/src/lib/xdgnotificationactions.cpp
+++ b/src/lib/xdgnotificationactions.cpp
@@ -1,18 +1,18 @@
#include "xdgnotificationactions.h"
#include <QDebug>
-xdg::NotificationActions::NotificationActions(QObject *parent)
+KaZoe::NotificationActions::NotificationActions(QObject *parent)
: QAbstractListModel(parent)
{
}
-QStringList xdg::NotificationActions::actionslist() const
+QStringList KaZoe::NotificationActions::actionslist() const
{
return m_actionslist;
}
-void xdg::NotificationActions::setActionslist(const QStringList &newActionslist)
+void KaZoe::NotificationActions::setActionslist(const QStringList &newActionslist)
{
if(newActionslist.count() % 2 != 0)
{
@@ -34,12 +34,12 @@ void xdg::NotificationActions::setActionslist(const QStringList &newActionslist)
emit actionslistChanged();
}
-int xdg::NotificationActions::rowCount(const QModelIndex &parent) const
+int KaZoe::NotificationActions::rowCount(const QModelIndex &parent) const
{
return m_actions.count();
}
-QVariant xdg::NotificationActions::data(const QModelIndex &index, int role) const
+QVariant KaZoe::NotificationActions::data(const QModelIndex &index, int role) const
{
if(index.row() > m_actions.count())
return QVariant();
@@ -54,7 +54,7 @@ QVariant xdg::NotificationActions::data(const QModelIndex &index, int role) cons
return QVariant();
}
-QHash<int, QByteArray> xdg::NotificationActions::roleNames() const
+QHash<int, QByteArray> KaZoe::NotificationActions::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
roles[KeyRole] = "key";
diff --git a/src/lib/xdgnotificationactions.h b/src/lib/xdgnotificationactions.h
index 1d1e449..54fd993 100644
--- a/src/lib/xdgnotificationactions.h
+++ b/src/lib/xdgnotificationactions.h
@@ -3,7 +3,7 @@
#include <QAbstractListModel>
-namespace xdg {
+namespace KaZoe {
class NotificationActions: public QAbstractListModel
{
diff --git a/src/lib/xdgnotificationmanager.cpp b/src/lib/xdgnotificationmanager.cpp
index 06e8594..bd70ed1 100644
--- a/src/lib/xdgnotificationmanager.cpp
+++ b/src/lib/xdgnotificationmanager.cpp
@@ -3,60 +3,60 @@
#include "xdgnotificationmessage.h"
#include "notificationsadaptor.h"
-uint xdg::serverNotify(QObject *obj, const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout)
+uint KaZoe::serverNotify(QObject *obj, const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout)
{
- xdg::NotificationManager *manager = qobject_cast<xdg::NotificationManager*>(obj);
+ KaZoe::NotificationManager *manager = qobject_cast<KaZoe::NotificationManager*>(obj);
if(replaces_id != 0 && manager->m_pending.contains(replaces_id))
{
- xdg::NotificationMessage *message = manager->m_pending[replaces_id];
+ KaZoe::NotificationMessage *message = manager->m_pending[replaces_id];
message->update(app_name, app_icon, summary, body, actions, hints, timeout);
}
else
{
- xdg::NotificationMessage *message = new xdg::NotificationMessage(app_name, app_icon, summary, body, actions, hints, timeout, manager);
+ KaZoe::NotificationMessage *message = new KaZoe::NotificationMessage(app_name, app_icon, summary, body, actions, hints, timeout, manager);
- QObject::connect(message, &xdg::NotificationMessage::appNameChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::AppNameRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::appNameChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::AppNameRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
roles);
});
- QObject::connect(message, &xdg::NotificationMessage::appIconChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::AppIconRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::appIconChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::AppIconRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
roles);
});
- QObject::connect(message, &xdg::NotificationMessage::summaryChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::SummaryRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::summaryChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::SummaryRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
roles);
});
- QObject::connect(message, &xdg::NotificationMessage::bodyChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::BodyRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::bodyChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::BodyRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
roles);
});
- QObject::connect(message, &xdg::NotificationMessage::actionsChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::ActionsRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::actionsChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::ActionsRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
roles);
});
- QObject::connect(message, &xdg::NotificationMessage::hintsChanged, [manager, replaces_id](){
- const QVector<int> roles = {xdg::NotificationManager::HintsRole};
+ QObject::connect(message, &KaZoe::NotificationMessage::hintsChanged, [manager, replaces_id](){
+ const QVector<int> roles = {KaZoe::NotificationManager::HintsRole};
emit manager->dataChanged(
manager->index(replaces_id),
manager->index(replaces_id),
@@ -64,8 +64,8 @@ uint xdg::serverNotify(QObject *obj, const QString &app_name, uint replaces_id,
});
- QObject::connect(message, &xdg::NotificationMessage::expired, [manager](QObject *obj){
- xdg::NotificationMessage *msg = qobject_cast<xdg::NotificationMessage*>(obj);
+ QObject::connect(message, &KaZoe::NotificationMessage::expired, [manager](QObject *obj){
+ KaZoe::NotificationMessage *msg = qobject_cast<KaZoe::NotificationMessage*>(obj);
if(msg)
{
manager->close(manager->m_pending.key(msg), 1);
@@ -82,7 +82,7 @@ uint xdg::serverNotify(QObject *obj, const QString &app_name, uint replaces_id,
}
-xdg::NotificationManager::NotificationManager(QObject *parent)
+KaZoe::NotificationManager::NotificationManager(QObject *parent)
: QAbstractListModel(parent)
{
m_server = new XdgNotificationServer(this);
@@ -94,12 +94,12 @@ xdg::NotificationManager::NotificationManager(QObject *parent)
XdgNotificationServer::RegisterServerToDbus(*m_server);
}
-int xdg::NotificationManager::rowCount(const QModelIndex &parent) const
+int KaZoe::NotificationManager::rowCount(const QModelIndex &parent) const
{
return m_ids.count();
}
-QVariant xdg::NotificationManager::data(const QModelIndex &index, int role) const
+QVariant KaZoe::NotificationManager::data(const QModelIndex &index, int role) const
{
if(index.row() > m_ids.count())
return QVariant();
@@ -128,7 +128,7 @@ QVariant xdg::NotificationManager::data(const QModelIndex &index, int role) cons
return QVariant();
}
-QHash<int, QByteArray> xdg::NotificationManager::roleNames() const
+QHash<int, QByteArray> KaZoe::NotificationManager::roleNames() const
{
QHash<int, QByteArray> roles = QAbstractItemModel::roleNames();
roles[AppNameRole] = "appName";
@@ -142,12 +142,12 @@ QHash<int, QByteArray> xdg::NotificationManager::roleNames() const
}
-int xdg::NotificationManager::nbNotifications()
+int KaZoe::NotificationManager::nbNotifications()
{
return rowCount();
}
-void xdg::NotificationManager::close(unsigned int id, unsigned int reason)
+void KaZoe::NotificationManager::close(unsigned int id, unsigned int reason)
{
unsigned int index = m_ids.indexOf(id);
beginRemoveRows(QModelIndex(), index, index);
@@ -161,13 +161,13 @@ void xdg::NotificationManager::close(unsigned int id, unsigned int reason)
m_server->sendNotificationClosed(id, reason);
}
-void xdg::NotificationManager::returnAction(unsigned int appid, const QString &key)
+void KaZoe::NotificationManager::returnAction(unsigned int appid, const QString &key)
{
m_server->sendActionInvoked(appid, key);
close(appid, 2);
}
-void xdg::NotificationManager::_closeNotification(unsigned int id)
+void KaZoe::NotificationManager::_closeNotification(unsigned int id)
{
close(id, 3);
}
diff --git a/src/lib/xdgnotificationmanager.h b/src/lib/xdgnotificationmanager.h
index 181bf0b..a22e2b2 100644
--- a/src/lib/xdgnotificationmanager.h
+++ b/src/lib/xdgnotificationmanager.h
@@ -6,7 +6,7 @@
class XdgNotificationServer;
-namespace xdg {
+namespace KaZoe {
uint serverNotify(QObject *manager, const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout);
class NotificationMessage;
diff --git a/src/lib/xdgnotificationmessage.cpp b/src/lib/xdgnotificationmessage.cpp
index 3dc0e2e..ba57504 100644
--- a/src/lib/xdgnotificationmessage.cpp
+++ b/src/lib/xdgnotificationmessage.cpp
@@ -2,48 +2,48 @@
#include <QTimer>
-QString xdg::NotificationMessage::appName() const
+QString KaZoe::NotificationMessage::appName() const
{
return m_appName;
}
-QString xdg::NotificationMessage::appIcon() const
+QString KaZoe::NotificationMessage::appIcon() const
{
return m_appIcon;
}
-QString xdg::NotificationMessage::summary() const
+QString KaZoe::NotificationMessage::summary() const
{
return m_summary;
}
-QString xdg::NotificationMessage::body() const
+QString KaZoe::NotificationMessage::body() const
{
return m_body;
}
-QStringList xdg::NotificationMessage::actions() const
+QStringList KaZoe::NotificationMessage::actions() const
{
return m_actions;
}
-QVariantMap xdg::NotificationMessage::hints() const
+QVariantMap KaZoe::NotificationMessage::hints() const
{
return m_hints;
}
-uint xdg::NotificationMessage::id() const
+uint KaZoe::NotificationMessage::id() const
{
return m_id;
}
-void xdg::NotificationMessage::_expired()
+void KaZoe::NotificationMessage::_expired()
{
emit expired(this);
}
-xdg::NotificationMessage::NotificationMessage(
+KaZoe::NotificationMessage::NotificationMessage(
const QString &app_name,
const QString &app_icon,
const QString &summary,
@@ -62,10 +62,10 @@ xdg::NotificationMessage::NotificationMessage(
, m_timeout(timeout)
{
if(m_timeout > 0)
- QTimer::singleShot(m_timeout, this, &xdg::NotificationMessage::_expired);
+ QTimer::singleShot(m_timeout, this, &KaZoe::NotificationMessage::_expired);
}
-void xdg::NotificationMessage::update(const QString &app_name, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout)
+void KaZoe::NotificationMessage::update(const QString &app_name, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantMap &hints, int timeout)
{
if(m_appName != app_name)
{
@@ -109,11 +109,11 @@ void xdg::NotificationMessage::update(const QString &app_name, const QString &ap
emit timeoutChanged(m_timeout);
}
if(m_timeout > 0)
- QTimer::singleShot(m_timeout, this, &xdg::NotificationMessage::_expired);
+ QTimer::singleShot(m_timeout, this, &KaZoe::NotificationMessage::_expired);
}
-void xdg::NotificationMessage::setId(uint id)
+void KaZoe::NotificationMessage::setId(uint id)
{
m_id = id;
}
diff --git a/src/lib/xdgnotificationmessage.h b/src/lib/xdgnotificationmessage.h
index 8e62cab..f42b8d6 100644
--- a/src/lib/xdgnotificationmessage.h
+++ b/src/lib/xdgnotificationmessage.h
@@ -4,7 +4,7 @@
#include <QObject>
#include <QVariantMap>
-namespace xdg {
+namespace KaZoe {
class NotificationMessage : public QObject
{
Q_OBJECT
diff --git a/src/lib/xdgstatusnotifierhost.cpp b/src/lib/xdgstatusnotifierhost.cpp
index 49a17b1..729bb8d 100644
--- a/src/lib/xdgstatusnotifierhost.cpp
+++ b/src/lib/xdgstatusnotifierhost.cpp
@@ -6,7 +6,7 @@
using namespace org::kde;
-namespace xdg {
+namespace KaZoe {
class StatusNotifierHostPrivate {
Q_DISABLE_COPY(StatusNotifierHostPrivate)
Q_DECLARE_PUBLIC(StatusNotifierHost)
@@ -75,7 +75,7 @@ namespace xdg {
};
};
-using namespace xdg;
+using namespace KaZoe;
StatusNotifierHost::StatusNotifierHost(QObject *parent)
: QAbstractListModel{parent}
diff --git a/src/lib/xdgstatusnotifierhost.h b/src/lib/xdgstatusnotifierhost.h
index 20c36ed..ff2b0d2 100644
--- a/src/lib/xdgstatusnotifierhost.h
+++ b/src/lib/xdgstatusnotifierhost.h
@@ -5,7 +5,7 @@
#include <QObject>
#include <QScopedPointer>
-namespace xdg {
+namespace KaZoe {
class StatusNotifierHostPrivate;
class StatusNotifierHost : public QAbstractListModel
diff --git a/src/lib/xdgstatusnotifieritem.cpp b/src/lib/xdgstatusnotifieritem.cpp
index 1a14846..81683dd 100644
--- a/src/lib/xdgstatusnotifieritem.cpp
+++ b/src/lib/xdgstatusnotifieritem.cpp
@@ -5,7 +5,7 @@
#include <QGuiApplication>
#include <debug.h>
-using namespace xdg;
+using namespace KaZoe;
StatusNotifierItem::StatusNotifierItem(QObject *parent)
: QObject{parent}
@@ -14,7 +14,7 @@ StatusNotifierItem::StatusNotifierItem(QObject *parent)
if (!bus.isConnected()) {
qCWarning(SYSTEM_TRAY) << "Cannot connect to the D-Bus session bus.\n" << "Please check your system settings and try again.\n";
}
- QString serviceName = "org.xdgutils.";
+ QString serviceName = "org.kazoe.xdg";
setId((QGuiApplication::desktopFileName().isEmpty())?(QCoreApplication::applicationName()):(QGuiApplication::desktopFileName()));
serviceName.append(Id());
serviceName.append("-");
diff --git a/src/lib/xdgstatusnotifieritem.h b/src/lib/xdgstatusnotifieritem.h
index 7f881a4..de1e87b 100644
--- a/src/lib/xdgstatusnotifieritem.h
+++ b/src/lib/xdgstatusnotifieritem.h
@@ -12,7 +12,7 @@
#define XDG_STATUS_ACTIVE "Active"
#define XDG_STATUS_NEEDSATTENTION "NeedsAttention"
-namespace xdg {
+namespace KaZoe {
class StatusNotifierItem : public QObject
{
diff --git a/src/lib/xdgstatusnotifierwatcher.cpp b/src/lib/xdgstatusnotifierwatcher.cpp
index c07a0f6..577d279 100644
--- a/src/lib/xdgstatusnotifierwatcher.cpp
+++ b/src/lib/xdgstatusnotifierwatcher.cpp
@@ -4,7 +4,7 @@
#include <QDBusConnection>
#include <debug.h>
-using namespace xdg;
+using namespace KaZoe;
StatusNotifierWatcher::StatusNotifierWatcher(QObject *parent)
: QObject{parent}
diff --git a/src/lib/xdgstatusnotifierwatcher.h b/src/lib/xdgstatusnotifierwatcher.h
index 8e2275c..1c3f513 100644
--- a/src/lib/xdgstatusnotifierwatcher.h
+++ b/src/lib/xdgstatusnotifierwatcher.h
@@ -6,7 +6,7 @@
class QDBusServiceWatcher;
#define XDG_STATUS_NOTIFIER_WATCHER_PROTOCOL_VERSION 1
-namespace xdg {
+namespace KaZoe {
class StatusNotifierWatcher: public QObject
{
diff --git a/src/test/test_xdg.cpp b/src/test/test_xdg.cpp
index 44c6dc2..27c02ed 100644
--- a/src/test/test_xdg.cpp
+++ b/src/test/test_xdg.cpp
@@ -9,7 +9,7 @@ int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
- xdg::Entries entries;
+ KaZoe::Entries entries;
entries.addDirectory("/usr/share/applications");
/*
QTimer t;