[Bug 353278] Re: [jaunty] kpackagekit doesn't prompt for user password
gwydion.dot
gwydion.dot at morrigan.ch
Thu Jun 18 07:33:07 UTC 2009
if ( Transaction *t = m_client->updateSystem() ) {
KpkTransaction *frm = new KpkTransaction(t, KpkTransaction::Modal | KpkTransaction::CloseOnFinish, this);
connect(frm, SIGNAL(kTransactionFinished(KpkTransaction::ExitStatus)),
this, SLOT(displayUpdates(KpkTransaction::ExitStatus)));
frm->show();
} else {
KMessageBox::sorry(this,
i18n("You don't have the necessary privileges to perform this action."),
i18n("Failed to update system"));
}
Yay, I found it again.
"if ( Transaction *t = m_client->updateSystem() ) "
"if ( Transaction *t = Client::instance()->installFiles(files, true))"
"PackageKit::Transaction" Ok, here we use packagekit.
updateSystem() will do this:
Transaction* Client::updateSystem()
{
if(!PolkitClient::instance()->getAuth(AUTH_SYSTEM_UPDATE)) {
emit authError(AUTH_SYSTEM_UPDATE);
return NULL;
}
Transaction* t = d->createNewTransaction();
t->d->p->UpdateSystem();
return t;
}
A sweet bool:
bool getAuth(const QString& action);
Some more about getAuth().
#ifdef USE_SECURITY_POLKIT
bool PolkitClient::getAuth(const QString &action) {
DBusError e;
dbus_error_init(&e);
if(polkit_check_auth(QCoreApplication::applicationPid(), action.toAscii().data(), NULL))
return true;
bool auth = polkit_auth_obtain(action.toAscii().data(), 0, QCoreApplication::applicationPid(), &e);
if(!auth) {
qDebug() << "Authentification error :" << e.name << ":" << e.message;
}
return auth;
}
#else
bool PolkitClient::getAuth(const QString &action) {
qDebug() << "Not configured with PolicyKit support";
return false;
}
#endif
Now, the big question, why it will not work?
--
[jaunty] kpackagekit doesn't prompt for user password
https://bugs.launchpad.net/bugs/353278
You received this bug notification because you are a member of Kubuntu
Bugs, which is subscribed to policykit-kde in ubuntu.
More information about the kubuntu-bugs
mailing list