Commit ac9c14d2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Move defaultgrantleeheaderstyleplugin in messageviewer directly

parent 2a08af3d
......@@ -6,7 +6,7 @@ add_subdirectory(enterpriseheaderstyleplugin)
add_subdirectory(fancyheaderstyleplugin)
add_subdirectory(grantleeheaderstyleplugin)
add_subdirectory(longheaderstyleplugin)
add_subdirectory(defaultgrantleeheaderstyleplugin)
add_subdirectory(standardsheaderstyleplugin)
if(BUILD_TESTING)
add_subdirectory(autotests)
add_subdirectory(tests)
......
......@@ -34,4 +34,7 @@ add_messageviewer_header_unittest( grantleeheaderstyleplugintest.cpp "../grantle
add_messageviewer_header_unittest( longheaderstyleplugintest.cpp "../longheaderstyleplugin/longheaderstyleplugin.cpp;../longheaderstyleplugin/longheaderstyleinterface.cpp")
add_messageviewer_header_unittest( standardsheaderstyleplugintest.cpp "../standardsheaderstyleplugin/standardheaderstrategy.cpp;../standardsheaderstyleplugin/standardsheaderstyleplugin.cpp;../standardsheaderstyleplugin/standardsheaderstyleinterface.cpp")
add_messageviewer_header_class_unittest( headerstylepluginmanagertest.cpp)
/*
Copyright (C) 2015-2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "standardsheaderstyleplugintest.h"
#include "../standardsheaderstyleplugin/standardsheaderstyleplugin.h"
#include "../standardsheaderstyleplugin/standardsheaderstyleinterface.h"
#include <QTest>
#include <KActionCollection>
#include <KActionMenu>
#include <QActionGroup>
StandardsHeaderStylePluginTest::StandardsHeaderStylePluginTest(QObject *parent)
: QObject(parent)
{
}
StandardsHeaderStylePluginTest::~StandardsHeaderStylePluginTest()
{
}
void StandardsHeaderStylePluginTest::shouldHaveDefaultValue()
{
MessageViewer::StandardsHeaderStylePlugin plugin;
QVERIFY(plugin.headerStyle());
QVERIFY(plugin.headerStrategy());
}
void StandardsHeaderStylePluginTest::shouldCreateInterface()
{
MessageViewer::StandardsHeaderStylePlugin 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(StandardsHeaderStylePluginTest)
/*
Copyright (C) 2015-2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef STANDARDSHEADERSTYLEPLUGINTEST_H
#define STANDARDSHEADERSTYLEPLUGINTEST_H
#include <QObject>
class StandardsHeaderStylePluginTest : public QObject
{
Q_OBJECT
public:
explicit StandardsHeaderStylePluginTest(QObject *parent = Q_NULLPTR);
~StandardsHeaderStylePluginTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
void shouldCreateInterface();
};
#endif // STANDARDSHEADERSTYLEPLUGINTEST_H
set(messageviewer_defaultgrantleeheaderstyleplugin_SRCS
defaultgrantleeheaderstyleplugin.cpp
defaultgrantleeheaderstyleinterface.cpp
defaultgrantleeheaderstrategy.cpp
)
kconfig_add_kcfg_files(messageviewer_defaultgrantleeheaderstyleplugin_SRCS
settings/globalsettings_base.kcfgc
)
kcoreaddons_add_plugin(messageviewer_defaultgrantleeheaderstyleplugin JSON messageviewer_defaultgrantleeheaderstyleplugin.json SOURCES
${messageviewer_defaultgrantleeheaderstyleplugin_SRCS} INSTALL_NAMESPACE messageviewer)
target_link_libraries(messageviewer_defaultgrantleeheaderstyleplugin
KF5::MessageViewer
KF5::GrantleeTheme
KF5::XmlGui
)
install(DIRECTORY theme/5.2 DESTINATION ${KDE_INSTALL_DATADIR}/messageviewer/defaultthemes/ )
/*
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 as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "defaultgrantleeheaderstyleinterface.h"
#include "messageviewer/headerstyleplugin.h"
#include "messageviewer/headerstyle.h"
#include <grantleetheme/grantleethememanager.h>
#include "globalsettings_base.h"
#include <KToggleAction>
#include <KActionCollection>
#include <QStandardPaths>
using namespace MessageViewer;
DefaultGrantleeHeaderStyleInterface::DefaultGrantleeHeaderStyleInterface(MessageViewer::HeaderStylePlugin *plugin, QObject *parent)
: MessageViewer::HeaderStyleInterface(plugin, parent)
{
qDebug()<<" DefaultGrantleeHeaderStyleInterface"<<this;
}
DefaultGrantleeHeaderStyleInterface::~DefaultGrantleeHeaderStyleInterface()
{
}
void DefaultGrantleeHeaderStyleInterface::createAction(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac)
{
qDebug()<<" void DefaultGrantleeHeaderStyleInterface::createAction(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac)";
const QStringList defaultThemePath = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("messageviewer/defaultthemes/"), QStandardPaths::LocateDirectory);
if (!defaultThemePath.isEmpty()) {
const QString themeName = DefaultGrantleeHeaderStylePluginSettings::self()->themeName();
mDefaultTheme = GrantleeTheme::ThemeManager::loadTheme(defaultThemePath.at(0) + QLatin1Char('/') + themeName,
themeName,
QStringLiteral("kmail_default.desktop"));
}
mHeaderStylePlugin->headerStyle()->setTheme(mDefaultTheme);
KToggleAction *act = new KToggleAction(mDefaultTheme.name(), this);
ac->addAction(QStringLiteral("default_grantlee_theme"), act);
connect(act, &KToggleAction::triggered, this, &DefaultGrantleeHeaderStyleInterface::slotDefaultGrantleeHeaders);
mAction.append(act);
addActionToMenu(menu, actionGroup);
}
void DefaultGrantleeHeaderStyleInterface::activateAction()
{
mAction.at(0)->setChecked(true);
}
void DefaultGrantleeHeaderStyleInterface::slotDefaultGrantleeHeaders()
{
qDebug()<<" void DefaultGrantleeHeaderStyleInterface::slotDefaultGrantleeHeaders()************";
mHeaderStylePlugin->headerStyle()->setTheme(mDefaultTheme);
slotStyleChanged();
}
{
"KPlugin": {
"Description": "This plugin allows you a default grantlee mail header.",
"Description[ca@valencia]": "Este connector permet una capçalera «Grantlee» predeterminada al correu.",
"Description[ca]": "Aquest connector permet una capçalera «Grantlee» predeterminada al correu.",
"Description[en_GB]": "This plugin allows you a default Grantlee mail header.",
"Description[nl]": "Deze plug-in stelt u in staat een standaard Grantlee e-mailheader te gebruiken.",
"Description[pt]": "Este 'plugin' permite-lhe atribuir um cabeçalho de e-mail predefinido do Grantlee.",
"Description[sv]": "Insticksprogrammet gör det möjligt att använda ett Grantlee-standardbrevhuvud.",
"Description[uk]": "Цей додаток визначає типовий заголовок повідомлення grantlee.",
"Description[x-test]": "xxThis plugin allows you a default grantlee mail header.xx",
"EnabledByDefault": "true",
"Name": "Default Grantlee Header Style",
"Name[ca@valencia]": "Estil de capçalera «Grantlee» predeterminat",
"Name[ca]": "Estil de capçalera «Grantlee» predeterminat",
"Name[de]": "Vorspann-Design „Standard-Grantlee“",
"Name[es]": "Estilo de encabezado predeterminado Grantlee",
"Name[et]": "Vaikimisi Grantlee päisestiil",
"Name[fi]": "Grantlee-oletusotsaketyyli",
"Name[gl]": "Estilo de cabeceira predeterminado de Grantlee",
"Name[it]": "Stile con intestazioni di Grantlee predefinite",
"Name[nl]": "Stijl met standaard Grantlee header",
"Name[pl]": "Domyślny styl nagłówków Grantlee",
"Name[pt]": "Estilo de Cabeçalho Predefinido do Grantlee",
"Name[pt_BR]": "Estilo de cabeçalho Grantlee padrão",
"Name[ru]": "Стандартный стиль заголовков Grantlee",
"Name[sk]": "Predvolený štýl hlavičiek Grantlee",
"Name[sl]": "Privzet slog z glavami Grantlee",
"Name[sr@ijekavian]": "Подразумевани Грантлијев стил заглавља",
"Name[sr@ijekavianlatin]": "Podrazumevani Grantleejev stil zaglavlja",
"Name[sr@latin]": "Podrazumevani Grantleejev stil zaglavlja",
"Name[sr]": "Подразумевани Грантлијев стил заглавља",
"Name[sv]": "Grantlee-standardtema för huvudstil",
"Name[uk]": "Типовий стиль заголовків Grantlee",
"Name[x-test]": "xxDefault Grantlee Header Stylexx",
"ServiceTypes": [
"MessageViewerHeaderStyle/Plugin"
],
"Version": "1.0"
},
"X-KDE-MessageViewer-Header-Order": "100"
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/standards/kcfg/1.0/kcfg.xsd">
<group name="GrantleeDefaultTheme">
<entry name="ThemeName" type="String">
<default>5.2</default>
</entry>
<entry name="ShowActionMail" type="bool">
<default>false</default>
</entry>
</group>
</kcfg>
File=defaultgrantleeheaderstyleplugin.kcfg
ClassName=DefaultGrantleeHeaderStylePluginSettings
Mutators=true
Singleton=true
ItemAccessors=true
<link href="{{ header.absoluteThemePath }}/style.css" rel="stylesheet" type="text/css" />
<div id="kmailPage">
<div id="headerbox" dir="ltr">
{% if header.showMailAction %}
{% if header.screenmode %}
<div class="actiontable">
<div class="actionrowtable">
<div class="theactioncell"> {{ header.newmessageaction|safe }} </div>
<div class="theactioncell"> {{ header.printpreviewmessageaction|safe }} </div>
<div class="theactioncell"> {{ header.printmessageaction|safe }} </div>
<div class="theactioncell theactionbigcell"></div>
<div class="theactioncell"> {{ header.replyaction|safe }} </div>
<div class="theactioncell"> {{ header.replyallaction|safe }} </div>
<div class="theactioncell"> {{ header.forwardaction|safe }} </div>
{% if header.readOnlyMessage %}
{% else %}
<div class="theactioncell"> {{ header.trashaction|safe }} </div>
{% endif %}
</div>
</div>
{% endif %}
{% endif %}
<div id="subject" dir="{{ header.subjectDir }}">{{ header.subject|safe }}</div>
<div id="photo">
{% if header.photourl %}
<img src="{{ header.photourl }}" width="{{ header.photowidth }}" height="{{ header.photoheight }}" />
{% else %}
<img src="{{ header.absoluteThemePath }}/photo.svg" width="{{ header.photowidth }}" height="{{ header.photoheight }}" />
{% endif %}
</div>
<div class="table">
<div class="row">
<div class="headerleft">{{ header.fromi18n }}</div>
<div class="headerright">
{{ header.from|safe }}
{% if header.resentfrom %}
{{ header.resentfromi18n }}: {{ header.resentfrom|safe }}
{% endif %}
{% if vCardName %}
<a href="{{ header.vcardname|safe }}">{{ header.vcardi18n }}</a>
{% endif %}
{% if header.organization %}
({{ header.organization|safe }})
{% endif %}
</div>
</div>
<div class="row">
<div class="headerleft">{{ header.toi18n }}</div>
<div class="headerright">{{ header.toExpandable|safe }}</div>
</div>
{% if header.cc %}
<div class="row">
<div class="headerleft">{{ header.cci18n }}</div>
<div class="headerright">{{ header.ccExpandable|safe }}</div>
</div>
{% endif %}
{% if header.bcc %}
<div class="row">
<div class="headerleft">{{ header.bcci18n }}</div>
<div class="headerright">{{ header.bcc|safe }}</div>
</div>
{% endif %}
{% if header.sender %}
<div class="row">
<div class="headerleft">{{ header.senderi18n }}</div>
<div class="headerright">{{ header.sender|safe }}</div>
</div>
{% endif %}
{% if header.listid %}
<div class="row">
<div class="headerleft">{{ header.listidi18n }}</div>
<div class="headerright">{{ header.listid }}</div>
</div>
{% endif %}
<div class="row">
<div class="headerleft">{{ header.datei18n }}</div>
<div class="headerrightdate" dir="{{ dateDir }}">{{ header.dateshort }}</div>
</div>
{% if header.spamHTML %}
<div class="row">
<div class="headerleft">{{ header.spamstatusi18n }}</div>
<div class="headerrightdate">{{ header.spamHTML|safe }}</div>
</div>
{% endif %}
</div>
<div id="attachmentInjectionPoint"></div>
</div>
<div id="kmailContent">
[Desktop Entry]
Author=KMail 5.2 Default Theme
AuthorEmail=montel@kde.org
Description=KMail Default Theme 5.2 (Based on Breeze Flat author Kristofer Rickheden Gustavsson)
Description[ca]=Tema per omissió pel KMail 5.2 (basat en la Brisa Flat de l'autor Kristofer Rickheden Gustavsson)
Description[ca@valencia]=Tema per omissió pel KMail 5.2 (basat en la Brisa Flat de l'autor Kristofer Rickheden Gustavsson)
Description[de]=KMail-Standarddesign 5.2 (Basiert auf „Breeze Flach“, Autor: Kristofer Rickheden Gustavsson)
Description[en_GB]=KMail Default Theme 5.2 (Based on Breeze Flat author Kristofer Rickheden Gustavsson)
Description[es]=KMail tema predeterminado 5.2 (basado en brisa plano, autor Kristofer Rickheden Gustavsson)
Description[et]=KMaili vaiketeema 5.2 (aluseks on Breeze Flat, autor: Kristofer Rickheden Gustavsson)
Description[fi]=KMail 5.2 -oletusteema (perustuu Breeze Flat -teemaan, jonka teki Kristofer Rickheden Gustavsson)
Description[gl]=Tema predeterminado de KMail 5.2 (baseado en Breeze Flat, creado por Kristofer Rickheden Gustavsson)
Description[it]=Tema predefinito di KMail 5.2 (basato su Brezza piatto, autore Kristofer Rickheden Gustavsson)
Description[nl]=KMail standaard thema 5.2 (gebaseerd op de auteur van Breeze Flat Kristofer Rickheden Gustavsson)
Description[pl]=Domyślny wystrój KMaila 5.2 (Oparty na Płaskiej Bryzie autorstwa Kristofer Rickheden Gustavsson)
Description[pt]=Tema Predefinido 5.2 do KMail (Baseado no autor do Brisa Plano Kristofer Rickheden Gustavsson)
Description[pt_BR]=Tema padrão do KMail 5.2 (Baseado no autor do Breeze Flat, Kristofer Rickheden Gustavsson)
Description[sk]=Predvolená téma KMail 5.2 (založená na Breeze Flat, autor Kristofer Rickheden Gustavsson)
Description[sl]=Privzeta tema za KMail 5.2 (Temelječa na ploski temi za Sapico, avtorja Kristoferja Rickhedena Gustavssona)
Description[sr]=К‑поштина подразумевана тема 5.2 (на основу Поветарца равног, аутор Кристофер Рикхеден Густавсон)
Description[sr@ijekavian]=К‑поштина подразумевана тема 5.2 (на основу Поветарца равног, аутор Кристофер Рикхеден Густавсон)
Description[sr@ijekavianlatin]=K‑poština podrazumevana tema 5.2 (na osnovu Povetarca ravnog, autor Kristofer Rikheden Gustavson)
Description[sr@latin]=K‑poština podrazumevana tema 5.2 (na osnovu Povetarca ravnog, autor Kristofer Rikheden Gustavson)
Description[sv]=Kmail 5.2 standardtema (baserat på Breeze flat med upphovsma Kristofer Rickheden Gustavsson)
Description[uk]=Типова тема KMail 5.2 (засновано на Breeze Flat, автором якої є Kristofer Rickheden Gustavsson)
Description[x-test]=xxKMail Default Theme 5.2 (Based on Breeze Flat author Kristofer Rickheden Gustavsson)xx
FileName=header.html
Name=KMail 5.2
Name[ast]=KMail 5.2
Name[ca]=KMail 5.2
Name[ca@valencia]=KMail 5.2
Name[cs]=KMail 5.2
Name[da]=KMail 5.2
Name[de]=KMail 5.2
Name[en_GB]=KMail 5.2
Name[es]=KMail 5.2
Name[et]=KMail 5.2
Name[fi]=KMail 5.2
Name[gl]=KMail 5.2
Name[it]=KMail 5.2
Name[nl]=KMail 5.2
Name[pl]=KMail 5.2
Name[pt]=KMail 5.2
Name[pt_BR]=KMail 5.2
Name[sk]=KMail 5.2
Name[sl]=KMail 5.2
Name[sr]=К‑пошта 5.2
Name[sr@ijekavian]=К‑пошта 5.2
Name[sr@ijekavianlatin]=K‑pošta 5.2
Name[sr@latin]=K‑pošta 5.2
Name[sv]=Kmail 5.2
Name[uk]=KMail 5.2
Name[x-test]=xxKMail 5.2xx
ThemeVersion=1
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48"
height="72"
id="svg3049"
version="1.1"
inkscape:version="0.91 r13725"
sodipodi:docname="photo.svg"
inkscape:export-filename="/home/uri/.kde/share/icons/NITRUX-KDE/16x16/actions/view-right-new.png"
inkscape:export-xdpi="30"
inkscape:export-ydpi="30">
<defs
id="defs3051" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="19.655546"
inkscape:cx="6.5434849"
inkscape:cy="43.289616"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="3200"
inkscape:window-height="1660"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:showpageshadow="false"
borderlayer="true"
showguides="true">
<sodipodi:guide
position="2.0000044,20.00003"
orientation="18,0"
id="guide4067" />
<sodipodi:guide
position="2.0000044,2.0000296"
orientation="0,18"
id="guide4069" />
<sodipodi:guide
position="46,19"
orientation="-18,0"
id="guide4071" />
<sodipodi:guide
position="38,70"
orientation="0,-18"
id="guide4073" />
<sodipodi:guide
position="3.0000044,19.00003"
orientation="16,0"
id="guide4077" />
<sodipodi:guide
position="3.0000044,3.0000296"
orientation="0,16"
id="guide4079" />
<sodipodi:guide
position="45,11"
orientation="-16,0"
id="guide4081" />
<sodipodi:guide
position="37,69"
orientation="0,-16"
id="guide4083" />
<inkscape:grid
type="xygrid"
id="grid4085" />
</sodipodi:namedview>
<metadata
id="metadata3054">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Capa 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-421.71429,-475.79074)">
<path
style="opacity:1;fill:#bdc3c7;fill-opacity:1;stroke:none"
d="m 445.67924,480.79074 c -6.648,0 -12,5.352 -12,12 0,6.648 5.352,12 12,12 6.648,0 12,-5.352 12,-12 0,-6.648 -5.352,-12 -12,-12 z m 0,32 c -11.08,0 -20,3.56792 -20,8 l 0,20 0,4 4.80468,0 30.39064,0 4.80468,0 0,-4 0,-20 c 0,-4.43208 -8.92,-8 -20,-8 z m 0,4 c 8.864,0 16,2.5452 16,5.71092 l 0,18.28908 -32,0 0,-18.28908 c 0,-3.16572 7.136,-5.71092 16,-5.71092 z"
id="rect4109"
inkscape:connector-curvature="0" />
</g>
</svg>
body {
margin: 0;
padding: 0;
}
div#headerbox {
border-radius: 3px;
border-bottom: 1px solid rgb(190, 190, 190);
color: rgb(100, 100, 100) !important;
overflow: auto;
padding: 5px 20px;
}
div#headerbox table.outer {
display: inline;
position: fixed !important;
top: -1px;
left: -1px;
bottom: -1px;
right: 0px;
border: none !important;
table-collapse: collapse;
}
div#headerbox div#subject {
color: rgb(100, 100, 100) !important;
font-size: 22px;
font-weight: normal;
line-height: 24px;
padding-bottom: 5px;
padding-top: 5px;
}
div#headerbox div#photo {
float: left;
margin: 5px;
}
div#headerbox div.table {
display: table;