Move SyncFileStatus to libcommon
authorChristian Kamm <mail@ckamm.de>
Mon, 21 Jan 2019 10:13:17 +0000 (11:13 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:37 +0000 (10:58 +0100)
It'll be needed in vfs plugins so they can connect to the data coming
out of SyncFileStatusTracker.

src/common/common.cmake
src/common/syncfilestatus.cpp [new file with mode: 0644]
src/common/syncfilestatus.h [new file with mode: 0644]
src/gui/socketapi.h
src/libsync/CMakeLists.txt
src/libsync/syncengine.cpp
src/libsync/syncfilestatus.cpp [deleted file]
src/libsync/syncfilestatus.h [deleted file]
src/libsync/syncfilestatustracker.h

index f47e7745efbc6caa1d5ed22cb36d04df094b0514..aaaed36af534dc05d17821b3bb850d332f54c8eb 100644 (file)
@@ -11,6 +11,7 @@ set(common_SOURCES
     ${CMAKE_CURRENT_LIST_DIR}/remotepermissions.cpp
     ${CMAKE_CURRENT_LIST_DIR}/vfs.cpp
     ${CMAKE_CURRENT_LIST_DIR}/plugin.cpp
+    ${CMAKE_CURRENT_LIST_DIR}/syncfilestatus.cpp
 )
 
 configure_file(${CMAKE_CURRENT_LIST_DIR}/vfspluginmetadata.json.in ${CMAKE_CURRENT_BINARY_DIR}/vfspluginmetadata.json)
diff --git a/src/common/syncfilestatus.cpp b/src/common/syncfilestatus.cpp
new file mode 100644 (file)
index 0000000..6ffea64
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#include "syncfilestatus.h"
+
+namespace OCC {
+SyncFileStatus::SyncFileStatus() = default;
+
+SyncFileStatus::SyncFileStatus(SyncFileStatusTag tag)
+    : _tag(tag)
+{
+}
+
+void SyncFileStatus::set(SyncFileStatusTag tag)
+{
+    _tag = tag;
+}
+
+SyncFileStatus::SyncFileStatusTag SyncFileStatus::tag() const
+{
+    return _tag;
+}
+
+void SyncFileStatus::setShared(bool isShared)
+{
+    _shared = isShared;
+}
+
+bool SyncFileStatus::shared() const
+{
+    return _shared;
+}
+
+QString SyncFileStatus::toSocketAPIString() const
+{
+    QString statusString;
+    bool canBeShared = true;
+
+    switch (_tag) {
+    case StatusNone:
+        statusString = QLatin1String("NOP");
+        canBeShared = false;
+        break;
+    case StatusSync:
+        statusString = QLatin1String("SYNC");
+        break;
+    case StatusWarning:
+        // The protocol says IGNORE, but all implementations show a yellow warning sign.
+        statusString = QLatin1String("IGNORE");
+        break;
+    case StatusUpToDate:
+        statusString = QLatin1String("OK");
+        break;
+    case StatusError:
+        statusString = QLatin1String("ERROR");
+        break;
+    }
+    if (canBeShared && _shared) {
+        statusString += QLatin1String("+SWM");
+    }
+
+    return statusString;
+}
+}
diff --git a/src/common/syncfilestatus.h b/src/common/syncfilestatus.h
new file mode 100644 (file)
index 0000000..cea595f
--- /dev/null
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * for more details.
+ */
+
+#ifndef SYNCFILESTATUS_H
+#define SYNCFILESTATUS_H
+
+#include <QMetaType>
+#include <QObject>
+#include <QString>
+
+#include "ocsynclib.h"
+
+namespace OCC {
+
+/**
+ * @brief The SyncFileStatus class
+ * @ingroup libsync
+ */
+class OCSYNC_EXPORT SyncFileStatus
+{
+public:
+    enum SyncFileStatusTag {
+        StatusNone,
+        StatusSync,
+        StatusWarning,
+        StatusUpToDate,
+        StatusError,
+    };
+
+    SyncFileStatus();
+    SyncFileStatus(SyncFileStatusTag);
+
+    void set(SyncFileStatusTag tag);
+    SyncFileStatusTag tag() const;
+
+    void setShared(bool isShared);
+    bool shared() const;
+
+    QString toSocketAPIString() const;
+
+private:
+    SyncFileStatusTag _tag = StatusNone;
+    bool _shared = false;
+};
+
+inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b)
+{
+    return a.tag() == b.tag() && a.shared() == b.shared();
+}
+
+inline bool operator!=(const SyncFileStatus &a, const SyncFileStatus &b)
+{
+    return !(a == b);
+}
+}
+
+Q_DECLARE_METATYPE(OCC::SyncFileStatus)
+
+#endif // SYNCFILESTATUS_H
index d23c3df526572bce97942931826bebcfe43995bd..6ef89f3eec1dad21f5de50cc7b4f18cfce3d1843 100644 (file)
@@ -17,7 +17,7 @@
 #define SOCKETAPI_H
 
 #include "syncfileitem.h"
