Use the ConflictDialog directly from the activity list

No need to go to the file manager first to then have the user go through
the context menu, just popup the dialog directly.

Signed-off-by: Kevin Ottens <kevin.ottens@nextcloud.com>
This commit is contained in:
Kevin Ottens 2020-10-07 18:05:21 +02:00
parent 4116c90c9c
commit b835092ae9
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2

View file

@ -22,6 +22,7 @@
#include "account.h"
#include "accountstate.h"
#include "accountmanager.h"
#include "conflictdialog.h"
#include "folderman.h"
#include "iconjob.h"
#include "accessmanager.h"
@ -426,6 +427,32 @@ void ActivityListModel::triggerActionAtIndex(int id) const
const auto modelIndex = index(id);
const auto path = data(modelIndex, PathRole).toUrl();
const auto activity = _finalList.at(id);
if (activity._status == SyncFileItem::Conflict) {
Q_ASSERT(!activity._file.isEmpty());
Q_ASSERT(!activity._folder.isEmpty());
Q_ASSERT(Utility::isConflictFile(activity._file));
const auto folder = FolderMan::instance()->folder(activity._folder);
const auto conflictedRelativePath = activity._file;
const auto baseRelativePath = folder->journalDb()->conflictFileBaseName(conflictedRelativePath.toUtf8());
const auto dir = QDir(folder->path());
const auto conflictedPath = dir.filePath(conflictedRelativePath);
const auto basePath = dir.filePath(baseRelativePath);
const auto baseName = QFileInfo(basePath).fileName();
ConflictDialog dialog;
dialog.setBaseFilename(baseName);
dialog.setLocalVersionFilename(conflictedPath);
dialog.setRemoteVersionFilename(basePath);
dialog.exec();
return;
}
if (path.isValid()) {
QDesktopServices::openUrl(path);
} else {