Avoid quick flickering up of the ok-icon for the sync prepare state.

For the SyncPrepare phase now the icon that was displayed before is
kept. If the folder was disabled before, the sync icon is displayed.
This commit is contained in:
Klaas Freitag 2013-10-11 17:51:55 +02:00
parent 89cfa387cd
commit a3927c5c2c
2 changed files with 21 additions and 5 deletions

View file

@ -34,6 +34,8 @@
#include <QMessageBox>
#include <QAction>
#include <QKeySequence>
#include <QIcon>
#include <QVariant>
namespace Mirall {
@ -49,7 +51,8 @@ static const char progressBarStyleC[] =
AccountSettings::AccountSettings(QWidget *parent) :
QWidget(parent),
ui(new Ui::AccountSettings)
ui(new Ui::AccountSettings),
_wasDisabledBefore(false)
{
ui->setupUi(this);
@ -225,11 +228,20 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
Theme *theme = Theme::instance();
item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole );
if( f->syncEnabled() ) {
item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole );
if( status == SyncResult::SyncPrepare ) {
if( _wasDisabledBefore ) {
// if the folder was disabled before, set the sync icon
item->setData( theme->syncStateIcon( SyncResult::SyncRunning), FolderStatusDelegate::FolderStatusIconRole );
} // we keep the previous icon for the SyncPrepare state.
} else {
// kepp the previous icon for the prepare phase.
item->setData( theme->syncStateIcon( status ), FolderStatusDelegate::FolderStatusIconRole );
}
} else {
item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before
item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before
_wasDisabledBefore = false;
}
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
if( errorList.isEmpty() ) {
if( (status == SyncResult::Error ||
@ -435,6 +447,10 @@ void AccountSettings::slotEnableCurrentFolder()
}
folderMan->slotEnableFolder( alias, !folderEnabled );
// keep state for the icon setting.
if( !folderEnabled ) _wasDisabledBefore = true;
slotUpdateFolderState (f);
// set the button text accordingly.
slotFolderActivated( selected );

View file

@ -98,7 +98,7 @@ private:
QHash<QStandardItem*, QTimer*> _hideProgressTimers;
QString _kindContext;
QStringList _generalErrors;
bool _wasDisabledBefore;
};
} // namespace Mirall