Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mirall/accountsettings.cpp17
-rw-r--r--src/mirall/folderstatusmodel.cpp24
2 files changed, 21 insertions, 20 deletions
diff --git a/src/mirall/accountsettings.cpp b/src/mirall/accountsettings.cpp
index cb642271a..f122dae44 100644
--- a/src/mirall/accountsettings.cpp
+++ b/src/mirall/accountsettings.cpp
@@ -223,10 +223,6 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
SyncResult::Status status = res.status();
QStringList errorList = res.errorStrings();
- QString errors;
- if( ! errorList.isEmpty() ) {
- errors = res.errorStrings().join(QLatin1String("<br/>"));
- }
Theme *theme = Theme::instance();
item->setData( theme->statusHeaderText( status ), Qt::ToolTipRole );
@@ -236,14 +232,17 @@ void AccountSettings::folderToModelItem( QStandardItem *item, Folder *f )
item->setData( theme->folderDisabledIcon( ), FolderStatusDelegate::FolderStatusIconRole ); // size 48 before
}
item->setData( theme->statusHeaderText( status ), FolderStatusDelegate::FolderStatus );
- item->setData( errors, FolderStatusDelegate::FolderErrorMsg );
- if( errors.isEmpty() && (status == SyncResult::Error ||
- status == SyncResult::SetupError ||
- status == SyncResult::Unavailable )) {
- item->setData( theme->statusHeaderText(status), FolderStatusDelegate::FolderErrorMsg);
+ if( errorList.isEmpty() ) {
+ if( (status == SyncResult::Error ||
+ status == SyncResult::SetupError ||
+ status == SyncResult::Unavailable )) {
+ errorList << theme->statusHeaderText(status);
+ }
}
+ item->setData( errorList, FolderStatusDelegate::FolderErrorMsg);
+
bool ongoing = false;
item->setData( QVariant(res.warnCount()), FolderStatusDelegate::WarningCount );
if( status == SyncResult::SyncRunning ) {
diff --git a/src/mirall/folderstatusmodel.cpp b/src/mirall/folderstatusmodel.cpp
index feffbcc9c..15a0a1f56 100644
--- a/src/mirall/folderstatusmodel.cpp
+++ b/src/mirall/folderstatusmodel.cpp
@@ -81,8 +81,9 @@ QSize FolderStatusDelegate::sizeHint(const QStyleOptionViewItem & option ,
h += aliasMargin; // bottom margin
// add some space to show an error condition.
- if( ! qvariant_cast<QString>(index.data(FolderErrorMsg)).isEmpty() ) {
- h += aliasMargin*2+fm.height();
+ if( ! qvariant_cast<QStringList>(index.data(FolderErrorMsg)).isEmpty() ) {
+ QStringList errMsgs = qvariant_cast<QStringList>(index.data(FolderErrorMsg));
+ h += aliasMargin*2 + errMsgs.count()*fm.height();
}
if( qvariant_cast<bool>(index.data(AddProgressSpace)) ) {
@@ -122,7 +123,7 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
QString aliasText = qvariant_cast<QString>(index.data(FolderAliasRole));
QString pathText = qvariant_cast<QString>(index.data(FolderPathRole));
QString remotePath = qvariant_cast<QString>(index.data(FolderSecondPathRole));
- QString errorText = qvariant_cast<QString>(index.data(FolderErrorMsg));
+ QStringList errorTexts= qvariant_cast<QStringList>(index.data(FolderErrorMsg));
int overallPercent = qvariant_cast<int>(index.data(SyncProgressOverallPercent));
QString overallString = qvariant_cast<QString>(index.data(SyncProgressOverallString));
@@ -211,12 +212,12 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
// paint an error overlay if there is an error string
int h = iconRect.bottom();
- if( !errorText.isEmpty() ) {
+ if( !errorTexts.isEmpty() ) {
h += aliasMargin;
QRect errorRect = localPathRect;
errorRect.setLeft( iconRect.left());
errorRect.setTop( h );
- errorRect.setHeight(subFm.height()+aliasMargin);
+ errorRect.setHeight(errorTexts.count() * subFm.height()+aliasMargin);
errorRect.setRight( option.rect.right()-aliasMargin );
painter->setBrush( QColor(0xbb, 0x4d, 0x4d) );
@@ -226,15 +227,16 @@ void FolderStatusDelegate::paint(QPainter *painter, const QStyleOptionViewItem &
painter->setPen( Qt::white );
painter->setFont(errorFont);
QRect errorTextRect = errorRect;
- errorTextRect.setLeft( errorTextRect.left()+aliasMargin +16);
+ errorTextRect.setLeft( errorTextRect.left()+aliasMargin );
errorTextRect.setTop( errorTextRect.top()+aliasMargin/2 );
- int linebreak = errorText.indexOf(QLatin1String("<br"));
- QString eText = errorText;
- if(linebreak) {
- eText = errorText.left(linebreak);
+ int x = errorTextRect.left();
+ int y = errorTextRect.top()+aliasMargin/2 + subFm.height()/2;
+
+ foreach( QString eText, errorTexts ) {
+ painter->drawText(x, y, subFm.elidedText( eText, Qt::ElideLeft, errorTextRect.width()-2*aliasMargin));
+ y += subFm.height();
}
- painter->drawText(errorTextRect, eText);
h = errorRect.bottom();
}