Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PIM
PIM Messagelib
Commits
5cc4be3f
Commit
5cc4be3f
authored
Feb 03, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start to implement plugin order
parent
d431d97a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
2 deletions
+38
-2
messagecomposer/src/plugineditor/plugineditor.cpp
messagecomposer/src/plugineditor/plugineditor.cpp
+23
-1
messagecomposer/src/plugineditor/plugineditor.h
messagecomposer/src/plugineditor/plugineditor.h
+5
-0
messagecomposer/src/plugineditor/plugineditormanager.cpp
messagecomposer/src/plugineditor/plugineditormanager.cpp
+10
-1
No files found.
messagecomposer/src/plugineditor/plugineditor.cpp
View file @
5cc4be3f
...
...
@@ -19,13 +19,35 @@
using
namespace
MessageComposer
;
class
MessageComposer
::
PluginEditorPrivate
{
public:
PluginEditorPrivate
()
:
order
(
0
)
{
}
int
order
;
};
PluginEditor
::
PluginEditor
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
),
d
(
new
PluginEditorPrivate
)
{
}
PluginEditor
::~
PluginEditor
()
{
delete
d
;
}
void
PluginEditor
::
setOrder
(
int
order
)
{
d
->
order
=
order
;
}
int
PluginEditor
::
order
()
const
{
return
d
->
order
;
}
messagecomposer/src/plugineditor/plugineditor.h
View file @
5cc4be3f
...
...
@@ -24,14 +24,19 @@ class KActionCollection;
namespace
MessageComposer
{
class
PluginEditorInterface
;
class
PluginEditorPrivate
;
class
MESSAGECOMPOSER_EXPORT
PluginEditor
:
public
QObject
{
Q_OBJECT
public:
explicit
PluginEditor
(
QObject
*
parent
=
Q_NULLPTR
);
~
PluginEditor
();
void
setOrder
(
int
order
);
virtual
PluginEditorInterface
*
createInterface
(
KActionCollection
*
ac
,
QObject
*
parent
=
Q_NULLPTR
)
=
0
;
int
order
()
const
;
private:
PluginEditorPrivate
*
const
d
;
};
}
#endif // PLUGINEDITOR_H
messagecomposer/src/plugineditor/plugineditormanager.cpp
View file @
5cc4be3f
...
...
@@ -45,13 +45,15 @@ class PluginEditorInfo
{
public:
PluginEditorInfo
()
:
plugin
(
Q_NULLPTR
)
:
order
(
0
),
plugin
(
Q_NULLPTR
)
{
}
QString
saveName
()
const
;
KPluginMetaData
metaData
;
int
order
;
PluginEditor
*
plugin
;
};
...
...
@@ -92,6 +94,12 @@ bool PluginEditorManagerPrivate::initializePlugins()
while
(
i
.
hasPrevious
())
{
PluginEditorInfo
info
;
info
.
metaData
=
i
.
previous
();
const
QVariant
p
=
info
.
metaData
.
rawData
().
value
(
QStringLiteral
(
"X-KDE-KMailEditor-Order"
)).
toVariant
();
int
order
=
-
1
;
if
(
p
.
isValid
())
{
order
=
p
.
toInt
();
}
info
.
order
=
order
;
if
(
pluginVersion
()
==
info
.
metaData
.
version
())
{
// only load plugins once, even if found multiple times!
if
(
unique
.
contains
(
info
.
saveName
()))
{
...
...
@@ -112,6 +120,7 @@ bool PluginEditorManagerPrivate::initializePlugins()
void
PluginEditorManagerPrivate
::
loadPlugin
(
PluginEditorInfo
*
item
)
{
item
->
plugin
=
KPluginLoader
(
item
->
metaData
.
fileName
()).
factory
()
->
create
<
PluginEditor
>
(
q
,
QVariantList
()
<<
item
->
saveName
());
item
->
plugin
->
setOrder
(
item
->
order
);
}
QVector
<
PluginEditor
*>
PluginEditorManagerPrivate
::
pluginsList
()
const
...
...
Write
Preview
Markdown
is supported
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