Forráskód Böngészése

Remove unused functions and variables

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
Felix Weilbach 4 éve
szülő
commit
acf6cc0527

+ 1 - 2
src/gui/application.cpp

@@ -478,7 +478,6 @@ void Application::slotCrash()
 
 void Application::slotownCloudWizardDone(int res)
 {
-    AccountManager *accountMan = AccountManager::instance();
     FolderMan *folderMan = FolderMan::instance();
 
     // During the wizard, scheduling of new syncs is disabled
@@ -491,7 +490,7 @@ void Application::slotownCloudWizardDone(int res)
 
         // If one account is configured: enable autostart
 #ifndef QT_DEBUG
-        bool shouldSetAutoStart = (accountMan->accounts().size() == 1);
+        bool shouldSetAutoStart = AccountManager::instance()->accounts().size() == 1;
 #else
         bool shouldSetAutoStart = false;
 #endif

+ 1 - 1
src/gui/folderman.cpp

@@ -1075,7 +1075,7 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition
     // Migration: The first account that's configured for a local folder shall
     // be saved in a backwards-compatible way.
     const auto folderList = FolderMan::instance()->map();
-    const auto oneAccountOnly = std::none_of(folderList.cbegin(), folderList.cend(), [this, folder](const auto *other) {
+    const auto oneAccountOnly = std::none_of(folderList.cbegin(), folderList.cend(), [folder](const auto *other) {
         return other != folder && other->cleanPath() == folder->cleanPath();
     });
 

+ 0 - 17
src/gui/userstatus.cpp

@@ -45,23 +45,6 @@ namespace {
         // it matches _preDefinedStatus, otherwise the default is online (0)
         return preDefinedStatus.value(status.toLower(), UserStatus::Status::Online);
     }
-    
-    QString enumToString(UserStatus::Status status) 
-    {
-        switch (status) {
-        case UserStatus::Status::Away:
-            return QObject::tr("Away");
-        case UserStatus::Status::DoNotDisturb:
-            return QObject::tr("Do not disturb");
-        case UserStatus::Status::Invisible:
-        case UserStatus::Status::Offline:
-            return QObject::tr("Offline");
-        case UserStatus::Status::Online:
-            return QObject::tr("Online");
-        }
-        
-        Q_UNREACHABLE();
-    }
 }
 
 UserStatus::UserStatus(QObject *parent)

+ 2 - 2
src/libsync/clientsideencryption.cpp

@@ -1009,7 +1009,7 @@ void ClientSideEncryption::writePrivateKey(const AccountPtr &account)
     job->setInsecureFallback(false);
     job->setKey(kck);
     job->setBinaryData(_privateKey);
-    connect(job, &WritePasswordJob::finished, [this](Job *incoming) {
+    connect(job, &WritePasswordJob::finished, [](Job *incoming) {
         Q_UNUSED(incoming);
         qCInfo(lcCse()) << "Private key stored in keychain";
     });
@@ -1028,7 +1028,7 @@ void ClientSideEncryption::writeCertificate(const AccountPtr &account)
     job->setInsecureFallback(false);
     job->setKey(kck);
     job->setBinaryData(_certificate.toPem());
-    connect(job, &WritePasswordJob::finished, [this](Job *incoming) {
+    connect(job, &WritePasswordJob::finished, [](Job *incoming) {
         Q_UNUSED(incoming);
         qCInfo(lcCse()) << "Certificate stored in keychain";
     });

+ 1 - 0
test/CMakeLists.txt

@@ -9,6 +9,7 @@ add_library(testutils
   syncenginetestutils.cpp
   pushnotificationstestutils.cpp
   themeutils.cpp
+  testhelper.cpp
 )
 
 target_link_libraries(testutils PUBLIC ${APPLICATION_EXECUTABLE}sync Qt5::Test)

+ 10 - 0
test/testhelper.cpp

@@ -0,0 +1,10 @@
+#include "testhelper.h"
+
+OCC::FolderDefinition folderDefinition(const QString &path)
+{
+    OCC::FolderDefinition d;
+    d.localPath = path;
+    d.targetPath = path;
+    d.alias = path;
+    return d;
+}

+ 4 - 11
test/testhelper.h

@@ -1,12 +1,11 @@
 #ifndef TESTHELPER_H
 #define TESTHELPER_H
 
-#include "folder.h"
+#include "gui/folder.h"
 #include "creds/httpcredentials.h"
 
-using namespace OCC;
-
-class HttpCredentialsTest : public HttpCredentials {
+class HttpCredentialsTest : public OCC::HttpCredentials
+{
 public:
     HttpCredentialsTest(const QString& user, const QString& password)
     : HttpCredentials(user, password)
@@ -17,12 +16,6 @@ public:
     }
 };
 
-static FolderDefinition folderDefinition(const QString &path) {
-    FolderDefinition d;
-    d.localPath = path;
-    d.targetPath = path;
-    d.alias = path;
-    return d;
-}
+OCC::FolderDefinition folderDefinition(const QString &path);
 
 #endif // TESTHELPER_H