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
KDE PIM Add-ons
Commits
efe23bfc
Commit
efe23bfc
authored
Feb 10, 2016
by
Laurent Montel
😁
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bye bye customheaderstyle
parent
87eb6bfc
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
0 additions
and
623 deletions
+0
-623
plugins/messageviewerheaderplugins/CMakeLists.txt
plugins/messageviewerheaderplugins/CMakeLists.txt
+0
-1
plugins/messageviewerheaderplugins/autotests/CMakeLists.txt
plugins/messageviewerheaderplugins/autotests/CMakeLists.txt
+0
-1
plugins/messageviewerheaderplugins/autotests/customheaderstyleplugintest.cpp
...erheaderplugins/autotests/customheaderstyleplugintest.cpp
+0
-55
plugins/messageviewerheaderplugins/autotests/customheaderstyleplugintest.h
...ewerheaderplugins/autotests/customheaderstyleplugintest.h
+0
-35
plugins/messageviewerheaderplugins/customheaderstyleplugin/CMakeLists.txt
...iewerheaderplugins/customheaderstyleplugin/CMakeLists.txt
+0
-17
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstrategy.cpp
...rplugins/customheaderstyleplugin/customheaderstrategy.cpp
+0
-38
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstrategy.h
...derplugins/customheaderstyleplugin/customheaderstrategy.h
+0
-60
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyle.cpp
...aderplugins/customheaderstyleplugin/customheaderstyle.cpp
+0
-147
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyle.h
...headerplugins/customheaderstyleplugin/customheaderstyle.h
+0
-45
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleinterface.cpp
...ns/customheaderstyleplugin/customheaderstyleinterface.cpp
+0
-49
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleinterface.h
...gins/customheaderstyleplugin/customheaderstyleinterface.h
+0
-38
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleplugin.cpp
...ugins/customheaderstyleplugin/customheaderstyleplugin.cpp
+0
-63
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleplugin.h
...plugins/customheaderstyleplugin/customheaderstyleplugin.h
+0
-43
plugins/messageviewerheaderplugins/customheaderstyleplugin/messageviewer_customheaderstyleplugin.json
...derstyleplugin/messageviewer_customheaderstyleplugin.json
+0
-31
No files found.
plugins/messageviewerheaderplugins/CMakeLists.txt
View file @
efe23bfc
...
...
@@ -2,7 +2,6 @@
add_definitions
(
-DTRANSLATION_DOMAIN=\"messageviewerheaderplugins\"
)
add_subdirectory
(
allheaderstyleplugin
)
add_subdirectory
(
briefheaderstyleplugin
)
add_subdirectory
(
customheaderstyleplugin
)
add_subdirectory
(
enterpriseheaderstyleplugin
)
add_subdirectory
(
fancyheaderstyleplugin
)
add_subdirectory
(
grantleeheaderstyleplugin
)
...
...
plugins/messageviewerheaderplugins/autotests/CMakeLists.txt
View file @
efe23bfc
...
...
@@ -25,7 +25,6 @@ endmacro ()
add_messageviewer_header_unittest
(
briefheaderstyleplugintest.cpp
"../briefheaderstyleplugin/briefheaderstrategy.cpp;../briefheaderstyleplugin/briefheaderstyle.cpp;../briefheaderstyleplugin/briefheaderstyleplugin.cpp;../briefheaderstyleplugin/briefheaderstyleinterface.cpp"
)
add_messageviewer_header_unittest
(
allheaderstyleplugintest.cpp
"../allheaderstyleplugin/allheaderstrategy.cpp;../allheaderstyleplugin/allheaderstyleplugin.cpp;../allheaderstyleplugin/allheaderstyleinterface.cpp"
)
add_messageviewer_header_unittest
(
customheaderstyleplugintest.cpp
"../customheaderstyleplugin/customheaderstrategy.cpp;../customheaderstyleplugin/customheaderstyle.cpp;../customheaderstyleplugin/customheaderstyleplugin.cpp;../customheaderstyleplugin/customheaderstyleinterface.cpp"
)
add_messageviewer_header_unittest
(
enterpriseheaderstyleplugintest.cpp
"../enterpriseheaderstyleplugin/enterpriseheaderstyle.cpp;../enterpriseheaderstyleplugin/enterpriseheaderstyleplugin.cpp;../enterpriseheaderstyleplugin/enterpriseheaderstyleinterface.cpp"
)
...
...
plugins/messageviewerheaderplugins/autotests/customheaderstyleplugintest.cpp
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "customheaderstyleplugintest.h"
#include "../customheaderstyleplugin/customheaderstyleplugin.h"
#include "../customheaderstyleplugin/customheaderstyleinterface.h"
#include <QTest>
#include <KActionCollection>
#include <KActionMenu>
#include <QActionGroup>
CustomHeaderStylePluginTest
::
CustomHeaderStylePluginTest
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
CustomHeaderStylePluginTest
::~
CustomHeaderStylePluginTest
()
{
}
void
CustomHeaderStylePluginTest
::
shouldHaveDefaultValue
()
{
MessageViewer
::
CustomHeaderStylePlugin
plugin
;
QVERIFY
(
plugin
.
headerStyle
());
QVERIFY
(
plugin
.
headerStrategy
());
}
void
CustomHeaderStylePluginTest
::
shouldCreateInterface
()
{
MessageViewer
::
CustomHeaderStylePlugin
plugin
;
KActionMenu
*
menu
=
new
KActionMenu
(
this
);
QActionGroup
*
act
=
new
QActionGroup
(
this
);
MessageViewer
::
HeaderStyleInterface
*
interface
=
plugin
.
createView
(
menu
,
act
,
new
KActionCollection
(
this
));
QVERIFY
(
interface
);
QVERIFY
(
!
interface
->
action
().
isEmpty
());
}
QTEST_MAIN
(
CustomHeaderStylePluginTest
)
plugins/messageviewerheaderplugins/autotests/customheaderstyleplugintest.h
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CUSTOMHEADERSTYLEPLUGINTEST_H
#define CUSTOMHEADERSTYLEPLUGINTEST_H
#include <QObject>
class
CustomHeaderStylePluginTest
:
public
QObject
{
Q_OBJECT
public:
explicit
CustomHeaderStylePluginTest
(
QObject
*
parent
=
Q_NULLPTR
);
~
CustomHeaderStylePluginTest
();
private
Q_SLOTS
:
void
shouldHaveDefaultValue
();
void
shouldCreateInterface
();
};
#endif // CUSTOMHEADERSTYLEPLUGINTEST_H
plugins/messageviewerheaderplugins/customheaderstyleplugin/CMakeLists.txt
deleted
100644 → 0
View file @
87eb6bfc
set
(
messageviewer_customheaderstyleplugin_SRCS
customheaderstyleplugin.cpp
customheaderstyleinterface.cpp
customheaderstyle.cpp
customheaderstrategy.cpp
)
add_library
(
messageviewer_customheaderstyleplugin MODULE
${
messageviewer_customheaderstyleplugin_SRCS
}
)
target_link_libraries
(
messageviewer_customheaderstyleplugin
KF5::MessageViewer
KF5::XmlGui
KF5::IconThemes
KF5::GrantleeTheme
)
install
(
TARGETS messageviewer_customheaderstyleplugin DESTINATION
${
PLUGIN_INSTALL_DIR
}
/messageviewer
)
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstrategy.cpp
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "customheaderstrategy.h"
#include "messageviewer/messageviewersettings.h"
using
namespace
MessageViewer
;
CustomHeaderStrategy
::
CustomHeaderStrategy
()
:
HeaderStrategy
()
{
loadConfig
();
}
void
CustomHeaderStrategy
::
loadConfig
()
{
mHeadersToDisplay
=
MessageViewer
::
MessageViewerSettings
::
self
()
->
headersToDisplay
();
mHeadersToHide
=
MessageViewer
::
MessageViewerSettings
::
self
()
->
headersToHide
();
mDefaultPolicy
=
MessageViewer
::
MessageViewerSettings
::
self
()
->
customHeadersDefaultPolicy
()
==
MessageViewer
::
MessageViewerSettings
::
EnumCustomHeadersDefaultPolicy
::
Display
?
Display
:
Hide
;
}
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstrategy.h
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CUSTOMHEADERSTRATEGY_H
#define CUSTOMHEADERSTRATEGY_H
#include <messageviewer/headerstrategy.h>
#include <QStringList>
namespace
MessageViewer
{
class
CustomHeaderStrategy
:
public
HeaderStrategy
{
friend
class
HeaderStrategy
;
public:
CustomHeaderStrategy
();
~
CustomHeaderStrategy
()
{}
public:
const
char
*
name
()
const
Q_DECL_OVERRIDE
{
return
"custom"
;
}
void
loadConfig
();
QStringList
headersToDisplay
()
const
Q_DECL_OVERRIDE
{
return
mHeadersToDisplay
;
}
QStringList
headersToHide
()
const
Q_DECL_OVERRIDE
{
return
mHeadersToHide
;
}
DefaultPolicy
defaultPolicy
()
const
Q_DECL_OVERRIDE
{
return
mDefaultPolicy
;
}
private:
QStringList
mHeadersToDisplay
;
QStringList
mHeadersToHide
;
DefaultPolicy
mDefaultPolicy
;
};
}
#endif // CUSTOMHEADERSTRATEGY_H
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyle.cpp
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2013-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "customheaderstyle.h"
#include "messageviewer/headerstyle_util.h"
#include "messageviewer/headerstrategy.h"
#include "messageviewer/messageviewersettings.h"
#include "messageviewer/nodehelper.h"
#include <MessageCore/StringUtil>
#include <KLocalizedString>
#include <kmime/kmime_message.h>
#include <kmime/kmime_dateformatter.h>
using
namespace
MessageCore
;
using
namespace
MessageViewer
;
namespace
MessageViewer
{
//
// CustomHeaderStyle:
// show every header field on a line by itself,
// show subject larger
//
QString
CustomHeaderStyle
::
format
(
KMime
::
Message
*
message
)
const
{
if
(
!
message
)
{
return
QString
();
}
const
HeaderStrategy
*
strategy
=
headerStrategy
();
// The direction of the header is determined according to the direction
// of the application layout.
const
QString
dir
=
(
QApplication
::
isRightToLeft
()
?
QStringLiteral
(
"rtl"
)
:
QStringLiteral
(
"ltr"
));
// However, the direction of the message subject within the header is
// determined according to the contents of the subject itself. Since
// the "Re:" and "Fwd:" prefixes would always cause the subject to be
// considered left-to-right, they are ignored when determining its
// direction.
const
QString
subjectDir
=
mHeaderStyleUtil
.
subjectDirectionString
(
message
);
QString
headerStr
;
const
QStringList
headersToDisplay
=
strategy
->
headersToDisplay
();
if
((
strategy
->
defaultPolicy
()
==
HeaderStrategy
::
Hide
)
||
(
headersToDisplay
.
isEmpty
()
&&
strategy
->
defaultPolicy
()
==
HeaderStrategy
::
Display
))
{
// crude way to emulate "all" headers - Note: no strings have
// i18n(), so direction should always be ltr.
headerStr
=
QStringLiteral
(
"<div class=
\"
header
\"
dir=
\"
ltr
\"
>"
);
const
QStringList
headersToHide
=
strategy
->
headersToHide
();
headerStr
+=
formatAllMessageHeaders
(
message
,
headersToHide
);
return
headerStr
+
QLatin1String
(
"</div>"
);
}
headerStr
=
QStringLiteral
(
"<div class=
\"
header
\"
dir=
\"
%1
\"
>"
).
arg
(
dir
);
Q_FOREACH
(
const
QString
&
headerToDisplay
,
headersToDisplay
)
{
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"subject"
))
{
headerStr
+=
QStringLiteral
(
"<div dir=
\"
%1
\"
><b style=
\"
font-size:130%
\"
>"
).
arg
(
subjectDir
)
+
mHeaderStyleUtil
.
subjectString
(
message
)
+
QLatin1String
(
"</b></div>
\n
"
);
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"date"
))
{
headerStr
.
append
(
i18n
(
"Date: "
)
+
mHeaderStyleUtil
.
strToHtml
(
mHeaderStyleUtil
.
dateString
(
message
,
isPrinting
(),
/* short = */
MessageViewer
::
HeaderStyleUtil
::
CustomDate
))
+
QLatin1String
(
"<br/>
\n
"
));
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"from"
))
{
headerStr
.
append
(
i18n
(
"From: "
)
+
StringUtil
::
emailAddrAsAnchor
(
message
->
from
(),
StringUtil
::
DisplayFullAddress
,
QString
(),
StringUtil
::
ShowLink
));
if
(
!
vCardName
().
isEmpty
())
headerStr
.
append
(
QLatin1String
(
" <a href=
\"
"
)
+
vCardName
()
+
QLatin1String
(
"
\"
>"
)
+
i18n
(
"[vCard]"
)
+
QLatin1String
(
"</a>"
));
if
(
strategy
->
showHeader
(
QStringLiteral
(
"organization"
))
&&
message
->
organization
(
false
))
headerStr
.
append
(
QLatin1String
(
" ("
)
+
mHeaderStyleUtil
.
strToHtml
(
message
->
organization
()
->
asUnicodeString
())
+
QLatin1Char
(
')'
));
headerStr
.
append
(
QLatin1String
(
"<br/>
\n
"
));
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"to"
))
{
headerStr
.
append
(
i18nc
(
"To-field of the mailheader."
,
"To: "
)
+
StringUtil
::
emailAddrAsAnchor
(
message
->
to
(),
StringUtil
::
DisplayFullAddress
)
+
QLatin1String
(
"<br/>
\n
"
));
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"cc"
))
{
if
(
message
->
cc
(
false
))
{
headerStr
.
append
(
i18n
(
"CC: "
)
+
StringUtil
::
emailAddrAsAnchor
(
message
->
cc
(),
StringUtil
::
DisplayFullAddress
)
+
QLatin1String
(
"<br/>
\n
"
));
}
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"bcc"
))
{
if
(
message
->
bcc
(
false
))
{
headerStr
.
append
(
i18n
(
"BCC: "
)
+
StringUtil
::
emailAddrAsAnchor
(
message
->
bcc
(),
StringUtil
::
DisplayFullAddress
)
+
QLatin1String
(
"<br/>
\n
"
));
}
}
else
if
(
headerToDisplay
.
toLower
()
==
QLatin1String
(
"reply-to"
))
{
if
(
message
->
replyTo
(
false
))
{
headerStr
.
append
(
i18n
(
"Reply to: "
)
+
StringUtil
::
emailAddrAsAnchor
(
message
->
replyTo
(),
StringUtil
::
DisplayFullAddress
)
+
QLatin1String
(
"<br/>
\n
"
));
}
}
else
{
const
QByteArray
header
=
headerToDisplay
.
toLatin1
();
if
(
message
->
headerByType
(
header
))
{
headerStr
.
append
(
mHeaderStyleUtil
.
strToHtml
(
i18n
(
"%1: "
,
headerToDisplay
)
+
message
->
headerByType
(
header
)
->
asUnicodeString
())
+
QLatin1String
(
"<br/>
\n
"
));
}
}
}
headerStr
+=
QLatin1String
(
"</div>
\n
"
);
return
headerStr
;
}
QString
CustomHeaderStyle
::
formatAllMessageHeaders
(
KMime
::
Message
*
message
,
const
QStringList
&
headersToHide
)
const
{
QByteArray
head
=
message
->
head
();
KMime
::
Headers
::
Base
*
header
=
KMime
::
HeaderParsing
::
extractFirstHeader
(
head
);
QString
result
;
while
(
header
)
{
const
QString
headerType
=
QLatin1String
(
header
->
type
());
if
(
!
headersToHide
.
contains
(
headerType
)
||
!
headersToHide
.
contains
(
headerType
.
toLower
()))
{
result
+=
mHeaderStyleUtil
.
strToHtml
(
headerType
)
+
QLatin1String
(
": "
)
+
header
->
asUnicodeString
();
result
+=
QLatin1String
(
"<br />
\n
"
);
}
delete
header
;
header
=
KMime
::
HeaderParsing
::
extractFirstHeader
(
head
);
}
return
result
;
}
const
char
*
MessageViewer
::
CustomHeaderStyle
::
name
()
const
{
return
"custom"
;
}
}
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyle.h
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2013-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CUSTOMHEADERSTYLE_H
#define CUSTOMHEADERSTYLE_H
#include "messageviewer/headerstyle.h"
#include <headerstyle_util.h>
namespace
MessageViewer
{
class
CustomHeaderStyle
:
public
HeaderStyle
{
public:
CustomHeaderStyle
()
:
HeaderStyle
()
{}
~
CustomHeaderStyle
()
{}
public:
const
char
*
name
()
const
Q_DECL_OVERRIDE
;
private:
QString
format
(
KMime
::
Message
*
message
)
const
Q_DECL_OVERRIDE
;
QString
formatAllMessageHeaders
(
KMime
::
Message
*
message
,
const
QStringList
&
headersToHide
)
const
;
MessageViewer
::
HeaderStyleUtil
mHeaderStyleUtil
;
};
}
#endif // CUSTOMHEADERSTYLE_H
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleinterface.cpp
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "customheaderstyleinterface.h"
#include <KToggleAction>
#include <KLocalizedString>
#include <KActionCollection>
using
namespace
MessageViewer
;
CustomHeaderStyleInterface
::
CustomHeaderStyleInterface
(
MessageViewer
::
HeaderStylePlugin
*
plugin
,
QObject
*
parent
)
:
MessageViewer
::
HeaderStyleInterface
(
plugin
,
parent
)
{
}
CustomHeaderStyleInterface
::~
CustomHeaderStyleInterface
()
{
}
void
CustomHeaderStyleInterface
::
createAction
(
KActionMenu
*
menu
,
QActionGroup
*
actionGroup
,
KActionCollection
*
ac
)
{
KToggleAction
*
act
=
new
KToggleAction
(
i18nc
(
"View->headers->"
,
"&Custom Headers"
),
this
);
ac
->
addAction
(
QStringLiteral
(
"view_custom_headers"
),
act
);
connect
(
act
,
&
KToggleAction
::
triggered
,
this
,
&
CustomHeaderStyleInterface
::
slotStyleChanged
);
addHelpTextAction
(
act
,
i18n
(
"Show custom headers"
));
mAction
.
append
(
act
);
addActionToMenu
(
menu
,
actionGroup
);
}
void
CustomHeaderStyleInterface
::
activateAction
()
{
mAction
.
at
(
0
)
->
setChecked
(
true
);
}
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleinterface.h
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef CUSTOMHEADERSTYLEINTERFACE_H
#define CUSTOMHEADERSTYLEINTERFACE_H
#include <messageviewer/headerstyleinterface.h>
namespace
MessageViewer
{
class
CustomHeaderStyleInterface
:
public
MessageViewer
::
HeaderStyleInterface
{
Q_OBJECT
public:
explicit
CustomHeaderStyleInterface
(
MessageViewer
::
HeaderStylePlugin
*
plugin
,
QObject
*
parent
=
Q_NULLPTR
);
~
CustomHeaderStyleInterface
();
void
createAction
(
KActionMenu
*
menu
,
QActionGroup
*
actionGroup
,
KActionCollection
*
ac
)
Q_DECL_OVERRIDE
;
void
activateAction
()
Q_DECL_OVERRIDE
;
};
}
#endif // CUSTOMHEADERSTYLEINTERFACE_H
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleplugin.cpp
deleted
100644 → 0
View file @
87eb6bfc
/*
Copyright (c) 2015-2016 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "customheaderstyleplugin.h"
#include "customheaderstyleinterface.h"
#include "customheaderstyle.h"
#include "customheaderstrategy.h"
#include <kpluginfactory.h>
using
namespace
MessageViewer
;
K_PLUGIN_FACTORY_WITH_JSON
(
MessageViewerCustomHeaderStylePluginFactory
,
"messageviewer_customheaderstyleplugin.json"
,
registerPlugin
<
CustomHeaderStylePlugin
>
();)
CustomHeaderStylePlugin
::
CustomHeaderStylePlugin
(
QObject
*
parent
,
const
QList
<
QVariant
>
&
)
:
MessageViewer
::
HeaderStylePlugin
(
parent
),
mHeaderStyle
(
new
CustomHeaderStyle
),
mHeaderStrategy
(
new
CustomHeaderStrategy
)
{
}
CustomHeaderStylePlugin
::~
CustomHeaderStylePlugin
()
{
}
HeaderStyle
*
CustomHeaderStylePlugin
::
headerStyle
()
const
{
return
mHeaderStyle
;
}
HeaderStrategy
*
CustomHeaderStylePlugin
::
headerStrategy
()
const
{
return
mHeaderStrategy
;
}
HeaderStyleInterface
*
CustomHeaderStylePlugin
::
createView
(
KActionMenu
*
menu
,
QActionGroup
*
actionGroup
,
KActionCollection
*
ac
,
QObject
*
parent
)
{
MessageViewer
::
HeaderStyleInterface
*
view
=
new
MessageViewer
::
CustomHeaderStyleInterface
(
this
,
parent
);
if
(
ac
)
{
view
->
createAction
(
menu
,
actionGroup
,
ac
);
}
return
view
;
}
QString
CustomHeaderStylePlugin
::
name
()
const
{
return
QStringLiteral
(
"custom"
);
}
#include "customheaderstyleplugin.moc"
plugins/messageviewerheaderplugins/customheaderstyleplugin/customheaderstyleplugin.h
deleted
100644 → 0