mirror of
https://github.com/nextcloud/desktop.git
synced 2025-10-26 11:17:43 +00:00
Merge pull request #8801 from nextcloud/feature/folderStateIcons
feat: Neutral folder state icons
This commit is contained in:
commit
2a458b83a8
@ -278,33 +278,31 @@ QVariant FolderStatusModel::data(const QModelIndex &index, int role) const
|
||||
toolTip += folderInfo._folder->path();
|
||||
return toolTip;
|
||||
}
|
||||
case FolderStatusDelegate::FolderStatusIconRole:
|
||||
if (accountConnected) {
|
||||
const auto theme = Theme::instance();
|
||||
const auto status = folder->syncResult().status();
|
||||
if (folder->syncPaused()) {
|
||||
return theme->folderDisabledIcon();
|
||||
} else {
|
||||
if (status == SyncResult::SyncPrepare || status == SyncResult::Undefined) {
|
||||
return theme->syncStateIcon(SyncResult::SyncRunning);
|
||||
} else {
|
||||
// The "Problem" *result* just means some files weren't
|
||||
// synced, so we show "Success" in these cases. But we
|
||||
// do use the "Problem" *icon* for unresolved conflicts.
|
||||
if (status == SyncResult::Success || status == SyncResult::Problem) {
|
||||
if (folder->syncResult().hasUnresolvedConflicts()) {
|
||||
return theme->syncStateIcon(SyncResult::Problem);
|
||||
} else {
|
||||
return theme->syncStateIcon(SyncResult::Success);
|
||||
}
|
||||
} else {
|
||||
return theme->syncStateIcon(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return Theme::instance()->folderOfflineIcon();
|
||||
case FolderStatusDelegate::FolderStatusIconRole: {
|
||||
if (!accountConnected) {
|
||||
return Theme::instance()->folderStateIcon(SyncResult::SetupError);
|
||||
}
|
||||
|
||||
const auto theme = Theme::instance();
|
||||
const auto result = folder->syncResult();
|
||||
const auto status = result.status();
|
||||
|
||||
if (folder->syncPaused()) {
|
||||
return theme->folderStateIcon(SyncResult::Paused);
|
||||
}
|
||||
|
||||
if (status == SyncResult::SyncPrepare || status == SyncResult::Undefined) {
|
||||
return theme->folderStateIcon(SyncResult::SyncRunning);
|
||||
}
|
||||
|
||||
if (status == SyncResult::Success || status == SyncResult::Problem) {
|
||||
return theme->folderStateIcon(result.hasUnresolvedConflicts()
|
||||
? SyncResult::Problem
|
||||
: SyncResult::Success);
|
||||
}
|
||||
|
||||
return theme->folderStateIcon(status);
|
||||
}
|
||||
case FolderStatusDelegate::SyncProgressItemString:
|
||||
// e.g. Syncing fileName1, filename2
|
||||
return progress._progressString;
|
||||
|
||||
@ -684,7 +684,6 @@ QIcon Theme::syncStateIcon(SyncResult::Status status, bool sysTray) const
|
||||
break;
|
||||
case SyncResult::Error:
|
||||
case SyncResult::SetupError:
|
||||
// FIXME: Use state-problem once we have an icon.
|
||||
default:
|
||||
statusIcon = QLatin1String("state-error");
|
||||
}
|
||||
@ -692,9 +691,42 @@ QIcon Theme::syncStateIcon(SyncResult::Status status, bool sysTray) const
|
||||
return themeIcon(statusIcon, sysTray);
|
||||
}
|
||||
|
||||
QIcon Theme::folderDisabledIcon() const
|
||||
// Neutral icons for the classic sync folder list
|
||||
|
||||
QIcon Theme::folderStateIcon(SyncResult::Status status) const
|
||||
{
|
||||
return themeIcon(QLatin1String("state-pause"));
|
||||
// FIXME: Mind the size!
|
||||
QString statusIcon;
|
||||
|
||||
switch (status) {
|
||||
case SyncResult::Undefined:
|
||||
// this can happen if no sync connections are configured.
|
||||
statusIcon = QLatin1String("warning");
|
||||
break;
|
||||
case SyncResult::NotYetStarted:
|
||||
case SyncResult::SyncRunning:
|
||||
statusIcon = QLatin1String("sync");
|
||||
break;
|
||||
case SyncResult::SyncAbortRequested:
|
||||
case SyncResult::Paused:
|
||||
statusIcon = QLatin1String("pause");
|
||||
break;
|
||||
case SyncResult::SyncPrepare:
|
||||
case SyncResult::Success:
|
||||
statusIcon = QLatin1String("ok");
|
||||
break;
|
||||
case SyncResult::Problem:
|
||||
statusIcon = QLatin1String("warning");
|
||||
break;
|
||||
case SyncResult::SetupError:
|
||||
statusIcon = QLatin1String("offline");
|
||||
break;
|
||||
case SyncResult::Error:
|
||||
default:
|
||||
statusIcon = QLatin1String("error");
|
||||
}
|
||||
|
||||
return themeIcon(statusIcon, false);
|
||||
}
|
||||
|
||||
QIcon Theme::folderOfflineIcon(bool sysTray) const
|
||||
|
||||
@ -44,7 +44,6 @@ class OWNCLOUDSYNC_EXPORT Theme : public QObject
|
||||
Q_PROPERTY(QUrl statusBusyImageSource READ statusBusyImageSource CONSTANT)
|
||||
Q_PROPERTY(QUrl statusInvisibleImageSource READ statusInvisibleImageSource CONSTANT)
|
||||
#ifndef TOKEN_AUTH_ONLY
|
||||
Q_PROPERTY(QIcon folderDisabledIcon READ folderDisabledIcon CONSTANT)
|
||||
Q_PROPERTY(QIcon folderOfflineIcon READ folderOfflineIcon CONSTANT)
|
||||
Q_PROPERTY(QIcon applicationIcon READ applicationIcon CONSTANT)
|
||||
#endif
|
||||
@ -190,8 +189,7 @@ public:
|
||||
* get an sync state icon
|
||||
*/
|
||||
[[nodiscard]] QIcon syncStateIcon(SyncResult::Status, bool sysTray = false) const;
|
||||
|
||||
[[nodiscard]] QIcon folderDisabledIcon() const;
|
||||
[[nodiscard]] QIcon folderStateIcon(SyncResult::Status) const;
|
||||
[[nodiscard]] QIcon folderOfflineIcon(bool sysTray = false) const;
|
||||
[[nodiscard]] QIcon applicationIcon() const;
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user