diff options
author | Christian Kamm <mail@ckamm.de> | 2018-04-16 10:12:44 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2018-04-25 14:31:49 +0300 |
commit | e9db52a3782e3286e2a1783692781f04a657e440 (patch) | |
tree | 922028681c23cda0bdf7bedff2519a382345daad | |
parent | fc73cde10c2dbca854105008463255356fddb590 (diff) |
Issues: Show link to conflicts doc if there are some #6396
The link url is themed.
-rw-r--r-- | src/gui/issueswidget.cpp | 7 | ||||
-rw-r--r-- | src/gui/issueswidget.h | 1 | ||||
-rw-r--r-- | src/gui/issueswidget.ui | 84 | ||||
-rw-r--r-- | src/libsync/theme.cpp | 11 | ||||
-rw-r--r-- | 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. <a href=\"%1\">Check the documentation on how to resolve them.</a>") + .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 @@ </widget> </item> <item> - <widget class="QLabel" name="_tooManyIssuesWarning"> - <property name="text"> - <string>There were too many issues. Not all will be visible here.</string> - </property> - </widget> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0"> <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QLabel" name="_tooManyIssuesWarning"> + <property name="text"> + <string>There were too many issues. Not all will be visible here.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="_conflictHelp"> + <property name="text"> + <string>There were conflicts. Check the documentation on how to resolve them.</string> + </property> + <property name="wordWrap"> + <bool>true</bool> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> </item> <item> - <widget class="QPushButton" name="copyIssuesButton"> - <property name="toolTip"> - <string>Copy the issues list to the clipboard.</string> - </property> - <property name="text"> - <string>Copy</string> - </property> - </widget> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Minimum</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>0</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="copyIssuesButton"> + <property name="toolTip"> + <string>Copy the issues list to the clipboard.</string> + </property> + <property name="text"> + <string>Copy</string> + </property> + </widget> + </item> + </layout> </item> </layout> </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"/> + </item> </layout> </widget> <resources/> diff --git a/src/libsync/theme.cpp b/src/libsync/theme.cpp index da6e28344..67c6f48f0 100644 --- a/src/libsync/theme.cpp +++ b/src/libsync/theme.cpp @@ -228,6 +228,16 @@ QString Theme::helpUrl() const return QString::fromLatin1("https://doc.owncloud.org/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(); @@ -539,5 +549,4 @@ QString Theme::versionSwitchOutput() const return helpText; } - } // end namespace client diff --git a/src/libsync/theme.h b/src/libsync/theme.h index 90ddd7ef1..3c375c3b9 100644 --- a/src/libsync/theme.h +++ b/src/libsync/theme.h @@ -114,12 +114,28 @@ 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 ownCloud's 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. * * The respective UI controls will be disabled @@ -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; |