@@ -249,32 +249,42 @@ void FileActionsModel::createRequest(const int row)
249249 }
250250 const auto verb = job->stringToVerb (_fileActions.at (row).method );
251251 job->setVerb (verb);
252+ job->setProperty (rowC, row);
252253 job->start ();
253254}
254255
255256void FileActionsModel::processRequest (const QJsonDocument &json, int statusCode)
256257{
257- auto message = tr (" File action succeded, access your instance for the result." );
258+ const auto row = sender ()->property (rowC).toInt ();
259+ const auto fileAction = _fileActions.at (row).name ;
260+ const auto errorMessage = tr (" %1 did not succeed, please try again later. "
261+ " If you need help, contact your server administrator." ,
262+ " file action error message" ).arg (fileAction);
258263 if (statusCode != 200 ) {
259264 qCWarning (lcFileActions) << " File action did not succeed for" << _localPath;
265+ setResponse ({ errorMessage, _accountUrl });
266+ return ;
260267 }
261268
262269 const auto root = json.object ().value (QStringLiteral (" root" )).toObject ();
270+ const auto folderForPath = FolderMan::instance ()->folderForPath (_localPath);
271+ const auto remoteFolderPath = _accountUrl + folderForPath->remotePath ();
272+ const auto successMessage = tr (" %1 done." , " file action success message" ).arg (fileAction);
263273 if (root.empty ()) {
264- const auto folderForPath = FolderMan::instance ()->folderForPath (_localPath);
265- setResponse ({ message, _accountUrl });
274+ setResponse ({ successMessage, remoteFolderPath });
266275 return ;
267276 }
277+
268278 const auto orientation = root.value (QStringLiteral (" orientation" )).toString ();
269279 const auto rows = root.value (QStringLiteral (" rows" )).toArray ();
270280 if (rows.empty ()) {
281+ setResponse ({ successMessage, remoteFolderPath });
271282 return ;
272283 }
273284
274285 for (const auto &rowValue : rows) {
275286 const auto row = rowValue.toObject ();
276287 const auto children = row.value (" children" ).toArray ();
277-
278288 for (const auto &childValue : children) {
279289 const auto child = childValue.toObject ();
280290 setResponse ({ child.value (QStringLiteral (" element" )).toString (),
0 commit comments