diff --git a/src/libtomahawk/Source.cpp b/src/libtomahawk/Source.cpp index 831b8e61c..509068e87 100644 --- a/src/libtomahawk/Source.cpp +++ b/src/libtomahawk/Source.cpp @@ -238,6 +238,19 @@ Source::avatar( TomahawkUtils::ImageMode style, const QSize& size ) break; } } + if ( result.isNull() ) + { + // Try to get the avatar from the cache + // Hint: We store the avatar for each xmpp peer using its contactId, the dbFriendlyName is a contactId of a peer + QByteArray avatarBuffer = TomahawkUtils::Cache::instance()->getData( "Sources", dbFriendlyName() ).toByteArray(); + if ( !avatarBuffer.isNull() ) + { + QPixmap avatar; + avatar.loadFromData( avatarBuffer ); + avatarBuffer.clear(); + result = QPixmap( TomahawkUtils::createRoundedImage( avatar, QSize( 0, 0 ) ) ); + } + } // tLog() << "****************************************************************************************"; return result; }