fix kwallet

This commit is contained in:
Ole-André Rodlie 2016-03-31 20:59:24 +02:00 committed by Frank Osterfeld
parent 52ba281801
commit 5be7e75113
1 changed files with 17 additions and 16 deletions

View File

@ -326,18 +326,18 @@ void ReadPasswordJobPrivate::kwalletEntryTypeFinished( QDBusPendingCallWatcher*
? QDBusPendingCall( iface->readPassword( walletHandle, q->service(), key, q->service() ) ) ? QDBusPendingCall( iface->readPassword( walletHandle, q->service(), key, q->service() ) )
: QDBusPendingCall( iface->readEntry( walletHandle, q->service(), key, q->service() ) ); : QDBusPendingCall( iface->readEntry( walletHandle, q->service(), key, q->service() ) );
QDBusPendingCallWatcher* nextWatcher = new QDBusPendingCallWatcher( nextReply, this ); QDBusPendingCallWatcher* nextWatcher = new QDBusPendingCallWatcher( nextReply, this );
connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletReadFinished(QDBusPendingCallWatcher*)) ); connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletFinished(QDBusPendingCallWatcher*)) );
} }
void ReadPasswordJobPrivate::kwalletFinished( QDBusPendingCallWatcher* watcher ) { void ReadPasswordJobPrivate::kwalletFinished( QDBusPendingCallWatcher* watcher ) {
if ( !watcher->isError() ) { if ( !watcher->isError() ) {
if ( mode == Binary ) { if ( mode == Binary ) {
QDBusPendingReply<QByteArray> reply = *watcher; QDBusPendingReply<QByteArray> reply = *watcher;
data = reply.value(); data = reply.value();
} else { } else {
QDBusPendingReply<QString> reply = *watcher; QDBusPendingReply<QString> reply = *watcher;
data = reply.value().toUtf8(); data = reply.value().toUtf8();
} }
} }
JobPrivate::kwalletFinished(watcher); JobPrivate::kwalletFinished(watcher);
@ -461,17 +461,18 @@ void JobPrivate::kwalletOpenFinished( QDBusPendingCallWatcher* watcher ) {
nextReply = iface->removeEntry( handle, q->service(), key, q->service() ); nextReply = iface->removeEntry( handle, q->service(), key, q->service() );
QDBusPendingCallWatcher* nextWatcher = new QDBusPendingCallWatcher( nextReply, this ); QDBusPendingCallWatcher* nextWatcher = new QDBusPendingCallWatcher( nextReply, this );
connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletWriteFinished(QDBusPendingCallWatcher*)) ); connect( nextWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)), this, SLOT(kwalletFinished(QDBusPendingCallWatcher*)) );
} }
void JobPrivate::kwalletFinished( QDBusPendingCallWatcher* watcher ) { void JobPrivate::kwalletFinished( QDBusPendingCallWatcher* watcher ) {
watcher->deleteLater(); if ( !watcher->isError() ) {
QDBusPendingReply<int> reply = *watcher; if ( mode == Binary ) {
if ( reply.isError() ) { QDBusPendingReply<QByteArray> reply = *watcher;
const QDBusError err = reply.error(); data = reply.value();
q->emitFinishedWithError( OtherError, tr("Could not open wallet: %1; %2") } else {
.arg( QDBusError::errorString( err.type() ), err.message() ) ); QDBusPendingReply<QString> reply = *watcher;
return; data = reply.value().toUtf8();
}
} }
q->emitFinished(); q->emitFinished();