[neon/backports-jammy/packagekit-qt/Neon/unstable] /: New upstream version 0.9.6

Matthias Klumpp null at kde.org
Wed Mar 15 04:29:32 GMT 2023


Git commit db26b14b88489fcd6ccad2be0362b33ff565ce48 by Matthias Klumpp.
Committed on 20/09/2016 at 17:27.
Pushed by carlosdem into branch 'Neon/unstable'.

New upstream version 0.9.6

M  +25   -27   CMakeLists.txt
M  +18   -0    NEWS
R  +0    -0    README.md [from: README - 100% similarity]
M  +13   -60   src/CMakeLists.txt
M  +20   -0    src/bitfield.cpp
M  +23   -1    src/bitfield.h
M  +4    -0    src/common.h
M  +103  -47   src/daemon.cpp
M  +15   -77   src/daemon.h
M  +3    -3    src/daemonprivate.cpp
M  +3    -3    src/daemonprivate.h
M  +1    -1    src/details.cpp
M  +2    -2    src/details.h
M  +5    -5    src/modules/CMakeLists.txt
M  +3    -3    src/modules/packagekit-qt-config.cmake.in
M  +0    -0    src/packagekitqt4.pc.in
A  +12   -0    src/packagekitqt_global.h  *
M  +25   -41   src/transaction.cpp
M  +20   -25   src/transaction.h
M  +4    -6    src/transactionprivate.cpp
M  +7    -3    src/transactionprivate.h

The files marked with a * at the end have a non valid license. Please read: https://community.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page.


https://invent.kde.org/neon/backports-jammy/packagekit-qt/commit/db26b14b88489fcd6ccad2be0362b33ff565ce48

diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100755
new mode 100644
index b4c1303..86af861
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,44 +4,43 @@ project(packagekit-qt)
 cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR)
 find_package(PkgConfig REQUIRED)
 
-set(CMAKE_BUILD_TYPE "Debug")
-
 # Used to set installation paths
+set(CMAKE_AUTOMOC ON)
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(BUILD_SHARED_LIBS ON)
+set(CMAKE_INSTALL_RPATH_USE_LINK_PATH ON)
 include(GNUInstallDirs)
 
 set(QPACKAGEKIT_VERSION_MAJOR  "0")
 set(QPACKAGEKIT_VERSION_MINOR  "9")
-set(QPACKAGEKIT_VERSION_PATCH  "5")
+set(QPACKAGEKIT_VERSION_PATCH  "6")
 set(QPACKAGEKIT_VERSION_SUFFIX "${VERSION_SUFFIX}")
+set(QPACKAGEKIT_API_LEVEL "0")
 set(QPACKAGEKIT_VERSION "${QPACKAGEKIT_VERSION_MAJOR}.${QPACKAGEKIT_VERSION_MINOR}.${QPACKAGEKIT_VERSION_PATCH}")
 
