Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Cantor
Commits
67cc44bd
Commit
67cc44bd
authored
Jul 17, 2021
by
Alexander Semke
Browse files
Open the default URL for the online documentation in case no local documentation is installed.
parent
1c8e7e79
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cantor_part.cpp
View file @
67cc44bd
...
...
@@ -134,7 +134,7 @@ CantorPart::CantorPart( QWidget *parentWidget, QObject *parent, const QVariantLi
connect
(
m_worksheet
,
&
Worksheet
::
hierarhyEntryNameChange
,
this
,
&
CantorPart
::
hierarhyEntryNameChange
);
connect
(
this
,
&
CantorPart
::
requestScrollToHierarchyEntry
,
m_worksheet
,
&
Worksheet
::
requestScrollToHierarchyEntry
);
connect
(
this
,
&
CantorPart
::
settingsChanges
,
m_worksheet
,
&
Worksheet
::
handleSettingsChanges
);
connect
(
m_worksheet
,
&
Worksheet
::
requestDocumentation
,
this
,
&
CantorPart
::
requestD
ocumentation
);
connect
(
m_worksheet
,
&
Worksheet
::
requestDocumentation
,
this
,
&
CantorPart
::
d
ocumentation
Requested
);
layout
->
addWidget
(
m_worksheetview
);
setWidget
(
widget
);
...
...
@@ -727,13 +727,27 @@ void CantorPart::enableTypesetting(bool enable)
m_worksheet
->
session
()
->
setTypesettingEnabled
(
enable
);
}
/*!
* called when the current worksheet has requested to show the documentation for \c keyword.
* In case the local documentation is available for the current backend, the signal is
* forwarded to the shell to show the documentation plugin/widget.
* If no local documentation is available, the defaul online URL for the backend documentation
* is openned.
*/
void
CantorPart
::
documentationRequested
(
const
QString
&
keyword
)
{
auto
*
backend
=
m_worksheet
->
session
()
->
backend
();
const
KConfigGroup
&
group
=
KSharedConfig
::
openConfig
()
->
group
(
backend
->
name
().
toLower
());
const
auto
&
docNames
=
group
.
readEntry
(
QLatin1String
(
"Names"
),
QStringList
());
if
(
!
docNames
.
isEmpty
())
emit
requestDocumentation
(
keyword
);
else
showBackendHelp
();
}
void
CantorPart
::
showBackendHelp
()
{
qDebug
()
<<
"Showing backend's help"
;
auto
*
backend
=
m_worksheet
->
session
()
->
backend
();
QUrl
url
=
backend
->
helpUrl
();
qDebug
()
<<
"launching url "
<<
url
;
auto
*
job
=
new
KIO
::
OpenUrlJob
(
url
);
auto
*
job
=
new
KIO
::
OpenUrlJob
(
backend
->
helpUrl
());
job
->
setUiDelegate
(
new
KIO
::
JobUiDelegate
(
KJobUiDelegate
::
AutoHandlingEnabled
,
widget
()));
job
->
start
();
}
...
...
src/cantor_part.h
View file @
67cc44bd
...
...
@@ -151,6 +151,7 @@ protected Q_SLOTS:
where set during the block
**/
void
unblockStatusBar
();
private:
Worksheet
*
m_worksheet
;
WorksheetView
*
m_worksheetview
;
...
...
@@ -177,6 +178,9 @@ private:
QString
m_cachedStatusMessage
;
bool
m_statusBarBlocked
;
unsigned
int
m_sessionStatusCounter
;
private
Q_SLOTS
:
void
documentationRequested
(
const
QString
&
);
};
#endif // CANTORPART_H
src/panelplugins/documentationpanel/documentationpanelwidget.cpp
View file @
67cc44bd
...
...
@@ -375,6 +375,9 @@ void DocumentationPanelWidget::contextSensitiveHelp(const QString& keyword)
//make sure first we show the web view in the stack widget
m_stackedWidget
->
setCurrentIndex
(
0
);
if
(
!
m_indexWidget
)
return
;
m_indexWidget
->
filterIndices
(
keyword
);
// filter exactly, no wildcards
m_indexWidget
->
activateCurrentItem
();
// this internally emitts the QHelpIndexWidget::linkActivated signal
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment