You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
199 lines
6.3 KiB
199 lines
6.3 KiB
From 60787cfccd76b15e0f5813d7ab5567292f7efce7 Mon Sep 17 00:00:00 2001
|
|
From: Aleix Pol <aleixpol@kde.org>
|
|
Date: Thu, 2 Oct 2014 18:51:55 +0200
|
|
Subject: [PATCH 16/16] Deprecate ::packageIcon methods
|
|
|
|
It's suggested to use Appstream instead.
|
|
Also removes the QtSql dependency, which is nice.
|
|
|
|
Reviewed by Daniel Nicoletti
|
|
---
|
|
src/CMakeLists.txt | 5 -----
|
|
src/common.h | 2 --
|
|
src/daemon.cpp | 11 -----------
|
|
src/daemon.h | 4 +++-
|
|
src/packagekitqt4.pc.in | 2 +-
|
|
src/packagekitqt5.pc.in | 2 +-
|
|
src/transaction.cpp | 33 +--------------------------------
|
|
src/transaction.h | 4 +++-
|
|
8 files changed, 9 insertions(+), 54 deletions(-)
|
|
|
|
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
|
index c6e16bd..0e18022 100755
|
|
--- a/src/CMakeLists.txt
|
|
+++ b/src/CMakeLists.txt
|
|
@@ -11,16 +11,12 @@ endif ()
|
|
# 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 ()
|
|
@@ -89,7 +85,6 @@ if (Qt5_FOUND)
|
|
add_dependencies(${LIBNAME} mocs)
|
|
target_link_libraries(${LIBNAME}
|
|
LINK_PUBLIC Qt5::DBus
|
|
- LINK_PRIVATE Qt5::Sql
|
|
)
|
|
elseif (Qt4_FOUND)
|
|
target_link_libraries(${LIBNAME}
|
|
diff --git a/src/common.h b/src/common.h
|
|
index d7497d4..05a3df4 100644
|
|
--- a/src/common.h
|
|
+++ b/src/common.h
|
|
@@ -34,5 +34,3 @@
|
|
#define AUTH_SYSTEM_SOURCES_REFRESH "org.freedesktop.packagekit.system-sources-refresh"
|
|
#define AUTH_SYSTEM_NETWORK_PROXY_CONFIGURE "org.freedesktop.packagekit.system-network-proxy-configure"
|
|
#define AUTH_CANCEL_FOREIGN "org.freedesktop.packagekit.cancel-foreign"
|
|
-
|
|
-#define PK_DESKTOP_DEFAULT_DATABASE LOCALSTATEDIR "/lib/PackageKit/desktop-files.db"
|
|
diff --git a/src/daemon.cpp b/src/daemon.cpp
|
|
index 442ef55..647756a 100755
|
|
--- a/src/daemon.cpp
|
|
+++ b/src/daemon.cpp
|
|
@@ -19,9 +19,6 @@
|
|
* Boston, MA 02110-1301, USA.
|
|
*/
|
|
|
|
-#include <QtSql>
|
|
-#include <QDebug>
|
|
-
|
|
#include "daemon.h"
|
|
#include "daemonprivate.h"
|
|
#include "transactionprivate.h"
|
|
@@ -58,14 +55,6 @@ Daemon::Daemon(QObject *parent) :
|
|
QLatin1String("PropertiesChanged"),
|
|
this,
|
|
SLOT(propertiesChanged(QString,QVariantMap,QStringList)));
|
|
-
|
|
- // Set up database for desktop files
|
|
- QSqlDatabase db;
|
|
- db = QSqlDatabase::addDatabase("QSQLITE", PK_DESKTOP_DEFAULT_DATABASE);
|
|
- db.setDatabaseName(PK_DESKTOP_DEFAULT_DATABASE);
|
|
- if (!db.open()) {
|
|
- qDebug() << "Failed to initialize the desktop files database";
|
|
- }
|
|
}
|
|
|
|
void DaemonPrivate::setupSignal(const QString &signal, bool connect)
|
|
diff --git a/src/daemon.h b/src/daemon.h
|
|
index 6ad2779..05d74f4 100644
|
|
--- a/src/daemon.h
|
|
+++ b/src/daemon.h
|
|
@@ -277,8 +277,10 @@ public:
|
|
|
|
/**
|
|
* Returns the package icon from the \p packageID
|
|
+ *
|
|
+ * @deprecated use Appstream to fetch icons
|
|
*/
|
|
- Q_INVOKABLE static QString packageIcon(const QString &packageID);
|
|
+ Q_INVOKABLE QT_DEPRECATED static QString packageIcon(const QString &packageID);
|
|
|
|
/**
|
|
* Returns the string representing the enum
|
|
diff --git a/src/packagekitqt4.pc.in b/src/packagekitqt4.pc.in
|
|
index 013e5a0..2030ff2 100755
|
|
--- a/src/packagekitqt4.pc.in
|
|
+++ b/src/packagekitqt4.pc.in
|
|
@@ -6,6 +6,6 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
Name: @LIBNAME@
|
|
Description: PackageKit is a system daemon for installing stuff.
|
|
Version: @VERSION@
|
|
-Requires: QtCore, QtDBus, QtSql, QtXml
|
|
+Requires: QtCore, QtDBus, QtXml
|
|
Libs: -L${libdir} -l@LIBNAME@
|
|
Cflags: -I${includedir}/PackageKit/@LIBNAME@
|
|
diff --git a/src/packagekitqt5.pc.in b/src/packagekitqt5.pc.in
|
|
index da6c2a9..99ace5b 100644
|
|
--- a/src/packagekitqt5.pc.in
|
|
+++ b/src/packagekitqt5.pc.in
|
|
@@ -6,6 +6,6 @@ includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
|
|
Name: @LIBNAME@
|
|
Description: PackageKit is a system daemon for installing stuff.
|
|
Version: @VERSION@
|
|
-Requires: Qt5Core, Qt5DBus, Qt5Sql, Qt5Xml
|
|
+Requires: Qt5Core, Qt5DBus, Qt5Xml
|
|
Libs: -L${libdir} -l@LIBNAME@
|
|
Cflags: -I${includedir}/PackageKit/@LIBNAME@
|
|
diff --git a/src/transaction.cpp b/src/transaction.cpp
|
|
index 0ed97e1..7cfa302 100755
|
|
--- a/src/transaction.cpp
|
|
+++ b/src/transaction.cpp
|
|
@@ -26,7 +26,6 @@
|
|
#include "daemon.h"
|
|
#include "common.h"
|
|
|
|
-#include <QSqlQuery>
|
|
#include <QDBusError>
|
|
|
|
using namespace PackageKit;
|
|
@@ -215,37 +214,7 @@ QString Transaction::packageData(const QString &packageID)
|
|
|
|
QString Transaction::packageIcon(const QString &packageID)
|
|
{
|
|
- QString path;
|
|
- QSqlDatabase db = QSqlDatabase::database(PK_DESKTOP_DEFAULT_DATABASE);
|
|
- if (!db.isOpen()) {
|
|
- qDebug() << "Desktop files database is not open";
|
|
- return path;
|
|
- }
|
|
-
|
|
- QSqlQuery q(db);
|
|
- q.prepare("SELECT filename FROM cache WHERE package = :name");
|
|
- q.bindValue(":name", Transaction::packageName(packageID));
|
|
- if (q.exec()) {
|
|
- if (q.next()) {
|
|
- QFile desktopFile(q.value(0).toString());
|
|
- if (desktopFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
|
- while (!desktopFile.atEnd()) {
|
|
- QByteArray line = desktopFile.readLine().trimmed();
|
|
- if (line.startsWith("Icon=")) {
|
|
- path = line.mid(5);
|
|
- break;
|
|
- }
|
|
- }
|
|
- desktopFile.close();
|
|
- } else {
|
|
- qDebug() << "Cannot open desktop file " << q.value(0).toString();
|
|
- }
|
|
- }
|
|
- } else {
|
|
- qDebug() << "Error while running query " << q.executedQuery();
|
|
- }
|
|
-
|
|
- return path;
|
|
+ return QString();
|
|
}
|
|
|
|
QString Transaction::lastPackage() const
|
|
diff --git a/src/transaction.h b/src/transaction.h
|
|
index f9d4802..51ac1d0 100644
|
|
--- a/src/transaction.h
|
|
+++ b/src/transaction.h
|
|
@@ -675,8 +675,10 @@ public:
|
|
|
|
/**
|
|
* Returns the package icon from the \p packageID
|
|
+ *
|
|
+ * @deprecated use Appstream to fetch icons
|
|
*/
|
|
- static QString packageIcon(const QString &packageID);
|
|
+ static QT_DEPRECATED QString packageIcon(const QString &packageID);
|
|
|
|
Q_SIGNALS:
|
|
void allowCancelChanged();
|
|
--
|
|
2.1.0
|
|
|