Commit 0be65944 authored by Ahmad Samir's avatar Ahmad Samir

If KHelpCenter isn't available fallback to opening doc at docs.kde.org

Summary:
UrlHandler from KGUIAddons sets a handler for help:/ urls, which opens
khelpcenter if it's available or falls back to opening the relevant page
at docs.kde.org.

Explicitly add KGuiAddons to find_package() and target_link_libraries().

Depends on D27615

BUG: 405647

FIXED-IN: 5.18.1

Test Plan:
- make sure khelpcenter is not installed and open systemsettings
- navigate to any module (one that has Help visible, e.g. Fonts),
  "Help" button is disabled
- install khelpcenter and restart systemsettings, the "Help" button
  should be enabled

Reviewers: #plasma, apol

Reviewed By: apol

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27518
parent c1663606
......@@ -45,6 +45,7 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Declarative
Activities
ActivitiesStats
GuiAddons # UrlHanlder hanldes help:/ urls
QUIET
)
......
......@@ -31,6 +31,7 @@ target_link_libraries( systemsettings5 systemsettingsview
KF5::DBusAddons
KF5::ConfigGui
KF5::QuickAddons
KF5::GuiAddons # UrlHanlder handles help:/ urls
PW::KWorkspace
)
......
......@@ -31,6 +31,7 @@
#include <QVBoxLayout>
#include <QPushButton>
#include <QLoggingCategory>
#include <QDesktopServices>
#include <QDialogButtonBox>
#include <KPageWidget>
......@@ -325,8 +326,10 @@ void ModuleView::moduleHelp()
if( docPath.isEmpty() ) {
return;
}
QUrl url( QStringLiteral("help:/")+docPath );
QProcess::startDetached(QStringLiteral("khelpcenter"), QStringList() << url.url());
// UrlHandler from KGUIAddons sets a handler for help:/ urls, which opens khelpcenter
// if it's available or falls back to opening the relevant page at docs.kde.org
QDesktopServices::openUrl(QUrl(QStringLiteral("help:/") + docPath));
}
void ModuleView::activeModuleChanged(KPageWidgetItem * current, KPageWidgetItem * previous)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment