[neon/backports-jammy/packagekit-qt/Neon/unstable] /: Imported Upstream version 0.9.2
Matthias Klumpp
null at kde.org
Wed Mar 15 04:29:31 GMT 2023
Git commit 7ab36bd28a3370e841a33eb6f4f997d37fdf8675 by Matthias Klumpp.
Committed on 22/07/2014 at 13:13.
Pushed by carlosdem into branch 'Neon/unstable'.
Imported Upstream version 0.9.2
M +3 -0 AUTHORS
M +18 -6 CMakeLists.txt
M +30 -0 NEWS
M +6 -6 RELEASE
M +59 -25 src/CMakeLists.txt
A +1 -0 src/Details
M +1 -1 src/bitfield.cpp
M +3 -0 src/common.h
M +441 -107 src/daemon.cpp
M +527 -49 src/daemon.h
M +111 -15 src/daemonprivate.cpp
M +21 -4 src/daemonprivate.h
A +68 -0 src/details.cpp [License: LGPL (v2+)]
A +55 -0 src/details.h [License: LGPL (v2+)]
M +7 -7 src/modules/CMakeLists.txt
R +0 -0 src/modules/packagekit-qt-config-version.cmake.in [from: src/modules/packagekit-qt2-config-version.cmake.in - 100% similarity]
A +11 -0 src/modules/packagekit-qt-config.cmake.in
D +0 -11 src/modules/packagekit-qt2-config.cmake.in
R +3 -3 src/packagekitqt4.pc.in [from: src/packagekit-qt2.pc.in - 069% similarity]
A +11 -0 src/packagekitqt5.pc.in
M +60 -415 src/transaction.cpp
M +100 -603 src/transaction.h
M +277 -19 src/transactionprivate.cpp
M +44 -8 src/transactionprivate.h
https://invent.kde.org/neon/backports-jammy/packagekit-qt/commit/7ab36bd28a3370e841a33eb6f4f997d37fdf8675
diff --git a/AUTHORS b/AUTHORS
index c9f4004..069a786 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,6 @@
Daniel Nicoletti <dantti12 at gmail.com>
Matthias Klumpp <matthias at tenstral.net>
+
+Qt5 Port: Martin Grimme <martin.grimme at gmail.com>
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100644
new mode 100755
index 7a0713c..9b1b054
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,13 +7,11 @@ find_package(PkgConfig REQUIRED)
set(CMAKE_BUILD_TYPE "Debug")
set(QPACKAGEKIT_VERSION_MAJOR "0")
-set(QPACKAGEKIT_VERSION_MINOR "8")
-set(QPACKAGEKIT_VERSION_PATCH "8")
+set(QPACKAGEKIT_VERSION_MINOR "9")
+set(QPACKAGEKIT_VERSION_PATCH "2")
set(QPACKAGEKIT_VERSION_SUFFIX "${VERSION_SUFFIX}")
set(QPACKAGEKIT_VERSION "${QPACKAGEKIT_VERSION_MAJOR}.${QPACKAGEKIT_VERSION_MINOR}.${QPACKAGEKIT_VERSION_PATCH}")
-set(QPACKAGEKIT_API_LEVEL "6")
-
# Forbid in-tree building
if(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
message(STATUS "Please do an out-of-tree build:")
@@ -24,8 +22,16 @@ endif(${CMAKE_SOURCE_DIR} MATCHES ${CMAKE_BINARY_DIR})
#
# Options
#
-
-# NONE
+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)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX
@@ -47,8 +53,14 @@ set (BUILDDIR "${CMAKE_BINARY_DIR}")
set (LOCALSTATEDIR "/var")
add_definitions("-DLOCALSTATEDIR=\"${LOCALSTATEDIR}\"")
+add_definitions("-std=gnu++11")
set(CMAKE_INSTALL_LIBDIR "lib/${CMAKE_LIBRARY_ARCHITECTURE}" CACHE PATH "Output directory for libraries")
+if (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
+ set (PKQT_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
+else (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
+ set (PKQT_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
+endif (IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
configure_file(config.h.in ${CMAKE_BINARY_DIR}/config.h)
diff --git a/NEWS b/NEWS
index 76e3875..24c9e2b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,33 @@
+Version 0.9.2
+~~~~~~~~~~~~~
+Released: 2013-04-29
+
+Notes:
+ - Update to new PK API 0.9 (Daniel Nicoletti)
+ - Applied a series of patches to port to Qt5 (Martin Grimme)
+
+New Features:
+ - Add GetDetailsLocal, GetFilesLocal and RepoRemove (Daniel Nicoletti)
+ - Make use of DBus Properties changed to make less blocking calls (Daniel Nicoletti)
+
+Bugfixes:
+ - Allow for Details to be empty constructed (Daniel Nicoletti)
+ - Cleaned include directive (Martin Grimme)
+ - Finish the API changes to get rid of blocking calls (Daniel Nicoletti)
+ - Fix CMake var names for both Qt versions (Daniel Nicoletti)
+ - Fix libdir path (Daniel Nicoletti)
+ - Fix reply signature for Transaction methods (Daniel Nicoletti)
+ - Improve object handlying (Daniel Nicoletti)
+ - I think the API level should be hidden from libname (Daniel Nicoletti)
+ - Keep only one transaction flags, which is unlikely to change (Daniel Nicoletti)
+ - PackageKit doesn't has a changed signal anymore (Daniel Nicoletti)
+ - Properly delete private data on daemon as DaemonPrivate is not a QObject (Daniel Nicoletti)
+ - Properly handle new Details signal (Daniel Nicoletti)
+ - Properly init some Daemon values (Daniel Nicoletti)
+ - Queue signals so that all transaction properties are available when needed (Daniel Nicoletti)
+ - Remove debug info (Daniel Nicoletti)
+ - Update Roles enum, remove Provides enum, and fix some docs typos (Daniel Nicoletti)
+
Version 0.8.8
~~~~~~~~~~~~~
Released: 2013-05-09
diff --git a/RELEASE b/RELEASE
index 5d2c6a2..cb1f5e3 100644
--- a/RELEASE
+++ b/RELEASE
@@ -2,10 +2,10 @@ PackageKit-Qt Release Notes
1. Write NEWS entries for PackageKit-Qt in the same format as usual.
-git shortlog QPACKAGEKIT_0_8_7.. | grep -i -v trivial | grep -v Merge > NEWS.new
+git shortlog QPACKAGEKIT_0_8_8.. | grep -i -v trivial | grep -v Merge > NEWS.new
--------------------------------------------------------------------------------
-Version 0.8.8
+Version 0.9.2
~~~~~~~~~~~~~
Released: 2013-xx-xx
@@ -20,13 +20,13 @@ Bugfixes:
3. Commit changes in PackageKit-Qt git:
-git commit -a -m "Release version 0.8.8"
-git tag -s -f -m "Release 0.8.8" QPACKAGEKIT_0_8_8
+git commit -a -m "Release version 0.9.2"
+git tag -s -f -m "Release 0.9.2" QPACKAGEKIT_0_9_2
<gpg password>
git push --tags
git push
-4. run './release.sh --version=0.8.8 --git-tag=QPACKAGEKIT_0_8_8 --sign'
+4. run './release.sh --version=0.9.2 --git-tag=QPACKAGEKIT_0_9_2 --sign'
5. Upload tarball to:
@@ -42,7 +42,7 @@ git push
8. Send an email to packagekit at lists.freedesktop.org
=================================================
-PackageKit-Qt 0.8.8 released!
+PackageKit-Qt 0.9.2 released!
Tarballs available here: http://www.packagekit.org/releases/
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
old mode 100644
new mode 100755
index 68f60d1..8ef7906
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,12 +1,29 @@
# CMakeLists for PackageKit-Qt library
-find_package(Qt4 REQUIRED)
+if (USE_QT5)
+ find_package(Qt5Core REQUIRED)
+ set(Qt5_FOUND YES)
+else ()
+ find_package(Qt4 REQUIRED)
+ set(Qt4_FOUND YES)
+endif ()
-# Set up Qt4
-set(QT_USE_QTDBUS TRUE)
-set(QT_USE_QTSQL TRUE)
-set(QT_DONT_USE_QTGUI TRUE)
-include(${QT_USE_FILE})
+# Set up Qt
+if (Qt5_FOUND)
+ find_package(Qt5DBus REQUIRED)
+ find_package(Qt5Sql REQUIRED)
+ include_directories(${Qt5Core_INCLUDE_DIRS}
+ ${Qt5DBus_INCLUDE_DIRS}
+ ${Qt5Sql_INCLUDE_DIRS}
+ )
+ add_definitions(${Qt5DBus_DEFINITIONS})
+ add_definitions(${Qt5Sql_DEFINITIONS})
+elseif (Qt4_FOUND)
+ set(QT_USE_QTDBUS TRUE)
+ set(QT_USE_QTSQL TRUE)
+ set(QT_DONT_USE_QTGUI TRUE)
+ include(${QT_USE_FILE})
+endif ()
include_directories(${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
@@ -19,6 +36,8 @@ set(packagekitqt_HEADERS
common.h
daemon.h
transaction.h
+ Details
+ details.h
bitfield.h
)
@@ -28,11 +47,12 @@ set(packagekitqt_HEADERS_PRIVATE
)
set(packagekitqt_SRC
- bitfield.cpp
- daemon.cpp
- daemonprivate.cpp
- transaction.cpp
- transactionprivate.cpp
+ bitfield.cpp
+ daemon.cpp
+ daemonprivate.cpp
+ transaction.cpp
+ transactionprivate.cpp
+ details.cpp
)
find_file(PK_INTERFACE_XML org.freedesktop.PackageKit.xml
@@ -46,32 +66,46 @@ if (PK_INTERFACE_XML STREQUAL "PK_INTERFACE_XML-NOTFOUND" OR PK_TRANSACTION_INTE
endif ()
set_source_files_properties(${PK_INTERFACE_XML} PROPERTIES CLASSNAME DaemonProxy)
-qt4_add_dbus_interface(packagekitqt_SRC ${PK_INTERFACE_XML} daemonproxy)
-
set_source_files_properties(${PK_TRANSACTION_INTERFACE_XML} PROPERTIES CLASSNAME TransactionProxy)
-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})
+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 ()
-add_library(packagekit-qt2 SHARED ${packagekitqt_SRC} ${packagekitqt_HEADERS} ${packagekitqt_HEADERS_PRIVATE})
-set_target_properties(packagekit-qt2 PROPERTIES VERSION ${QPACKAGEKIT_VERSION} SOVERSION ${QPACKAGEKIT_API_LEVEL})
+add_library(${LIBNAME} SHARED ${packagekitqt_SRC} ${packagekitqt_HEADERS} ${packagekitqt_HEADERS_PRIVATE})
+set_target_properties(${LIBNAME} PROPERTIES VERSION ${QPACKAGEKIT_VERSION} SOVERSION ${QPACKAGEKIT_API_LEVEL})
-target_link_libraries(packagekit-qt2
+if (Qt5_FOUND)
+ add_dependencies(${LIBNAME} mocs)
+ target_link_libraries(${LIBNAME}
+ ${Qt5DBus_LIBRARIES} ${Qt5Sql_LIBRARIES}
+ )
+elseif (Qt4_FOUND)
+ target_link_libraries(${LIBNAME}
${QT_LIBRARIES}
-)
+ )
+endif ()
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt2.pc.in
- ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2.pc
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${LIBNAME}.pc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
@ONLY
)
-install(TARGETS packagekit-qt2 DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2.pc
+install(TARGETS ${LIBNAME} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
)
install(FILES ${packagekitqt_HEADERS}
- DESTINATION include/PackageKit/packagekit-qt2
+ DESTINATION include/PackageKit/${LIBNAME}
)
add_subdirectory(modules)
diff --git a/src/Details b/src/Details
new file mode 100644
index 0000000..2cd8055
--- /dev/null
+++ b/src/Details
@@ -0,0 +1 @@
+#include "details.h"
diff --git a/src/bitfield.cpp b/src/bitfield.cpp
index 2fa6e82..c986905 100644
--- a/src/bitfield.cpp
+++ b/src/bitfield.cpp
@@ -16,7 +16,7 @@ Bitfield::~Bitfield ()
qulonglong Bitfield::operator& (qulonglong mask) const
{
- return m_val & (1ULL << mask);
+ return m_val & (1ULL << mask);
}
qulonglong Bitfield::operator&= (qulonglong mask)
diff --git a/src/common.h b/src/common.h
index 527eead..d7497d4 100644
--- a/src/common.h
+++ b/src/common.h
@@ -20,6 +20,9 @@
#define PK_NAME "org.freedesktop.PackageKit"
#define PK_PATH "/org/freedesktop/PackageKit"
+#define PK_TRANSACTION_INTERFACE "org.freedesktop.PackageKit.Transaction"
+
+#define DBUS_PROPERTIES "org.freedesktop.DBus.Properties"
#define AUTH_PACKAGE_INSTALL "org.freedesktop.packagekit.package-install"
#define AUTH_PACKAGE_INSTALL_UNTRUSTED "org.freedesktop.packagekit.package-install-untrusted"
diff --git a/src/daemon.cpp b/src/daemon.cpp
old mode 100644
new mode 100755
index 7b49745..621fb89
--- a/src/daemon.cpp
+++ b/src/daemon.cpp
@@ -24,16 +24,11 @@
#include "daemon.h"
#include "daemonprivate.h"
+#include "transactionprivate.h"
#include "daemonproxy.h"
#include "common.h"
-#define PENDING_CALL(blurb) \
- Q_D(Daemon); \
- QDBusPendingReply<> r = d->daemon->blurb; \
- r.waitForFinished(); \
- d->lastError = r.error(); \
-
using namespace PackageKit;
Daemon* Daemon::m_global = 0;
@@ -57,6 +52,13 @@ Daemon::Daemon(QObject *parent) :
QDBusConnection::systemBus(),
this);
+ QDBusConnection::systemBus().connect(QLatin1String(PK_NAME),
+ QLatin1String(PK_PATH),
+ QLatin1String(DBUS_PROPERTIES),
+ QLatin1String("PropertiesChanged"),
+ this,
+ SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
+
// Set up database for desktop files
QSqlDatabase db;
db = QSqlDatabase::addDatabase("QSQLITE", PK_DESKTOP_DEFAULT_DATABASE);
@@ -75,10 +77,7 @@ Daemon::Daemon(QObject *parent) :
qRegisterMetaType<PackageKit::Transaction::Message>("PackageKit::Transaction::Message");
qRegisterMetaType<PackageKit::Transaction::Status>("PackageKit::Transaction::Status");
qRegisterMetaType<PackageKit::Transaction::MediaType>("PackageKit::Transaction::MediaType");
- qRegisterMetaType<PackageKit::Transaction::Provides>("PackageKit::Transaction::Provides");
- qRegisterMetaType<PackageKit::Transaction::ProvidesFlag>("PackageKit::Transaction::ProvidesFlag");
qRegisterMetaType<PackageKit::Transaction::DistroUpgrade>("PackageKit::Transaction::DistroUpgrade");
- qRegisterMetaType<PackageKit::Transaction::UpgradeKind>("PackageKit::Transaction::UpgradeKind");
qRegisterMetaType<PackageKit::Transaction::TransactionFlag>("PackageKit::Transaction::TransactionFlag");
qRegisterMetaType<PackageKit::Transaction::TransactionFlags>("PackageKit::Transaction::TransactionFlags");
qRegisterMetaType<PackageKit::Transaction::Restart>("PackageKit::Transaction::Restart");
@@ -130,6 +129,15 @@ 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)
{
Q_D(Daemon);
@@ -141,193 +149,138 @@ 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;
}
-Transaction::Roles Daemon::actions()
+bool Daemon::isRunning()
{
- Q_D(const Daemon);
- return d->daemon->roles();
+ return global()->d_ptr->running;
}
-Transaction::ProvidesFlag Daemon::provides()
+Transaction::Roles Daemon::roles()
{
- Q_D(const Daemon);
- return static_cast<Transaction::ProvidesFlag>(d->daemon->provides());
+ return global()->d_ptr->roles;
}
QString Daemon::backendName()
{
- Q_D(const Daemon);
- return d->daemon->backendName();
+ return global()->d_ptr->backendName;
}
QString Daemon::backendDescription()
{
- Q_D(const Daemon);
- return d->daemon->backendDescription();
+ return global()->d_ptr->backendDescription;
}
QString Daemon::backendAuthor()
{
- Q_D(const Daemon);
- return d->daemon->backendAuthor();
+ return global()->d_ptr->backendAuthor;
}
Transaction::Filters Daemon::filters()
{
- Q_D(const Daemon);
- return static_cast<Transaction::Filters>(d->daemon->filters());
+ return global()->d_ptr->filters;
}
Transaction::Groups Daemon::groups()
{
- Q_D(const Daemon);
- return static_cast<Transaction::Groups>(d->daemon->groups());
+ return global()->d_ptr->groups;
}
bool Daemon::locked()
{
- Q_D(const Daemon);
- return d->daemon->locked();
+ return global()->d_ptr->locked;
}
QStringList Daemon::mimeTypes()
{
- Q_D(const Daemon);
- return d->daemon->mimeTypes();
+ return global()->d_ptr->mimeTypes;
}
Daemon::Network Daemon::networkState()
{
- Q_D(const Daemon);
- return static_cast<Daemon::Network>(d->daemon->networkState());
+ return global()->d_ptr->networkState;
}
QString Daemon::distroID()
{
- Q_D(const Daemon);
- return d->daemon->distroId();
+ return global()->d_ptr->distroId;
}
-Daemon::Authorize Daemon::canAuthorize(const QString &actionId)
+QDBusPendingReply<Daemon::Authorize> Daemon::canAuthorize(const QString &actionId)
{
- Q_D(Daemon);
- QDBusPendingReply<uint> reply = d->daemon->CanAuthorize(actionId);
- reply.waitForFinished();
- d->lastError = reply.error();
- if (reply.isValid()) {
- return static_cast<Daemon::Authorize>(reply.value());
- }
- return Daemon::AuthorizeUnknown;
+ return global()->d_ptr->daemon->CanAuthorize(actionId);
}
-QDBusObjectPath Daemon::getTid()
+QDBusPendingReply<QDBusObjectPath> Daemon::createTransaction()
{
- Q_D(Daemon);
- QDBusPendingReply<QDBusObjectPath> reply = d->daemon->CreateTransaction();
- reply.waitForFinished();
- d->lastError = reply.error();
- if (reply.isValid()) {
- return reply.value();
- }
- return QDBusObjectPath();
+ return global()->d_ptr->daemon->CreateTransaction();
}
-uint Daemon::getTimeSinceAction(Transaction::Role role)
+QDBusPendingReply<uint> Daemon::getTimeSinceAction(Transaction::Role role)
{
- Q_D(Daemon);
- QDBusPendingReply<uint> reply = d->daemon->GetTimeSinceAction(role);
- reply.waitForFinished();
- d->lastError = reply.error();
- if (reply.isValid()) {
- return reply.value();
- }
- return 0u;
+ return global()->d_ptr->daemon->GetTimeSinceAction(role);
}
-QList<QDBusObjectPath> Daemon::getTransactionList()
+QDBusPendingReply<QList<QDBusObjectPath> > Daemon::getTransactionList()
{
- Q_D(Daemon);
- QDBusPendingReply<QList<QDBusObjectPath> > reply = d->daemon->GetTransactionList();
- reply.waitForFinished();
- d->lastError = reply.error();
- if (reply.isValid()) {
- return reply.value();
- }
- return QList<QDBusObjectPath>();
-}
-
-QList<Transaction*> Daemon::getTransactionObjects(QObject *parent)
-{
- Q_D(Daemon);
- return d->transactions(getTransactionList(), parent);
+ return global()->d_ptr->daemon->GetTransactionList();
}
void Daemon::setHints(const QStringList &hints)
{
- Q_D(Daemon);
- d->hints = hints;
+ global()->d_ptr->hints = hints;
}
void Daemon::setHints(const QString &hints)
{
- Q_D(Daemon);
- d->hints = QStringList() << hints;
+ global()->d_ptr->hints = QStringList() << hints;
}
QStringList Daemon::hints()
{
- Q_D(const Daemon);
- return d->hints;
-}
-
-Transaction::InternalError Daemon::setProxy(const QString& http_proxy, const QString& https_proxy, const QString& ftp_proxy, const QString& socks_proxy, const QString& no_proxy, const QString& pac)
-{
- Q_D(Daemon);
- QDBusPendingReply<> r = d->daemon->SetProxy(http_proxy, https_proxy, ftp_proxy, socks_proxy, no_proxy, pac);
- r.waitForFinished();
- d->lastError = r.error();
- if (r.isError()) {
- return Transaction::parseError(r.error().name());
- } else {
- return Transaction::InternalErrorNone;
- }
+ return global()->d_ptr->hints;
}
-void Daemon::stateHasChanged(const QString& reason)
+QDBusPendingReply<> Daemon::setProxy(const QString& http_proxy, const QString& https_proxy, const QString& ftp_proxy, const QString& socks_proxy, const QString& no_proxy, const QString& pac)
{
- PENDING_CALL(StateHasChanged(reason))
+ return global()->d_ptr->daemon->SetProxy(http_proxy, https_proxy, ftp_proxy, socks_proxy, no_proxy, pac);
}
-void Daemon::suggestDaemonQuit()
+QDBusPendingReply<> Daemon::stateHasChanged(const QString& reason)
{
- PENDING_CALL(SuggestDaemonQuit())
+ return global()->d_ptr->daemon->StateHasChanged(reason);
}
-QDBusError Daemon::lastError() const
+QDBusPendingReply<> Daemon::suggestDaemonQuit()
{
- Q_D(const Daemon);
- return d->lastError;
+ return global()->d_ptr->daemon->SuggestDaemonQuit();
}
uint Daemon::versionMajor()
{
- Q_D(const Daemon);
- return d->daemon->versionMajor();
+ return global()->d_ptr->versionMajor;
}
uint Daemon::versionMinor()
{
- Q_D(const Daemon);
- return d->daemon->versionMinor();
+ return global()->d_ptr->versionMinor;
}
uint Daemon::versionMicro()
{
- Q_D(const Daemon);
- return d->daemon->versionMicro();
+ return global()->d_ptr->versionMicro;
}
QString Daemon::packageName(const QString &packageID)
@@ -355,4 +308,385 @@ QString Daemon::packageIcon(const QString &packageID)
return Transaction::packageIcon(packageID);
}
+Transaction *Daemon::acceptEula(const QString &eulaId)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleAcceptEula;
+ ret->d_ptr->eulaId = eulaId;
+ return ret;
+}
+
+Transaction *Daemon::downloadPackages(const QStringList &packageIDs, bool storeInCache)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleDownloadPackages;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->storeInCache = storeInCache;
+ return ret;
+}
+
+Transaction *Daemon::downloadPackage(const QString &packageID, bool storeInCache)
+{
+ return downloadPackages(QStringList() << packageID, storeInCache);
+}
+
+Transaction *Daemon::getCategories()
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetCategories;
+ return ret;
+}
+
+Transaction *Daemon::dependsOn(const QStringList &packageIDs, Transaction::Filters filters, bool recursive)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleDependsOn;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->filters = filters;
+ ret->d_ptr->recursive = recursive;
+ return ret;
+}
+
+Transaction *Daemon::dependsOn(const QString &packageID, Transaction::Filters filters, bool recursive)
+{
+ return dependsOn(QStringList() << packageID, filters, recursive);
+}
+
+Transaction *Daemon::getDetails(const QStringList &packageIDs)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetDetails;
+ ret->d_ptr->search = packageIDs;
+ return ret;
+}
+
+Transaction *Daemon::getDetails(const QString &packageID)
+{
+ return getDetails(QStringList() << packageID);
+}
+
+Transaction *Daemon::getDetailsLocal(const QStringList &files)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetDetailsLocal;
+ ret->d_ptr->search = files;
+ return ret;
+}
+
+Transaction *Daemon::getDetailsLocal(const QString &file)
+{
+ return getDetailsLocal(QStringList() << file);
+}
+
+Transaction *Daemon::getFiles(const QStringList &packageIDs)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetFiles;
+ ret->d_ptr->search = packageIDs;
+ return ret;
+}
+
+Transaction *Daemon::getFiles(const QString &packageID)
+{
+ return getFiles(QStringList() << packageID);
+}
+
+Transaction *Daemon::getFilesLocal(const QStringList &files)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetFilesLocal;
+ ret->d_ptr->search = files;
+ return ret;
+}
+
+Transaction *Daemon::getFilesLocal(const QString &file)
+{
+ return getFilesLocal(QStringList() << file);
+}
+
+Transaction *Daemon::getOldTransactions(uint number)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetOldTransactions;
+ ret->d_ptr->numberOfOldTransactions = number;
+ return ret;
+}
+
+Transaction *Daemon::getPackages(Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetPackages;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::getRepoList(Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetRepoList;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::requiredBy(const QStringList &packageIDs, Transaction::Filters filters, bool recursive)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRequiredBy;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->filters = filters;
+ ret->d_ptr->recursive = recursive;
+ return ret;
+}
+
+Transaction *Daemon::requiredBy(const QString &packageID, Transaction::Filters filters, bool recursive)
+{
+ return requiredBy(QStringList() << packageID, filters, recursive);
+}
+
+Transaction *Daemon::getUpdatesDetails(const QStringList &packageIDs)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetUpdateDetail;
+ ret->d_ptr->search = packageIDs;
+ return ret;
+}
+
+Transaction *Daemon::getUpdateDetail(const QString &packageID)
+{
+ return getUpdatesDetails(QStringList() << packageID);
+}
+
+Transaction *Daemon::getUpdates(Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetUpdates;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::getDistroUpgrades()
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleGetDistroUpgrades;
+ return ret;
+}
+
+Transaction *Daemon::installFiles(const QStringList &files, Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleInstallFiles;
+ ret->d_ptr->search = files;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::installFile(const QString &file, Transaction::TransactionFlags flags)
+{
+ return installFiles(QStringList() << file, flags);
+}
+
+Transaction *Daemon::installPackages(const QStringList &packageIDs, Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleInstallPackages;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::installPackage(const QString &packageID, Transaction::TransactionFlags flags)
+{
+ return installPackages(QStringList() << packageID, flags);
+}
+
+Transaction *Daemon::installSignature(Transaction::SigType type, const QString &keyID, const QString &packageID)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleInstallSignature;
+ ret->d_ptr->signatureType = type;
+ ret->d_ptr->signatureKey = keyID;
+ ret->d_ptr->signaturePackage = packageID;
+ return ret;
+}
+
+Transaction *Daemon::refreshCache(bool force)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRefreshCache;
+ ret->d_ptr->refreshCacheForce = force;
+ return ret;
+}
+
+Transaction *Daemon::removePackages(const QStringList &packageIDs, bool allowDeps, bool autoremove, Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRemovePackages;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->allowDeps = allowDeps;
+ ret->d_ptr->autoremove = autoremove;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::removePackage(const QString &packageID, bool allowDeps, bool autoremove, Transaction::TransactionFlags flags)
+{
+ return removePackages(QStringList() << packageID, allowDeps, autoremove, flags);
+}
+
+Transaction *Daemon::repairSystem(Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRepairSystem;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::repoEnable(const QString &repoId, bool enable)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRepoEnable;
+ ret->d_ptr->repoId = repoId;
+ ret->d_ptr->repoEnable = enable;
+ return ret;
+}
+
+Transaction *Daemon::repoRemove(const QString &repoId, bool autoremove, Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRepoRemove;
+ ret->d_ptr->repoId = repoId;
+ ret->d_ptr->autoremove = autoremove;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::repoSetData(const QString &repoId, const QString ¶meter, const QString &value)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleRepoSetData;
+ ret->d_ptr->repoId = repoId;
+ ret->d_ptr->repoParameter = parameter;
+ ret->d_ptr->repoValue = value;
+ return ret;
+}
+
+Transaction *Daemon::resolve(const QStringList &packageNames, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleResolve;
+ ret->d_ptr->search = packageNames;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::resolve(const QString &packageName, Transaction::Filters filters)
+{
+ return resolve(QStringList() << packageName, filters);
+}
+
+Transaction *Daemon::searchFiles(const QStringList &search, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleSearchFile;
+ ret->d_ptr->search = search;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::searchFiles(const QString &search, Transaction::Filters filters)
+{
+ return searchFiles(QStringList() << search, filters);
+}
+
+Transaction *Daemon::searchDetails(const QStringList &search, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleSearchDetails;
+ ret->d_ptr->search = search;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::searchDetails(const QString &search, Transaction::Filters filters)
+{
+ return searchDetails(QStringList() << search, filters);
+}
+
+Transaction *Daemon::searchGroups(const QStringList &groups, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleSearchGroup;
+ ret->d_ptr->search = groups;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::searchGroup(const QString &group, Transaction::Filters filters)
+{
+ return searchGroups(QStringList() << group, filters);
+}
+
+Transaction *Daemon::searchGroup(Transaction::Group group, Transaction::Filters filters)
+{
+ QString groupString = Daemon::enumToString<Transaction>(group, "Group");
+ return searchGroup(groupString, filters);
+}
+
+Transaction *Daemon::searchGroups(Transaction::Groups groups, Transaction::Filters filters)
+{
+ QStringList groupsStringList;
+ for (int i = 1; i < 64; ++i) {
+ if (groups & i) {
+ Transaction::Group group = static_cast<Transaction::Group>(i);
+ if (group != Transaction::GroupUnknown) {
+ groupsStringList << Daemon::enumToString<Transaction>(group, "Group");
+ }
+ }
+ }
+ return searchGroups(groupsStringList, filters);
+}
+
+Transaction *Daemon::searchNames(const QStringList &search, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleSearchName;
+ ret->d_ptr->search = search;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::searchNames(const QString &search, Transaction::Filters filters)
+{
+ return searchNames(QStringList() << search, filters);
+}
+
+Transaction *Daemon::updatePackages(const QStringList &packageIDs, Transaction::TransactionFlags flags)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleUpdatePackages;
+ ret->d_ptr->search = packageIDs;
+ ret->d_ptr->transactionFlags = flags;
+ return ret;
+}
+
+Transaction *Daemon::updatePackage(const QString &packageID, Transaction::TransactionFlags flags)
+{
+ return updatePackages(QStringList() << packageID, flags);
+}
+
+Transaction *Daemon::whatProvides(const QStringList &search, Transaction::Filters filters)
+{
+ Transaction *ret = new Transaction;
+ ret->d_ptr->role = Transaction::RoleWhatProvides;
+ ret->d_ptr->search = search;
+ ret->d_ptr->filters = filters;
+ return ret;
+}
+
+Transaction *Daemon::whatProvides(const QString &search, Transaction::Filters filters)
+{
+ return whatProvides(QStringList() << search, filters);
+}
+
#include "daemon.moc"
+
diff --git a/src/daemon.h b/src/daemon.h
index 07d1654..4114112 100644
--- a/src/daemon.h
+++ b/src/daemon.h
@@ -25,6 +25,7 @@
#include <QtCore/QObject>
#include <QtCore/QMetaEnum>
#include <QtDBus/QDBusError>
+#include <QtDBus/QDBusPendingReply>
#include "transaction.h"
@@ -51,8 +52,8 @@ class Daemon : public QObject
Q_OBJECT
Q_ENUMS(Network)
Q_ENUMS(Authorize)
- Q_PROPERTY(Transaction::Roles actions READ actions NOTIFY changed)
- Q_PROPERTY(Transaction::ProvidesFlag provides READ provides NOTIFY changed)
+ 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)
Q_PROPERTY(QString backendDescription READ backendDescription NOTIFY changed)
Q_PROPERTY(QString backendAuthor READ backendAuthor NOTIFY changed)
@@ -60,7 +61,7 @@ class Daemon : public QObject
Q_PROPERTY(Transaction::Groups groups READ groups NOTIFY changed)
Q_PROPERTY(bool locked READ locked NOTIFY changed)
Q_PROPERTY(QStringList mimeTypes READ mimeTypes NOTIFY changed)
- Q_PROPERTY(Daemon::Network networkState READ networkState NOTIFY changed)
+ Q_PROPERTY(Daemon::Network networkState READ networkState NOTIFY networkStateChanged)
Q_PROPERTY(QString distroID READ distroID NOTIFY changed)
Q_PROPERTY(uint versionMajor READ versionMajor NOTIFY changed)
Q_PROPERTY(uint versionMinor READ versionMinor NOTIFY changed)
@@ -104,76 +105,76 @@ public:
~Daemon();
/**
- * Returns all the actions supported by the current backend
+ * Returns true if the daemon is running (ie registered to DBus)
*/
- Transaction::Roles actions();
+ static bool isRunning();
/**
- * Returns all the actions supported by the current backend
+ * Returns all the roles supported by the current backend
*/
- Transaction::ProvidesFlag provides();
+ static Transaction::Roles roles();
/**
* The backend name, e.g. "yum".
*/
- QString backendName();
+ static QString backendName();
/**
* The backend description, e.g. "Yellow Dog Update Modifier".
*/
- QString backendDescription();
+ static QString backendDescription();
/**
* The backend author, e.g. "Joe Bloggs <joe at blogs.com>"
*/
- QString backendAuthor();
+ static QString backendAuthor();
/**
* Returns the package filters supported by the current backend
*/
- Transaction::Filters filters();
+ static Transaction::Filters filters();
/**
* Returns the package groups supported by the current backend
*/
- Transaction::Groups groups();
+ static Transaction::Groups groups();
/**
* Set when the backend is locked and native tools would fail.
*/
- bool locked();
+ static bool locked();
/**
* Returns a list containing the MIME types supported by the current backend
*/
- QStringList mimeTypes();
+ static QStringList mimeTypes();
/**
* Returns the current network state
*/
- Daemon::Network networkState();
+ static Daemon::Network networkState();
/**
* The distribution identifier in the
* distro;version;arch form,
* e.g. "debian;squeeze/sid;x86_64".
*/
- QString distroID();
+ static QString distroID();
/**
* Returns the major version number.
*/
- uint versionMajor();
+ static uint versionMajor();
/**
* The minor version number.
*/
- uint versionMinor();
+ static uint versionMinor();
/**
* The micro version number.
*/
- uint versionMicro();
+ static uint versionMicro();
/**
* Allows a client to find out if it would be allowed to authorize an action.
@@ -181,39 +182,30 @@ public:
* specified in \p actionId
* Returm might be either yes, no or interactive \sa Authorize.
*/
- Q_INVOKABLE Authorize canAuthorize(const QString &actionId);
+ static QDBusPendingReply<Authorize> canAuthorize(const QString &actionId);
/**
* Returns the time (in seconds) since the specified \p action
*/
- Q_INVOKABLE uint getTimeSinceAction(PackageKit::Transaction::Role action);
+ static QDBusPendingReply<uint> getTimeSinceAction(PackageKit::Transaction::Role action);
/**
* \brief creates a new transaction path
- *
+ *
* This function register a new DBus path on PackageKit
* allowing a \c Transaction object to be created.
- *
+ *
* \note Unless you want to know the transaction id
* before creating the \c Transaction object this function
* is not useful as simply creating a \c Transaction object will
* automatically create this path.
*/
- Q_INVOKABLE QDBusObjectPath getTid();
+ static QDBusPendingReply<QDBusObjectPath> createTransaction();
/**
* Returns the list of current transactions
*/
- Q_INVOKABLE QList<QDBusObjectPath> getTransactionList();
-
- /**
- * Convenience function
- * Returns the list of current transactions as \c Transaction objects
- *
- * You must delete these yourself or pass a
- * \p parent for these comming transactions
- */
- Q_INVOKABLE QList<Transaction*> getTransactionObjects(QObject *parent = 0);
+ static QDBusPendingReply<QList<QDBusObjectPath> > getTransactionList();
/**
* \brief Sets a global hints for all the transactions to be created
@@ -233,40 +225,35 @@ public:
*
* \sa Transaction::setHints
*/
- Q_INVOKABLE void setHints(const QStringList &hints);
+ static void setHints(const QStringList &hints);
/**
* Convenience function to set global hints
* \sa setHints(const QStringList &hints)
*/
- Q_INVOKABLE void setHints(const QString &hints);
+ static void setHints(const QString &hints);
/**
* This method returns the current hints
*/
- Q_INVOKABLE QStringList hints();
+ static QStringList hints();
/**
* Sets a proxy to be used for all the network operations
*/
- Q_INVOKABLE Transaction::InternalError setProxy(const QString &http_proxy, const QString &https_proxy, const QString &ftp_proxy, const QString &socks_proxy, const QString &no_proxy, const QString &pac);
+ static QDBusPendingReply<> setProxy(const QString &http_proxy, const QString &https_proxy, const QString &ftp_proxy, const QString &socks_proxy, const QString &no_proxy, const QString &pac);
/**
* \brief Tells the daemon that the system state has changed, to make it reload its cache
*
* \p reason can be resume or posttrans
*/
- Q_INVOKABLE void stateHasChanged(const QString &reason);
+ static QDBusPendingReply<> stateHasChanged(const QString &reason);
/**
* Asks PackageKit to quit, for example to let a native package manager operate
*/
- Q_INVOKABLE void suggestDaemonQuit();
-
- /**
- * Get the last call status
- */
- Q_INVOKABLE QDBusError lastError() const;
+ static QDBusPendingReply<> suggestDaemonQuit();
/**
* Returns the package name from the \p packageID
@@ -358,10 +345,10 @@ public:
int id = T::staticMetaObject.indexOfEnumerator(enumName);
QMetaEnum e = T::staticMetaObject.enumerator(id);
- int enumValue = e.keyToValue(realName.toAscii().data());
+ int enumValue = e.keyToValue(realName.toLatin1().data());
if (enumValue == -1) {
- enumValue = e.keyToValue(prefix.append("Unknown").toAscii().data());
+ 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;
}
@@ -369,7 +356,490 @@ public:
return enumValue;
}
+ /**
+ * \brief Accepts an EULA
+ *
+ * The EULA is identified by the \sa Eula structure \p info
+ *
+ * \note You need to manually restart the transaction which triggered the EULA.
+ * \sa eulaRequired()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *acceptEula(const QString &eulaID);
+
+ /**
+ * Download the given \p packages to a temp dir, if \p storeInCache is true
+ * the download will be stored in the package manager cache
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *downloadPackages(const QStringList &packageIDs, bool storeInCache = false);
+
+ /**
+ * This is a convenience function to download this \p package
+ * \sa downloadPackages(const QStringList &packageIDs, bool storeInCache = false)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *downloadPackage(const QString &packageID, bool storeInCache = false);
+
+ /**
+ * Returns the collection categories
+ *
+ * \sa category
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getCategories();
+
+ /**
+ * \brief Gets the list of dependencies for the given \p packages
+ *
+ * You can use the \p filters to limit the results to certain packages.
+ * The \p recursive flag indicates if the package manager should also
+ * fetch the dependencies's dependencies.
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *dependsOn(const QStringList &packageIDs, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);
+
+ /**
+ * Convenience function to get the dependencies of this \p package
+ * \sa dependsOn(const QStringList &packageIDs, Filters filters, bool recursive = false)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *dependsOn(const QString &packageID, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);
+
+ /**
+ * Gets more details about the given \p packages
+ *
+ * \sa Transaction::details
+ * \note This method emits \sa package()
+ * with details set
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getDetails(const QStringList &packageIDs);
+
+ /**
+ * Convenience function to get the details about this \p package
+ * \sa getDetails(const QStringList &packageIDs)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getDetails(const QString &packageID);
+
+ /**
+ * Gets more details about the given \p files
+ *
+ * \sa Transaction::details
+ * \note This method emits \sa package()
+ * with details set
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getDetailsLocal(const QStringList &files);
+
+ /**
+ * Gets more details about the given \p file
+ *
+ * \sa Transaction::details
+ * \note This method emits \sa package()
+ * with details set
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getDetailsLocal(const QString &file);
+
+ /**
+ * Gets the files contained in the given \p packages
+ *
+ * \note This method emits \sa files()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getFiles(const QStringList &packageIDs);
+
+ /**
+ * Convenience function to get the files contained in this \p package
+ * \sa getFiles(const QStringList &packageIDs)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getFiles(const QString &packageIDs);
+
+ /**
+ * Gets the files contained in the given \p files
+ *
+ * \note This method emits \sa files()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getFilesLocal(const QStringList &files);
+
+ /**
+ * Gets the files contained in the given \p file
+ *
+ * \note This method emits \sa files()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getFilesLocal(const QString &file);
+
+ /**
+ * \brief Gets the last \p number finished transactions
+ *
+ * \note You must delete these transactions yourself
+ * \note This method emits \sa transaction()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getOldTransactions(uint number);
+
+ /**
+ * Gets all the packages matching the given \p filters
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getPackages(Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Gets the list of software repositories matching the given \p filters
+ *
+ * \note This method emits \sa repository()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getRepoList(Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Searches for the packages requiring the given \p packages
+ *
+ * The search can be limited using the \p filters parameter.
+ * The \p recursive flag is used to tell if the package manager should
+ * also search for the package requiring the resulting packages.
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *requiredBy(const QStringList &packageIDs, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);
+
+ /**
+ * Convenience function to get packages requiring this package
+ * \sa requiredBy(const QStringList &packageIDs, Filters filters, bool recursive = false)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *requiredBy(const QString &packageID, Transaction::Filters filters = Transaction::FilterNone, bool recursive = false);
+
+ /**
+ * Retrieves more details about the update for the given \p packageIDs
+ *
+ * \note This method emits \sa updateDetail()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getUpdatesDetails(const QStringList &packageIDs);
+
+ /**
+ * Convenience function to get update details
+ * \sa getUpdateDetail(const QStringList &packageIDs)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getUpdateDetail(const QString &packageID);
+
+ /**
+ * \p Gets the available updates
+ *
+ * The \p filters parameters can be used to restrict the updates returned
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getUpdates(Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Retrieves the available distribution upgrades
+ *
+ * \note This method emits \sa distroUpgrade()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *getDistroUpgrades();
+
+ /**
+ * \brief Installs the local packages \p files
+ *
+ * \p onlyTrusted indicate if the packages are signed by a trusted authority
+ *
+ * \note This method emits \sa package() and \sa changed()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *installFiles(const QStringList &files, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Convenience function to install a file
+ * \sa installFiles(const QStringList &files, TransactionFlags flags)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *installFile(const QString &file, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Install the given \p packages
+ *
+ * \p only_trusted indicates if we should allow installation of untrusted packages (requires a different authorization)
+ *
+ * \note This method emits \sa package() and \sa changed()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *installPackages(const QStringList &packageIDs, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Convenience function to install a package
+ * \sa installPackages(const QStringList &packageIDs, TransactionFlags flags)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *installPackage(const QString &packageID, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * \brief Installs a signature
+ *
+ * \p type, \p keyId and \p package generally come from the Transaction::repoSignatureRequired
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *installSignature(Transaction::SigType type, const QString &keyID, const QString &packageID);
+
+ /**
+ * Refreshes the package manager's cache
+ *
+ * \note This method emits \sa changed()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *refreshCache(bool force);
+
+ /**
+ * \brief Removes the given \p packages
+ *
+ * \p allowDeps if the package manager has the right to remove other packages which depend on the
+ * packages to be removed. \p autoRemove tells the package manager to remove all the package which
+ * won't be needed anymore after the packages are uninstalled.
+ *
+ * \note This method emits \sa package() and \sa changed()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *removePackages(const QStringList &packageIDs, bool allowDeps = false, bool autoRemove = false, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Convenience function to remove a package
+ *
+ * \sa removePackages(const PackageList &packages, bool allowDeps = false, bool autoRemove = false, TransactionFlags flags)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *removePackage(const QString &packageID, bool allowDeps = false, bool autoRemove = false, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Repairs a broken system
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *repairSystem(Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Activates or disables a repository
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *repoEnable(const QString &repoId, bool enable = true);
+
+ /**
+ * Removes a repository
+ *
+ * \p autoremove packages from this repository
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *repoRemove(const QString &repoId, bool autoremove, Transaction::TransactionFlags flags = Transaction::TransactionFlagNone);
+
+ /**
+ * Sets a repository's parameter
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *repoSetData(const QString &repoId, const QString ¶meter, const QString &value);
+
+ /**
+ * \brief Tries to create a Package object from the package's name
+ *
+ * The \p filters can be used to restrict the search
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *resolve(const QStringList &packageNames, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to remove a package name
+ * \sa resolve(const QStringList &packageNames, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *resolve(const QString &packageName, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Search in the packages files
+ *
+ * \p filters can be used to restrict the returned packages
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchFiles(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search for a file
+ * \sa searchFiles(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchFiles(const QString &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Search in the packages details
+ *
+ * \p filters can be used to restrict the returned packages
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchDetails(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search by details
+ * \sa searchDetails(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchDetails(const QString &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Lists all the packages in the given \p group
+ *
+ * \p groups is the name of the group that you want, when searching for
+ * categories prefix it with '@'
+ * \p filters can be used to restrict the returned packages
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search by group string
+ * \sa searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchGroup(const QString &group, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search by group enum
+ * \sa searchGroups(const QStringList &groups, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchGroup(Transaction::Group group, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Lists all the packages in the given \p group
+ *
+ * \p filters can be used to restrict the returned packages
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchGroups(Transaction::Groups group, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * \brief Search in the packages names
+ *
+ * \p filters can be used to restrict the returned packages
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchNames(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search by names
+ * \sa searchNames(const QStringList &search, Filters filters)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *searchNames(const QString &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Update the given \p packages
+ *
+ * \p onlyTrusted indicates if this transaction is only allowed to install trusted packages
+ * \note This method emits \sa package() and \sa changed()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *updatePackages(const QStringList &packageIDs, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Convenience function to update a package
+ * \sa updatePackages(const QStringList &packageIDs, TransactionFlags flags)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *updatePackage(const QString &packageID, Transaction::TransactionFlags flags = Transaction::TransactionFlagOnlyTrusted);
+
+ /**
+ * Searchs for a package providing a file/a mimetype
+ *
+ * \note This method emits \sa package()
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *whatProvides(const QStringList &search, Transaction::Filters filters = Transaction::FilterNone);
+
+ /**
+ * Convenience function to search for what provides
+ * \sa whatProvides(Provides type, const QStringList &search, Transaction::Filters filters = Transaction::FilterNone)
+ *
+ * \warning check \sa error() to know if it the call has any error
+ */
+ static Transaction *whatProvides(const QString &search, Transaction::Filters filters = Transaction::FilterNone);
+
Q_SIGNALS:
+ void isRunningChanged();
+
+ void networkStateChanged();
+
/**
* This signal is emitted when a property on the interface changes.
*/
@@ -409,6 +879,9 @@ protected:
* 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
/**
* This method disconnects from DBus signals
@@ -416,12 +889,17 @@ protected:
* 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
DaemonPrivate * const d_ptr;
private:
- Q_DECLARE_PRIVATE(Daemon);
- Q_PRIVATE_SLOT(d_ptr, void serviceUnregistered());
+ Q_DECLARE_PRIVATE(Daemon)
+ Q_PRIVATE_SLOT(d_func(), void serviceOwnerChanged(QString,QString,QString))
+ Q_PRIVATE_SLOT(d_func(), void propertiesChanged(QString,QVariantMap,QStringList))
+ Q_PRIVATE_SLOT(d_func(), void updateProperties(QVariantMap))
Daemon(QObject *parent = 0);
static Daemon *m_global;
};
diff --git a/src/daemonprivate.cpp b/src/daemonprivate.cpp
index 9765022..6a52f14 100644
--- a/src/daemonprivate.cpp
+++ b/src/daemonprivate.cpp
@@ -24,36 +24,132 @@
#include "common.h"
#include <QDBusConnection>
+#include <QDBusMessage>
+#include <QDBusArgument>
+#include <QDBusReply>
+#include <QDebug>
using namespace PackageKit;
-DaemonPrivate::DaemonPrivate(Daemon* parent) :
- q_ptr(parent)
+DaemonPrivate::DaemonPrivate(Daemon* parent)
+ : q_ptr(parent)
{
m_watcher = new QDBusServiceWatcher(QLatin1String(PK_NAME),
QDBusConnection::systemBus(),
- QDBusServiceWatcher::WatchForUnregistration,
+ QDBusServiceWatcher::WatchForOwnerChange,
q_ptr);
- q_ptr->connect(m_watcher, SIGNAL(serviceUnregistered(QString)),
- SLOT(serviceUnregistered()));
+ q_ptr->connect(m_watcher, SIGNAL(serviceOwnerChanged(QString,QString,QString)),
+ SLOT(serviceOwnerChanged(QString,QString,QString)));
+
+ // On PK 0.9 this will always be async
+ getAllProperties(false);
+}
+
+void DaemonPrivate::serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner)
+{
+ Q_Q(Daemon);
+ Q_UNUSED(service)
+
+ if (newOwner.isEmpty() || !oldOwner.isEmpty()) {
+ // TODO check if we don't emit this twice when
+ // the daemon exits cleanly
+ q->daemonQuit();
+ }
+
+ // There is a new PackageKit running get it's props
+ if (!newOwner.isEmpty()) {
+ // We don't have more transactions running
+ q->transactionListChanged(QStringList());
+
+ getAllProperties(false);
+
+ if (!running) {
+ running = true;
+ q->isRunningChanged();
+ }
+ } else if (running) {
+ running = false;
+ q->isRunningChanged();
+ }
}
-QList<Transaction*> DaemonPrivate::transactions(const QList<QDBusObjectPath> &tids, QObject *parent)
+void DaemonPrivate::getAllProperties(bool sync)
{
- QList<Transaction*> transactionList;
- foreach (const QDBusObjectPath &tid, tids) {
- Transaction *transaction = new Transaction(tid, parent);
- transactionList << transaction;
+ Q_Q(Daemon);
+
+ QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String(PK_NAME),
+ QLatin1String(PK_PATH),
+ QLatin1String(DBUS_PROPERTIES),
+ QLatin1String("GetAll"));
+ message << PK_NAME;
+ if (sync) {
+ QDBusReply<QVariantMap> reply = QDBusConnection::systemBus().call(message);
+ if (reply.isValid()) {
+ updateProperties(reply.value());
+ }
+ } else {
+ QDBusConnection::systemBus().callWithCallback(message,
+ q,
+ SLOT(updateProperties(QVariantMap)));
}
- return transactionList;
}
-void DaemonPrivate::serviceUnregistered()
+void DaemonPrivate::propertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties)
+{
+ Q_UNUSED(interface)
+ Q_UNUSED(invalidatedProperties)
+
+ updateProperties(properties);
+}
+
+void DaemonPrivate::updateProperties(const QVariantMap &properties)
{
Q_Q(Daemon);
- q->daemonQuit();
+ if (!running) {
+ running = true;
+ q->isRunningChanged();
+ }
+
+ QVariantMap::ConstIterator it = properties.constBegin();
+ while (it != properties.constEnd()) {
+ const QString &property = it.key();
+ const QVariant &value = it.value();
+ if (property == QLatin1String("BackendAuthor")) {
+ backendAuthor = value.toString();
+ } else if (property == QLatin1String("BackendDescription")) {
+ backendDescription = value.toString();
+ } else if (property == QLatin1String("BackendName")) {
+ backendName = value.toString();
+ } else if (property == QLatin1String("DistroId")) {
+ distroId = value.toString();
+ } else if (property == QLatin1String("Filters")) {
+ filters = static_cast<Transaction::Filters>(value.toULongLong());
+ } else if (property == QLatin1String("Groups")) {
+ groups = static_cast<Transaction::Groups>(value.toULongLong());
+ } else if (property == QLatin1String("Locked")) {
+ locked = value.toBool();
+ } else if (property == QLatin1String("MimeTypes")) {
+ mimeTypes = value.toStringList();
+ } else if (property == QLatin1String("NetworkState")) {
+ networkState = static_cast<Daemon::Network>(value.toUInt());
+ q->networkStateChanged();
+ } else if (property == QLatin1String("Roles")) {
+ roles = value.toULongLong();
+ } else if (property == QLatin1String("VersionMajor")) {
+ versionMajor = value.toUInt();
+ } else if (property == QLatin1String("VersionMicro")) {
+ versionMicro = value.toUInt();
+ } else if (property == QLatin1String("VersionMinor")) {
+ versionMinor = value.toUInt();
+ } else {
+ qWarning() << "Unknown Transaction property:" << property << value;
+ }
- // We don't have more transactions running
- q->transactionListChanged(QStringList());
+ ++it;
+ }
+
+ if (!properties.isEmpty()) {
+ q->changed();
+ }
}
diff --git a/src/daemonprivate.h b/src/daemonprivate.h
index 0fcb9f1..abc03a7 100644
--- a/src/daemonprivate.h
+++ b/src/daemonprivate.h
@@ -36,19 +36,36 @@ class DaemonPrivate
Q_DECLARE_PUBLIC(Daemon)
protected:
DaemonPrivate(Daemon *parent);
- virtual ~DaemonPrivate() {};
+ virtual ~DaemonPrivate() {}
Daemon *q_ptr;
::DaemonProxy *daemon;
QStringList hints;
- QDBusError lastError;
QStringList connectedSignals;
- QList<Transaction*> transactions(const QList<QDBusObjectPath> &tids, QObject *parent);
void setupSignal(const QString &signal, bool connect);
+ void getAllProperties(bool sync);
+
+ QString backendAuthor;
+ QString backendDescription;
+ QString backendName;
+ QString distroId;
+ Transaction::Filters filters = Transaction::FilterNone;
+ Transaction::Groups groups = Transaction::GroupUnknown;
+ bool locked = false;
+ QStringList mimeTypes;
+ Daemon::Network networkState = Daemon::NetworkUnknown;
+ Transaction::Roles roles = Transaction::RoleUnknown;
+ uint versionMajor = 0;
+ uint versionMicro = 0;
+ uint versionMinor = 0;
+
+ bool running = false;
protected Q_SLOTS:
- void serviceUnregistered();
+ void serviceOwnerChanged(const QString &service, const QString &oldOwner, const QString &newOwner);
+ void propertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties);
+ void updateProperties(const QVariantMap &properties);
private:
QDBusServiceWatcher *m_watcher;
diff --git a/src/details.cpp b/src/details.cpp
new file mode 100644
index 0000000..d7e21e7
--- /dev/null
+++ b/src/details.cpp
@@ -0,0 +1,68 @@
+/*
+ * This file is part of the PackageKitQt project
+ * Copyright (C) 2014 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 "details.h"
+
+#include <QVariant>
+
+PackageKit::Details::Details()
+{
+
+}
+
+PackageKit::Details::Details(const QVariantMap &other) :
+ QVariantMap(other)
+{
+}
+
+QString PackageKit::Details::packageId() const
+{
+ return value(QLatin1String("package-id")).toString();
+}
+
+QString PackageKit::Details::description() const
+{
+ return value(QLatin1String("description")).toString();
+}
+
+PackageKit::Transaction::Group PackageKit::Details::group() const
+{
+ return static_cast<Transaction::Transaction::Group>(value(QLatin1String("group")).toUInt());
+}
+
+QString PackageKit::Details::summary() const
+{
+ return value(QLatin1String("summary")).toString();
+}
+
+QString PackageKit::Details::url() const
+{
+ return value(QLatin1String("url")).toString();
+}
+
+QString PackageKit::Details::license() const
+{
+ return value(QLatin1String("license")).toString();
+}
+
+qulonglong PackageKit::Details::size() const
+{
+ return value(QLatin1String("size")).toULongLong();
+}
diff --git a/src/details.h b/src/details.h
new file mode 100644
index 0000000..62bd1b5
--- /dev/null
+++ b/src/details.h
@@ -0,0 +1,55 @@
+/*
+ * This file is part of the PackageKitQt project
+ * Copyright (C) 2014 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 DETAILS_H
+#define DETAILS_H
+
+#include <QVariantMap>
+
+#include "transaction.h"
+
+namespace PackageKit {
+
+class Details : public QVariantMap
+{
+public:
+ Details();
+
+ Details(const QVariantMap &other);
+
+ QString packageId() const;
+
+ QString description() const;
+
+ Transaction::Group group() const;
+
+ QString summary() const;
+
+ QString url() const;
+
+ QString license() const;
+
+ qulonglong size() const;
+
+};
+
+}
+
+#endif // DETAILS_H
diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt
old mode 100644
new mode 100755
index d97a84a..f80f595
--- 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-qt2-config.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2-config.cmake
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config.cmake
@ONLY
)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt2-config-version.cmake.in
- ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2-config-version.cmake
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/packagekit-qt-config-version.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config-version.cmake
@ONLY
)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2-config.cmake
- ${CMAKE_CURRENT_BINARY_DIR}/packagekit-qt2-config-version.cmake
- DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/packagekit-qt2/
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/${LIBNAME}-config-version.cmake
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${LIBNAME}/
)
diff --git a/src/modules/packagekit-qt2-config-version.cmake.in b/src/modules/packagekit-qt-config-version.cmake.in
similarity index 100%
rename from src/modules/packagekit-qt2-config-version.cmake.in
rename to src/modules/packagekit-qt-config-version.cmake.in
diff --git a/src/modules/packagekit-qt-config.cmake.in b/src/modules/packagekit-qt-config.cmake.in
new file mode 100644
index 0000000..f9f4436
--- /dev/null
+++ b/src/modules/packagekit-qt-config.cmake.in
@@ -0,0 +1,11 @@
+# - Config information for PackageKit-Qt at QT_VERSION@
+# This file defines:
+#
+# PackageKitQt at QT_VERSION@_INCLUDE_DIR - the PackageKitQt at QT_VERSION@ include directory
+# PackageKitQt at QT_VERSION@_LIBRARIES - Link these to use PackageKitQt at QT_VERSION@
+
+SET(prefix "@CMAKE_INSTALL_PREFIX@")
+SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
+SET(PackageKitQt at QT_VERSION@_LIBRARIES "@PKQT_INSTALL_LIBDIR@/lib at LIBNAME@.so" CACHE FILEPATH "Libraries for PackageKitQt at QT_VERSION@")
+SET(PackageKitQt at QT_VERSION@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PackageKit/@LIBNAME@" CACHE PATH "Include path for PackageKitQt at QT_VERSION@")
+SET(PackageKitQt at QT_VERSION@_FOUND "TRUE")
diff --git a/src/modules/packagekit-qt2-config.cmake.in b/src/modules/packagekit-qt2-config.cmake.in
deleted file mode 100644
index 0c5288e..0000000
--- a/src/modules/packagekit-qt2-config.cmake.in
+++ /dev/null
@@ -1,11 +0,0 @@
-# - Config information for PackageKit-Qt2
-# This file defines:
-#
-# PACKAGEKIT_QT2_INCLUDE_DIR - the PackageKitQt2 include directory
-# PACKAGEKIT_QT2_LIBRARIES - Link these to use PackageKitQt2
-
-SET(prefix "@CMAKE_INSTALL_PREFIX@")
-SET(exec_prefix "@CMAKE_INSTALL_PREFIX@")
-SET(PACKAGEKIT_QT2_LIBRARIES "@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/libpackagekit-qt2.so" CACHE FILEPATH "Libraries for PackageKit-Qt2")
-SET(PACKAGEKIT_QT2_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include/PackageKit/packagekit-qt2" CACHE PATH "Include path for PackageKit-Qt2")
-SET(PACKAGEKIT_QT2_FOUND "TRUE")
diff --git a/src/packagekit-qt2.pc.in b/src/packagekitqt4.pc.in
old mode 100644
new mode 100755
similarity index 69%
rename from src/packagekit-qt2.pc.in
rename to src/packagekitqt4.pc.in
index ca63c61..449bbe2
--- a/src/packagekit-qt2.pc.in
+++ b/src/packagekitqt4.pc.in
@@ -3,9 +3,9 @@ exec_prefix=${prefix}
libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@
includedir=${prefix}/include
-Name: packagekit-qt2
+Name: @LIBNAME@
Description: PackageKit is a system daemon for installing stuff.
Version: @VERSION@
Requires: QtCore, QtDBus, QtSql, QtXml
-Libs: -L${libdir} -lpackagekit-qt2
-Cflags: -I${includedir}/PackageKit/packagekit-qt2
+Libs: -L${libdir} -l at LIBNAME@
+Cflags: -I${includedir}/PackageKit/@LIBNAME@
diff --git a/src/packagekitqt5.pc.in b/src/packagekitqt5.pc.in
new file mode 100644
index 0000000..0b2f476
--- /dev/null
+++ b/src/packagekitqt5.pc.in
@@ -0,0 +1,11 @@
+prefix=@CMAKE_INSTALL_PREFIX@
+exec_prefix=${prefix}
+libdir=@PKQT_INSTALL_LIBDIR@
+includedir=${prefix}/include
+
+Name: @LIBNAME@
+Description: PackageKit is a system daemon for installing stuff.
+Version: @VERSION@
+Requires: Qt5Core, Qt5DBus, Qt5Sql, Qt5Xml
+Libs: -L${libdir} -l at LIBNAME@
+Cflags: -I${includedir}/PackageKit/@LIBNAME@
diff --git a/src/transaction.cpp b/src/transaction.cpp
old mode 100644
new mode 100755
index e9966c9..0ed97e1
--- a/src/transaction.cpp
+++ b/src/transaction.cpp
@@ -29,32 +29,26 @@
#include <QSqlQuery>
#include <QDBusError>
-#define RUN_TRANSACTION(blurb) \
- Q_D(Transaction); \
- if (init()) { \
- QDBusPendingReply<> r = d->p->blurb; \
- r.waitForFinished(); \
- if (r.isError()) { \
- d->error = Transaction::parseError(r.error().name()); \
- d->errorMessage = r.error().message(); \
- } \
- } \
-
using namespace PackageKit;
-Transaction::Transaction(QObject *parent) :
- QObject(parent),
- d_ptr(new TransactionPrivate(this))
+Transaction::Transaction()
+ : d_ptr(new TransactionPrivate(this))
{
connect(Daemon::global(), SIGNAL(daemonQuit()), SLOT(daemonQuit()));
+
+ QDBusPendingReply<QDBusObjectPath> reply = Daemon::global()->createTransaction();
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);
+ connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ this, SLOT(createTransactionFinished(QDBusPendingCallWatcher*)));
}
-Transaction::Transaction(const QDBusObjectPath &tid, QObject *parent) :
- QObject(parent),
- d_ptr(new TransactionPrivate(this))
+Transaction::Transaction(const QDBusObjectPath &tid)
+ : d_ptr(new TransactionPrivate(this))
{
+ Q_D(Transaction);
+
connect(Daemon::global(), SIGNAL(daemonQuit()), SLOT(daemonQuit()));
- init(tid);
+ d->setup(tid);
}
void Transaction::connectNotify(const char *signal)
@@ -66,6 +60,15 @@ 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)
{
Q_D(Transaction);
@@ -77,6 +80,20 @@ 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)
{
Q_Q(Transaction);
@@ -84,15 +101,12 @@ void TransactionPrivate::setupSignal(const QString &signal, bool connect)
const char *signalToConnect = 0;
const char *memberToConnect = 0;
- if (signal == SIGNAL(changed())) {
- signalToConnect = SIGNAL(Changed());
- memberToConnect = SIGNAL(changed());
- } else if (signal == SIGNAL(category(QString,QString,QString,QString,QString))) {
+ if (signal == SIGNAL(category(QString,QString,QString,QString,QString))) {
signalToConnect = SIGNAL(Category(QString,QString,QString,QString,QString));
memberToConnect = SIGNAL(category(QString,QString,QString,QString,QString));
- } else if (signal == SIGNAL(details(QString,QString,PackageKit::Transaction::Group,QString,QString,qulonglong))) {
- signalToConnect = SIGNAL(Details(QString,QString,uint,QString,QString,qulonglong));
- memberToConnect = SLOT(Details(QString,QString,uint,QString,QString,qulonglong));
+ } else if (signal == SIGNAL(details(PackageKit::Details))) {
+ signalToConnect = SIGNAL(Details(QVariantMap));
+ memberToConnect = SLOT(details(QVariantMap));
} else if (signal == SIGNAL(distroUpgrade(PackageKit::Transaction::DistroUpgrade,QString,QString))) {
signalToConnect = SIGNAL(DistroUpgrade(uint,QString,QString));
memberToConnect = SLOT(distroUpgrade(uint,QString,QString));
@@ -146,83 +160,10 @@ void TransactionPrivate::setupSignal(const QString &signal, bool connect)
}
}
-bool Transaction::init(const QDBusObjectPath &tid)
-{
- Q_D(Transaction);
-
- if (d->p) {
- return true;
- }
-
- if (!tid.path().isNull()) {
- d->tid = tid;
- } else {
- d->tid = Daemon::global()->getTid();
- if (d->tid.path().isNull()) {
- d->error = Transaction::InternalErrorFailed;
- if (Daemon::global()->lastError().isValid()) {
- d->errorMessage = Daemon::global()->lastError().message();
- }
- return false;
- }
- }
-
- d->p = new TransactionProxy(QLatin1String(PK_NAME),
- d->tid.path(),
- QDBusConnection::systemBus(),
- this);
- d->error = Transaction::InternalErrorNone;
- d->errorMessage.clear();
- if (!Daemon::global()->hints().isEmpty()) {
- setHints(Daemon::global()->hints());
- }
-
- connect(d->p, SIGNAL(Destroy()),
- SLOT(destroy()));
-
- QStringList currentSignals = d->connectedSignals;
- currentSignals.removeDuplicates();
- foreach (const QString &signal, currentSignals) {
- d->setupSignal(signal, true);
- }
- return true;
-}
-
-Transaction::Transaction(const QDBusObjectPath &tid,
- const QString ×pec,
- bool succeeded,
- Role role,
- uint duration,
- const QString &data,
- uint uid,
- const QString &cmdline,
- QObject *parent) :
- QObject(parent),
- d_ptr(new TransactionPrivate(this))
-{
- Q_D(Transaction);
- d->tid = tid;
- d->timespec = QDateTime::fromString(timespec, Qt::ISODate);
- d->succeeded = succeeded;
- d->role = role;
- d->duration = duration;
- d->data = data;
- d->uid = uid;
- d->cmdline = cmdline;
- d->error = InternalErrorNone;
-}
-
Transaction::~Transaction()
{
- Q_D(Transaction);
-// qDebug() << "Destroying transaction with tid" << d->tid;
- delete d;
-}
-
-void Transaction::reset()
-{
- Q_D(Transaction);
- d->destroy();
+// qDebug() << "Destroying transaction with tid" << d_ptr->tid.path();
+ delete d_ptr;
}
QDBusObjectPath Transaction::tid() const
@@ -231,48 +172,25 @@ QDBusObjectPath Transaction::tid() const
return d->tid;
}
-Transaction::InternalError Transaction::error() const
-{
- Q_D(const Transaction);
- return d->error;
-}
-
-Transaction::InternalError Transaction::internalError() const
-{
- Q_D(const Transaction);
- return d->error;
-}
-
-QString Transaction::internalErrorMessage() const
-{
- Q_D(const Transaction);
- return d->errorMessage;
-}
-
bool Transaction::allowCancel() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->allowCancel();
- }
- return false;
+ return d->allowCancel;
}
bool Transaction::isCallerActive() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->callerActive();
- }
- return false;
+ return d->callerActive;
}
-void Transaction::cancel()
+QDBusPendingReply<> Transaction::cancel()
{
Q_D(const Transaction);
if (d->p) {
- RUN_TRANSACTION(Cancel())
+ return d->p->Cancel();
}
+ return QDBusPendingReply<>();
}
QString Transaction::packageName(const QString &packageID)
@@ -333,95 +251,69 @@ QString Transaction::packageIcon(const QString &packageID)
QString Transaction::lastPackage() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->lastPackage();
- }
- return QString();
+ return d->lastPackage;
}
uint Transaction::percentage() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->percentage();
- }
- return 0;
+ return d->percentage;
}
uint Transaction::elapsedTime() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->elapsedTime();
- }
- return 0;
+ return d->elapsedTime;
}
uint Transaction::remainingTime() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->remainingTime();
- }
- return 0;
+ return d->remainingTime;
}
uint Transaction::speed() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->speed();
- }
- return 0;
+ return d->speed;
}
qulonglong Transaction::downloadSizeRemaining() const
{
Q_D(const Transaction);
- if (d->p) {
- return d->p->downloadSizeRemaining();
- }
- return 0;
+ return d->downloadSizeRemaining;
}
Transaction::Role Transaction::role() const
{
Q_D(const Transaction);
- if (d->p) {
- return static_cast<Transaction::Role>(d->p->role());
- }
return d->role;
}
-void Transaction::setHints(const QStringList &hints)
+QDBusPendingReply<> Transaction::setHints(const QStringList &hints)
{
Q_D(Transaction);
if (d->p) {
- d->p->SetHints(hints);
+ return d->p->SetHints(hints);
}
+ return QDBusPendingReply<>();
}
-void Transaction::setHints(const QString &hints)
+QDBusPendingReply<> Transaction::setHints(const QString &hints)
{
- setHints(QStringList() << hints);
+ return setHints(QStringList() << hints);
}
Transaction::Status Transaction::status() const
{
Q_D(const Transaction);
- if (d->p) {
- return static_cast<Transaction::Status>(d->p->status());
- }
- return Transaction::StatusUnknown;
+ return d->status;
}
Transaction::TransactionFlags Transaction::transactionFlags() const
{
Q_D(const Transaction);
- if (d->p) {
- return static_cast<Transaction::TransactionFlags>(d->p->transactionFlags());
- }
- return Transaction::TransactionFlagNone;
+ return d->transactionFlags;
}
QDateTime Transaction::timespec() const
@@ -451,9 +343,6 @@ QString Transaction::data() const
uint Transaction::uid() const
{
Q_D(const Transaction);
- if(d->p) {
- return d->p->uid();
- }
return d->uid;
}
@@ -463,251 +352,6 @@ QString Transaction::cmdline() const
return d->cmdline;
}
-void Transaction::acceptEula(const QString &eulaId)
-{
- RUN_TRANSACTION(AcceptEula(eulaId))
-}
-
-void Transaction::downloadPackages(const QStringList &packageIDs, bool storeInCache)
-{
- RUN_TRANSACTION(DownloadPackages(storeInCache, packageIDs))
-}
-
-void Transaction::downloadPackage(const QString &packageID, bool storeInCache)
-{
- downloadPackages(QStringList() << packageID, storeInCache);
-}
-
-void Transaction::getCategories()
-{
- RUN_TRANSACTION(GetCategories())
-}
-
-void Transaction::getDepends(const QStringList &packageIDs, Transaction::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(GetDepends(filters, packageIDs, recursive))
-}
-
-void Transaction::getDepends(const QString &packageID, Transaction::Filters filters, bool recursive)
-{
- getDepends(QStringList() << packageID, filters, recursive);
-}
-
-void Transaction::getDetails(const QStringList &packageIDs)
-{
- RUN_TRANSACTION(GetDetails(packageIDs))
-}
-
-void Transaction::getDetails(const QString &packageID)
-{
- getDetails(QStringList() << packageID);
-}
-
-void Transaction::getFiles(const QStringList &packageIDs)
-{
- RUN_TRANSACTION(GetFiles(packageIDs))
-}
-
-void Transaction::getFiles(const QString &packageID)
-{
- getFiles(QStringList() << packageID);
-}
-
-void Transaction::getOldTransactions(uint number)
-{
- RUN_TRANSACTION(GetOldTransactions(number))
-}
-
-void Transaction::getPackages(Transaction::Filters filters)
-{
- RUN_TRANSACTION(GetPackages(filters))
-}
-
-void Transaction::getRepoList(Transaction::Filters filters)
-{
- RUN_TRANSACTION(GetRepoList(filters))
-}
-
-void Transaction::getRequires(const QStringList &packageIDs, Transaction::Filters filters, bool recursive)
-{
- RUN_TRANSACTION(GetRequires(filters, packageIDs, recursive))
-}
-
-void Transaction::getRequires(const QString &packageID, Transaction::Filters filters, bool recursive)
-{
- getRequires(QStringList() << packageID, filters, recursive);
-}
-
-void Transaction::getUpdatesDetails(const QStringList &packageIDs)
-{
- RUN_TRANSACTION(GetUpdateDetail(packageIDs))
-}
-
-void Transaction::getUpdateDetail(const QString &packageID)
-{
- getUpdatesDetails(QStringList() << packageID);
-}
-
-void Transaction::getUpdates(Transaction::Filters filters)
-{
- RUN_TRANSACTION(GetUpdates(filters))
-}
-
-void Transaction::getDistroUpgrades()
-{
- RUN_TRANSACTION(GetDistroUpgrades())
-}
-
-void Transaction::installFiles(const QStringList &files, TransactionFlags flags)
-{
- RUN_TRANSACTION(InstallFiles(flags, files))
-}
-
-void Transaction::installFile(const QString &file, TransactionFlags flags)
-{
- installFiles(QStringList() << file, flags);
-}
-
-void Transaction::installPackages(const QStringList &packageIDs, TransactionFlags flags)
-{
- RUN_TRANSACTION(InstallPackages(flags, packageIDs))
-}
-
-void Transaction::installPackage(const QString &packageID, TransactionFlags flags)
-{
- installPackages(QStringList() << packageID, flags);
-}
-
-void Transaction::installSignature(SigType type, const QString &keyID, const QString &packageID)
-{
- RUN_TRANSACTION(InstallSignature(type, keyID, packageID))
-}
-
-void Transaction::refreshCache(bool force)
-{
- RUN_TRANSACTION(RefreshCache(force))
-}
-
-void Transaction::removePackages(const QStringList &packageIDs, bool allowDeps, bool autoremove, TransactionFlags flags)
-{
- RUN_TRANSACTION(RemovePackages(flags, packageIDs, allowDeps, autoremove))
-}
-
-void Transaction::removePackage(const QString &packageID, bool allowDeps, bool autoremove, TransactionFlags flags)
-{
- removePackages(QStringList() << packageID, allowDeps, autoremove, flags);
-}
-
-void Transaction::repairSystem(TransactionFlags flags)
-{
- RUN_TRANSACTION(RepairSystem(flags))
-}
-
-void Transaction::repoEnable(const QString &repoId, bool enable)
-{
- RUN_TRANSACTION(RepoEnable(repoId, enable))
-}
-
-void Transaction::repoSetData(const QString &repoId, const QString ¶meter, const QString &value)
-{
- RUN_TRANSACTION(RepoSetData(repoId, parameter, value))
-}
-
-void Transaction::resolve(const QStringList &packageNames, Transaction::Filters filters)
-{
- RUN_TRANSACTION(Resolve(filters, packageNames))
-}
-
-void Transaction::resolve(const QString &packageName, Transaction::Filters filters)
-{
- resolve(QStringList() << packageName, filters);
-}
-
-void Transaction::searchFiles(const QStringList &search, Transaction::Filters filters)
-{
- RUN_TRANSACTION(SearchFiles(filters, search))
-}
-
-void Transaction::searchFiles(const QString &search, Transaction::Filters filters)
-{
- searchFiles(QStringList() << search, filters);
-}
-
-void Transaction::searchDetails(const QStringList &search, Transaction::Filters filters)
-{
- RUN_TRANSACTION(SearchDetails(filters, search))
-}
-
-void Transaction::searchDetails(const QString &search, Transaction::Filters filters)
-{
- searchDetails(QStringList() << search, filters);
-}
-
-void Transaction::searchGroups(const QStringList &groups, Transaction::Filters filters)
-{
- RUN_TRANSACTION(SearchGroups(filters, groups))
-}
-
-void Transaction::searchGroup(const QString &group, Transaction::Filters filters)
-{
- searchGroups(QStringList() << group, filters);
-}
-
-void Transaction::searchGroup(Group group, Filters filters)
-{
- QString groupString = Daemon::enumToString<Transaction>(group, "Group");
- searchGroup(groupString, filters);
-}
-
-void Transaction::searchGroups(Groups groups, Transaction::Filters filters)
-{
- QStringList groupsStringList;
- for (int i = 1; i < 64; ++i) {
- if (groups & i) {
- Transaction::Group group = static_cast<Transaction::Group>(i);
- if (group != Transaction::GroupUnknown) {
- groupsStringList << Daemon::enumToString<Transaction>(group, "Group");
- }
- }
- }
- searchGroups(groupsStringList, filters);
-}
-
-void Transaction::searchNames(const QStringList &search, Transaction::Filters filters)
-{
- RUN_TRANSACTION(SearchNames(filters, search))
-}
-
-void Transaction::searchNames(const QString &search, Transaction::Filters filters)
-{
- searchNames(QStringList() << search, filters);
-}
-
-void Transaction::updatePackages(const QStringList &packageIDs, TransactionFlags flags)
-{
- RUN_TRANSACTION(UpdatePackages(flags, packageIDs))
-}
-
-void Transaction::updatePackage(const QString &packageID, TransactionFlags flags)
-{
- updatePackages(QStringList() << packageID, flags);
-}
-
-void Transaction::upgradeSystem(const QString &distroId, UpgradeKind kind)
-{
- RUN_TRANSACTION(UpgradeSystem(distroId, kind))
-}
-
-void Transaction::whatProvides(Transaction::Provides type, const QStringList &search, Transaction::Filters filters)
-{
- RUN_TRANSACTION(WhatProvides(filters, type, search))
-}
-
-void Transaction::whatProvides(Transaction::Provides type, const QString &search, Transaction::Filters filters)
-{
- whatProvides(type, QStringList() << search, filters);
-}
-
Transaction::InternalError Transaction::parseError(const QString &errorName)
{
QString error = errorName;
@@ -745,3 +389,4 @@ Transaction::InternalError Transaction::parseError(const QString &errorName)
}
#include "transaction.moc"
+
diff --git a/src/transaction.h b/src/transaction.h
index ad1f14e..2b03f41 100644
--- a/src/transaction.h
+++ b/src/transaction.h
@@ -25,11 +25,14 @@
#include <QtCore/QObject>
#include <QtCore/QDateTime>
#include <QtDBus/QDBusObjectPath>
+#include <QtDBus/QDBusPendingReply>
#include "bitfield.h"
namespace PackageKit {
+class Details;
+
/**
* \class Transaction transaction.h Transaction
* \author Adrien Bustany \e <madcat at mymadcat.com>
@@ -40,8 +43,7 @@ namespace PackageKit {
* A Transaction is created whenever you do an asynchronous action (for example a Search, Install...).
* This class allows you to monitor and control the flow of the action.
*
-* You should delete the transaction after finished() is emitted,
-* or use the reset() method to reuse it
+* You should delete the transaction after finished() is emitted
*
* \sa Daemon
*/
@@ -49,7 +51,6 @@ class TransactionPrivate;
class Transaction : public QObject
{
Q_OBJECT
- Q_ENUMS(InternalError)
Q_ENUMS(Role)
Q_ENUMS(Error)
Q_ENUMS(Exit)
@@ -67,27 +68,24 @@ class Transaction : public QObject
Q_ENUMS(Filter)
Q_FLAGS(TransactionFlag TransactionFlags)
Q_FLAGS(Filter Filters)
- Q_PROPERTY(QDBusObjectPath tid READ tid NOTIFY changed)
- Q_PROPERTY(InternalError error READ internalError NOTIFY changed)
- Q_PROPERTY(InternalError internalError READ internalError NOTIFY changed)
- Q_PROPERTY(QString internalErrorMessage READ internalErrorMessage NOTIFY changed)
- Q_PROPERTY(bool allowCancel READ allowCancel NOTIFY changed)
- Q_PROPERTY(bool isCallerActive READ isCallerActive NOTIFY changed)
- Q_PROPERTY(QString lastPackage READ lastPackage NOTIFY changed)
- Q_PROPERTY(uint percentage READ percentage NOTIFY changed)
- Q_PROPERTY(uint elapsedTime READ elapsedTime NOTIFY changed)
- Q_PROPERTY(uint remainingTime READ remainingTime NOTIFY changed)
- Q_PROPERTY(uint speed READ speed NOTIFY changed)
- Q_PROPERTY(qulonglong downloadSizeRemaining READ downloadSizeRemaining)
- Q_PROPERTY(Role role READ role NOTIFY changed)
- Q_PROPERTY(Status status READ status NOTIFY changed)
- Q_PROPERTY(TransactionFlags transactionFlags READ transactionFlags NOTIFY changed)
- Q_PROPERTY(QDateTime timespec READ timespec NOTIFY changed)
- Q_PROPERTY(bool succeeded READ succeeded NOTIFY changed)
- Q_PROPERTY(uint duration READ duration NOTIFY changed)
- Q_PROPERTY(QString data READ data NOTIFY changed)
- Q_PROPERTY(uint uid READ uid NOTIFY changed)
- Q_PROPERTY(QString cmdline READ cmdline NOTIFY changed)
+ Q_PROPERTY(QDBusObjectPath tid READ tid)
+ Q_PROPERTY(bool allowCancel READ allowCancel NOTIFY allowCancelChanged)
+ Q_PROPERTY(bool isCallerActive READ isCallerActive NOTIFY isCallerActiveChanged)
+ Q_PROPERTY(QString lastPackage READ lastPackage NOTIFY lastPackageChanged)
+ Q_PROPERTY(uint percentage READ percentage NOTIFY percentageChanged)
+ Q_PROPERTY(uint elapsedTime READ elapsedTime NOTIFY elapsedTimeChanged)
+ Q_PROPERTY(uint remainingTime READ remainingTime NOTIFY remainingTimeChanged)
+ Q_PROPERTY(uint speed READ speed NOTIFY speedChanged)
+ Q_PROPERTY(qulonglong downloadSizeRemaining READ downloadSizeRemaining NOTIFY downloadSizeRemainingChanged)
+ Q_PROPERTY(Role role READ role NOTIFY roleChanged)
+ Q_PROPERTY(Status status READ status NOTIFY statusChanged)
+ Q_PROPERTY(TransactionFlags transactionFlags READ transactionFlags NOTIFY transactionFlagsChanged)
+ Q_PROPERTY(QDateTime timespec READ timespec)
+ Q_PROPERTY(bool succeeded READ succeeded)
+ Q_PROPERTY(uint duration READ duration)
+ Q_PROPERTY(QString data READ data)
+ Q_PROPERTY(uint uid READ uid NOTIFY uidChanged)
+ Q_PROPERTY(QString cmdline READ cmdline)
public:
/**
* Describes an error at the daemon level (for example, PackageKit crashes or is unreachable)
@@ -115,12 +113,12 @@ public:
enum Role {
RoleUnknown,
RoleCancel,
- RoleGetDepends,
+ RoleDependsOn,
RoleGetDetails,
RoleGetFiles,
RoleGetPackages,
RoleGetRepoList,
- RoleGetRequires,
+ RoleRequiredBy,
RoleGetUpdateDetail,
RoleGetUpdates,
RoleInstallFiles,
@@ -142,8 +140,11 @@ public:
RoleGetDistroUpgrades,
RoleGetCategories,
RoleGetOldTransactions,
- RoleUpgradeSystem, // Since 0.6.11
- RoleRepairSystem // Since 0.7.2
+ RoleUpgradeSystem, // Since 0.6.11
+ RoleRepairSystem, // Since 0.7.2
+ RoleGetDetailsLocal, // Since 0.8.17
+ RoleGetFilesLocal, // Since 0.9.1
+ RoleRepoRemove // Since 0.9.1
};
typedef Bitfield Roles;
@@ -349,26 +350,6 @@ public:
MediaTypeDisc
};
- /**
- * Enum used to describe a "provides" request
- * \sa whatProvides
- */
- enum Provides {
- ProvidesUnknown,
- ProvidesAny,
- ProvidesModalias,
- ProvidesCodec,
- ProvidesMimetype,
- ProvidesFont,
- ProvidesHardwareDriver,
- ProvidesPostscriptDriver,
- ProvidesPlasmaService,
- ProvidesSharedLib,
- ProvidesPythonModule,
- ProvidesLanguageSupport
- };
- Q_DECLARE_FLAGS(ProvidesFlag, Provides)
-
/**
* Describes an distro upgrade state
*/
@@ -378,17 +359,6 @@ public:
DistroUpgradeUnstable
};
- /**
- * Describes the type of distribution upgrade to perform
- * \sa upgradeSystem()
- */
- enum UpgradeKind {
- UpgradeKindUnknown,
- UpgradeKindMinimal,
- UpgradeKindDefault,
- UpgradeKindComplete
- };
-
/**
* Describes the type of distribution upgrade to perform
* \sa upgradeSystem()
@@ -505,27 +475,18 @@ public:
SigTypeGpg
};
- /**
- * Create a transaction object with a new transaction id
- *
- * The transaction object \b cannot be reused
- * (i.e. removePackages then installPackages)
- *
- */
- Transaction(QObject *parent = 0);
-
/**
* Create a transaction object with transaction id \p tid
- * \note The if \p tid is a NULL string then it will automatically
- * asks PackageKit for a tid
*
- * The transaction object \b cannot be reused
- * (i.e. removePackages then installPackages)
+ * Before using any members wait for roleChanged() signal
+ * to be emitted, this is because we ask for the Transaction
+ * properties in async mode.
+ *
+ * The transaction is automatically deleted once finished()
+ * is emitted.
*
- * \warning after creating the transaction object be sure
- * to verify if it doesn't have any error()
*/
- Transaction(const QDBusObjectPath &tid, QObject *parent = 0);
+ Transaction(const QDBusObjectPath &tid);
/**
* Destructor
@@ -541,30 +502,6 @@ public:
*/
QDBusObjectPath tid() const;
- /**
- * \brief Returns the error status of the Transaction
- *
- * \return A value from TransactionError describing the state of the transaction
- * or 0 in case of not having an error
- */
- Q_DECL_DEPRECATED InternalError error() const;
-
- /**
- * \brief Returns the error status of the Transaction
- *
- * \return A value from TransactionError describing the state of the transaction
- * or 0 in case of not having an error
- */
- InternalError internalError() const;
-
- /**
- * \brief Returns the error message of the Transaction startup
- *
- * \return a string in case an error was set when trying to
- * perform an action
- */
- QString internalErrorMessage() const;
-
/**
* Indicates whether you can cancel the transaction or not
* i.e. the backend forbids cancelling the transaction while
@@ -702,477 +639,20 @@ public:
*
* \sa Daemon::setHints
*/
- Q_INVOKABLE void setHints(const QStringList &hints);
+ QDBusPendingReply<> setHints(const QStringList &hints);
/**
* Convenience function to set this transaction \p hints
* \sa getDetails(const QStringList &hints)
*/
- Q_INVOKABLE void setHints(const QString &hints);
-
- /**
- * Reset the transaction for reuse
- */
- Q_INVOKABLE void reset();
-
- /**
- * \brief Accepts an EULA
- *
- * The EULA is identified by the \sa Eula structure \p info
- *
- * \note You need to manually restart the transaction which triggered the EULA.
- * \sa eulaRequired()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void acceptEula(const QString &eulaID);
-
- /**
- * Download the given \p packages to a temp dir, if \p storeInCache is true
- * the download will be stored in the package manager cache
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void downloadPackages(const QStringList &packageIDs, bool storeInCache = false);
-
- /**
- * This is a convenience function to download this \p package
- * \sa downloadPackages(const QStringList &packageIDs, bool storeInCache = false)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void downloadPackage(const QString &packageID, bool storeInCache = false);
-
- /**
- * Returns the collection categories
- *
- * \sa category
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getCategories();
-
- /**
- * \brief Gets the list of dependencies for the given \p packages
- *
- * You can use the \p filters to limit the results to certain packages.
- * The \p recursive flag indicates if the package manager should also
- * fetch the dependencies's dependencies.
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getDepends(const QStringList &packageIDs, Filters filters, bool recursive = false);
-
- /**
- * Convenience function to get the dependencies of this \p package
- * \sa getDetails(const QStringList &packageIDs, Filters filters, bool recursive = false)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getDepends(const QString &packageID, Filters filters , bool recursive = false);
-
- /**
- * Gets more details about the given \p packages
- *
- * \sa Transaction::details
- * \note This method emits \sa package()
- * with details set
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getDetails(const QStringList &packageIDs);
-
- /**
- * Convenience function to get the details about this \p package
- * \sa getDetails(const QStringList &packageIDs)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getDetails(const QString &packageID);
-
- /**
- * Gets the files contained in the given \p packages
- *
- * \note This method emits \sa files()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getFiles(const QStringList &packageIDs);
-
- /**
- * Convenience function to get the files contained in this \p package
- * \sa getRequires(const QStringList &packageIDs)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getFiles(const QString &packageIDs);
-
- /**
- * \brief Gets the last \p number finished transactions
- *
- * \note You must delete these transactions yourself
- * \note This method emits \sa transaction()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getOldTransactions(uint number);
-
- /**
- * Gets all the packages matching the given \p filters
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getPackages(Filters filters = FilterNone);
-
- /**
- * Gets the list of software repositories matching the given \p filters
- *
- * \note This method emits \sa repository()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getRepoList(Filters filter = FilterNone);
-
- /**
- * \brief Searches for the packages requiring the given \p packages
- *
- * The search can be limited using the \p filters parameter.
- * The \p recursive flag is used to tell if the package manager should
- * also search for the package requiring the resulting packages.
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getRequires(const QStringList &packageIDs, Filters filters, bool recursive = false);
-
- /**
- * Convenience function to get packages requiring this package
- * \sa getRequires(const QStringList &packageIDs, Filters filters, bool recursive = false)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getRequires(const QString &packageID, Filters filters, bool recursive = false);
-
- /**
- * Retrieves more details about the update for the given \p packageIDs
- *
- * \note This method emits \sa updateDetail()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getUpdatesDetails(const QStringList &packageIDs);
-
- /**
- * Convenience function to get update details
- * \sa getUpdateDetail(const QStringList &packageIDs)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getUpdateDetail(const QString &packageID);
-
- /**
- * \p Gets the available updates
- *
- * The \p filters parameters can be used to restrict the updates returned
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getUpdates(Filters filters = FilterNone);
-
- /**
- * Retrieves the available distribution upgrades
- *
- * \note This method emits \sa distroUpgrade()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void getDistroUpgrades();
-
- /**
- * \brief Installs the local packages \p files
- *
- * \p onlyTrusted indicate if the packages are signed by a trusted authority
- *
- * \note This method emits \sa package() and \sa changed()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void installFiles(const QStringList &files, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Convenience function to install a file
- * \sa installFiles(const QStringList &files, TransactionFlags flags)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void installFile(const QString &file, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Install the given \p packages
- *
- * \p only_trusted indicates if we should allow installation of untrusted packages (requires a different authorization)
- *
- * \note This method emits \sa package() and \sa changed()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void installPackages(const QStringList &packageIDs, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Convenience function to install a package
- * \sa installPackages(const QStringList &packageIDs, TransactionFlags flags)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void installPackage(const QString &packageID, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * \brief Installs a signature
- *
- * \p type, \p keyId and \p package generally come from the Transaction::repoSignatureRequired
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void installSignature(SigType type, const QString &keyID, const QString &packageID);
-
- /**
- * Refreshes the package manager's cache
- *
- * \note This method emits \sa changed()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void refreshCache(bool force);
-
- /**
- * \brief Removes the given \p packages
- *
- * \p allowDeps if the package manager has the right to remove other packages which depend on the
- * packages to be removed. \p autoRemove tells the package manager to remove all the package which
- * won't be needed anymore after the packages are uninstalled.
- *
- * \note This method emits \sa package() and \sa changed()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void removePackages(const QStringList &packageIDs, bool allowDeps = false, bool autoRemove = false, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Convenience function to remove a package
- *
- * \sa removePackages(const PackageList &packages, bool allowDeps = false, bool autoRemove = false, TransactionFlags flags)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void removePackage(const QString &packageID, bool allowDeps = false, bool autoRemove = false, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Repairs a broken system
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void repairSystem(TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Activates or disables a repository
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void repoEnable(const QString &repoId, bool enable = true);
-
- /**
- * Sets a repository's parameter
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void repoSetData(const QString &repoId, const QString ¶meter, const QString &value);
-
- /**
- * \brief Tries to create a Package object from the package's name
- *
- * The \p filters can be used to restrict the search
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void resolve(const QStringList &packageNames, Filters filters = FilterNone);
-
- /**
- * Convenience function to remove a package name
- * \sa resolve(const QStringList &packageNames, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void resolve(const QString &packageName, Filters filters = FilterNone);
-
- /**
- * \brief Search in the packages files
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchFiles(const QStringList &search, Filters filters = FilterNone);
-
- /**
- * Convenience function to search for a file
- * \sa searchFiles(const QStringList &search, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchFiles(const QString &search, Filters filters = FilterNone);
-
- /**
- * \brief Search in the packages details
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchDetails(const QStringList &search, Filters filters = FilterNone);
-
- /**
- * Convenience function to search by details
- * \sa searchDetails(const QStringList &search, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchDetails(const QString &search, Filters filters = FilterNone);
-
- /**
- * \brief Lists all the packages in the given \p group
- *
- * \p groups is the name of the group that you want, when searching for
- * categories prefix it with '@'
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchGroups(const QStringList &groups, Filters filters = FilterNone);
-
- /**
- * Convenience function to search by group string
- * \sa searchGroups(const QStringList &groups, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchGroup(const QString &group, Filters filters = FilterNone);
-
- /**
- * Convenience function to search by group enum
- * \sa searchGroups(const QStringList &groups, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchGroup(Group group, Filters filters = FilterNone);
-
- /**
- * \brief Lists all the packages in the given \p group
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchGroups(Groups group, Filters filters = FilterNone);
-
- /**
- * \brief Search in the packages names
- *
- * \p filters can be used to restrict the returned packages
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchNames(const QStringList &search, Filters filters = FilterNone);
-
- /**
- * Convenience function to search by names
- * \sa searchNames(const QStringList &search, Filters filters)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void searchNames(const QString &search, Filters filters = FilterNone);
-
- /**
- * Update the given \p packages
- *
- * \p onlyTrusted indicates if this transaction is only allowed to install trusted packages
- * \note This method emits \sa package() and \sa changed()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void updatePackages(const QStringList &packageIDs, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Convenience function to update a package
- * \sa updatePackages(const QStringList &packageIDs, TransactionFlags flags)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void updatePackage(const QString &packageID, TransactionFlags flags = TransactionFlagOnlyTrusted);
-
- /**
- * Updates the whole system
- *
- * This method perfoms a distribution upgrade to the
- * specified version.
- *
- * The \p type of upgrade, e.g. minimal, default or complete.
- * Minimal upgrades will download the smallest amount of data
- * before launching a installer.
- * The default is to download enough data to launch a full
- * graphical installer, but a complete upgrade will be
- * required if there is no internet access during install time.
- *
- * \note This method typically emits
- * \li changed()
- * \li error()
- * \li package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void upgradeSystem(const QString &distroId, UpgradeKind kind);
-
- /**
- * Searchs for a package providing a file/a mimetype
- *
- * \note This method emits \sa package()
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void whatProvides(Provides type, const QStringList &search, Filters filters = FilterNone);
-
- /**
- * Convenience function to search for what provides
- * \sa whatProvides(Provides type, const QStringList &search, Filters filters = FilterNone)
- *
- * \warning check \sa error() to know if it the call has any error
- */
- Q_INVOKABLE void whatProvides(Provides type, const QString &search, Filters filters = FilterNone);
+ QDBusPendingReply<> setHints(const QString &hints);
/**
* Cancels the transaction
*
* \warning check \sa error() to know if it the call has any error
*/
- Q_INVOKABLE void cancel();
+ Q_INVOKABLE QDBusPendingReply<> cancel();
/**
* Returns the package name from the \p packageID
@@ -1200,10 +680,29 @@ public:
static QString packageIcon(const QString &packageID);
Q_SIGNALS:
- /**
- * The transaction has changed one of it's properties
- */
- void changed();
+ void allowCancelChanged();
+
+ void isCallerActiveChanged();
+
+ void downloadSizeRemainingChanged();
+
+ void elapsedTimeChanged();
+
+ void lastPackageChanged();
+
+ void percentageChanged();
+
+ void remainingTimeChanged();
+
+ void roleChanged();
+
+ void speedChanged();
+
+ void statusChanged();
+
+ void transactionFlagsChanged();
+
+ void uidChanged();
/**
* \brief Sends a category
@@ -1283,12 +782,7 @@ Q_SIGNALS:
/**
* Emitted when the transaction sends details of a package
*/
- void details(const QString &packageID,
- const QString &license,
- PackageKit::Transaction::Group group,
- const QString &detail,
- const QString &url,
- qulonglong size);
+ void details(const PackageKit::Details &values);
/**
* Emitted when the transaction sends details of an update
@@ -1334,15 +828,10 @@ Q_SIGNALS:
/**
* Sends an old transaction
* \sa getOldTransactions()
+ *
+ * These objects must be manually deleted
*/
void transaction(PackageKit::Transaction *transaction);
-
- /**
- * Emitted a bit after a transaction has been finished
- * It's useful when the transaction is too fast and emits
- * finished before we finish connecting
- */
- void destroy();
protected:
static Transaction::InternalError parseError(const QString &errorName);
@@ -1353,6 +842,9 @@ protected:
* 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
/**
* This method disconnects from DBus signals
@@ -1360,41 +852,48 @@ protected:
* 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
TransactionPrivate * const d_ptr;
+ /**
+ * Creates a new transaction object
+ * asking PackageKit for a new TID
+ *
+ * This constructor is used by Daemon
+ *
+ */
+ Transaction();
+
+ Transaction(TransactionPrivate *d);
+
private:
friend class Daemon;
- bool init(const QDBusObjectPath &tid = QDBusObjectPath());
- Transaction(const QDBusObjectPath &tid,
- const QString ×pec,
- bool succeeded,
- Role role,
- uint duration,
- const QString &data,
- uint uid,
- const QString &cmdline,
- QObject *parent);
Q_DECLARE_PRIVATE(Transaction)
Q_DISABLE_COPY(Transaction)
- Q_PRIVATE_SLOT(d_ptr, void Details(const QString &pid, const QString &license, uint group, const QString &detail, const QString &url, qulonglong size))
- Q_PRIVATE_SLOT(d_ptr, void distroUpgrade(uint type, const QString &name, const QString &description))
- Q_PRIVATE_SLOT(d_ptr, void errorCode(uint error, const QString &details))
- Q_PRIVATE_SLOT(d_ptr, void mediaChangeRequired(uint mediaType, const QString &mediaId, const QString &mediaText))
- Q_PRIVATE_SLOT(d_ptr, void finished(uint exitCode, uint runtime))
- Q_PRIVATE_SLOT(d_ptr, void message(uint type, const QString &message))
- Q_PRIVATE_SLOT(d_ptr, void Package(uint info, const QString &pid, const QString &summary))
- Q_PRIVATE_SLOT(d_ptr, void ItemProgress(const QString &itemID, uint status, uint percentage))
- Q_PRIVATE_SLOT(d_ptr, void RepoSignatureRequired(const QString &pid, const QString &repoName, const QString &keyUrl, const QString &keyUserid, const QString &keyId, const QString &keyFingerprint, const QString &keyTimestamp, uint type))
- Q_PRIVATE_SLOT(d_ptr, void requireRestart(uint type, const QString &pid))
- Q_PRIVATE_SLOT(d_ptr, void transaction(const QDBusObjectPath &oldTid, const QString ×pec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &cmdline))
- Q_PRIVATE_SLOT(d_ptr, void UpdateDetail(const QString &package_id, const QStringList &updates, const QStringList &obsoletes, const QStringList &vendor_urls, const QStringList &bugzilla_urls, const QStringList &cve_urls, uint restart, const QString &update_text, const QString &changelog, uint state, const QString &issued, const QString &updated))
- Q_PRIVATE_SLOT(d_ptr, void destroy())
- Q_PRIVATE_SLOT(d_ptr, void daemonQuit())
+ Q_PRIVATE_SLOT(d_func(), void createTransactionFinished(QDBusPendingCallWatcher*))
+ Q_PRIVATE_SLOT(d_func(), void methodCallFinished(QDBusPendingCallWatcher*))
+ Q_PRIVATE_SLOT(d_func(), void distroUpgrade(uint type, const QString &name, const QString &description))
+ Q_PRIVATE_SLOT(d_func(), void details(const QVariantMap &values))
+ Q_PRIVATE_SLOT(d_func(), void errorCode(uint error, const QString &details))
+ Q_PRIVATE_SLOT(d_func(), void mediaChangeRequired(uint mediaType, const QString &mediaId, const QString &mediaText))
+ Q_PRIVATE_SLOT(d_func(), void finished(uint exitCode, uint runtime))
+ Q_PRIVATE_SLOT(d_func(), void message(uint type, const QString &message))
+ Q_PRIVATE_SLOT(d_func(), void Package(uint info, const QString &pid, const QString &summary))
+ Q_PRIVATE_SLOT(d_func(), void ItemProgress(const QString &itemID, uint status, uint percentage))
+ Q_PRIVATE_SLOT(d_func(), void RepoSignatureRequired(const QString &pid, const QString &repoName, const QString &keyUrl, const QString &keyUserid, const QString &keyId, const QString &keyFingerprint, const QString &keyTimestamp, uint type))
+ Q_PRIVATE_SLOT(d_func(), void requireRestart(uint type, const QString &pid))
+ Q_PRIVATE_SLOT(d_func(), void transaction(const QDBusObjectPath &oldTid, const QString ×pec, bool succeeded, uint role, uint duration, const QString &data, uint uid, const QString &cmdline))
+ Q_PRIVATE_SLOT(d_func(), void UpdateDetail(const QString &package_id, const QStringList &updates, const QStringList &obsoletes, const QStringList &vendor_urls, const QStringList &bugzilla_urls, const QStringList &cve_urls, uint restart, const QString &update_text, const QString &changelog, uint state, const QString &issued, const QString &updated))
+ Q_PRIVATE_SLOT(d_func(), void destroy())
+ Q_PRIVATE_SLOT(d_func(), void daemonQuit())
+ Q_PRIVATE_SLOT(d_func(), void propertiesChanged(QString,QVariantMap,QStringList))
+ Q_PRIVATE_SLOT(d_func(), void updateProperties(QVariantMap))
};
Q_DECLARE_OPERATORS_FOR_FLAGS(Transaction::Filters)
Q_DECLARE_OPERATORS_FOR_FLAGS(Transaction::TransactionFlags)
-Q_DECLARE_OPERATORS_FOR_FLAGS(Transaction::ProvidesFlag)
} // End namespace PackageKit
Q_DECLARE_METATYPE(PackageKit::Transaction::InternalError)
@@ -1404,7 +903,6 @@ Q_DECLARE_METATYPE(PackageKit::Transaction::Exit)
Q_DECLARE_METATYPE(PackageKit::Transaction::Message)
Q_DECLARE_METATYPE(PackageKit::Transaction::Status)
Q_DECLARE_METATYPE(PackageKit::Transaction::MediaType)
-Q_DECLARE_METATYPE(PackageKit::Transaction::Provides)
Q_DECLARE_METATYPE(PackageKit::Transaction::DistroUpgrade)
Q_DECLARE_METATYPE(PackageKit::Transaction::TransactionFlag)
Q_DECLARE_METATYPE(PackageKit::Transaction::Restart)
@@ -1415,6 +913,5 @@ Q_DECLARE_METATYPE(PackageKit::Transaction::SigType)
Q_DECLARE_METATYPE(PackageKit::Transaction::Filter)
Q_DECLARE_METATYPE(PackageKit::Transaction::TransactionFlags)
Q_DECLARE_METATYPE(PackageKit::Transaction::Filters)
-Q_DECLARE_METATYPE(PackageKit::Transaction::ProvidesFlag)
#endif
diff --git a/src/transactionprivate.cpp b/src/transactionprivate.cpp
index ea0f559..7a87aec 100644
--- a/src/transactionprivate.cpp
+++ b/src/transactionprivate.cpp
@@ -22,33 +22,207 @@
#include "transactionprivate.h"
#include "transactionproxy.h"
+#include "daemon.h"
+#include "common.h"
+#include "details.h"
#include <QStringList>
#include <QDebug>
using namespace PackageKit;
-TransactionPrivate::TransactionPrivate(Transaction* parent) :
- q_ptr(parent),
- p(0),
- role(Transaction::RoleUnknown)
+TransactionPrivate::TransactionPrivate(Transaction* parent)
+ : q_ptr(parent)
{
}
-void TransactionPrivate::Details(const QString &pid,
- const QString &license,
- uint group,
- const QString &detail,
- const QString &url,
- qulonglong size)
+TransactionPrivate::~TransactionPrivate()
+{
+ delete p;
+}
+
+void TransactionPrivate::setup(const QDBusObjectPath &transactionId)
+{
+ Q_Q(Transaction);
+
+ tid = transactionId;
+ p = new TransactionProxy(QLatin1String(PK_NAME),
+ tid.path(),
+ QDBusConnection::systemBus(),
+ q);
+ if (!Daemon::global()->hints().isEmpty()) {
+ q->setHints(Daemon::global()->hints());
+ }
+
+ q->connect(p, SIGNAL(Destroy()), SLOT(destroy()));
+
+ // Get current properties
+ QDBusMessage message = QDBusMessage::createMethodCall(QLatin1String(PK_NAME),
+ tid.path(),
+ QLatin1String(DBUS_PROPERTIES),
+ QLatin1String("GetAll"));
+ message << PK_TRANSACTION_INTERFACE;
+ QDBusConnection::systemBus().callWithCallback(message,
+ q,
+ SLOT(updateProperties(QVariantMap)));
+
+ // Watch for properties updates
+ QDBusConnection::systemBus().connect(QLatin1String(PK_NAME),
+ tid.path(),
+ QLatin1String(DBUS_PROPERTIES),
+ QLatin1String("PropertiesChanged"),
+ q,
+ SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
+
+ QStringList currentSignals = connectedSignals;
+ currentSignals.removeDuplicates();
+ foreach (const QString &signal, currentSignals) {
+ setupSignal(signal, true);
+ }
+
+ // Execute pending call
+ runQueuedTransaction();
+}
+
+void TransactionPrivate::runQueuedTransaction()
{
Q_Q(Transaction);
- q->details(pid,
- license,
- static_cast<Transaction::Group>(group),
- detail,
- url,
- size);
+
+ QDBusPendingReply<> reply;
+ switch (role) {
+ case Transaction::RoleAcceptEula:
+ reply = p->AcceptEula(eulaId);
+ break;
+ case Transaction::RoleDownloadPackages:
+ reply = p->DownloadPackages(storeInCache, search);
+ break;
+ case Transaction::RoleGetCategories:
+ reply = p->GetCategories();
+ break;
+ case Transaction::RoleDependsOn:
+ reply = p->DependsOn(filters, search, recursive);
+ break;
+ case Transaction::RoleGetDetails:
+ reply = p->GetDetails(search);
+ break;
+ case Transaction::RoleGetFiles:
+ reply = p->GetFiles(search);
+ break;
+ case Transaction::RoleGetOldTransactions:
+ reply = p->GetOldTransactions(numberOfOldTransactions);
+ break;
+ case Transaction::RoleGetPackages:
+ reply = p->GetPackages(filters);
+ break;
+ case Transaction::RoleGetRepoList:
+ reply = p->GetRepoList(filters);
+ break;
+ case Transaction::RoleRequiredBy:
+ reply = p->RequiredBy(filters, search, recursive);
+ break;
+ case Transaction::RoleGetUpdateDetail:
+ reply = p->GetUpdateDetail(search);
+ break;
+ case Transaction::RoleGetUpdates:
+ reply = p->GetUpdates(filters);
+ break;
+ case Transaction::RoleGetDistroUpgrades:
+ reply = p->GetDistroUpgrades();
+ break;
+ case Transaction::RoleInstallFiles:
+ reply = p->InstallFiles(transactionFlags, search);
+ break;
+ case Transaction::RoleInstallPackages:
+ reply = p->InstallPackages(transactionFlags, search);
+ break;
+ case Transaction::RoleInstallSignature:
+ reply = p->InstallSignature(signatureType, signatureKey, signaturePackage);
+ break;
+ case Transaction::RoleRefreshCache:
+ reply = p->RefreshCache(refreshCacheForce);
+ break;
+ case Transaction::RoleRemovePackages:
+ reply = p->RemovePackages(transactionFlags, search, allowDeps, autoremove);
+ break;
+ case Transaction::RoleRepairSystem:
+ reply = p->RepairSystem(transactionFlags);
+ break;
+ case Transaction::RoleRepoEnable:
+ reply = p->RepoEnable(repoId, repoEnable);
+ break;
+ case Transaction::RoleRepoSetData:
+ reply = p->RepoSetData(repoId, repoParameter, repoValue);
+ break;
+ case Transaction::RoleResolve:
+ reply = p->Resolve(filters, search);
+ break;
+ case Transaction::RoleSearchFile:
+ reply = p->SearchFiles(filters, search);
+ break;
+ case Transaction::RoleSearchDetails:
+ reply = p->SearchDetails(filters, search);
+ break;
+ case Transaction::RoleSearchGroup:
+ reply = p->SearchGroups(filters, search);
+ break;
+ case Transaction::RoleSearchName:
+ reply = p->SearchNames(filters, search);
+ break;
+ case Transaction::RoleUpdatePackages:
+ reply = p->UpdatePackages(transactionFlags, search);
+ break;
+ case Transaction::RoleWhatProvides:
+ reply = p->WhatProvides(filters, search);
+ break;
+ case Transaction::RoleGetDetailsLocal:
+ reply = p->GetDetailsLocal(search);
+ break;
+ case Transaction::RoleGetFilesLocal:
+ reply = p->GetFilesLocal(search);
+ break;
+ case Transaction::RoleRepoRemove:
+ reply = p->RepoRemove(transactionFlags, repoId, autoremove);
+ break;
+ default:
+ break;
+ }
+
+ QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, q);
+ q->connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
+ q, SLOT(methodCallFinished(QDBusPendingCallWatcher*)));
+}
+
+void TransactionPrivate::createTransactionFinished(QDBusPendingCallWatcher *call)
+{
+ Q_Q(Transaction);
+ QDBusPendingReply<QDBusObjectPath> reply = *call;
+ if (reply.isError()) {
+ q->errorCode(Transaction::ErrorInternalError, reply.error().message());
+ finished(Transaction::ExitFailed, 0);
+ destroy();
+ } else {
+ // Setup our new Transaction ID
+ setup(reply.argumentAt<0>());
+ }
+ call->deleteLater();
+}
+
+void TransactionPrivate::methodCallFinished(QDBusPendingCallWatcher *call)
+{
+ Q_Q(Transaction);
+ QDBusPendingReply<> reply = *call;
+ if (reply.isError()) {
+ q->errorCode(Transaction::ErrorInternalError, reply.error().message());
+ finished(Transaction::ExitFailed, 0);
+ destroy();
+ }
+ call->deleteLater();
+}
+
+void TransactionPrivate::details(const QVariantMap &values)
+{
+ Q_Q(Transaction);
+ q->details(PackageKit::Details(values));
}
void TransactionPrivate::distroUpgrade(uint type, const QString &name, const QString &description)
@@ -77,6 +251,7 @@ void TransactionPrivate::finished(uint exitCode, uint runtime)
{
Q_Q(Transaction);
q->finished(static_cast<Transaction::Exit>(exitCode), runtime);
+ sentFinished = true;
}
void TransactionPrivate::destroy()
@@ -86,18 +261,87 @@ void TransactionPrivate::destroy()
delete p;
p = 0;
}
- q->destroy();
+
+ if (!sentFinished) {
+ // If after we connect to a transaction we happend
+ // to only receive destroyed signal send a finished
+ // to the client
+ q->finished(Transaction::ExitUnknown, 0);
+ }
+
+ q->deleteLater();
}
void TransactionPrivate::daemonQuit()
{
Q_Q(Transaction);
if (p) {
- q->finished(Transaction::ExitFailed, 0);
+ q->errorCode(Transaction::ErrorProcessKill, QObject::tr("The PackageKit daemon has crashed"));
+ finished(Transaction::ExitKilled, 0);
destroy();
}
}
+void TransactionPrivate::propertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties)
+{
+ Q_UNUSED(interface)
+ Q_UNUSED(invalidatedProperties)
+
+ updateProperties(properties);
+}
+
+void TransactionPrivate::updateProperties(const QVariantMap &properties)
+{
+ Q_Q(Transaction);
+
+ QVariantMap::ConstIterator it = properties.constBegin();
+ while (it != properties.constEnd()) {
+ const QString &property = it.key();
+ const QVariant &value = it.value();
+ if (property == QLatin1String("AllowCancel")) {
+ allowCancel = value.toBool();
+ QMetaObject::invokeMethod(q, "allowCancelChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("CallerActive")) {
+ callerActive = value.toBool();
+ QMetaObject::invokeMethod(q, "isCallerActiveChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("DownloadSizeRemaining")) {
+ downloadSizeRemaining = value.toLongLong();
+ QMetaObject::invokeMethod(q, "downloadSizeRemainingChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("ElapsedTime")) {
+ elapsedTime = value.toUInt();
+ QMetaObject::invokeMethod(q, "elapsedTimeChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("LastPackage")) {
+ lastPackage = value.toString();
+ QMetaObject::invokeMethod(q, "lastPackageChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("Percentage")) {
+ percentage = value.toUInt();
+ QMetaObject::invokeMethod(q, "percentageChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("RemainingTime")) {
+ remainingTime = value.toUInt();
+ q->remainingTimeChanged();
+ } else if (property == QLatin1String("Role")) {
+ role = static_cast<Transaction::Role>(value.toUInt());
+ QMetaObject::invokeMethod(q, "roleChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("Speed")) {
+ speed = value.toUInt();
+ QMetaObject::invokeMethod(q, "speedChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("Status")) {
+ status = static_cast<Transaction::Status>(value.toUInt());
+ QMetaObject::invokeMethod(q, "statusChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("TransactionFlags")) {
+ transactionFlags = static_cast<Transaction::TransactionFlags>(value.toULongLong());
+ QMetaObject::invokeMethod(q, "transactionFlagsChanged", Qt::QueuedConnection);
+ } else if (property == QLatin1String("Uid")) {
+ uid = value.toUInt();
+ QMetaObject::invokeMethod(q, "uidChanged", Qt::QueuedConnection);
+ } else {
+ qWarning() << "Unknown Transaction property:" << property << value;
+ }
+
+ ++it;
+ }
+}
+
void TransactionPrivate::message(uint type, const QString &message)
{
Q_Q(Transaction);
@@ -156,7 +400,21 @@ void TransactionPrivate::transaction(const QDBusObjectPath &oldTid,
const QString &cmdline)
{
Q_Q(Transaction);
- q->transaction(new Transaction(oldTid, timespec, succeeded, static_cast<Transaction::Role>(role), duration, data, uid, cmdline, q->parent()));
+
+ TransactionPrivate *priv = new TransactionPrivate(q);
+ priv->tid = tid;
+ priv->timespec = QDateTime::fromString(timespec, Qt::ISODate);
+ priv->succeeded = succeeded;
+ priv->role = static_cast<Transaction::Role>(role);
+ priv->duration = duration;
+ priv->data = data;
+ priv->uid = uid;
+ priv->cmdline = cmdline;
+
+ Transaction *transaction = new Transaction(priv);
+ priv->q_ptr = transaction;
+
+ q->transaction(transaction);
}
void TransactionPrivate::UpdateDetail(const QString &package_id,
diff --git a/src/transactionprivate.h b/src/transactionprivate.h
index d6c9408..895cfac 100644
--- a/src/transactionprivate.h
+++ b/src/transactionprivate.h
@@ -25,6 +25,7 @@
#include <QString>
#include <QHash>
#include <QStringList>
+#include <QDBusPendingCallWatcher>
#include "transaction.h"
@@ -35,31 +36,64 @@ namespace PackageKit {
class TransactionPrivate
{
Q_DECLARE_PUBLIC(Transaction)
+ friend class Daemon;
protected:
TransactionPrivate(Transaction *parent);
- virtual ~TransactionPrivate() {}
+ virtual ~TransactionPrivate();
+
+ void setup(const QDBusObjectPath &transactionId);
+ void runQueuedTransaction();
QDBusObjectPath tid;
- ::TransactionProxy* p;
+ ::TransactionProxy* p = 0;
Transaction *q_ptr;
QStringList connectedSignals;
+ bool sentFinished = false;
+ bool allowCancel = false;
+ bool callerActive = false;
+ qulonglong downloadSizeRemaining = 0;
+ uint elapsedTime = 0;
+ QString lastPackage;
+ uint percentage = 0;
+ uint remainingTime = 0;
+ Transaction::Role role = Transaction::RoleUnknown;
+ uint speed = 0;
+ Transaction::Status status = Transaction::StatusUnknown;
+ uint uid = 0;
+
+ // Queue params
+ QString eulaId;
+ bool storeInCache;
+ Transaction::Filters filters;
+ bool recursive = false;
+ uint numberOfOldTransactions = 0;
+ Transaction::TransactionFlags transactionFlags = Transaction::TransactionFlagNone;
+ Transaction::SigType signatureType = Transaction::SigTypeUnknown;
+ QString signatureKey;
+ QString signaturePackage;
+ bool refreshCacheForce;
+ bool allowDeps;
+ bool autoremove;
+ QString repoId;
+ QString repoParameter;
+ QString repoValue;
+ bool repoEnable;
+ QStringList search;
+
// Only used for old transactions
QDateTime timespec;
- Transaction::Role role;
bool succeeded;
uint duration;
QString data;
- uint uid;
QString cmdline;
- Transaction::InternalError error;
- QString errorMessage;
-
void setupSignal(const QString &signal, bool connect);
protected Q_SLOTS:
- void Details(const QString &pid, const QString &license, uint group, const QString &detail, const QString &url, qulonglong size);
+ void createTransactionFinished(QDBusPendingCallWatcher *call);
+ void methodCallFinished(QDBusPendingCallWatcher *call);
+ void details(const QVariantMap &values);
void distroUpgrade(uint type, const QString &name, const QString &description);
void errorCode(uint error, const QString &details);
void mediaChangeRequired(uint mediaType, const QString &mediaId, const QString &mediaText);
@@ -80,6 +114,8 @@ protected Q_SLOTS:
void UpdateDetail(const QString &package_id, const QStringList &updates, const QStringList &obsoletes, const QStringList &vendor_urls, const QStringList &bugzilla_urls, const QStringList &cve_urls, uint restart, const QString &update_text, const QString &changelog, uint state, const QString &issued, const QString &updated);
void destroy();
void daemonQuit();
+ void propertiesChanged(const QString &interface, const QVariantMap &properties, const QStringList &invalidatedProperties);
+ void updateProperties(const QVariantMap &properties);
};
} // End namespace PackageKit
More information about the Neon-commits
mailing list