Remove unused functions and variables

Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
This commit is contained in:
Felix Weilbach 2021-07-23 17:41:02 +02:00 committed by Matthieu Gallien (Rebase PR Action)
parent d72f7e9109
commit acf6cc0527
7 changed files with 19 additions and 33 deletions

View file

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

View file

@ -1075,7 +1075,7 @@ Folder *FolderMan::addFolder(AccountState *accountState, const FolderDefinition
// Migration: The first account that's configured for a local folder shall // Migration: The first account that's configured for a local folder shall
// be saved in a backwards-compatible way. // be saved in a backwards-compatible way.
const auto folderList = FolderMan::instance()->map(); 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(); return other != folder && other->cleanPath() == folder->cleanPath();
}); });

View file

@ -45,23 +45,6 @@ namespace {
// it matches _preDefinedStatus, otherwise the default is online (0) // it matches _preDefinedStatus, otherwise the default is online (0)
return preDefinedStatus.value(status.toLower(), UserStatus::Status::Online); 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) UserStatus::UserStatus(QObject *parent)

View file

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

View file

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

10
test/testhelper.cpp Normal file
View file

@ -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;
}

View file

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