Hello community, here is the log from the commit of package PackageKit-Qt for openSUSE:Factory checked in at 2017-02-15 10:02:51 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/PackageKit-Qt (Old) and /work/SRC/openSUSE:Factory/.PackageKit-Qt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "PackageKit-Qt" Changes: -------- --- /work/SRC/openSUSE:Factory/PackageKit-Qt/PackageKit-Qt.changes 2014-11-28 08:46:03.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.PackageKit-Qt.new/PackageKit-Qt.changes 2017-02-15 10:02:52.526031639 +0100 @@ -1,0 +2,22 @@ +Sat Sep 24 20:44:51 UTC 2016 - [email protected] + +- Update to version 0.9.6: + + Features: + - Use Qt 5 by default. + - Drop Qt4 support from PK-Qt. + - Make use of QLoggingCategory packagekitqt. + - Change default visibility to hidden. + - Require at least Qt 5.6. + + Bugfixes: + - Fix compilation with strict QString() constructors on a host + application. + - Move enumTo/FromString code from header to cpp file. + - No need to have random files marked as executable. + - Reduce changes between QString <-> QByteArray. + - Properly expose enums for introspection. +- Remove multi-spec handling: only PackageKit-Qt is now built. The + former PackageKit-Qt5 assumes the identify of PK-Qt now. + + Obsolete/Provide PackageKit-Qt5-devel by Pk-Qt-devel. There is + no extra handling needed for the library subpackage. + +------------------------------------------------------------------- Old: ---- PackageKit-Qt-0.9.5.tar.xz PackageKit-Qt5.changes PackageKit-Qt5.spec pre_checkin.sh New: ---- PackageKit-Qt-0.9.6.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ PackageKit-Qt.spec ++++++ --- /var/tmp/diff_new_pack.lGCznl/_old 2017-02-15 10:02:52.973968545 +0100 +++ /var/tmp/diff_new_pack.lGCznl/_new 2017-02-15 10:02:52.973968545 +0100 @@ -1,7 +1,7 @@ # # spec file for package PackageKit-Qt # -# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -16,36 +16,21 @@ # -%define QtVersion 4 -%if %{QtVersion} == 4 -BuildRequires: libqt4-devel -%define libpk libpackagekitqt4-0 -%endif -%if %{QtVersion} == 5 %define libpk libpackagekitqt5-0 -%endif Name: PackageKit-Qt -%define _name PackageKit-Qt -Version: 0.9.5 +Version: 0.9.6 Release: 0 Summary: Simple software installation management software License: LGPL-2.1+ Group: System/Daemons Url: http://packagekit.org/ -Source: http://www.freedesktop.org/software/PackageKit/releases/%{_name}-%{version}.tar.xz -Source99: pre_checkin.sh +Source: http://www.freedesktop.org/software/PackageKit/releases/%{name}-%{version}.tar.xz BuildRequires: PackageKit-devel >= %{version} BuildRequires: cmake -BuildRequires: kde4-filesystem -%if %{QtVersion} == 4 -BuildRequires: libqt4-devel -%endif -%if %{QtVersion} == 5 BuildRequires: pkgconfig(Qt5Core) BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(Qt5Sql) -%endif %description PackageKit is a system designed to make installing and updating @@ -69,10 +54,10 @@ Summary: Simple software installation management software Group: Development/Libraries/C and C++ Requires: %{libpk} = %{version} -%if %{QtVersion} == 4 -Provides: libpackagekit-qt2-devel = %{version} -Obsoletes: libpackagekit-qt2-devel < %{version} -%endif +# PackageKit-Qt used to be Qt4 based until 0.9.6; then it turned into a Qt5 package (no more Qt4 support) +# For this reason, we now have to obsolete the former 2nd spec file names +Provides: PackageKit-Qt5-devel = %{version} +Obsoletes: PackageKit-Qt5-devel < %{version} %description devel PackageKit is a system designed to make installing and updating @@ -82,16 +67,13 @@ suck less. %prep -%setup -q -n %{_name}-%{version} +%setup -q -n %{name}-%{version} %build mkdir build cd build cmake \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -%if %{QtVersion} == 5 - -DUSE_QT5=ON \ -%endif .. make %{?smp_mflags} @@ -111,9 +93,9 @@ %files devel %defattr(-,root,root) %doc TODO MAINTAINERS -%{_libdir}/libpackagekitqt?.so -%{_libdir}/cmake/packagekitqt?/ -%{_libdir}/pkgconfig/packagekitqt?.pc -%{_includedir}/packagekitqt?/ +%{_libdir}/libpackagekitqt5.so +%{_libdir}/cmake/packagekitqt5/ +%{_libdir}/pkgconfig/packagekitqt5.pc +%{_includedir}/packagekitqt5/ %changelog ++++++ PackageKit-Qt-0.9.5.tar.xz -> PackageKit-Qt-0.9.6.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/CMakeLists.txt new/PackageKit-Qt-0.9.6/CMakeLists.txt --- old/PackageKit-Qt-0.9.5/CMakeLists.txt 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/CMakeLists.txt 2016-09-20 19:22:37.000000000 +0200 @@ -4,44 +4,43 @@ 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 @@ 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 @@ # # 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/NEWS new/PackageKit-Qt-0.9.6/NEWS --- old/PackageKit-Qt-0.9.5/NEWS 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/NEWS 2016-09-20 19:22:37.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/README new/PackageKit-Qt-0.9.6/README --- old/PackageKit-Qt-0.9.5/README 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/README 1970-01-01 01:00:00.000000000 +0100 @@ -1,8 +0,0 @@ -# PackageKit-Qt -Qt bindings for PackageKit - -## PackageKit -PackageKit is a DBUS abstraction layer that allows the session user to manage -packages in a secure way using a cross-distro, cross-architecture API. - -For more information, please see http://www.packagekit.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/README.md new/PackageKit-Qt-0.9.6/README.md --- old/PackageKit-Qt-0.9.5/README.md 1970-01-01 01:00:00.000000000 +0100 +++ new/PackageKit-Qt-0.9.6/README.md 2016-09-20 19:22:37.000000000 +0200 @@ -0,0 +1,8 @@ +# PackageKit-Qt +Qt bindings for PackageKit + +## PackageKit +PackageKit is a DBUS abstraction layer that allows the session user to manage +packages in a secure way using a cross-distro, cross-architecture API. + +For more information, please see http://www.packagekit.org diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/CMakeLists.txt new/PackageKit-Qt-0.9.6/src/CMakeLists.txt --- old/PackageKit-Qt-0.9.5/src/CMakeLists.txt 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/CMakeLists.txt 2016-09-20 19:22:37.000000000 +0200 @@ -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 @@ Details details.h bitfield.h -) - -set(packagekitqt_HEADERS_PRIVATE - daemonprivate.h - transactionprivate.h + packagekitqt_global.h ) set(packagekitqt_SRC @@ -65,44 +37,25 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/bitfield.cpp new/PackageKit-Qt-0.9.6/src/bitfield.cpp --- old/PackageKit-Qt-0.9.5/src/bitfield.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/bitfield.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -1,3 +1,23 @@ +/* + * This file is part of the QPackageKit project + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> + * + * 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/bitfield.h new/PackageKit-Qt-0.9.6/src/bitfield.h --- old/PackageKit-Qt-0.9.5/src/bitfield.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/bitfield.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,12 +1,34 @@ +/* + * This file is part of the QPackageKit project + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> + * + * 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/common.h new/PackageKit-Qt-0.9.6/src/common.h --- old/PackageKit-Qt-0.9.5/src/common.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/common.h 2016-09-20 19:22:37.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/daemon.cpp new/PackageKit-Qt-0.9.6/src/daemon.cpp --- old/PackageKit-Qt-0.9.5/src/daemon.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/daemon.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -1,23 +1,23 @@ /* -* This file is part of the QPackageKit project -* Copyright (C) 2008 Adrien Bustany <[email protected]> -* Copyright (C) 2010-2011 Daniel Nicoletti <[email protected]> -* -* 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 <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> + * + * 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 @@ 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 @@ 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 @@ } } -#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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/daemon.h new/PackageKit-Qt-0.9.6/src/daemon.h --- old/PackageKit-Qt-0.9.5/src/daemon.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/daemon.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2012 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ * 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 @@ NetworkWifi, NetworkMobile }; + Q_ENUM(Network) /** * Describes the authorization result @@ -89,6 +90,7 @@ AuthorizeNo, AuthorizeInteractive }; + Q_ENUM(Authorize) /** * \brief Returns an instance of the Daemon @@ -282,80 +284,22 @@ */ 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 @@ * \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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/daemonprivate.cpp new/PackageKit-Qt-0.9.6/src/daemonprivate.cpp --- old/PackageKit-Qt-0.9.5/src/daemonprivate.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/daemonprivate.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2011 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ 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 @@ } 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/daemonprivate.h new/PackageKit-Qt-0.9.6/src/daemonprivate.h --- old/PackageKit-Qt-0.9.5/src/daemonprivate.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/daemonprivate.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2011 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/details.cpp new/PackageKit-Qt-0.9.6/src/details.cpp --- old/PackageKit-Qt-0.9.5/src/details.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/details.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -1,6 +1,6 @@ /* * This file is part of the PackageKitQt project - * Copyright (C) 2014 Daniel Nicoletti <[email protected]> + * Copyright (C) 2014-2016 Daniel Nicoletti <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/details.h new/PackageKit-Qt-0.9.6/src/details.h --- old/PackageKit-Qt-0.9.5/src/details.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/details.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,6 +1,6 @@ /* * This file is part of the PackageKitQt project - * Copyright (C) 2014 Daniel Nicoletti <[email protected]> + * Copyright (C) 2014-2016 Daniel Nicoletti <[email protected]> * * 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/modules/CMakeLists.txt new/PackageKit-Qt-0.9.6/src/modules/CMakeLists.txt --- old/PackageKit-Qt-0.9.5/src/modules/CMakeLists.txt 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/modules/CMakeLists.txt 2016-09-20 19:22:37.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/modules/packagekit-qt-config.cmake.in new/PackageKit-Qt-0.9.6/src/modules/packagekit-qt-config.cmake.in --- old/PackageKit-Qt-0.9.5/src/modules/packagekit-qt-config.cmake.in 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/modules/packagekit-qt-config.cmake.in 2016-09-20 19:22:37.000000000 +0200 @@ -1,10 +1,10 @@ -# - Config information for PackageKit-Qt@QT_VERSION@ +# - Config information for PackageKit-Qt5 # This file defines: # -# PackageKitQt@QT_VERSION@_LIBRARIES - Link these to use PackageKitQt@QT_VERSION@ +# PackageKitQt5_LIBRARIES - Link these to use PackageKitQt5 SET(prefix "@CMAKE_INSTALL_PREFIX@") SET(exec_prefix "@CMAKE_INSTALL_PREFIX@") -SET(PackageKitQt@QT_VERSION@_LIBRARIES "PK::@LIBNAME@") +SET(PackageKitQt5_LIBRARIES "PK::packagekitqt5") include("${CMAKE_CURRENT_LIST_DIR}/PackageKitQtTargets.cmake") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/packagekitqt_global.h new/PackageKit-Qt-0.9.6/src/packagekitqt_global.h --- old/PackageKit-Qt-0.9.5/src/packagekitqt_global.h 1970-01-01 01:00:00.000000000 +0100 +++ new/PackageKit-Qt-0.9.6/src/packagekitqt_global.h 2016-09-20 19:22:37.000000000 +0200 @@ -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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/transaction.cpp new/PackageKit-Qt-0.9.6/src/transaction.cpp --- old/PackageKit-Qt-0.9.5/src/transaction.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/transaction.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -28,6 +28,8 @@ #include <QDBusError> +Q_LOGGING_CATEGORY(PACKAGEKITQT_TRANSACTION, "packagekitqt.transaction") + using namespace PackageKit; Transaction::Transaction() @@ -50,7 +52,7 @@ 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 @@ 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 @@ } } -#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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/transaction.h new/PackageKit-Qt-0.9.6/src/transaction.h --- old/PackageKit-Qt-0.9.5/src/transaction.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/transaction.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2012 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ * \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 @@ RoleGetFilesLocal, // Since 0.9.1 RoleRepoRemove // Since 0.9.1 }; + Q_ENUM(Role) typedef Bitfield Roles; /** @@ -220,6 +208,7 @@ ErrorUnfinishedTransaction, ErrorLockRequired }; + Q_ENUM(Error) /** * Describes how the transaction finished @@ -238,6 +227,7 @@ ExitCancelledPriority, ExitRepairRequired }; + Q_ENUM(Exit) /** * Describes the different package filters @@ -272,6 +262,7 @@ /* 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 @@ MessageRepoForDevelopersOnly, MessageOtherUpdatesHeldBack }; + Q_ENUM(Message) /** * Describes the current state of the transaction @@ -338,6 +330,7 @@ StatusCheckLibraries, StatusCopyFiles }; + Q_ENUM(Status) /** * Describes what kind of media is required @@ -348,6 +341,7 @@ MediaTypeDvd, MediaTypeDisc }; + Q_ENUM(MediaType) /** * Describes an distro upgrade state @@ -357,6 +351,7 @@ DistroUpgradeStable, DistroUpgradeUnstable }; + Q_ENUM(DistroUpgrade) /** * Describes the type of distribution upgrade to perform @@ -369,6 +364,7 @@ TransactionFlagOnlyDownload = 1 << 3 // Since: 0.8.1 }; Q_DECLARE_FLAGS(TransactionFlags, TransactionFlag) + Q_ENUM(TransactionFlag) /** * Describes a restart type @@ -382,6 +378,7 @@ 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 @@ UpdateStateUnstable, UpdateStateTesting }; + Q_ENUM(UpdateState) /** * Describes the different package groups @@ -434,6 +432,7 @@ GroupNewest }; typedef Bitfield Groups; + Q_ENUM(Group) /** * Describes the state of a package @@ -465,6 +464,7 @@ InfoUntrusted, InfoTrusted }; + Q_ENUM(Info) /** * Describes a signature type @@ -473,6 +473,7 @@ SigTypeUnknown, SigTypeGpg }; + Q_ENUM(SigType) /** * Create a transaction object with transaction id \p tid @@ -842,20 +843,14 @@ * \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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/transactionprivate.cpp new/PackageKit-Qt-0.9.6/src/transactionprivate.cpp --- old/PackageKit-Qt-0.9.5/src/transactionprivate.cpp 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/transactionprivate.cpp 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2011 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ 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 @@ 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 @@ 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 -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/PackageKit-Qt-0.9.5/src/transactionprivate.h new/PackageKit-Qt-0.9.6/src/transactionprivate.h --- old/PackageKit-Qt-0.9.5/src/transactionprivate.h 2014-10-10 17:11:54.000000000 +0200 +++ new/PackageKit-Qt-0.9.6/src/transactionprivate.h 2016-09-20 19:22:37.000000000 +0200 @@ -1,7 +1,7 @@ /* * This file is part of the QPackageKit project * Copyright (C) 2008 Adrien Bustany <[email protected]> - * Copyright (C) 2010-2011 Daniel Nicoletti <[email protected]> + * Copyright (C) 2010-2016 Daniel Nicoletti <[email protected]> * * 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 @@ QDBusObjectPath tid; ::OrgFreedesktopPackageKitTransactionInterface* p = 0; Transaction *q_ptr; - QStringList connectedSignals; + QList<QMetaMethod> connectedSignals; bool sentFinished = false; bool allowCancel = false; @@ -88,7 +88,11 @@ 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);
