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

Fix commit on stable PackageKitQt

BUG: 388093
parent 2de84def
......@@ -15,10 +15,6 @@ add_library(packagekit-backend MODULE PackageKitBackend.cpp
TransactionSet.cpp
)
if(packagekitqt5_VERSION VERSION_GREATER 0.9.7)
target_compile_definitions(packagekit-backend -DHAS_OFFLINE_UPDATES)
endif()
target_link_libraries(packagekit-backend PRIVATE Discover::Common Qt5::Core PK::packagekitqt5 KF5::ConfigGui KF5::KIOCore KF5::Archive AppStreamQt)
install(TARGETS packagekit-backend DESTINATION ${PLUGIN_INSTALL_DIR}/discover)
......@@ -32,3 +28,8 @@ 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 -DPKQT_0_10)
target_compile_definitions(DiscoverPackageKitNotifier -DPKQT_0_10)
endif()
......@@ -131,6 +131,7 @@ uint PackageKitNotifier::updatesCount()
void PackageKitNotifier::onDistroUpgrade(PackageKit::Transaction::DistroUpgrade type, const QString& name, const QString& description)
{
#ifdef PKQT_0_10
KNotification *notification = new KNotification(QLatin1String("distupgrade-notification"), KNotification::Persistent | KNotification::DefaultEvent);
notification->setIconName(QStringLiteral("system-software-update"));
notification->setActions(QStringList{QLatin1String("Upgrade")});
......@@ -150,6 +151,7 @@ void PackageKitNotifier::onDistroUpgrade(PackageKit::Transaction::DistroUpgrade
});
notification->sendEvent();
#endif
}
void PackageKitNotifier::refreshDatabase()
......@@ -162,6 +164,7 @@ void PackageKitNotifier::refreshDatabase()
});
}
#ifdef PKQT_0_10
if (!m_distUpgrades && (PackageKit::Daemon::roles() & PackageKit::Transaction::RoleUpgradeSystem)) {
m_distUpgrades = PackageKit::Daemon::getDistroUpgrades();
connect(m_distUpgrades, &PackageKit::Transaction::distroUpgrade, this, &PackageKitNotifier::onDistroUpgrade);
......@@ -170,6 +173,7 @@ void PackageKitNotifier::refreshDatabase()
delete m_distUpgrades;
});
}
#endif
}
QProcess* PackageKitNotifier::checkAptVariable(const QString &aptconfig, const QLatin1String& varname, std::function<void(const QStringRef& val)> func)
......
......@@ -142,7 +142,7 @@ void PackageKitUpdater::proceed()
{
if (!m_proceedFunctions.isEmpty())
processProceedFunction();
#ifdef HAS_OFFLINE_UPDATES
#ifdef PKQT_0_10
else if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
setupTransaction(PackageKit::Transaction::TransactionFlagOnlyTrusted | PackageKit::Transaction::TransactionFlagOnlyDownload);
#endif
......@@ -183,7 +183,7 @@ void PackageKitUpdater::finished(PackageKit::Transaction::Exit exit, uint /*time
fetchLastUpdateTime();
if (qEnvironmentVariableIsSet("PK_OFFLINE_UPDATE"))
#ifdef HAS_OFFLINE_UPDATES
#ifdef PKQT_0_10
PackageKit::Daemon::global()->offlineTrigger(PackageKit::Daemon::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