Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PIM Messagelib
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
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
Hide 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 @@
...
@@ -19,13 +19,35 @@
using
namespace
MessageComposer
;
using
namespace
MessageComposer
;
class
MessageComposer
::
PluginEditorPrivate
{
public:
PluginEditorPrivate
()
:
order
(
0
)
{
}
int
order
;
};
PluginEditor
::
PluginEditor
(
QObject
*
parent
)
PluginEditor
::
PluginEditor
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
),
d
(
new
PluginEditorPrivate
)
{
{
}
}
PluginEditor
::~
PluginEditor
()
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;
...
@@ -24,14 +24,19 @@ class KActionCollection;
namespace
MessageComposer
namespace
MessageComposer
{
{
class
PluginEditorInterface
;
class
PluginEditorInterface
;
class
PluginEditorPrivate
;
class
MESSAGECOMPOSER_EXPORT
PluginEditor
:
public
QObject
class
MESSAGECOMPOSER_EXPORT
PluginEditor
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
public:
explicit
PluginEditor
(
QObject
*
parent
=
Q_NULLPTR
);
explicit
PluginEditor
(
QObject
*
parent
=
Q_NULLPTR
);
~
PluginEditor
();
~
PluginEditor
();
void
setOrder
(
int
order
);
virtual
PluginEditorInterface
*
createInterface
(
KActionCollection
*
ac
,
QObject
*
parent
=
Q_NULLPTR
)
=
0
;
virtual
PluginEditorInterface
*
createInterface
(
KActionCollection
*
ac
,
QObject
*
parent
=
Q_NULLPTR
)
=
0
;
int
order
()
const
;
private:
PluginEditorPrivate
*
const
d
;
};
};
}
}
#endif // PLUGINEDITOR_H
#endif // PLUGINEDITOR_H
messagecomposer/src/plugineditor/plugineditormanager.cpp
View file @
5cc4be3f
...
@@ -45,13 +45,15 @@ class PluginEditorInfo
...
@@ -45,13 +45,15 @@ class PluginEditorInfo
{
{
public:
public:
PluginEditorInfo
()
PluginEditorInfo
()
:
plugin
(
Q_NULLPTR
)
:
order
(
0
),
plugin
(
Q_NULLPTR
)
{
{
}
}
QString
saveName
()
const
;
QString
saveName
()
const
;
KPluginMetaData
metaData
;
KPluginMetaData
metaData
;
int
order
;
PluginEditor
*
plugin
;
PluginEditor
*
plugin
;
};
};
...
@@ -92,6 +94,12 @@ bool PluginEditorManagerPrivate::initializePlugins()
...
@@ -92,6 +94,12 @@ bool PluginEditorManagerPrivate::initializePlugins()
while
(
i
.
hasPrevious
())
{
while
(
i
.
hasPrevious
())
{
PluginEditorInfo
info
;
PluginEditorInfo
info
;
info
.
metaData
=
i
.
previous
();
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
())
{
if
(
pluginVersion
()
==
info
.
metaData
.
version
())
{
// only load plugins once, even if found multiple times!
// only load plugins once, even if found multiple times!
if
(
unique
.
contains
(
info
.
saveName
()))
{
if
(
unique
.
contains
(
info
.
saveName
()))
{
...
@@ -112,6 +120,7 @@ bool PluginEditorManagerPrivate::initializePlugins()
...
@@ -112,6 +120,7 @@ bool PluginEditorManagerPrivate::initializePlugins()
void
PluginEditorManagerPrivate
::
loadPlugin
(
PluginEditorInfo
*
item
)
void
PluginEditorManagerPrivate
::
loadPlugin
(
PluginEditorInfo
*
item
)
{
{
item
->
plugin
=
KPluginLoader
(
item
->
metaData
.
fileName
()).
factory
()
->
create
<
PluginEditor
>
(
q
,
QVariantList
()
<<
item
->
saveName
());
item
->
plugin
=
KPluginLoader
(
item
->
metaData
.
fileName
()).
factory
()
->
create
<
PluginEditor
>
(
q
,
QVariantList
()
<<
item
->
saveName
());
item
->
plugin
->
setOrder
(
item
->
order
);
}
}
QVector
<
PluginEditor
*>
PluginEditorManagerPrivate
::
pluginsList
()
const
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