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
Utilities
Ark
Commits
827e6d97
Commit
827e6d97
authored
Nov 17, 2020
by
Friedrich W. H. Kossebau
Browse files
Internal previewer: add menu option to show About dialog for kpart
parent
5f54fd84
Changes
3
Hide whitespace changes
Inline
Side-by-side
part/ark_viewer.rc
View file @
827e6d97
<!DOCTYPE gui SYSTEM "kpartgui.dtd">
<gui
name=
"ark_viewer"
version=
"
1
"
>
<gui
name=
"ark_viewer"
version=
"
2
"
>
<MenuBar>
<Menu
name=
"help"
>
<text>
&
Help
</text>
<Action
name=
"help_about_kpart"
append=
"about_merge"
/>
</Menu>
<Merge/>
</MenuBar>
</gui>
part/arkviewer.cpp
View file @
827e6d97
...
...
@@ -29,12 +29,16 @@
#include <KMessageBox>
#include <KParts/OpenUrlArguments>
#include <KXMLGUIFactory>
#include <KActionCollection>
#include <KAboutPluginDialog>
#include <KPluginMetaData>
#include <QFile>
#include <QMimeDatabase>
#include <QProgressDialog>
#include <QPushButton>
#include <QStyle>
#include <QAction>
#include <algorithm>
...
...
@@ -199,6 +203,15 @@ bool ArkViewer::viewInInternalViewer(const QString& fileName, const QMimeType &m
// Insert the KPart into its placeholder.
centralWidget
()
->
layout
()
->
replaceWidget
(
m_partPlaceholder
,
m_part
.
data
()
->
widget
());
QAction
*
action
=
actionCollection
()
->
addAction
(
QStringLiteral
(
"help_about_kpart"
));
const
KPluginMetaData
partMetaData
=
m_part
->
metaData
();
const
QString
iconName
=
partMetaData
.
iconName
();
if
(
!
iconName
.
isEmpty
())
{
action
->
setIcon
(
QIcon
::
fromTheme
(
iconName
));
}
action
->
setText
(
i18nc
(
"@action"
,
"About Viewer Component"
));
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
ArkViewer
::
aboutKPart
);
createGUI
(
m_part
.
data
());
setAutoSaveSettings
(
QStringLiteral
(
"Viewer"
),
true
);
...
...
@@ -244,3 +257,14 @@ KService::Ptr ArkViewer::getViewer(const QString &mimeType)
return
KService
::
Ptr
();
}
}
void
ArkViewer
::
aboutKPart
()
{
if
(
!
m_part
)
{
return
;
}
auto
*
dialog
=
new
KAboutPluginDialog
(
m_part
->
metaData
(),
this
);
dialog
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
dialog
->
show
();
}
part/arkviewer.h
View file @
827e6d97
...
...
@@ -46,6 +46,10 @@ private:
static
KService
::
Ptr
getViewer
(
const
QString
&
mimeType
);
bool
viewInInternalViewer
(
const
QString
&
fileName
,
const
QMimeType
&
mimeType
);
private
Q_SLOTS
:
void
aboutKPart
();
private:
QPointer
<
KParts
::
ReadOnlyPart
>
m_part
;
QString
m_fileName
;
};
...
...
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