-#include "syncfilestatus.h"
+#include "common/syncfilestatus.h"
 #include "sharedialog.h" // for the ShareDialogStartPage
 #include "common/syncjournalfilerecord.h"
 
index 353acf3d7b2a7553b8aeb6bd861d4e5a229a8565..9824f988d71a417f56759b3d4e3a44a348dae37b 100644 (file)
@@ -47,7 +47,6 @@ set(libsync_SRCS
     propagatedownloadencrypted.cpp
     syncengine.cpp
     syncfileitem.cpp
-    syncfilestatus.cpp
     syncfilestatustracker.cpp
     localdiscoverytracker.cpp
     syncresult.cpp
index 550f1347d118eec29f4cb74eab446401b57a5771..a10edb7b29b84c9dcfbb7f1f3dd2c3a0c15f936a 100644 (file)
@@ -20,7 +20,7 @@
 #include "common/syncjournalfilerecord.h"
 #include "discoveryphase.h"
 #include "creds/abstractcredentials.h"
-#include "syncfilestatus.h"
+#include "common/syncfilestatus.h"
 #include "csync_exclude.h"
 #include "filesystem.h"
 #include "propagateremotedelete.h"
diff --git a/src/libsync/syncfilestatus.cpp b/src/libsync/syncfilestatus.cpp
deleted file mode 100644 (file)
index 6ffea64..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#include "syncfilestatus.h"
-
-namespace OCC {
-SyncFileStatus::SyncFileStatus() = default;
-
-SyncFileStatus::SyncFileStatus(SyncFileStatusTag tag)
-    : _tag(tag)
-{
-}
-
-void SyncFileStatus::set(SyncFileStatusTag tag)
-{
-    _tag = tag;
-}
-
-SyncFileStatus::SyncFileStatusTag SyncFileStatus::tag() const
-{
-    return _tag;
-}
-
-void SyncFileStatus::setShared(bool isShared)
-{
-    _shared = isShared;
-}
-
-bool SyncFileStatus::shared() const
-{
-    return _shared;
-}
-
-QString SyncFileStatus::toSocketAPIString() const
-{
-    QString statusString;
-    bool canBeShared = true;
-
-    switch (_tag) {
-    case StatusNone:
-        statusString = QLatin1String("NOP");
-        canBeShared = false;
-        break;
-    case StatusSync:
-        statusString = QLatin1String("SYNC");
-        break;
-    case StatusWarning:
-        // The protocol says IGNORE, but all implementations show a yellow warning sign.
-        statusString = QLatin1String("IGNORE");
-        break;
-    case StatusUpToDate:
-        statusString = QLatin1String("OK");
-        break;
-    case StatusError:
-        statusString = QLatin1String("ERROR");
-        break;
-    }
-    if (canBeShared && _shared) {
-        statusString += QLatin1String("+SWM");
-    }
-
-    return statusString;
-}
-}
diff --git a/src/libsync/syncfilestatus.h b/src/libsync/syncfilestatus.h
deleted file mode 100644 (file)
index f778c89..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) by Klaas Freitag <freitag@owncloud.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- */
-
-#ifndef SYNCFILESTATUS_H
-#define SYNCFILESTATUS_H
-
-#include <QMetaType>
-#include <QObject>
-#include <QString>
-
-#include "owncloudlib.h"
-
-namespace OCC {
-
-/**
- * @brief The SyncFileStatus class
- * @ingroup libsync
- */
-class OWNCLOUDSYNC_EXPORT SyncFileStatus
-{
-public:
-    enum SyncFileStatusTag {
-        StatusNone,
-        StatusSync,
-        StatusWarning,
-        StatusUpToDate,
-        StatusError,
-    };
-
-    SyncFileStatus();
-    SyncFileStatus(SyncFileStatusTag);
-
-    void set(SyncFileStatusTag tag);
-    SyncFileStatusTag tag() const;
-
-    void setShared(bool isShared);
-    bool shared() const;
-
-    QString toSocketAPIString() const;
-
-private:
-    SyncFileStatusTag _tag = StatusNone;
-    bool _shared = false;
-};
-
-inline bool operator==(const SyncFileStatus &a, const SyncFileStatus &b)
-{
-    return a.tag() == b.tag() && a.shared() == b.shared();
-}
-
-inline bool operator!=(const SyncFileStatus &a, const SyncFileStatus &b)
-{
-    return !(a == b);
-}
-}
-
-Q_DECLARE_METATYPE(OCC::SyncFileStatus)
-
-#endif // SYNCFILESTATUS_H
index 4a6b89f0d02d030d5980a8f226c8cabe63da8b05..362c4143c2f38bd82716f8d225d743e5b3d867fc 100644 (file)
@@ -18,7 +18,7 @@
 
 // #include "ownsql.h"
 #include "syncfileitem.h"
-#include "syncfilestatus.h"
+#include "common/syncfilestatus.h"
 #include <map>
 #include <QSet>