1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 22:26:32 +02:00

Try to fix startup issue.

This commit is contained in:
Teo Mrnjavac
2013-05-23 22:23:19 +02:00
committed by Michael Zanetti
parent b006c56876
commit 30a4019c65

View File

@@ -36,13 +36,14 @@ namespace Accounts
CredentialsManager::CredentialsManager( QObject* parent ) CredentialsManager::CredentialsManager( QObject* parent )
: QObject( parent ) : QObject( parent )
{ {
tDebug() << Q_FUNC_INFO;
} }
void void
CredentialsManager::loadCredentials( QStringList keys ) CredentialsManager::loadCredentials( QStringList keys )
{ {
tDebug() << Q_FUNC_INFO << "keys:" << keys;
foreach ( QString key, keys ) foreach ( QString key, keys )
{ {
QKeychain::ReadPasswordJob* j = new QKeychain::ReadPasswordJob( TOMAHAWK_KEYCHAINSVC, this ); QKeychain::ReadPasswordJob* j = new QKeychain::ReadPasswordJob( TOMAHAWK_KEYCHAINSVC, this );
@@ -55,6 +56,7 @@ CredentialsManager::loadCredentials( QStringList keys )
SLOT( keychainJobFinished( QKeychain::Job* ) ) ); SLOT( keychainJobFinished( QKeychain::Job* ) ) );
m_readJobs << j; m_readJobs << j;
j->start(); j->start();
tDebug() << "Launching QtKeychain readJob for" << key;
} }
} }
@@ -124,9 +126,10 @@ CredentialsManager::setCredentials( const QString& key, const QVariantHash& valu
void void
CredentialsManager::keychainJobFinished( QKeychain::Job* j ) CredentialsManager::keychainJobFinished( QKeychain::Job* j )
{ {
if ( j->error() == QKeychain::NoError ) tDebug() << Q_FUNC_INFO;
{
if ( QKeychain::ReadPasswordJob* readJob = qobject_cast< QKeychain::ReadPasswordJob* >( j ) ) if ( QKeychain::ReadPasswordJob* readJob = qobject_cast< QKeychain::ReadPasswordJob* >( j ) )
{
if ( readJob->error() == QKeychain::NoError )
{ {
tDebug() << "QtKeychain readJob for" << readJob->key() << "finished without errors"; tDebug() << "QtKeychain readJob for" << readJob->key() << "finished without errors";
@@ -135,6 +138,11 @@ CredentialsManager::keychainJobFinished( QKeychain::Job* j )
dataStream >> creds; dataStream >> creds;
m_credentials.insert( readJob->key(), creds ); m_credentials.insert( readJob->key(), creds );
}
else
{
tDebug() << "QtKeychain readJob finished with error:" << j->error() << j->errorString();
}
m_readJobs.removeAll( readJob ); m_readJobs.removeAll( readJob );
@@ -145,16 +153,13 @@ CredentialsManager::keychainJobFinished( QKeychain::Job* j )
} }
else if ( QKeychain::WritePasswordJob* writeJob = qobject_cast< QKeychain::WritePasswordJob* >( j ) ) else if ( QKeychain::WritePasswordJob* writeJob = qobject_cast< QKeychain::WritePasswordJob* >( j ) )
{ {
tLog() << Q_FUNC_INFO << "QtKeychain writeJob for" << writeJob->key() << "finished"; tLog() << Q_FUNC_INFO << "QtKeychain writeJob for" << writeJob->key() << "finished"
<< ( ( j->error() == QKeychain::NoError ) ? "without error" : j->errorString() );
} }
else if ( QKeychain::DeletePasswordJob* deleteJob = qobject_cast< QKeychain::DeletePasswordJob* >( j ) ) else if ( QKeychain::DeletePasswordJob* deleteJob = qobject_cast< QKeychain::DeletePasswordJob* >( j ) )
{ {
tLog() << Q_FUNC_INFO << "QtKeychain deleteJob for" << deleteJob->key() << "finished"; tLog() << Q_FUNC_INFO << "QtKeychain deleteJob for" << deleteJob->key() << "finished"
} << ( ( j->error() == QKeychain::NoError ) ? "without error" : j->errorString() );
}
else
{
tDebug() << "QtKeychain job finished with error:" << j->error() << j->errorString();
} }
j->deleteLater(); j->deleteLater();
} }