|
7 | 7 | #include "socketapi.h" |
8 | 8 | #include "socketapi_p.h" |
9 | 9 |
|
10 | | -#include "conflictdialog.h" |
11 | 10 | #include "conflictsolver.h" |
12 | 11 |
|
13 | 12 | #include "config.h" |
|
51 | 50 | #include <QStringBuilder> |
52 | 51 | #include <QMessageBox> |
53 | 52 | #include <QInputDialog> |
54 | | -#include <QFileDialog> |
55 | | -#include <QTimer> |
56 | 53 |
|
57 | 54 |
|
58 | 55 | #include <QAction> |
@@ -1072,26 +1069,8 @@ void SocketApi::command_RESOLVE_CONFLICT(const QString &localFile, SocketListene |
1072 | 1069 | const auto basePath = dir.filePath(baseRelativePath); |
1073 | 1070 |
|
1074 | 1071 | const auto baseName = QFileInfo(basePath).fileName(); |
1075 | | - const auto folderAlias = fileData.folder->alias(); |
1076 | 1072 |
|
1077 | | -#ifndef OWNCLOUD_TEST |
1078 | | - // Show the dialog outside of the socket read loop. This handler runs via a |
1079 | | - // Qt::DirectConnection while SocketApi is still iterating the socket, so a nested |
1080 | | - // modal loop here can let the socket or the Folder be destroyed underneath us. |
1081 | | - // Defer to the next event loop iteration and look up the folder again by alias. |
1082 | | - QTimer::singleShot(0, this, [conflictedPath, basePath, baseName, folderAlias] { |
1083 | | - ConflictDialog dialog; |
1084 | | - dialog.setBaseFilename(baseName); |
1085 | | - dialog.setLocalVersionFilename(conflictedPath); |
1086 | | - dialog.setRemoteVersionFilename(basePath); |
1087 | | - if (dialog.exec() != ConflictDialog::Accepted) { |
1088 | | - return; |
1089 | | - } |
1090 | | - if (const auto folder = FolderMan::instance()->folder(folderAlias)) { |
1091 | | - folder->scheduleThisFolderSoon(); |
1092 | | - } |
1093 | | - }); |
1094 | | -#endif |
| 1073 | + emit resolveConflictCommandReceived(conflictedPath, basePath, baseName, fileData.folder->alias()); |
1095 | 1074 | } |
1096 | 1075 |
|
1097 | 1076 | void SocketApi::command_DELETE_ITEM(const QString &localFile, SocketListener *) |
@@ -1132,34 +1111,7 @@ void SocketApi::command_MOVE_ITEM(const QString &localFile, SocketListener *) |
1132 | 1111 | // Add back the folder path |
1133 | 1112 | defaultDirAndName = QDir(fileData.folder->path()).filePath(defaultDirAndName); |
1134 | 1113 |
|
1135 | | - // Show the file dialog outside of the socket read loop. As in command_RESOLVE_CONFLICT, |
1136 | | - // a nested modal loop from the Qt::DirectConnection dispatch can free the socket under us. |
1137 | | - QTimer::singleShot(0, this, [localFile, defaultDirAndName] { |
1138 | | - // Use getSaveFileUrl for sandbox compatibility |
1139 | | - const auto targetUrl = QFileDialog::getSaveFileUrl( |
1140 | | - nullptr, |
1141 | | - SocketApi::tr("Select new location …"), |
1142 | | - QUrl::fromLocalFile(defaultDirAndName), |
1143 | | - QString(), nullptr, QFileDialog::HideNameFilterDetails); |
1144 | | - if (targetUrl.isEmpty()) |
1145 | | - return; |
1146 | | - |
1147 | | -#ifdef Q_OS_MACOS |
1148 | | - // On macOS with app sandbox, we need to explicitly access the security-scoped resource |
1149 | | - auto scopedAccess = Utility::MacSandboxSecurityScopedAccess::create(targetUrl); |
1150 | | - |
1151 | | - if (!scopedAccess->isValid()) { |
1152 | | - qCWarning(lcSocketApi) << "Could not access security-scoped resource for conflict resolution:" << targetUrl; |
1153 | | - return; |
1154 | | - } |
1155 | | -#endif |
1156 | | - |
1157 | | - const auto target = targetUrl.toLocalFile(); |
1158 | | - |
1159 | | - ConflictSolver solver; |
1160 | | - solver.setLocalVersionFilename(localFile); |
1161 | | - solver.setRemoteVersionFilename(target); |
1162 | | - }); |
| 1114 | + emit moveItemCommandReceived(localFile, defaultDirAndName); |
1163 | 1115 | } |
1164 | 1116 |
|
1165 | 1117 | void SocketApi::command_LOCK_FILE(const QString &localFile, SocketListener *listener) |
|
0 commit comments