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 Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to