mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 23:28:14 +03:00
Merge pull request #580 from nextcloud/issues/activities
Fixes #538: correctly checks for local sync actitivities.
This commit is contained in:
commit
647df7bcee
5 changed files with 63 additions and 45 deletions
|
@ -36,6 +36,7 @@
|
||||||
<file>resources/public.svg</file>
|
<file>resources/public.svg</file>
|
||||||
<file>resources/confirm.svg</file>
|
<file>resources/confirm.svg</file>
|
||||||
<file>resources/copy.svg</file>
|
<file>resources/copy.svg</file>
|
||||||
|
<file>resources/state-sync.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/"/>
|
<qresource prefix="/"/>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
1
resources/state-sync.svg
Normal file
1
resources/state-sync.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg width="16" height="16" version="1.1" viewBox="0 0 4.2333 4.2333" xmlns="http://www.w3.org/2000/svg"><g transform="matrix(.87498 0 0 .87498 .26458 -255.9)"><circle cx="2.1167" cy="294.88" r="2.1167" fill="#2268ab" stroke-width=".25066"/><g fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="m3.0714 295.43a1.1024 1.1024 0 0 1-0.95473 0.55121 1.1024 1.1024 0 0 1-0.95473-0.55121" stroke="#fff" stroke-width=".44097"/><path transform="scale(-1)" d="m-1.1619-294.33a1.1024 1.1024 0 0 1-0.95473 0.55122 1.1024 1.1024 0 0 1-0.95473-0.55122" stroke="#fff" stroke-width=".44097"/><path d="m1.4349 295.15-0.52538-4e-5 1.138e-4 0.52563" stroke="#faffff" stroke-width=".52916"/><path d="m2.815 294.62 0.52538 4e-5 -1.138e-4 -0.52563" stroke="#faffff" stroke-width=".52916"/></g></g></svg>
|
After Width: | Height: | Size: 800 B |
|
@ -108,9 +108,9 @@ QVariant ActivityListModel::data(const QModelIndex &index, int role) const
|
||||||
|| a._status == SyncFileItem::Restoration){
|
|| a._status == SyncFileItem::Restoration){
|
||||||
return QIcon(QLatin1String(":/client/resources/state-warning.svg"));
|
return QIcon(QLatin1String(":/client/resources/state-warning.svg"));
|
||||||
}
|
}
|
||||||
return QIcon(QLatin1String(":/client/resources/activity.png"));
|
return QIcon(QLatin1String(":/client/resources/state-sync.svg"));
|
||||||
} else return QIcon(QLatin1String(":/client/resources/activity.png"));
|
}
|
||||||
return QVariant();
|
return QIcon(QLatin1String(":/client/resources/activity.png"));
|
||||||
break;
|
break;
|
||||||
case ActivityItemDelegate::ObjectTypeRole:
|
case ActivityItemDelegate::ObjectTypeRole:
|
||||||
return a._objectType;
|
return a._objectType;
|
||||||
|
@ -237,6 +237,12 @@ void ActivityListModel::removeActivityFromActivityList(int row) {
|
||||||
removeActivityFromActivityList(activity);
|
removeActivityFromActivityList(activity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ActivityListModel::addSyncFileItemToActivityList(Activity activity) {
|
||||||
|
qCInfo(lcActivity) << "Successfully added to the activity list: " << activity._subject;
|
||||||
|
_syncFileItemLists.prepend(activity);
|
||||||
|
combineActivityLists();
|
||||||
|
}
|
||||||
|
|
||||||
void ActivityListModel::removeActivityFromActivityList(Activity activity) {
|
void ActivityListModel::removeActivityFromActivityList(Activity activity) {
|
||||||
qCInfo(lcActivity) << "Activity/Notification/Error successfully dismissed: " << activity._subject;
|
qCInfo(lcActivity) << "Activity/Notification/Error successfully dismissed: " << activity._subject;
|
||||||
qCInfo(lcActivity) << "Trying to remove Activity/Notification/Error from view... ";
|
qCInfo(lcActivity) << "Trying to remove Activity/Notification/Error from view... ";
|
||||||
|
@ -271,6 +277,9 @@ void ActivityListModel::combineActivityLists()
|
||||||
std::sort(_notificationLists.begin(), _notificationLists.end());
|
std::sort(_notificationLists.begin(), _notificationLists.end());
|
||||||
resultList.append(_notificationLists);
|
resultList.append(_notificationLists);
|
||||||
|
|
||||||
|
std::sort(_syncFileItemLists.begin(), _syncFileItemLists.end());
|
||||||
|
resultList.append(_syncFileItemLists);
|
||||||
|
|
||||||
std::sort(_activityLists.begin(), _activityLists.end());
|
std::sort(_activityLists.begin(), _activityLists.end());
|
||||||
resultList.append(_activityLists);
|
resultList.append(_activityLists);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
ActivityList errorsList() { return _notificationErrorsLists; }
|
ActivityList errorsList() { return _notificationErrorsLists; }
|
||||||
void addNotificationToActivityList(Activity activity);
|
void addNotificationToActivityList(Activity activity);
|
||||||
void addErrorToActivityList(Activity activity);
|
void addErrorToActivityList(Activity activity);
|
||||||
|
void addSyncFileItemToActivityList(Activity activity);
|
||||||
void removeActivityFromActivityList(int row);
|
void removeActivityFromActivityList(int row);
|
||||||
void removeActivityFromActivityList(Activity activity);
|
void removeActivityFromActivityList(Activity activity);
|
||||||
|
|
||||||
|
@ -68,6 +69,7 @@ private:
|
||||||
void combineActivityLists();
|
void combineActivityLists();
|
||||||
|
|
||||||
ActivityList _activityLists;
|
ActivityList _activityLists;
|
||||||
|
ActivityList _syncFileItemLists;
|
||||||
ActivityList _notificationLists;
|
ActivityList _notificationLists;
|
||||||
ActivityList _notificationErrorsLists;
|
ActivityList _notificationErrorsLists;
|
||||||
ActivityList _finalList;
|
ActivityList _finalList;
|
||||||
|
|
|
@ -98,52 +98,49 @@ ActivityWidget::~ActivityWidget()
|
||||||
|
|
||||||
void ActivityWidget::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
|
void ActivityWidget::slotProgressInfo(const QString &folder, const ProgressInfo &progress)
|
||||||
{
|
{
|
||||||
|
if (progress.status() == ProgressInfo::Reconcile) {
|
||||||
|
// Wipe all non-persistent entries - as well as the persistent ones
|
||||||
|
// in cases where a local discovery was done.
|
||||||
|
auto f = FolderMan::instance()->folder(folder);
|
||||||
|
if (!f)
|
||||||
|
return;
|
||||||
|
const auto &engine = f->syncEngine();
|
||||||
|
const auto style = engine.lastLocalDiscoveryStyle();
|
||||||
|
foreach (Activity activity, _model->errorsList()) {
|
||||||
|
if (activity._folder != folder){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: this is really not working
|
if (style == LocalDiscoveryStyle::FilesystemOnly){
|
||||||
// if (progress.status() == ProgressInfo::Done
|
_model->removeActivityFromActivityList(activity);
|
||||||
// || progress.status() == ProgressInfo::Reconcile) {
|
continue;
|
||||||
// // Wipe all non-persistent entries - as well as the persistent ones
|
}
|
||||||
// // in cases where a local discovery was done.
|
|
||||||
// auto f = FolderMan::instance()->folder(folder);
|
|
||||||
// if (!f)
|
|
||||||
// return;
|
|
||||||
// const auto &engine = f->syncEngine();
|
|
||||||
// const auto style = engine.lastLocalDiscoveryStyle();
|
|
||||||
// foreach (Activity activity, _model->errorsList()) {
|
|
||||||
// if (activity._folder != folder){
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (style == LocalDiscoveryStyle::FilesystemOnly){
|
if(activity._status == SyncFileItem::Conflict && !QFileInfo(f->path() + activity._file).exists()){
|
||||||
// _model->removeActivityFromActivityList(activity);
|
_model->removeActivityFromActivityList(activity);
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if(activity._status == SyncFileItem::Conflict && !QFileInfo(f->path() + activity._file).exists()){
|
|
||||||
// _model->removeActivityFromActivityList(activity);
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// if(activity._status == SyncFileItem::FileIgnored && !QFileInfo(f->path() + activity._file).exists()){
|
if(activity._status == SyncFileItem::FileIgnored && !QFileInfo(f->path() + activity._file).exists()){
|
||||||
// _model->removeActivityFromActivityList(activity);
|
_model->removeActivityFromActivityList(activity);
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if(!QFileInfo(f->path() + activity._file).exists()){
|
if(!QFileInfo(f->path() + activity._file).exists()){
|
||||||
// _model->removeActivityFromActivityList(activity);
|
_model->removeActivityFromActivityList(activity);
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// auto path = QFileInfo(activity._file).dir().path().toUtf8();
|
auto path = QFileInfo(activity._file).dir().path().toUtf8();
|
||||||
// if (path == ".")
|
if (path == ".")
|
||||||
// path.clear();
|
path.clear();
|
||||||
|
|
||||||
// if(engine.shouldDiscoverLocally(path))
|
if(engine.shouldDiscoverLocally(path))
|
||||||
// _model->removeActivityFromActivityList(activity);
|
_model->removeActivityFromActivityList(activity);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (progress.status() == ProgressInfo::Done) {
|
if (progress.status() == ProgressInfo::Done) {
|
||||||
// We keep track very well of pending conflicts.
|
// We keep track very well of pending conflicts.
|
||||||
|
@ -171,18 +168,26 @@ void ActivityWidget::slotItemCompleted(const QString &folder, const SyncFileItem
|
||||||
qCWarning(lcActivity) << "Item " << item->_file << " retrieved resulted in " << item->_errorString;
|
qCWarning(lcActivity) << "Item " << item->_file << " retrieved resulted in " << item->_errorString;
|
||||||
|
|
||||||
Activity activity;
|
Activity activity;
|
||||||
activity._type = Activity::SyncFileItemType;
|
activity._type = Activity::SyncFileItemType; //client activity
|
||||||
activity._status = item->_status;
|
activity._status = item->_status;
|
||||||
activity._dateTime = QDateTime::fromString(QDateTime::currentDateTime().toString(), Qt::ISODate);
|
activity._dateTime = QDateTime::fromString(QDateTime::currentDateTime().toString(), Qt::ISODate);
|
||||||
activity._subject = item->_errorString;
|
|
||||||
activity._message = item->_originalFile;
|
activity._message = item->_originalFile;
|
||||||
activity._link = folderInstance->accountState()->account()->url();
|
activity._link = folderInstance->accountState()->account()->url();
|
||||||
activity._accName = folderInstance->accountState()->account()->displayName();
|
activity._accName = folderInstance->accountState()->account()->displayName();
|
||||||
activity._file = item->_file;
|
activity._file = item->_file;
|
||||||
activity._folder = folder;
|
activity._folder = folder;
|
||||||
|
|
||||||
// add 'protocol error' to activity list
|
if(item->_status == SyncFileItem::NoStatus || item->_status == SyncFileItem::Success){
|
||||||
_model->addErrorToActivityList(activity);
|
qCWarning(lcActivity) << "Item " << item->_file << " retrieved successfully.";
|
||||||
|
activity._message.prepend(tr("Synced "));
|
||||||
|
_model->addSyncFileItemToActivityList(activity);
|
||||||
|
} else {
|
||||||
|
qCWarning(lcActivity) << "Item " << item->_file << " retrieved resulted in error " << item->_errorString;
|
||||||
|
activity._subject = item->_errorString;
|
||||||
|
|
||||||
|
// add 'protocol error' to activity list
|
||||||
|
_model->addErrorToActivityList(activity);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue