Fixed tray icon, use theme for this

Fixed folder enable/disable.
This commit is contained in:
Klaas Freitag 2012-03-03 10:51:06 +01:00
parent 1f12f3d181
commit dbf02772c3
4 changed files with 18 additions and 18 deletions

View file

@ -376,9 +376,10 @@ void Application::slotInfoFolder( const QString& alias )
void Application::slotEnableFolder(const QString& alias, const bool enable)
{
qDebug() << "enable folder with alias " << alias;
qDebug() << "Application: enable folder with alias " << alias;
_folderMan->slotEnableFolder( alias, enable );
_statusDialog->setFolderList( _folderMan->map() );
}
@ -439,21 +440,15 @@ void Application::computeOverallSyncStatus()
trayMessage += folderMessage;
}
QString statusIcon = MIRALL_ICON;
qDebug() << "overall result is " << overallResult.status();
if( overallResult.status() == SyncResult::Error ) {
statusIcon = "dialog-close";
} else if( overallResult.status() == SyncResult::Success ) {
statusIcon = MIRALL_ICON;
} else if( overallResult.status() == SyncResult::Disabled ) {
statusIcon = "dialog-cancel";
} else if( overallResult.status() == SyncResult::SetupError ) {
statusIcon = "dialog-cancel";
} else if( overallResult.status() == SyncResult::Undefined ) {
statusIcon = "view-refresh";
QIcon statusIcon = _theme->syncStateIcon( overallResult.status(), 20 );
if( overallResult.status() == SyncResult::Success ) {
// Rather display the mirall icon instead of the ok icon.
statusIcon = _theme->applicationIcon( 24 );
}
_tray->setIcon(QIcon::fromTheme(statusIcon, QIcon( QString( ":/mirall/resources/%1").arg(statusIcon))));
_tray->setIcon( statusIcon );
_tray->setToolTip(trayMessage);
// Only refresh the folder if it is being shown
@ -462,6 +457,5 @@ void Application::computeOverallSyncStatus()
}
}
} // namespace Mirall

View file

@ -190,7 +190,7 @@ void StatusDialog::setFolderList( Folder::Map folders )
item->setData( f->path(), FolderViewDelegate::FolderPathRole );
item->setData( f->alias(), FolderViewDelegate::FolderNameRole );
item->setData( f->syncEnabled(), FolderViewDelegate::FolderSyncEnabled );
qDebug() << "Folder is SyncEnabled: " << f->syncEnabled();
qDebug() << "***** Folder is SyncEnabled: " << f->syncEnabled();
SyncResult res = f->syncResult();
SyncResult::Status status = res.status();

View file

@ -84,6 +84,11 @@ QString Theme::statusHeaderText( SyncResult::Status status ) const
return resultStr;
}
QIcon Theme::applicationIcon( int size ) const
{
return QIcon::fromTheme( "mirall", QIcon(QString(":mirall/resources/mirall-%1").arg(size) ) );
}
QString Theme::version() const
{
return QString::fromLocal8Bit( MIRALL_STRINGIFY( MIRALL_VERSION ) );

View file

@ -43,6 +43,7 @@ public:
virtual QIcon syncStateIcon( SyncResult::Status, int ) const;
virtual QString statusHeaderText( SyncResult::Status ) const;
virtual QPixmap splashScreen() const = 0;
virtual QIcon applicationIcon( int ) const;
virtual QString version() const;
private: