Issues: Show link to conflicts doc if there are some #6396

The link url is themed.
This commit is contained in:
Christian Kamm 2018-04-16 09:12:44 +02:00 committed by Roeland Jago Douma
parent b527013ad8
commit d549c77af6
No known key found for this signature in database
GPG Key ID: F941078878347C0C
5 changed files with 91 additions and 31 deletions

View File

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

View File

@ -63,7 +63,6 @@ protected:
signals:
void copyToClipboard();
void issueCountUpdated(int);
void folderConflicts(QString folder, QStringList conflictPaths);
private slots:
void slotRefreshIssues();

View File

@ -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/>

View File

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

View File

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