Integrated local error messages in activitymodel

Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com>
This commit is contained in:
Dominique Fuchs 2020-01-13 12:54:38 +01:00
parent 9e82ba60b4
commit 84066634e7
2 changed files with 37 additions and 0 deletions

View file

@ -19,6 +19,42 @@ User::User(AccountStatePtr &account, const bool &isCurrent, QObject* parent)
{ {
connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted, connect(ProgressDispatcher::instance(), &ProgressDispatcher::itemCompleted,
this, &User::slotItemCompleted); 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) void User::slotItemCompleted(const QString &folder, const SyncFileItemPtr &item)

View file

@ -38,6 +38,7 @@ public:
public slots: public slots:
void slotItemCompleted(const QString &folder, const SyncFileItemPtr &item); void slotItemCompleted(const QString &folder, const SyncFileItemPtr &item);
void slotAddError(const QString &folderAlias, const QString &message, ErrorCategory category);
private: private:
AccountStatePtr _account; AccountStatePtr _account;