Commit 65f986dc authored by Tomaz  Canabrava's avatar Tomaz Canabrava
Browse files

Add method to query if polkit is installed correctly

The std::cout and qDebugs on the external command helper is
not visible to the user as it runs in another process via dbus
this is highly annoying if you want to be able to discover what's
wrong on the command line.

A method that checks if the file is in the right place should be
called by the users of this library
parent 259f5626
Pipeline #102786 passed with stage
in 1 minute and 6 seconds
......@@ -14,6 +14,8 @@
#include "util/globallog.h"
#include <QDebug>
#include <QFileInfo>
#include <KLocalizedString>
struct CoreBackendPrivate
......@@ -29,6 +31,20 @@ CoreBackend::~CoreBackend()
bool CoreBackend::isPolkitInstalledCorrectly() {
// Assume PACKAGE_DATA_DIR is /usr/share, this is defined on polkit on buildtime so this might be wrong.
// This is a warning, not a hard failure, so it does not matter much.
QFileInfo fInfo(QStringLiteral("/usr/share/polkit-1/actions/org.kde.kpmcore.externalcommand.policy"));
// TODO: Port kpm to qCDebug, currently everything is debug.
if (!fInfo.exists()) {
qDebug() << "Installation might be wrong, we can't locate `org.kde.kpmcore.externalcommand.policy` on the polkit actions folder.";
qDebug() << "Please check if your Installation is on a different prefix and copy it to /usr/share/polkit-1/actions";
qDebug() << "That's specified for your distro. Since this is distro specific, you need to look at your distribution documentation.";
return fInfo.exists();
void CoreBackend::emitProgress(int i)
Q_EMIT progress(i);
......@@ -170,6 +170,8 @@ public:
virtual void emitScanProgress(const QString& deviceNode, int i);
static bool isPolkitInstalledCorrectly();
static void setPartitionTableForDevice(Device& d, PartitionTable* p);
static void setPartitionTableMaxPrimaries(PartitionTable& p, qint32 max_primaries);
Supports Markdown
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