+add_definitions(-DQT_NO_CAST_TO_ASCII
+                -DQT_NO_CAST_FROM_ASCII
+                -DQT_NO_URL_CAST_FROM_STRING
+                -DQT_NO_CAST_FROM_BYTEARRAY
+                -DQT_NO_SIGNALS_SLOTS_KEYWORDS
+                -DQT_USE_FAST_OPERATOR_PLUS
+                -DQT_USE_QSTRINGBUILDER
+               )
+
 # Forbid in-tree building
 if(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
       message(STATUS "Please do an out-of-tree build:")
       message(STATUS "rm -f CMakeCache.txt && mkdir build && cd build; cmake .. && make")
       message(FATAL_ERROR "In-tree-build detected!")
-endif(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
-
-#
-# Options
-#
-option(USE_QT5 "Build against Qt5 instead of Qt4." OFF)
-if(USE_QT5)
-  set(QPACKAGEKIT_API_LEVEL "0")
-  set(LIBNAME "packagekitqt5")
-  set(QT_VERSION "5")
-else()
-  set(QPACKAGEKIT_API_LEVEL "0")
-  set(LIBNAME "packagekitqt4")
-  set(QT_VERSION "4")
-endif(USE_QT5)
-
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+endif()
 
 if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set(CMAKE_INSTALL_PREFIX
     "/usr" CACHE PATH "QPK default install prefix" FORCE)
-endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+endif()
+
+set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
 
 #
 # Configure files
@@ -49,7 +48,7 @@ endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 set (GETTEXT_PACKAGE "packagekit")
 set (VERSION "${QPACKAGEKIT_VERSION}")
 set (LOCALSTATEDIR "/var")
-set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${LIBNAME}/")
+set (CMAKECONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/packagekitqt5/")
 
 add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")
 add_definitions("-std=gnu++11")
@@ -59,12 +58,11 @@ configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
 #
 # Custom C flags
 #
-set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self")
 option (DISABLE_MAINTAINER_CFLAGS "Disable maintainer CFlags" ON)
-if (DISABLE_MAINTAINER_CFLAGS)
-	set (MAINTAINER_CFLAGS "")
-endif (DISABLE_MAINTAINER_CFLAGS)
-add_definitions(${MAINTAINER_CFLAGS})
+if (NOT DISABLE_MAINTAINER_CFLAGS)
+    set (MAINTAINER_CFLAGS "-Werror -Wall -Wcast-align -Wno-uninitialized -Wempty-body -Wformat-security -Winit-self")
+    add_definitions(${MAINTAINER_CFLAGS})
+endif ()
 
 add_subdirectory(src)
 
diff --git a/NEWS b/NEWS
index 9f64004..ad18902 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,21 @@
+Version 0.9.6
+~~~~~~~~~~~~~
+Released: 2016-09-20
+
+Features:
+ * Use Qt 5 by default (Aleix Pol)
+ * Drop Qt4 support from PK-Qt (Aleix Pol)
+ * Make use of QLoggingCategory packagekitqt (Daniel Nicoletti)
+ * Change default visibility to hidden (Daniel Nicoletti)
+ * Require at least Qt 5.6 (Matthias Klumpp)
+
+Bugfixes:
+ * Fix compilation with strict QString() constructors on a host application (Aleix Pol)
+ * Move enumTo/FromString code from header to cpp file (Aleix Pol)
+ * No need to have random files marked as executable (Aleix Pol)
+ * Reduce changes between QString <-> QByteArray (Aleix Pol)
+ * Properly expose enums for introspection (Aleix Pol)
+
 Version 0.9.5
 ~~~~~~~~~~~~~
 Released: 2014-10-10
diff --git a/README b/README.md
similarity index 100%
rename from README
rename to README.md
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
old mode 100755
new mode 100644
index 0e18022..0b58c12
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,30 +1,6 @@
 # CMakeLists for PackageKit-Qt library
 
-if (USE_QT5)
-  find_package(Qt5Core REQUIRED)
-  set(Qt5_FOUND YES)
-else ()
-  find_package(Qt4 REQUIRED)
-  set(Qt4_FOUND YES)
-endif ()
-
-# Set up Qt
-if (Qt5_FOUND)
-  find_package(Qt5DBus REQUIRED)
-  include_directories(${Qt5Core_INCLUDE_DIRS}
-                      ${Qt5DBus_INCLUDE_DIRS}
-  )
-  add_definitions(${Qt5DBus_DEFINITIONS})
-elseif (Qt4_FOUND)
-  set(QT_USE_QTDBUS TRUE)
-  set(QT_DONT_USE_QTGUI TRUE)
-  include(${QT_USE_FILE})
-endif ()
-
-include_directories(${CMAKE_BINARY_DIR}
-		    ${CMAKE_CURRENT_BINARY_DIR}
-		    ${CMAKE_CURRENT_SOURCE_DIR}
-)
+find_package(Qt5 5.6 REQUIRED COMPONENTS Core DBus)
 
 set(packagekitqt_HEADERS
     Daemon
@@ -35,11 +11,7 @@ set(packagekitqt_HEADERS
     Details
     details.h
     bitfield.h
-)
-
-set(packagekitqt_HEADERS_PRIVATE
-                daemonprivate.h
-		transactionprivate.h
+    packagekitqt_global.h
 )
 
 set(packagekitqt_SRC
@@ -65,44 +37,25 @@ endif ()
 set_source_files_properties(${PK_INTERFACE_XML} PROPERTIES NO_NAMESPACE true)
 set_source_files_properties(${PK_TRANSACTION_INTERFACE_XML} PROPERTIES NO_NAMESPACE true)
 
-if (Qt5_FOUND)
-  qt5_add_dbus_interface(packagekitqt_SRC ${PK_INTERFACE_XML} daemonproxy)
-  qt5_add_dbus_interface(packagekitqt_SRC ${PK_TRANSACTION_INTERFACE_XML} transactionproxy)
-  qt5_generate_moc(daemon.h daemon.moc)
-  qt5_generate_moc(transaction.h transaction.moc)
-  add_custom_target(mocs DEPENDS daemon.moc transaction.moc)
-elseif (Qt4_FOUND)
-  qt4_add_dbus_interface(packagekitqt_SRC ${PK_INTERFACE_XML} daemonproxy)
-  qt4_add_dbus_interface(packagekitqt_SRC ${PK_TRANSACTION_INTERFACE_XML} transactionproxy)
-  qt4_automoc(${packagekitqt_SRC})
-  qt4_wrap_cpp(packagekitqt_MOC_SRC ${packagekitqt_HEADERS} ${packagekitqt_HEADERS_PRIVATE})
-endif ()
+qt5_add_dbus_interface(packagekitqt_SRC ${PK_INTERFACE_XML} daemonproxy)
+qt5_add_dbus_interface(packagekitqt_SRC ${PK_TRANSACTION_INTERFACE_XML} transactionproxy)
 
-add_library(${LIBNAME} SHARED ${packagekitqt_SRC} ${packagekitqt_HEADERS} ${packagekitqt_HEADERS_PRIVATE})
-set_target_properties(${LIBNAME} PROPERTIES VERSION ${QPACKAGEKIT_VERSION} SOVERSION ${QPACKAGEKIT_API_LEVEL})
+add_library(packagekitqt5 ${packagekitqt_SRC} ${packagekitqt_HEADERS} ${packagekitqt_HEADERS_PRIVATE})
+set_target_properties(packagekitqt5 PROPERTIES VERSION ${QPACKAGEKIT_VERSION} SOVERSION ${QPACKAGEKIT_API_LEVEL})
 
-if (Qt5_FOUND)
-  add_dependencies(${LIBNAME} mocs)
-  target_link_libraries(${LIBNAME}
-		LINK_PUBLIC Qt5::DBus
-  )
-elseif (Qt4_FOUND)
-  target_link_libraries(${LIBNAME}
-		${QT_LIBRARIES}
-  )
-endif ()
+target_link_libraries(packagekitqt5 PUBLIC Qt5::DBus)
 
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${LIBNAME}.pc.in
-  ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekitqt5.pc.in
+  ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5.pc
   @ONLY
 )
-target_include_directories(${LIBNAME} INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}/PackageKit/;${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}>")
-install(TARGETS ${LIBNAME} EXPORT PackageKitQtTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
+target_include_directories(packagekitqt5 INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/packagekitqt5/PackageKit/;${CMAKE_INSTALL_INCLUDEDIR}/packagekitqt5>")
+install(TARGETS packagekitqt5 EXPORT PackageKitQtTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5.pc
 	DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
 )
 install(FILES ${packagekitqt_HEADERS}
-        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${LIBNAME}/PackageKit/
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/packagekitqt5/PackageKit/
 )
 
 add_subdirectory(modules)
diff --git a/src/bitfield.cpp b/src/bitfield.cpp
index 68ef80c..a4d7fd3 100644
--- a/src/bitfield.cpp
+++ b/src/bitfield.cpp
@@ -1,3 +1,23 @@
+/*
+ * This file is part of the QPackageKit project
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
 #include "bitfield.h"
 
 using namespace PackageKit;
diff --git a/src/bitfield.h b/src/bitfield.h
index 8535e46..d2dc4bf 100644
--- a/src/bitfield.h
+++ b/src/bitfield.h
@@ -1,12 +1,34 @@
+/*
+ * This file is part of the QPackageKit project
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
 #ifndef PACKAGEKIT_BITFIELD_H
 #define PACKAGEKIT_BITFIELD_H
 
 #include <QtGlobal>
 #include <QMetaType>
 
+#include <packagekitqt_global.h>
+
 namespace PackageKit {
 
-class Bitfield
+class PACKAGEKITQT_LIBRARY Bitfield
 {
 public:
     Bitfield ();
diff --git a/src/common.h b/src/common.h
index 05a3df4..24b7894 100644
--- a/src/common.h
+++ b/src/common.h
@@ -17,6 +17,10 @@
  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301, USA.
  */
+#include <QtCore/QLoggingCategory>
+
+Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_TRANSACTION)
+Q_DECLARE_LOGGING_CATEGORY(PACKAGEKITQT_DAEMON)
 
 #define PK_NAME					"org.freedesktop.PackageKit"
 #define PK_PATH					"/org/freedesktop/PackageKit"
diff --git a/src/daemon.cpp b/src/daemon.cpp
old mode 100755
new mode 100644
index 647756a..7529a3e
--- a/src/daemon.cpp
+++ b/src/daemon.cpp
@@ -1,23 +1,23 @@
 /*
-* This file is part of the QPackageKit project
-* Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
-* Copyright (C) 2010-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
-*
-* This library is free software; you can redistribute it and/or
-* modify it under the terms of the GNU Library General Public
-* License as published by the Free Software Foundation; either
-* version 2 of the License, or (at your option) any later version.
-*
-* This library 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
-* Library General Public License for more details.
-*
-* You should have received a copy of the GNU Library General Public License
-* along with this library; see the file COPYING.LIB. If not, write to
-* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-* Boston, MA 02110-1301, USA.
-*/
+ * This file is part of the QPackageKit project
+ * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
 
 #include "daemon.h"
 #include "daemonprivate.h"
@@ -26,6 +26,8 @@
 
 #include "common.h"
 
+Q_LOGGING_CATEGORY(PACKAGEKITQT_DAEMON, "packagekitqt.daemon")
+
 using namespace PackageKit;
 
 Daemon* Daemon::m_global = 0;
@@ -57,37 +59,37 @@ Daemon::Daemon(QObject *parent) :
                                          SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
 }
 
-void DaemonPrivate::setupSignal(const QString &signal, bool connect)
+void DaemonPrivate::setupSignal(const QMetaMethod &signal, bool connect)
 {
     Q_Q(Daemon);
 
     const char *signalToConnect = 0;
     const char *memberToConnect = 0;
 
-    if (signal == SIGNAL(repoListChanged())) {
+    if (signal == QMetaMethod::fromSignal(&Daemon::repoListChanged)) {
         signalToConnect = SIGNAL(RepoListChanged());
         memberToConnect = SIGNAL(repoListChanged());
-    } else if (signal == SIGNAL(restartScheduled())) {
+    } else if (signal == QMetaMethod::fromSignal(&Daemon::restartScheduled)) {
         signalToConnect = SIGNAL(RestartSchedule());
         memberToConnect = SIGNAL(restartScheduled());
-    } else if (signal == SIGNAL(transactionListChanged(QStringList))) {
+    } else if (signal == QMetaMethod::fromSignal(&Daemon::transactionListChanged)) {
         signalToConnect = SIGNAL(TransactionListChanged(QStringList));
         memberToConnect = SIGNAL(transactionListChanged(QStringList));
-    } else if (signal == SIGNAL(updatesChanged())) {
+    } else if (signal == QMetaMethod::fromSignal(&Daemon::updatesChanged)) {
         signalToConnect = SIGNAL(UpdatesChanged());
         memberToConnect = SIGNAL(updatesChanged());
     }
 
     if (signalToConnect && memberToConnect) {
         if (connect) {
-            q->connect(daemon, signalToConnect, memberToConnect);
+            QObject::connect(daemon, signalToConnect, q, memberToConnect);
         } else {
-            daemon->disconnect(signalToConnect, q, memberToConnect);
+            QObject::disconnect(daemon, signalToConnect, q, memberToConnect);
         }
     }
 }
 
-void Daemon::connectNotify(const char *signal)
+void Daemon::connectNotify(const QMetaMethod &signal)
 {
     Q_D(Daemon);
     if (!d->connectedSignals.contains(signal) && d->daemon) {
@@ -96,16 +98,7 @@ void Daemon::connectNotify(const char *signal)
     d->connectedSignals << signal;
 }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-void Daemon::connectNotify(const QMetaMethod &signal)
-{
-    // ugly but recommended way to convert a methodSignature to a SIGNAL
-    connectNotify(QString("2%1")
-                  .arg(QLatin1String(signal.methodSignature())).toLatin1());
-}
-#endif
-
-void Daemon::disconnectNotify(const char *signal)
+void Daemon::disconnectNotify(const QMetaMethod &signal)
 {
     Q_D(Daemon);
     if (d->connectedSignals.contains(signal)) {
@@ -116,15 +109,6 @@ void Daemon::disconnectNotify(const char *signal)
     }
 }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-void Daemon::disconnectNotify(const QMetaMethod &signal)
-{
-    // ugly but recommended way to convert a methodSignature to a SIGNAL
-    disconnectNotify(QString("2%1")
-                     .arg(QLatin1String(signal.methodSignature())).toLatin1());
-}
-#endif
-
 Daemon::~Daemon()
 {
     delete d_ptr;
@@ -655,5 +639,77 @@ Transaction *Daemon::whatProvides(const QString &search, Transaction::Filters fi
     return whatProvides(QStringList() << search, filters);
 }
 
-#include "daemon.moc"
+QString Daemon::enumToString(const QMetaObject &metaObject, int value, const char *enumName)
+{
+    QString prefix = QLatin1String(enumName);
+    int id = metaObject.indexOfEnumerator(enumName);
+    QMetaEnum e = metaObject.enumerator(id);
+    if (!e.isValid ()) {
+//         qDebug() << "Invalid enum " << prefix;
+        return QString();
+    }
+    QString enumString = QString::fromLatin1(e.valueToKey(value));
+    if (enumString.isNull()) {
+//         qDebug() << "Enum key not found while searching for value" << QString::number(value) << "in enum" << prefix;
+        return QString();
+    }
+
+    // Remove the prefix
+    if(!prefix.isNull() && enumString.indexOf(prefix) == 0) {
+        enumString.remove(0, prefix.length());
+    }
+
+    QString pkName;
+    for(int i = 0 ; i < enumString.length() - 1 ; ++i) {
+        pkName += enumString[i];
+        if(enumString[i+1].isUpper())
+            pkName += QLatin1Char('-');
+    }
+    pkName += enumString[enumString.length() - 1];
+
+    return pkName.toLower();
+}
+
+int Daemon::enumFromString(const QMetaObject& metaObject, const QString &str, const char *enumName)
+{
+    QString prefix = QLatin1String(enumName);
+    QString realName;
+    bool lastWasDash = false;
+    QChar buf;
+
+    for(int i = 0 ; i < str.length() ; ++i) {
+        buf = str[i].toLower();
+        if(i == 0 || lastWasDash) {
+            buf = buf.toUpper();
+        }
+
+        lastWasDash = false;
+        if(buf == QLatin1Char('-')) {
+            lastWasDash = true;
+        } else if(buf == QLatin1Char('~')) {
+            lastWasDash = true;
+            realName += QLatin1String("Not");
+        } else {
+            realName += buf;
+        }
+    };
+
+    if (!prefix.isNull()) {
+        realName = prefix + realName;
+    }
+
+    int id = metaObject.indexOfEnumerator(enumName);
+    QMetaEnum e = metaObject.enumerator(id);
+    int enumValue = e.keyToValue(realName.toLatin1().data());
+
+    if (enumValue == -1) {
+        enumValue = e.keyToValue(prefix.append(QLatin1String("Unknown")).toLatin1().constData());
+//         if (!QByteArray(enumName).isEmpty()) {
+//             qDebug() << "enumFromString (" << enumName << ") : converted" << str << "to" << QString("Unknown").append(enumName) << ", enum id" << id;
+//         }
+    }
+    return enumValue;
+}
+
+#include "moc_daemon.cpp"
 
diff --git a/src/daemon.h b/src/daemon.h
index 05d74f4..212a15c 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2012 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -10,7 +10,7 @@
  *
  * This library 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
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Library General Public License for more details.
  *
  * You should have received a copy of the GNU Library General Public License
@@ -27,6 +27,8 @@
 #include <QtDBus/QDBusError>
 #include <QtDBus/QDBusPendingReply>
 
+#include <packagekitqt_global.h>
+
 #include "transaction.h"
 
 namespace PackageKit {
@@ -47,11 +49,9 @@ namespace PackageKit {
  * of this class.
  */
 class DaemonPrivate;
-class Daemon : public QObject
+class PACKAGEKITQT_LIBRARY Daemon : public QObject
 {
     Q_OBJECT
-    Q_ENUMS(Network)
-    Q_ENUMS(Authorize)
     Q_PROPERTY(bool isRunning READ isRunning NOTIFY isRunningChanged)
     Q_PROPERTY(Transaction::Roles roles READ roles NOTIFY changed)
     Q_PROPERTY(QString backendName READ backendName NOTIFY changed)
@@ -78,6 +78,7 @@ public:
         NetworkWifi,
         NetworkMobile
     };
+    Q_ENUM(Network)
 
     /**
      * Describes the authorization result
@@ -89,6 +90,7 @@ public:
         AuthorizeNo,
         AuthorizeInteractive
     };
+    Q_ENUM(Authorize)
 
     /**
      * \brief Returns an instance of the Daemon
@@ -282,80 +284,22 @@ public:
      */
     Q_INVOKABLE QT_DEPRECATED static QString packageIcon(const QString &packageID);
     
+    static QString enumToString(const QMetaObject &metaObject, int value, const char *enumName);
+
     /**
      * Returns the string representing the enum
      * Useful for PackageDetails::Group
      */
     template<class T> static QString enumToString(int value, const char *enumName)
     {
-        QString prefix = enumName;
-        int id = T::staticMetaObject.indexOfEnumerator(enumName);
-        QMetaEnum e = T::staticMetaObject.enumerator(id);
-        if (!e.isValid ()) {
-//             qDebug() << "Invalid enum " << prefix;
-            return QString();
-        }
-        QString enumString = e.valueToKey(value);
-        if (enumString.isNull()) {
-//             qDebug() << "Enum key not found while searching for value" << QString::number(value) << "in enum" << prefix;
-            return QString();
-        }
-
-        // Remove the prefix
-        if(!prefix.isNull() && enumString.indexOf(prefix) == 0) {
-            enumString.remove(0, prefix.length());
-        }
-
-        QString pkName;
-        for(int i = 0 ; i < enumString.length() - 1 ; ++i) {
-            pkName += enumString[i];
-            if(enumString[i+1].isUpper())
-                pkName += QChar('-');
-        }
-        pkName += enumString[enumString.length() - 1];
-
-        return pkName.toLower();
+        return enumToString(T::staticMetaObject, value, enumName);
     }
+
+    static int enumFromString(const QMetaObject &metaObject, const QString &str, const char *enumName);
     
     template<class T> static int enumFromString(const QString &str, const char *enumName)
     {
-        QString prefix = enumName;
-        QString realName;
-        bool lastWasDash = false;
-        QChar buf;
-
-        for(int i = 0 ; i < str.length() ; ++i) {
-            buf = str[i].toLower();
-            if(i == 0 || lastWasDash) {
-                buf = buf.toUpper();
-            }
-
-            lastWasDash = false;
-            if(buf == QLatin1Char('-')) {
-                lastWasDash = true;
-            } else if(buf == QLatin1Char('~')) {
-                lastWasDash = true;
-                realName += "Not";
-            } else {
-                realName += buf;
-            }
-        };
-
-        if (!prefix.isNull()) {
-            realName = prefix + realName;
-        }
-
-        int id = T::staticMetaObject.indexOfEnumerator(enumName);
-        QMetaEnum e = T::staticMetaObject.enumerator(id);
-        int enumValue = e.keyToValue(realName.toLatin1().data());
-
-        if (enumValue == -1) {
-            enumValue = e.keyToValue(prefix.append("Unknown").toLatin1().data());
-            if (!QString(enumName).isEmpty()) {
-//                 qDebug() << "enumFromString (" << enumName << ") : converted" << str << "to" << QString("Unknown").append(enumName) << ", enum id" << id;
-            }
-        }
-        return enumValue;
+        return enumFromString(T::staticMetaObject, str, enumName);
     }
 
     /**
@@ -880,20 +824,14 @@ protected:
      * \attention Make sure to call this method in inherited classes
      * otherwise no signals will be emitted
      */
-    virtual void connectNotify(const char *signal);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-    virtual void connectNotify(const QMetaMethod &signal);
-#endif
+    void connectNotify(const QMetaMethod &signal) override;
 
     /**
      * This method disconnects from DBus signals
      * \attention Make sure to call this method in inherited classes
      * otherwise no signals will be disconnected
      */
-    virtual void disconnectNotify(const char *signal);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-    virtual void disconnectNotify(const QMetaMethod &signal);
-#endif
+    void disconnectNotify(const QMetaMethod &signal) override;
 
     DaemonPrivate * const d_ptr;
 
diff --git a/src/daemonprivate.cpp b/src/daemonprivate.cpp
index 25ba55b..a5af33b 100644
--- a/src/daemonprivate.cpp
+++ b/src/daemonprivate.cpp
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -81,7 +81,7 @@ void DaemonPrivate::getAllProperties(bool sync)
                                                           QLatin1String(PK_PATH),
                                                           QLatin1String(DBUS_PROPERTIES),
                                                           QLatin1String("GetAll"));
-    message << PK_NAME;
+    message << QLatin1String(PK_NAME);
     if (sync) {
         QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(message);
         if (reply.isValid()) {
@@ -143,7 +143,7 @@ void DaemonPrivate::updateProperties(const QVariantMap &properties)
         } else if (property == QLatin1String("VersionMinor")) {
             versionMinor = value.toUInt();
         } else {
-            qWarning() << "Unknown Transaction property:" << property << value;
+            qCWarning(PACKAGEKITQT_DAEMON) << "Unknown Daemon property:" << property << value;
         }
 
         ++it;
diff --git a/src/daemonprivate.h b/src/daemonprivate.h
index b8c2b6c..5e63bd6 100644
--- a/src/daemonprivate.h
+++ b/src/daemonprivate.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -41,9 +41,9 @@ protected:
     Daemon *q_ptr;
     ::OrgFreedesktopPackageKitInterface *daemon;
     QStringList hints;
-    QStringList connectedSignals;
+    QList<QMetaMethod> connectedSignals;
 
-    void setupSignal(const QString &signal, bool connect);
+    void setupSignal(const QMetaMethod &signal, bool connect);
     void getAllProperties(bool sync);
 
     QString backendAuthor;
diff --git a/src/details.cpp b/src/details.cpp
index d7e21e7..18b6434 100644
--- a/src/details.cpp
+++ b/src/details.cpp
@@ -1,6 +1,6 @@
 /*
  * This file is part of the PackageKitQt project
- * Copyright (C) 2014 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (C) 2014-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
diff --git a/src/details.h b/src/details.h
index 62bd1b5..67c7a57 100644
--- a/src/details.h
+++ b/src/details.h
@@ -1,6 +1,6 @@
 /*
  * This file is part of the PackageKitQt project
- * Copyright (C) 2014 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (C) 2014-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -27,7 +27,7 @@
 
 namespace PackageKit {
 
-class Details : public QVariantMap
+class PACKAGEKITQT_LIBRARY Details : public QVariantMap
 {
 public:
     Details();
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
old mode 100755
new mode 100644
index f80f595..3e3c0d5
--- a/src/modules/CMakeLists.txt
+++ b/src/modules/CMakeLists.txt
@@ -1,15 +1,15 @@
 # CMakeLists for PackageKit-Qt lib extra modules
 
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt-config.cmake.in
-  ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5-config.cmake
   @ONLY
 )
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt-config-version.cmake.in
-  ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config-version.cmake
+  ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5-config-version.cmake
   @ONLY
 )
 
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config.cmake
-        ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config-version.cmake
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIBNAME}/
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5-config.cmake
+        ${CMAKE_CURRENT_BINARY_DIR}/packagekitqt5-config-version.cmake
+        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/packagekitqt5/
 )
diff --git a/src/modules/packagekit-qt-config.cmake.in b/src/modules/packagekit-qt-config.cmake.in
index 3dcf3f3..4684978 100644
--- a/src/modules/packagekit-qt-config.cmake.in
+++ b/src/modules/packagekit-qt-config.cmake.in
@@ -1,10 +1,10 @@
-# - Config information for PackageKit-Qt at QT_VERSION@
+# - Config information for PackageKit-Qt5
 # This file defines:
 #
-#  PackageKitQt at QT_VERSION@_LIBRARIES - Link these to use PackageKitQt at QT_VERSION@
+#  PackageKitQt5_LIBRARIES - Link these to use PackageKitQt5
 
 SET(prefix "@CMAKE_INSTALL_PREFIX@")
 SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
-SET(PackageKitQt at QT_VERSION@_LIBRARIES "PK::@LIBNAME@")
+SET(PackageKitQt5_LIBRARIES "PK::packagekitqt5")
 
 include("${CMAKE_CURRENT_LIST_DIR}/PackageKitQtTargets.cmake")
diff --git a/src/packagekitqt4.pc.in b/src/packagekitqt4.pc.in
old mode 100755
new mode 100644
diff --git a/src/packagekitqt_global.h b/src/packagekitqt_global.h
new file mode 100644
index 0000000..e6c82a4
--- /dev/null
+++ b/src/packagekitqt_global.h
@@ -0,0 +1,12 @@
+#ifndef PACKAGEKITQT_GLOBAL_H
+#define PACKAGEKITQT_GLOBAL_H
+
+#include <QtCore/QtGlobal>
+
+#if defined(PACKAGEKITQT_LIBRARY)
+#  define PACKAGEKITQT_LIBRARY Q_DECL_EXPORT
+#else
+#  define PACKAGEKITQT_LIBRARY Q_DECL_IMPORT
+#endif
+
+#endif // PACKAGEKITQT_GLOBAL_H
diff --git a/src/transaction.cpp b/src/transaction.cpp
old mode 100755
new mode 100644
index 7cfa302..a5fa4b8
--- a/src/transaction.cpp
+++ b/src/transaction.cpp
@@ -28,6 +28,8 @@
 
 #include <QDBusError>
 
+Q_LOGGING_CATEGORY(PACKAGEKITQT_TRANSACTION, "packagekitqt.transaction")
+
 using namespace PackageKit;
 
 Transaction::Transaction()
@@ -50,7 +52,7 @@ Transaction::Transaction(const QDBusObjectPath &tid)
     d->setup(tid);
 }
 
-void Transaction::connectNotify(const char *signal)
+void Transaction::connectNotify(const QMetaMethod &signal)
 {
     Q_D(Transaction);
     if (!d->connectedSignals.contains(signal) && d->p) {
@@ -59,16 +61,7 @@ void Transaction::connectNotify(const char *signal)
     d->connectedSignals << signal;
 }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-void Transaction::connectNotify(const QMetaMethod &signal)
-{
-    // ugly but recommended way to convert a methodSignature to a SIGNAL
-    connectNotify(QString("2%1")
-                  .arg(QLatin1String(signal.methodSignature())).toLatin1());
-}
-#endif
-
-void Transaction::disconnectNotify(const char *signal)
+void Transaction::disconnectNotify(const QMetaMethod &signal)
 {
     Q_D(Transaction);
     if (d->connectedSignals.contains(signal)) {
@@ -79,82 +72,73 @@ void Transaction::disconnectNotify(const char *signal)
     }
 }
 
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-void Transaction::disconnectNotify(const QMetaMethod &signal)
-{
-    // ugly but recommended way to convert a methodSignature to a SIGNAL
-    disconnectNotify(QString("2%1")
-                     .arg(QLatin1String(signal.methodSignature())).toLatin1());
-}
-#endif
-
 Transaction::Transaction(TransactionPrivate *d)
     : d_ptr(d)
 {
 }
 
-void TransactionPrivate::setupSignal(const QString &signal, bool connect)
+void TransactionPrivate::setupSignal(const QMetaMethod &signal, bool connect)
 {
     Q_Q(Transaction);
 
     const char *signalToConnect = 0;
     const char *memberToConnect = 0;
 
-    if (signal == SIGNAL(category(QString,QString,QString,QString,QString))) {
+    if (signal == QMetaMethod::fromSignal(&Transaction::category)) {
         signalToConnect = SIGNAL(Category(QString,QString,QString,QString,QString));
         memberToConnect = SIGNAL(category(QString,QString,QString,QString,QString));
-    } else if (signal == SIGNAL(details(PackageKit::Details))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::details)) {
         signalToConnect = SIGNAL(Details(QVariantMap));
         memberToConnect = SLOT(details(QVariantMap));
-    } else if (signal == SIGNAL(distroUpgrade(PackageKit::Transaction::DistroUpgrade,QString,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::distroUpgrade)) {
         signalToConnect = SIGNAL(DistroUpgrade(uint,QString,QString));
         memberToConnect = SLOT(distroUpgrade(uint,QString,QString));
-    } else if (signal == SIGNAL(errorCode(PackageKit::Transaction::Error,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::errorCode)) {
         signalToConnect = SIGNAL(ErrorCode(uint,QString));
         memberToConnect = SLOT(errorCode(uint,QString));
-    } else if (signal == SIGNAL(files(QString,QStringList))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::files)) {
         signalToConnect = SIGNAL(Files(QString,QStringList));
         memberToConnect = SIGNAL(files(QString,QStringList));
-    } else if (signal == SIGNAL(finished(PackageKit::Transaction::Exit,uint))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::finished)) {
         signalToConnect = SIGNAL(Finished(uint,uint));
         memberToConnect = SLOT(finished(uint,uint));
-    } else if (signal == SIGNAL(message(PackageKit::Transaction::Message,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::message)) {
         signalToConnect = SIGNAL(Message(uint,QString));
         memberToConnect = SLOT(message(uint,QString));
-    } else if (signal == SIGNAL(package(PackageKit::Transaction::Info,QString,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::package)) {
         signalToConnect = SIGNAL(Package(uint,QString,QString));
         memberToConnect = SLOT(Package(uint,QString,QString));
-    } else if (signal == SIGNAL(repoDetail(QString,QString,bool))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::repoDetail)) {
         signalToConnect = SIGNAL(RepoDetail(QString,QString,bool));
         memberToConnect = SIGNAL(repoDetail(QString,QString,bool));
-    } else if (signal == SIGNAL(repoSignatureRequired(QString,QString,QString,QString,QString,QString,QString,PackageKit::Transaction::SigType))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::repoSignatureRequired)) {
         signalToConnect = SIGNAL(RepoSignatureRequired(QString,QString,QString,QString,QString,QString,QString,uint));
         memberToConnect = SLOT(RepoSignatureRequired(QString,QString,QString,QString,QString,QString,QString,uint));
-    } else if (signal == SIGNAL(eulaRequired(QString,QString,QString,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::eulaRequired)) {
         signalToConnect = SIGNAL(EulaRequired(QString,QString,QString,QString));
         memberToConnect = SIGNAL(eulaRequired(QString,QString,QString,QString));
-    } else if (signal == SIGNAL(mediaChangeRequired(PackageKit::Transaction::MediaType,QString,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::mediaChangeRequired)) {
         signalToConnect = SIGNAL(MediaChangeRequired(uint,QString,QString));
         memberToConnect = SLOT(mediaChangeRequired(uint,QString,QString));
-    } else if (signal == SIGNAL(itemProgress(QString,PackageKit::Transaction::Status,uint))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::itemProgress)) {
         signalToConnect = SIGNAL(ItemProgress(QString,uint,uint));
         memberToConnect = SLOT(ItemProgress(QString,uint,uint));
-    } else if (signal == SIGNAL(requireRestart(PackageKit::Transaction::Restart,QString))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::requireRestart)) {
         signalToConnect = SIGNAL(RequireRestart(uint,QString));
         memberToConnect = SLOT(requireRestart(uint,QString));
-    } else if (signal == SIGNAL(transaction(PackageKit::Transaction*))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::transaction)) {
         signalToConnect = SIGNAL(Transaction(QDBusObjectPath,QString,bool,uint,uint,QString,uint,QString));
         memberToConnect = SLOT(transaction(QDBusObjectPath,QString,bool,uint,uint,QString,uint,QString));
-    } else if (signal == SIGNAL(updateDetail(QString,QStringList,QStringList,QStringList,QStringList,QStringList,PackageKit::Transaction::Restart,QString,QString,PackageKit::Transaction::UpdateState,QDateTime,QDateTime))) {
+    } else if (signal == QMetaMethod::fromSignal(&Transaction::updateDetail)) {
         signalToConnect = SIGNAL(UpdateDetail(QString,QStringList,QStringList,QStringList,QStringList,QStringList,uint,QString,QString,uint,QString,QString));
         memberToConnect = SLOT(UpdateDetail(QString,QStringList,QStringList,QStringList,QStringList,QStringList,uint,QString,QString,uint,QString,QString));
     }
 
     if (signalToConnect && memberToConnect) {
         if (connect) {
-            q->connect(p, signalToConnect, memberToConnect);
+            QObject::connect(p, signalToConnect, q, memberToConnect);
         } else {
-            p->disconnect(signalToConnect, q, memberToConnect);
+            QObject::disconnect(p, signalToConnect, q, memberToConnect);
         }
     }
 }
@@ -353,9 +337,9 @@ Transaction::InternalError Transaction::parseError(const QString &errorName)
         return Transaction::InternalErrorFunctionNotSupported;
     }
 
-    qWarning() << "Transaction::parseError: unknown error" << errorName;
+    qCWarning(PACKAGEKITQT_TRANSACTION) << "Transaction::parseError: unknown error" << errorName;
     return Transaction::InternalErrorFailed;
 }
 
-#include "transaction.moc"
+#include "moc_transaction.cpp"
 
diff --git a/src/transaction.h b/src/transaction.h
index 51ac1d0..28348aa 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2012 Daniel Nicoletti <dantti12 at gmail.com>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -27,6 +27,8 @@
 #include <QtDBus/QDBusObjectPath>
 #include <QtDBus/QDBusPendingReply>
 
+#include <packagekitqt_global.h>
+
 #include "bitfield.h"
 
 namespace PackageKit {
@@ -48,24 +50,9 @@ class Details;
 * \sa Daemon
 */
 class TransactionPrivate;
-class Transaction : public QObject
+class PACKAGEKITQT_LIBRARY Transaction : public QObject
 {
     Q_OBJECT
-    Q_ENUMS(Role)
-    Q_ENUMS(Error)
-    Q_ENUMS(Exit)
-    Q_ENUMS(Message)
-    Q_ENUMS(Status)
-    Q_ENUMS(MediaType)
-    Q_ENUMS(Provides)
-    Q_ENUMS(DistroUpgrade)
-    Q_ENUMS(TransactionFlag)
-    Q_ENUMS(Restart)
-    Q_ENUMS(UpdateState)
-    Q_ENUMS(Group)
-    Q_ENUMS(Info)
-    Q_ENUMS(SigType)
-    Q_ENUMS(Filter)
     Q_FLAGS(TransactionFlag TransactionFlags)
     Q_FLAGS(Filter Filters)
     Q_PROPERTY(QDBusObjectPath tid READ tid)
@@ -145,6 +132,7 @@ public:
         RoleGetFilesLocal,      // Since 0.9.1
         RoleRepoRemove          // Since 0.9.1
     };
+    Q_ENUM(Role)
     typedef Bitfield Roles;
 
     /**
@@ -220,6 +208,7 @@ public:
         ErrorUnfinishedTransaction,
         ErrorLockRequired
     };
+    Q_ENUM(Error)
 
     /**
      * Describes how the transaction finished
@@ -238,6 +227,7 @@ public:
         ExitCancelledPriority,
         ExitRepairRequired
     };
+    Q_ENUM(Exit)
 
     /**
      * Describes the different package filters
@@ -272,6 +262,7 @@ public:
         /* this always has to be at the end of the list */
         FilterLast           = 0x4000000
     };
+    Q_ENUM(Filter)
     Q_DECLARE_FLAGS(Filters, Filter)
 
     /**
@@ -296,6 +287,7 @@ public:
         MessageRepoForDevelopersOnly,
         MessageOtherUpdatesHeldBack
     };
+    Q_ENUM(Message)
 
     /**
      * Describes the current state of the transaction
@@ -338,6 +330,7 @@ public:
         StatusCheckLibraries,
         StatusCopyFiles
     };
+    Q_ENUM(Status)
 
     /**
      * Describes what kind of media is required
@@ -348,6 +341,7 @@ public:
         MediaTypeDvd,
         MediaTypeDisc
     };
+    Q_ENUM(MediaType)
 
     /**
      * Describes an distro upgrade state
@@ -357,6 +351,7 @@ public:
         DistroUpgradeStable,
         DistroUpgradeUnstable
     };
+    Q_ENUM(DistroUpgrade)
 
     /**
      * Describes the type of distribution upgrade to perform
@@ -369,6 +364,7 @@ public:
         TransactionFlagOnlyDownload = 1 << 3  // Since: 0.8.1
     };
     Q_DECLARE_FLAGS(TransactionFlags, TransactionFlag)
+    Q_ENUM(TransactionFlag)
 
     /**
      * Describes a restart type
@@ -382,6 +378,7 @@ public:
         RestartSecuritySession, /* a library that is being used by this package has been updated for security */
         RestartSecuritySystem
     };
+    Q_ENUM(Restart)
 
     /**
      * Describes an update's state
@@ -392,6 +389,7 @@ public:
         UpdateStateUnstable,
         UpdateStateTesting
     };
+    Q_ENUM(UpdateState)
 
     /**
      * Describes the different package groups
@@ -434,6 +432,7 @@ public:
         GroupNewest
     };
     typedef Bitfield Groups;
+    Q_ENUM(Group)
 
     /**
      * Describes the state of a package
@@ -465,6 +464,7 @@ public:
         InfoUntrusted,
         InfoTrusted
     };
+    Q_ENUM(Info)
 
     /**
      * Describes a signature type
@@ -473,6 +473,7 @@ public:
         SigTypeUnknown,
         SigTypeGpg
     };
+    Q_ENUM(SigType)
 
     /**
      * Create a transaction object with transaction id \p tid
@@ -842,20 +843,14 @@ protected:
      * \attention Make sure to call this method in inherited classes
      * otherwise no signals will be emitted
      */
-    virtual void connectNotify(const char *signal);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-    virtual void connectNotify(const QMetaMethod &signal);
-#endif
+    void connectNotify(const QMetaMethod &signal) override;
 
     /**
      * This method disconnects from DBus signals
      * \attention Make sure to call this method in inherited classes
      * otherwise no signals will be disconnected
      */
-    virtual void disconnectNotify(const char *signal);
-#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
-    virtual void disconnectNotify(const QMetaMethod &signal);
-#endif
+    void disconnectNotify(const QMetaMethod &signal) override;
 
     TransactionPrivate * const d_ptr;
 
diff --git a/src/transactionprivate.cpp b/src/transactionprivate.cpp
index 2c73899..d1e4cb7 100644
--- a/src/transactionprivate.cpp
+++ b/src/transactionprivate.cpp
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -61,7 +61,7 @@ void TransactionPrivate::setup(const QDBusObjectPath &transactionId)
                                                           tid.path(),
                                                           QLatin1String(DBUS_PROPERTIES),
                                                           QLatin1String("GetAll"));
-    message << PK_TRANSACTION_INTERFACE;
+    message << QLatin1String(PK_TRANSACTION_INTERFACE);
     QDBusConnection::systemBus().callWithCallback(message,
                                                   q,
                                                   SLOT(updateProperties(QVariantMap)));
@@ -74,9 +74,7 @@ void TransactionPrivate::setup(const QDBusObjectPath &transactionId)
                                          q,
                                          SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
 
-    QStringList currentSignals = connectedSignals;
-    currentSignals.removeDuplicates();
-    foreach (const QString &signal, currentSignals) {
+    foreach (const QMetaMethod &signal, connectedSignals) {
         setupSignal(signal, true);
     }
 
@@ -335,7 +333,7 @@ void TransactionPrivate::updateProperties(const QVariantMap &properties)
             uid = value.toUInt();
             QMetaObject::invokeMethod(q, "uidChanged", Qt::QueuedConnection);
         } else {
-            qWarning() << "Unknown Transaction property:" << property << value;
+            qCWarning(PACKAGEKITQT_TRANSACTION) << "Unknown Transaction property:" << property << value;
         }
 
         ++it;
diff --git a/src/transactionprivate.h b/src/transactionprivate.h
index 72860d8..c0a2b60 100644
--- a/src/transactionprivate.h
+++ b/src/transactionprivate.h
@@ -1,7 +1,7 @@
 /*
  * This file is part of the QPackageKit project
  * Copyright (C) 2008 Adrien Bustany <madcat at mymadcat.com>
- * Copyright (C) 2010-2011 Daniel Nicoletti <dantti85-pk at yahoo.com.br>
+ * Copyright (C) 2010-2016 Daniel Nicoletti <dantti12 at gmail.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -47,7 +47,7 @@ protected:
     QDBusObjectPath tid;
     ::OrgFreedesktopPackageKitTransactionInterface* p = 0;
     Transaction *q_ptr;
-    QStringList connectedSignals;
+    QList<QMetaMethod> connectedSignals;
 
     bool sentFinished = false;
     bool allowCancel = false;
@@ -88,7 +88,11 @@ protected:
     QString data;
     QString cmdline;
 
-    void setupSignal(const QString &signal, bool connect);
+    void setupSignal(const QMetaMethod &signal, bool connect);
+
+private:
+    template <typename Func1, typename Func2>
+    void processConnect(bool connect, Func1 signal, Func2 slot);
 
 protected Q_SLOTS:
     void createTransactionFinished(QDBusPendingCallWatcher *call);



More information about the Neon-commits mailing list