From d549c77af6857c43dba2a15de42624fd45be4bd9 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 16 Apr 2018 09:12:44 +0200 Subject: [PATCH] Issues: Show link to conflicts doc if there are some #6396 The link url is themed. --- src/gui/issueswidget.cpp | 7 ++++ src/gui/issueswidget.h | 1 - src/gui/issueswidget.ui | 84 +++++++++++++++++++++++++++------------- src/libsync/theme.cpp | 11 +++++- src/libsync/theme.h | 19 ++++++++- 5 files changed, 91 insertions(+), 31 deletions(-) diff --git a/src/gui/issueswidget.cpp b/src/gui/issueswidget.cpp index ad1163efb..04359dcae 100644 --- a/src/gui/issueswidget.cpp +++ b/src/gui/issueswidget.cpp @@ -120,6 +120,11 @@ IssuesWidget::IssuesWidget(QWidget *parent) _ui->_tooManyIssuesWarning->hide(); connect(this, &IssuesWidget::issueCountUpdated, this, [this](int count) { _ui->_tooManyIssuesWarning->setVisible(count >= maxIssueCount); }); + + _ui->_conflictHelp->hide(); + _ui->_conflictHelp->setText( + tr("There were conflicts. Check the documentation on how to resolve them.") + .arg(Theme::instance()->conflictHelpUrl())); } IssuesWidget::~IssuesWidget() @@ -277,6 +282,8 @@ void IssuesWidget::slotProgressInfo(const QString &folder, const ProgressInfo &p } } emit ProgressDispatcher::instance()->folderConflicts(folder, conflicts); + + _ui->_conflictHelp->setHidden(Theme::instance()->conflictHelpUrl().isEmpty() || conflicts.isEmpty()); } } diff --git a/src/gui/issueswidget.h b/src/gui/issueswidget.h index ebf916d35..2a897a8b3 100644 --- a/src/gui/issueswidget.h +++ b/src/gui/issueswidget.h @@ -63,7 +63,6 @@ protected: signals: void copyToClipboard(); void issueCountUpdated(int); - void folderConflicts(QString folder, QStringList conflictPaths); private slots: void slotRefreshIssues(); diff --git a/src/gui/issueswidget.ui b/src/gui/issueswidget.ui index 73acf809a..f1c2d8fdf 100644 --- a/src/gui/issueswidget.ui +++ b/src/gui/issueswidget.ui @@ -128,39 +128,69 @@ - - - There were too many issues. Not all will be visible here. - - - - - + - - - Qt::Horizontal - - - - 40 - 20 - - - + + + + + There were too many issues. Not all will be visible here. + + + true + + + + + + + There were conflicts. Check the documentation on how to resolve them. + + + true + + + true + + + + - - - Copy the issues list to the clipboard. - - - Copy - - + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 0 + + + + + + + + Copy the issues list to the clipboard. + + + Copy + + + + + + + diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index b05f1d8d9..a533f7e81 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -228,6 +228,16 @@ QString Theme::helpUrl() const return QString::fromLatin1("https://docs.nextcloud.com/desktop/%1.%2/").arg(MIRALL_VERSION_MAJOR).arg(MIRALL_VERSION_MINOR); } +QString Theme::conflictHelpUrl() const +{ + auto baseUrl = helpUrl(); + if (baseUrl.isEmpty()) + return QString(); + if (!baseUrl.endsWith('/')) + baseUrl.append('/'); + return baseUrl + QStringLiteral("conflicts.html"); +} + QString Theme::overrideServerUrl() const { return QString(); @@ -542,5 +552,4 @@ QString Theme::versionSwitchOutput() const return helpText; } - } // end namespace client diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 90ddd7ef1..77ec90b2f 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -114,11 +114,27 @@ public: /** * URL to documentation. + * * This is opened in the browser when the "Help" action is selected from the tray menu. - * (If it is an empty stringn the action is removed from the menu. Defaults to ownCloud's help) + * + * If the function is overridden to return an empty string the action is removed from + * the menu. + * + * Defaults to Nextclouds client documentation website. */ virtual QString helpUrl() const; + /** + * The url to use for showing help on conflicts. + * + * If the function is overridden to return an empty string no help link will be shown. + * + * Defaults to helpUrl() + "conflicts.html", which is a page in ownCloud's client + * documentation website. If helpUrl() is empty, this function will also return the + * empty string. + */ + virtual QString conflictHelpUrl() const; + /** * Setting a value here will pre-define the server url. * @@ -332,7 +348,6 @@ public: */ virtual QString versionSwitchOutput() const; - protected: #ifndef TOKEN_AUTH_ONLY QIcon themeIcon(const QString &name, bool sysTray = false, bool sysTrayMenuVisible = false) const;