caseclashconflictsolver.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #ifndef CASECLASHCONFLICTSOLVER_H
  2. #define CASECLASHCONFLICTSOLVER_H
  3. #include <QObject>
  4. #include "accountfwd.h"
  5. #include "owncloudlib.h"
  6. class QNetworkReply;
  7. namespace OCC {
  8. class SyncJournalDb;
  9. class OWNCLOUDSYNC_EXPORT CaseClashConflictSolver : public QObject
  10. {
  11. Q_OBJECT
  12. Q_PROPERTY(bool allowedToRename READ allowedToRename NOTIFY allowedToRenameChanged)
  13. Q_PROPERTY(QString errorString READ errorString NOTIFY errorStringChanged)
  14. public:
  15. explicit CaseClashConflictSolver(const QString &targetFilePath,
  16. const QString &conflictFilePath,
  17. const QString &remotePath,
  18. const QString &localPath,
  19. AccountPtr account,
  20. SyncJournalDb *journal,
  21. QObject *parent = nullptr);
  22. [[nodiscard]] bool allowedToRename() const;
  23. [[nodiscard]] QString errorString() const;
  24. signals:
  25. void allowedToRenameChanged();
  26. void errorStringChanged();
  27. void done();
  28. void failed();
  29. public slots:
  30. void solveConflict(const QString &newFilename);
  31. void checkIfAllowedToRename();
  32. private slots:
  33. void onRemoteDestinationFileAlreadyExists();
  34. void onRemoteDestinationFileDoesNotExist();
  35. void onPropfindPermissionSuccess(const QVariantMap &values);
  36. void onPropfindPermissionError(QNetworkReply *reply);
  37. void onRemoteSourceFileAlreadyExists();
  38. void onRemoteSourceFileDoesNotExist();
  39. void onMoveJobFinished();
  40. private:
  41. [[nodiscard]] QString remoteNewFilename() const;
  42. [[nodiscard]] QString remoteTargetFilePath() const;
  43. void onCheckIfAllowedToRenameComplete(const QVariantMap &values, QNetworkReply *reply = nullptr);
  44. void processLeadingOrTrailingSpacesError(const QString &fileName);
  45. AccountPtr _account;
  46. QString _targetFilePath;
  47. QString _conflictFilePath;
  48. QString _newFilename;
  49. QString _remotePath;
  50. QString _localPath;
  51. QString _errorString;
  52. SyncJournalDb *_journal = nullptr;
  53. bool _allowedToRename = false;
  54. };
  55. }
  56. #endif // CASECLASHCONFLICTSOLVER_H