mirror of
https://github.com/nextcloud/desktop.git
synced 2024-12-18 03:41:50 +03:00
Integrated local error messages in activitymodel
Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
parent
9e82ba60b4
commit
84066634e7
2 changed files with 37 additions and 0 deletions
|
@ -19,6 +19,42 @@ User::User(AccountStatePtr &account, const bool &isCurrent, QObject* parent)
|
|||
{
|
||||
connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted,
|
||||
this, &User::slotItemCompleted);
|
||||
connect(ProgressDispatcher::instance(), &ProgressDispatcher::syncError,
|
||||
this, &User::slotAddError);
|
||||
}
|
||||
|
||||
void User::slotAddError(const QString &folderAlias, const QString &message, ErrorCategory category)
|
||||
{
|
||||
auto folderInstance = FolderMan::instance()->folder(folderAlias);
|
||||
if (!folderInstance)
|
||||
return;
|
||||
|
||||
if (folderInstance->accountState() == _account.data()) {
|
||||
qCWarning(lcActivity) << "Item " << folderInstance->shortGuiLocalPath() << " retrieved resulted in " << message;
|
||||
|
||||
Activity activity;
|
||||
activity._type = Activity::SyncResultType;
|
||||
activity._status = SyncResult::Error;
|
||||
activity._dateTime = QDateTime::fromString(QDateTime::currentDateTime().toString(), Qt::ISODate);
|
||||
activity._subject = message;
|
||||
activity._message = folderInstance->shortGuiLocalPath();
|
||||
activity._link = folderInstance->shortGuiLocalPath();
|
||||
activity._accName = folderInstance->accountState()->account()->displayName();
|
||||
activity._folder = folderAlias;
|
||||
|
||||
|
||||
if (category == ErrorCategory::InsufficientRemoteStorage) {
|
||||
ActivityLink link;
|
||||
link._label = tr("Retry all uploads");
|
||||
link._link = folderInstance->path();
|
||||
link._verb = "";
|
||||
link._isPrimary = true;
|
||||
activity._links.append(link);
|
||||
}
|
||||
|
||||
// add 'other errors' to activity list
|
||||
_activityModel->addErrorToActivityList(activity);
|
||||
}
|
||||
}
|
||||
|
||||
void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void slotItemCompleted(const QString &folder, const SyncFileItemPtr &item);
|
||||
void slotAddError(const QString &folderAlias, const QString &message, ErrorCategory category);
|
||||
|
||||
private:
|
||||
AccountStatePtr _account;
|
||||
|
|
Loading…
Reference in a new issue