Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-05-24 16:07:36 +0300
committerHannah von Reth <vonreth@kde.org>2022-05-25 15:21:44 +0300
commite81625c9706ac5280fed65f6b8af141963860072 (patch)
tree9ce22eeb4bc3c88c834921818627c253b0bbdb57 /src/gui
parent0ae84fad0d718b084dc5bcefc2098ce4f4b8b7a3 (diff)
Use ocis productversion
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accountmanager.cpp2
-rw-r--r--src/gui/accountsettings.cpp2
-rw-r--r--src/gui/application.cpp23
-rw-r--r--src/gui/application.h2
-rw-r--r--src/gui/connectionvalidator.cpp24
-rw-r--r--src/gui/connectionvalidator.h2
-rw-r--r--src/gui/folderman.cpp2
-rw-r--r--src/gui/owncloudgui.cpp2
-rw-r--r--src/gui/sharemanager.cpp2
9 files changed, 16 insertions, 45 deletions
diff --git a/src/gui/accountmanager.cpp b/src/gui/accountmanager.cpp
index 472fcfb4e..4aeaea983 100644
--- a/src/gui/accountmanager.cpp
+++ b/src/gui/accountmanager.cpp
@@ -248,7 +248,6 @@ void AccountManager::saveAccountHelper(Account *acc, QSettings &settings, bool s
settings.setValue(davUserC(), acc->_davUser);
settings.setValue(davUserDisplyNameC(), acc->_displayName);
settings.setValue(userUUIDC(), acc->uuid());
- settings.setValue(QLatin1String(serverVersionC), acc->_serverVersion);
if (acc->hasCapabilities()) {
settings.setValue(capabilitesC(), acc->capabilities().raw());
}
@@ -308,7 +307,6 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
acc->setUrl(urlConfig.toUrl());
}
- acc->_serverVersion = settings.value(QLatin1String(serverVersionC)).toString();
acc->_davUser = settings.value(davUserC()).toString();
acc->_displayName = settings.value(davUserDisplyNameC()).toString();
acc->_uuid = settings.value(userUUIDC(), acc->_uuid).toUuid();
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 030e410a4..3a5488d38 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -799,7 +799,7 @@ void AccountSettings::slotAccountStateChanged()
case AccountState::Connected: {
QStringList errors;
if (account->serverVersionUnsupported()) {
- errors << tr("The server version %1 is unsupported! Proceed at your own risk.").arg(account->serverVersionString());
+ errors << tr("The server version %1 is unsupported! Proceed at your own risk.").arg(account->capabilities().status().versionString());
}
showConnectionLabel(tr("Connected to %1.").arg(serverWithUser), errors);
ui->openBrowserButton->setVisible(false);
diff --git a/src/gui/application.cpp b/src/gui/application.cpp
index fbd5401be..bea9c357d 100644
--- a/src/gui/application.cpp
+++ b/src/gui/application.cpp
@@ -396,21 +396,8 @@ Application::~Application()
AccountManager::instance()->shutdown();
}
-void Application::slotAccountStateRemoved(AccountStatePtr accountState) const
+void Application::slotAccountStateRemoved() const
{
- if (_gui) {
- disconnect(accountState.data(), &AccountState::stateChanged,
- _gui.data(), &ownCloudGui::slotAccountStateChanged);
- disconnect(accountState->account().data(), &Account::serverVersionChanged,
- _gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported);
- }
- if (_folderManager) {
- disconnect(accountState.data(), &AccountState::stateChanged,
- _folderManager.data(), &FolderMan::slotAccountStateChanged);
- disconnect(accountState->account().data(), &Account::serverVersionChanged,
- _folderManager.data(), &FolderMan::slotServerVersionChanged);
- }
-
// if there is no more account, show the wizard.
if (_gui && AccountManager::instance()->accounts().isEmpty()) {
// allow to add a new account if there is non any more. Always think
@@ -425,13 +412,17 @@ void Application::slotAccountStateAdded(AccountStatePtr accountState) const
connect(accountState.data(), &AccountState::stateChanged,
_gui.data(), &ownCloudGui::slotAccountStateChanged);
connect(accountState->account().data(), &Account::serverVersionChanged,
- _gui.data(), &ownCloudGui::slotTrayMessageIfServerUnsupported);
+ _gui.data(), [account = accountState->account().data(), this] {
+ _gui->slotTrayMessageIfServerUnsupported(account);
+ });
// Hook up the folder manager slots to the account state's signals:
connect(accountState.data(), &AccountState::stateChanged,
_folderManager.data(), &FolderMan::slotAccountStateChanged);
connect(accountState->account().data(), &Account::serverVersionChanged,
- _folderManager.data(), &FolderMan::slotServerVersionChanged);
+ _folderManager.data(), [account = accountState->account().data()] {
+ FolderMan::instance()->slotServerVersionChanged(account);
+ });
_gui->slotTrayMessageIfServerUnsupported(accountState->account().data());
}
diff --git a/src/gui/application.h b/src/gui/application.h
index bca12b4b5..c9a1c0248 100644
--- a/src/gui/application.h
+++ b/src/gui/application.h
@@ -98,7 +98,7 @@ protected slots:
void slotUseMonoIconsChanged(bool);
void slotCleanup();
void slotAccountStateAdded(AccountStatePtr accountState) const;
- void slotAccountStateRemoved(AccountStatePtr accountState) const;
+ void slotAccountStateRemoved() const;
void slotSystemOnlineConfigurationChanged(QNetworkConfiguration);
private:
diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp
index 23bcb2118..7284f44ee 100644
--- a/src/gui/connectionvalidator.cpp
+++ b/src/gui/connectionvalidator.cpp
@@ -152,18 +152,10 @@ void ConnectionValidator::slotCheckServerAndAuth()
void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &info)
{
- // Newer servers don't disclose any version in status.php anymore
- // https://github.com/owncloud/core/pull/27473/files
- // so this string can be empty.
- const QString serverVersion = info.value(QLatin1String("version")).toString();
- const QString serverProduct = info.value(QLatin1String("productname")).toString();
-
// status.php was found.
qCInfo(lcConnectionValidator) << "** Application: ownCloud found: "
<< url << " with version "
- << info.value(QLatin1String("versionstring")).toString()
- << "(" << serverVersion << "-" << serverProduct
- << ")";
+ << info.value(QLatin1String("versionstring")).toString();
// Update server url in case of redirection
if (_account->url() != url) {
@@ -173,10 +165,6 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in
return;
}
- if (!serverVersion.isEmpty() && !setAndCheckServerInfo(serverVersion, serverProduct)) {
- return;
- }
-
// Check for maintenance mode: Servers send "true", so go through QVariant
// to parse it correctly.
if (info["maintenance"].toVariant().toBool()) {
@@ -263,11 +251,7 @@ void ConnectionValidator::checkServerCapabilities()
auto caps = job->data().value("ocs").toObject().value("data").toObject().value("capabilities").toObject();
qCInfo(lcConnectionValidator) << "Server capabilities" << caps;
_account->setCapabilities(caps.toVariantMap());
-
- // New servers also report the version in the capabilities
- const QString serverVersion = caps["core"].toObject()["status"].toObject()["version"].toString();
- const QString product = caps["core"].toObject()["status"].toObject()["productname"].toString();
- if (!setAndCheckServerInfo(serverVersion, product)) {
+ if (!checkServerInfo()) {
return;
}
@@ -313,10 +297,8 @@ void ConnectionValidator::fetchUser()
job->start();
}
-bool ConnectionValidator::setAndCheckServerInfo(const QString &version, const QString &serverProduct)
+bool ConnectionValidator::checkServerInfo()
{
- _account->setServerInfo(version, serverProduct);
-
// We cannot deal with servers < 10.0.0
if (_account->serverVersionUnsupported()) {
_errors.append(tr("The configured server for this client is too old."));
diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h
index 34d84e0dd..f8c2a0d34 100644
--- a/src/gui/connectionvalidator.h
+++ b/src/gui/connectionvalidator.h
@@ -142,7 +142,7 @@ private:
*
* Returns false and reports ServerVersionMismatch for very old servers.
*/
- bool setAndCheckServerInfo(const QString &version, const QString &serverProduct);
+ bool checkServerInfo();
QStringList _errors;
AccountPtr _account;
diff --git a/src/gui/folderman.cpp b/src/gui/folderman.cpp
index 5fbb10fed..b2cbf6e0b 100644
--- a/src/gui/folderman.cpp
+++ b/src/gui/folderman.cpp
@@ -793,7 +793,7 @@ void FolderMan::slotServerVersionChanged(Account *account)
{
// Pause folders if the server version is unsupported
if (account->serverVersionUnsupported()) {
- qCWarning(lcFolderMan) << "The server version is unsupported:" << account->serverVersion()
+ qCWarning(lcFolderMan) << "The server version is unsupported:" << account->capabilities().status().versionString()
<< "pausing all folders on the account";
for (auto &f : qAsConst(_folders)) {
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index 1a1f780e1..33d6b87ce 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -240,7 +240,7 @@ void ownCloudGui::slotTrayMessageIfServerUnsupported(Account *account)
tr("The server on account %1 runs an unsupported version %2. "
"Using this client with unsupported server versions is untested and "
"potentially dangerous. Proceed at your own risk.")
- .arg(account->displayName(), account->serverVersionString()));
+ .arg(account->displayName(), account->capabilities().status().versionString()));
}
}
diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp
index f0522d425..b52640516 100644
--- a/src/gui/sharemanager.cpp
+++ b/src/gui/sharemanager.cpp
@@ -332,7 +332,7 @@ void ShareManager::fetchShares(const QString &path)
emit serverError(job->ocsStatus(), job->ocsMessage());
} else {
const auto &tmpShares = job->data().value(QLatin1String("ocs")).toObject().value(QLatin1String("data")).toArray();
- qCDebug(lcSharing) << _account->serverVersion() << "Fetched" << tmpShares.count() << "shares";
+ qCDebug(lcSharing) << "Fetched" << tmpShares.count() << "shares";
QList<QSharedPointer<Share>> shares;