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-13 15:39:12 +0300
committerHannah von Reth <vonreth@kde.org>2022-05-17 11:53:33 +0300
commitb7d69f0db6db0ae15513cf73281d5fa8dceaf062 (patch)
tree68435cb39c3e05e0e0579d839c02ebdad71128ae /src/gui
parent9751b49032e6e049cea8875c172947ed44531ab0 (diff)
Remove version checks for < 10.0
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accountsettings.cpp2
-rw-r--r--src/gui/connectionvalidator.cpp22
-rw-r--r--src/gui/connectionvalidator.h2
-rw-r--r--src/gui/creds/httpcredentialsgui.cpp15
-rw-r--r--src/gui/owncloudgui.cpp2
-rw-r--r--src/gui/sharedialog.cpp7
-rw-r--r--src/gui/sharelinkwidget.cpp3
-rw-r--r--src/gui/sharemanager.cpp7
-rw-r--r--src/gui/shareusergroupwidget.cpp27
-rw-r--r--src/gui/socketapi/socketapi.cpp2
10 files changed, 22 insertions, 67 deletions
diff --git a/src/gui/accountsettings.cpp b/src/gui/accountsettings.cpp
index 7f3fa147f..38084b7ad 100644
--- a/src/gui/accountsettings.cpp
+++ b/src/gui/accountsettings.cpp
@@ -805,7 +805,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->serverVersion());
+ errors << tr("The server version %1 is unsupported! Proceed at your own risk.").arg(account->serverVersionString());
}
showConnectionLabel(tr("Connected to %1.").arg(serverWithUser), errors);
ui->openBrowserButton->setVisible(false);
diff --git a/src/gui/connectionvalidator.cpp b/src/gui/connectionvalidator.cpp
index 7ca871132..8c616e89a 100644
--- a/src/gui/connectionvalidator.cpp
+++ b/src/gui/connectionvalidator.cpp
@@ -155,13 +155,15 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in
// 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.
- QString serverVersion = info.value(QLatin1String("version")).toString() + QLatin1Char('-') + info.value(QLatin1String("productname")).toString();
+ 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 << ")";
+ << "(" << serverVersion << "-" << serverProduct
+ << ")";
// Update server url in case of redirection
if (_account->url() != url) {
@@ -171,7 +173,7 @@ void ConnectionValidator::slotStatusFound(const QUrl &url, const QJsonObject &in
return;
}
- if (!serverVersion.isEmpty() && !setAndCheckServerVersion(serverVersion)) {
+ if (!serverVersion.isEmpty() && !setAndCheckServerInfo(serverVersion, serverProduct)) {
return;
}
@@ -265,8 +267,9 @@ void ConnectionValidator::checkServerCapabilities()
_account->setCapabilities(caps.toVariantMap());
// New servers also report the version in the capabilities
- QString serverVersion = caps["core"].toObject()["status"].toObject()["version"].toString();
- if (!serverVersion.isEmpty() && !setAndCheckServerVersion(serverVersion)) {
+ const QString serverVersion = caps["core"].toObject()["status"].toObject()["version"].toString();
+ const QString product = caps["core"].toObject()["status"].toObject()["productname"].toString();
+ if (!setAndCheckServerInfo(serverVersion, product)) {
return;
}
@@ -312,13 +315,12 @@ void ConnectionValidator::fetchUser()
job->start();
}
-bool ConnectionValidator::setAndCheckServerVersion(const QString &version)
+bool ConnectionValidator::setAndCheckServerInfo(const QString &version, const QString &serverProduct)
{
- _account->setServerVersion(version);
+ _account->setServerInfo(version, serverProduct);
- // We cannot deal with servers < 7.0.0
- if (_account->serverVersionInt()
- && _account->serverVersionInt() < Account::makeServerVersion(7, 0, 0)) {
+ // We cannot deal with servers < 10.0.0
+ if (_account->serverVersionUnsupported()) {
_errors.append(tr("The configured server for this client is too old"));
_errors.append(tr("Please update to the latest server and restart the client."));
reportResult(ServerVersionMismatch);
diff --git a/src/gui/connectionvalidator.h b/src/gui/connectionvalidator.h
index edfd62cd4..34d84e0dd 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 setAndCheckServerVersion(const QString &version);
+ bool setAndCheckServerInfo(const QString &version, const QString &serverProduct);
QStringList _errors;
AccountPtr _account;
diff --git a/src/gui/creds/httpcredentialsgui.cpp b/src/gui/creds/httpcredentialsgui.cpp
index c825ef506..af90c67e9 100644
--- a/src/gui/creds/httpcredentialsgui.cpp
+++ b/src/gui/creds/httpcredentialsgui.cpp
@@ -160,23 +160,10 @@ void HttpCredentialsGui::showDialog()
QString HttpCredentialsGui::requestAppPasswordText(const Account *account)
{
- int version = account->serverVersionInt();
- QString path;
-
- // Version may not be available before login on new servers!
- if (!version || version >= Account::makeServerVersion(10, 0, 0)) {
- path = QLatin1String("/index.php/settings/personal?sectionid=security#apppasswords");
- } else if (version >= Account::makeServerVersion(9, 1, 0)) {
- path = QLatin1String("/index.php/settings/personal?section=apppasswords");
- } else {
- // Older server than 9.1 does not have the feature to request App Password
- return QString();
- }
-
auto baseUrl = account->url().toString();
if (baseUrl.endsWith('/'))
baseUrl.chop(1);
return tr("<a href=\"%1\">Click here</a> to request an app password from the web interface.")
- .arg(baseUrl + path);
+ .arg(Utility::concatUrlPath(baseUrl, QStringLiteral("/index.php/settings/personal?sectionid=security#apppasswords")).toString());
}
} // namespace OCC
diff --git a/src/gui/owncloudgui.cpp b/src/gui/owncloudgui.cpp
index d7d4a4535..3ea0997a4 100644
--- a/src/gui/owncloudgui.cpp
+++ b/src/gui/owncloudgui.cpp
@@ -239,7 +239,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->serverVersion()));
+ .arg(account->displayName(), account->serverVersionString()));
}
}
diff --git a/src/gui/sharedialog.cpp b/src/gui/sharedialog.cpp
index 106432676..5ba8101e8 100644
--- a/src/gui/sharedialog.cpp
+++ b/src/gui/sharedialog.cpp
@@ -190,12 +190,7 @@ void ShareDialog::showSharingUi()
return;
}
- // We only do user/group sharing from 8.2.0
- bool userGroupSharing =
- theme->userGroupSharing()
- && _accountState->account()->serverVersionInt() >= Account::makeServerVersion(8, 2, 0);
-
- if (userGroupSharing) {
+ if (theme->userGroupSharing()) {
_userGroupWidget = new ShareUserGroupWidget(_accountState->account(), _sharePath, _localPath, _maxSharingPermissions, _privateLinkUrl, this);
_ui->shareWidgets->addTab(_userGroupWidget, tr("Users and Groups"));
_userGroupWidget->getShares();
diff --git a/src/gui/sharelinkwidget.cpp b/src/gui/sharelinkwidget.cpp
index e7cf2025c..75078025d 100644
--- a/src/gui/sharelinkwidget.cpp
+++ b/src/gui/sharelinkwidget.cpp
@@ -206,8 +206,7 @@ void ShareLinkWidget::getShares()
void ShareLinkWidget::slotSharesFetched(const QList<QSharedPointer<Share>> &shares)
{
- const QString versionString = _account->serverVersion();
- qCInfo(lcSharing) << versionString << "Fetched" << shares.count() << "shares";
+ qCInfo(lcSharing) << "Fetched" << shares.count() << "shares";
// Select the share that was previously selected,
// except if an explicit override was asked for
diff --git a/src/gui/sharemanager.cpp b/src/gui/sharemanager.cpp
index e101ad205..f0522d425 100644
--- a/src/gui/sharemanager.cpp
+++ b/src/gui/sharemanager.cpp
@@ -364,14 +364,9 @@ QSharedPointer<LinkShare> ShareManager::parseLinkShare(const QJsonObject &data)
// From ownCloud server 8.2 the url field is always set for public shares
if (data.contains("url")) {
url = QUrl(data.value("url").toString());
- } else if (_account->serverVersionInt() >= Account::makeServerVersion(8, 0, 0)) {
+ } else {
// From ownCloud server version 8 on, a different share link scheme is used.
url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("index.php/s/") + data.value("token").toString())).toString();
- } else {
- QUrlQuery queryArgs;
- queryArgs.addQueryItem(QLatin1String("service"), QLatin1String("files"));
- queryArgs.addQueryItem(QLatin1String("t"), data.value("token").toString());
- url = QUrl(Utility::concatUrlPath(_account->url(), QLatin1String("public.php"), queryArgs).toString());
}
QDate expireDate;
diff --git a/src/gui/shareusergroupwidget.cpp b/src/gui/shareusergroupwidget.cpp
index cc1f23052..6ef7063e3 100644
--- a/src/gui/shareusergroupwidget.cpp
+++ b/src/gui/shareusergroupwidget.cpp
@@ -294,20 +294,8 @@ void ShareUserGroupWidget::slotCompleterActivated(const QModelIndex &index)
* https://github.com/owncloud/client/issues/4996
*/
const SharePermissions defaultPermissions = static_cast<SharePermissions>(_account->capabilities().defaultPermissions());
- if (sharee->type() == Sharee::Federated
- && _account->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) {
- SharePermissions permissions = SharePermissionRead | SharePermissionUpdate;
- if (!_isFile) {
- permissions |= SharePermissionCreate | SharePermissionDelete;
- }
- permissions &= defaultPermissions;
- _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
- sharee->shareWith(), permissions);
- } else {
- _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
- sharee->shareWith(), _maxSharingPermissions & defaultPermissions);
- }
-
+ _manager->createShare(_sharePath, Share::ShareType(sharee->type()),
+ sharee->shareWith(), _maxSharingPermissions & defaultPermissions);
_ui->shareeLineEdit->setEnabled(false);
_ui->shareeLineEdit->setText(QString());
}
@@ -405,17 +393,6 @@ ShareUserLine::ShareUserLine(QSharedPointer<Share> share,
connect(_ui->permissionShare, &QAbstractButton::clicked, this, &ShareUserLine::slotPermissionsChanged);
connect(_ui->permissionsEdit, &QAbstractButton::clicked, this, &ShareUserLine::slotEditPermissionsChanged);
- /*
- * We don't show permssion share for federated shares with server <9.1
- * https://github.com/owncloud/core/issues/22122#issuecomment-185637344
- * https://github.com/owncloud/client/issues/4996
- */
- if (share->getShareType() == Share::TypeRemote
- && share->account()->serverVersionInt() < Account::makeServerVersion(9, 1, 0)) {
- _ui->permissionShare->setVisible(false);
- _ui->permissionToolButton->setVisible(false);
- }
-
connect(share.data(), &Share::permissionsSet, this, &ShareUserLine::slotPermissionsSet);
connect(share.data(), &Share::shareDeleted, this, &ShareUserLine::slotShareDeleted);
diff --git a/src/gui/socketapi/socketapi.cpp b/src/gui/socketapi/socketapi.cpp
index 72c5816ed..e638fbbc1 100644
--- a/src/gui/socketapi/socketapi.cpp
+++ b/src/gui/socketapi/socketapi.cpp
@@ -467,7 +467,7 @@ void SocketApi::processShareRequest(const QString &localFile, SocketListener *li
const QString message = QLatin1String("SHARE:NOTCONNECTED:") + QDir::toNativeSeparators(localFile);
// if the folder isn't connected, don't open the share dialog
listener->sendMessage(message);
- } else if (!theme->linkSharing() && (!theme->userGroupSharing() || shareFolder->accountState()->account()->serverVersionInt() < Account::makeServerVersion(8, 2, 0))) {
+ } else if (!theme->linkSharing() && !theme->userGroupSharing()) {
const QString message = QLatin1String("SHARE:NOP:") + QDir::toNativeSeparators(localFile);
listener->sendMessage(message);
} else {