Commit dc87d64e authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Properly detect the right pkqt version for offline updates

parent 3d37d257
......@@ -29,9 +29,9 @@ install(TARGETS DiscoverPackageKitNotifier DESTINATION ${PLUGIN_INSTALL_DIR}/dis
install(FILES packagekit-backend-categories.xml DESTINATION ${DATA_INSTALL_DIR}/libdiscover/categories)
add_subdirectory(categoryimages)
if(packagekitqt5_VERSION VERSION_GREATER 0.9.7)
target_compile_definitions(packagekit-backend PUBLIC -DPKQT_0_10)
target_compile_definitions(DiscoverPackageKitNotifier PUBLIC -DPKQT_0_10)
if(packagekitqt5_VERSION VERSION_GREATER 1.0.1)
target_compile_definitions(packagekit-backend PUBLIC -DPKQT_1_0)
target_compile_definitions(DiscoverPackageKitNotifier PUBLIC -DPKQT_1_0)
endif()
install( FILES org.kde.discover.packagekit.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR} )
......@@ -191,7 +191,7 @@ uint PackageKitNotifier::updatesCount()
void PackageKitNotifier::onDistroUpgrade(PackageKit::Transaction::DistroUpgrade type, const QString& name, const QString& description)
{
#ifdef PKQT_0_10
#ifdef PKQT_1_0
KNotification *notification = new KNotification(QLatin1String("distupgrade-notification"), KNotification::Persistent | KNotification::DefaultEvent);
notification->setIconName(QStringLiteral("system-software-update"));
notification->setActions(QStringList{QLatin1String("Upgrade")});
......@@ -223,7 +223,7 @@ void PackageKitNotifier::refreshDatabase()
});
}
#ifdef PKQT_0_10
#ifdef PKQT_1_0
if (!m_distUpgrades && (PackageKit::Daemon::roles() & PackageKit::Transaction::RoleUpgradeSystem)) {
m_distUpgrades = PackageKit::Daemon::getDistroUpgrades();
connect(m_distUpgrades, &PackageKit::Transaction::distroUpgrade, this, &PackageKitNotifier::onDistroUpgrade);
......
......@@ -21,7 +21,7 @@
#include "PackageKitMessages.h"
#include <PackageKit/Daemon>
#ifdef PKQT_0_10
#ifdef PKQT_1_0
#include <PackageKit/Offline>
#endif
#include <QDebug>
......@@ -143,7 +143,7 @@ void PackageKitUpdater::proceed()
{
if (!m_proceedFunctions.isEmpty())
processProceedFunction();
#ifdef PKQT_0_10
#ifdef PKQT_1_0
else if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
setupTransaction(PackageKit::Transaction::TransactionFlagOnlyTrusted | PackageKit::Transaction::TransactionFlagOnlyDownload);
#endif
......@@ -184,7 +184,7 @@ void PackageKitUpdater::finished(PackageKit::Transaction::Exit exit, uint /*time
fetchLastUpdateTime();
if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
#ifdef PKQT_0_10
#ifdef PKQT_1_0
PackageKit::Daemon::global()->offline()->trigger(PackageKit::Offline::ActionReboot);
#else
qWarning() << "PK_OFFLINE_UPDATE is set but discover was built against an old version of PackageKitQt that didn't support offline updates";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment