summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-06-09 09:00:17 +0200
committerMontel Laurent <[email protected]>2017-06-09 09:00:17 +0200
commit79949843c261948211d8397d831df70792bc60f6 (patch)
tree3c92f82dbff694734dd4743527813e70ef201d92
parentc21489acf5a7804c4357e9b08ef37552c318b531 (diff)
Coding style
-rw-r--r--messageviewer/autotests/mailsourceviewtextbrowserwidgettest.cpp12
-rw-r--r--messageviewer/autotests/mailsourceviewtextbrowserwidgettest.h1
-rw-r--r--messageviewer/autotests/messagedisplayformatattributetest.cpp3
-rw-r--r--messageviewer/autotests/setupenv.cpp4
-rw-r--r--messageviewer/autotests/setupenv.h10
-rw-r--r--messageviewer/autotests/viewergrantleethemesupporttest.cpp4
-rw-r--r--messageviewer/autotests/viewertest.cpp55
-rw-r--r--messageviewer/autotests/zoomactionmenutest.cpp2
-rw-r--r--messageviewer/src/antispam/antispamconfig.cpp14
-rw-r--r--messageviewer/src/antispam/antispamconfig.h32
-rw-r--r--messageviewer/src/antispam/spamheaderanalyzer.cpp5
-rw-r--r--messageviewer/src/antispam/spamheaderanalyzer.h27
-rw-r--r--messageviewer/src/findbar/findbarsourceview.cpp4
-rw-r--r--messageviewer/src/findbar/findbarsourceview.h5
-rw-r--r--messageviewer/src/header/contactdisplaymessagememento.cpp42
-rw-r--r--messageviewer/src/header/contactdisplaymessagememento.h15
-rw-r--r--messageviewer/src/header/grantleeheaderformatter.cpp164
-rw-r--r--messageviewer/src/header/grantleeheaderformatter.h25
-rw-r--r--messageviewer/src/header/grantleeheaderstyle.cpp9
-rw-r--r--messageviewer/src/header/grantleeheaderstyle.h3
-rw-r--r--messageviewer/src/header/grantleeheaderteststyle.cpp9
-rw-r--r--messageviewer/src/header/grantleeheaderteststyle.h3
-rw-r--r--messageviewer/src/header/headerstrategy.cpp2
-rw-r--r--messageviewer/src/header/headerstrategy.h10
-rw-r--r--messageviewer/src/header/headerstyle.cpp17
-rw-r--r--messageviewer/src/header/headerstyle.h12
-rw-r--r--messageviewer/src/header/headerstyle_util.cpp202
-rw-r--r--messageviewer/src/header/headerstyle_util.h16
-rw-r--r--messageviewer/src/header/headerstyleinterface.cpp8
-rw-r--r--messageviewer/src/header/headerstyleinterface.h6
-rw-r--r--messageviewer/src/header/headerstylemenumanager.cpp53
-rw-r--r--messageviewer/src/header/headerstylemenumanager.h3
-rw-r--r--messageviewer/src/header/headerstyleplugin.cpp7
-rw-r--r--messageviewer/src/header/headerstyleplugin.h6
-rw-r--r--messageviewer/src/header/headerstylepluginmanager.cpp47
-rw-r--r--messageviewer/src/header/headerstylepluginmanager.h3
-rw-r--r--messageviewer/src/header/kxface.cpp141
-rw-r--r--messageviewer/src/header/kxface.h17
-rw-r--r--messageviewer/src/header/plainheaderstyle.cpp79
-rw-r--r--messageviewer/src/header/plainheaderstyle.h3
-rw-r--r--messageviewer/src/header/richheaderstrategy.cpp6
-rw-r--r--messageviewer/src/header/richheaderstrategy.h7
-rw-r--r--messageviewer/src/htmlwriter/autotests/webengineembedparttest.cpp2
-rw-r--r--messageviewer/src/htmlwriter/autotests/webengineparthtmlwritertest.cpp63
-rw-r--r--messageviewer/src/htmlwriter/teehtmlwriter.cpp9
-rw-r--r--messageviewer/src/htmlwriter/teehtmlwriter.h5
-rw-r--r--messageviewer/src/htmlwriter/webengineembedpart.cpp2
-rw-r--r--messageviewer/src/htmlwriter/webengineembedpart.h3
-rw-r--r--messageviewer/src/htmlwriter/webengineparthtmlwriter.cpp9
-rw-r--r--messageviewer/src/htmlwriter/webengineparthtmlwriter.h8
-rw-r--r--messageviewer/src/interfaces/bodyparturlhandler.h33
-rw-r--r--messageviewer/src/interfaces/urlhandler.h16
-rw-r--r--messageviewer/src/job/attachmenteditjob.cpp32
-rw-r--r--messageviewer/src/job/attachmenteditjob.h6
-rw-r--r--messageviewer/src/job/modifymessagedisplayformatjob.cpp16
-rw-r--r--messageviewer/src/job/modifymessagedisplayformatjob.h3
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/converthtmltoplaintexttest.cpp14
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/objecttreeparsertest.cpp55
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/quotehtmltest.cpp137
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp89
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/setupenv.cpp4
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/setupenv.h38
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/testcsshelper.cpp17
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/testcsshelper.h8
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.cpp115
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.h2
-rw-r--r--messageviewer/src/messagepartthemes/default/autotests/util.h63
-rw-r--r--messageviewer/src/messagepartthemes/default/converthtmltoplaintext.cpp2
-rw-r--r--messageviewer/src/messagepartthemes/default/converthtmltoplaintext.h3
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.cpp235
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer.h15
-rw-r--r--messageviewer/src/messagepartthemes/default/defaultrenderer_p.h21
-rw-r--r--messageviewer/src/messagepartthemes/default/htmlblock.cpp2
-rw-r--r--messageviewer/src/messagepartthemes/default/htmlblock.h7
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrendererbase.h14
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.cpp14
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.h5
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase_p.h6
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp22
-rw-r--r--messageviewer/src/messagepartthemes/default/messagepartrenderermanager.h7
-rw-r--r--messageviewer/src/messagepartthemes/default/partrendered.cpp79
-rw-r--r--messageviewer/src/messagepartthemes/default/partrendered.h22
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp17
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.h4
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.cpp9
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.h4
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/plugins.cpp3
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/quotehtml.cpp51
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/quotehtml.h14
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.cpp5
-rw-r--r--messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.h4
-rw-r--r--messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.cpp3
-rw-r--r--messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.h3
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.cpp2
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.h4
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.cpp25
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.h8
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.cpp25
-rw-r--r--messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.h9
-rw-r--r--messageviewer/src/scamdetection/autotests/scamattributetest.cpp2
-rw-r--r--messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp67
-rw-r--r--messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.h3
-rw-r--r--messageviewer/src/scamdetection/scamattribute.cpp3
-rw-r--r--messageviewer/src/scamdetection/scamattribute.h3
-rw-r--r--messageviewer/src/scamdetection/scamcheckshorturl.cpp9
-rw-r--r--messageviewer/src/scamdetection/scamcheckshorturl.h3
-rw-r--r--messageviewer/src/scamdetection/scamcheckshorturlmanager.cpp6
-rw-r--r--messageviewer/src/scamdetection/scamcheckshorturlmanager.h3
-rw-r--r--messageviewer/src/scamdetection/scamdetectiondetailsdialog.cpp11
-rw-r--r--messageviewer/src/scamdetection/scamdetectiondetailsdialog.h6
-rw-r--r--messageviewer/src/scamdetection/scamdetectionwarningwidget.cpp13
-rw-r--r--messageviewer/src/scamdetection/scamdetectionwarningwidget.h3
-rw-r--r--messageviewer/src/scamdetection/scamdetectionwebengine.cpp52
-rw-r--r--messageviewer/src/scamdetection/scamdetectionwebengine.h3
-rw-r--r--messageviewer/src/scamdetection/scamexpandurljob.cpp24
-rw-r--r--messageviewer/src/scamdetection/scamexpandurljob.h3
-rw-r--r--messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.cpp26
-rw-r--r--messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.h3
-rw-r--r--messageviewer/src/settings/messageviewersettings.cpp1
-rw-r--r--messageviewer/src/settings/messageviewersettings.h6
-rw-r--r--messageviewer/src/utils/iconnamecache.cpp7
-rw-r--r--messageviewer/src/utils/iconnamecache.h7
-rw-r--r--messageviewer/src/utils/markmessagereadhandler.cpp6
-rw-r--r--messageviewer/src/utils/markmessagereadhandler.h8
-rw-r--r--messageviewer/src/utils/messageviewerutil.cpp142
-rw-r--r--messageviewer/src/utils/messageviewerutil.h21
-rw-r--r--messageviewer/src/utils/messageviewerutil_p.h8
-rw-r--r--messageviewer/src/utils/mimetype.cpp17
-rw-r--r--messageviewer/src/utils/mimetype.h16
-rw-r--r--messageviewer/src/viewer/bodypartformatterfactory.cpp11
-rw-r--r--messageviewer/src/viewer/bodypartformatterfactory.h8
-rw-r--r--messageviewer/src/viewer/bodypartformatterfactorysingleton.cpp6
-rw-r--r--messageviewer/src/viewer/bodypartformatterfactorysingleton.h6
-rw-r--r--messageviewer/src/viewer/csshelper.cpp58
-rw-r--r--messageviewer/src/viewer/csshelper.h5
-rw-r--r--messageviewer/src/viewer/csshelperbase.cpp36
-rw-r--r--messageviewer/src/viewer/csshelperbase.h6
-rw-r--r--messageviewer/src/viewer/editorwatcher.cpp49
-rw-r--r--messageviewer/src/viewer/editorwatcher.h9
-rw-r--r--messageviewer/src/viewer/messagedisplayformatattribute.cpp9
-rw-r--r--messageviewer/src/viewer/messagedisplayformatattribute.h3
-rw-r--r--messageviewer/src/viewer/mimeparttree/mimeparttreeview.h3
-rw-r--r--messageviewer/src/viewer/mimeparttree/mimetreemodel.cpp29
-rw-r--r--messageviewer/src/viewer/mimeparttree/mimetreemodel.h14
-rw-r--r--messageviewer/src/viewer/objecttreeemptysource.cpp21
-rw-r--r--messageviewer/src/viewer/objecttreeemptysource.h11
-rw-r--r--messageviewer/src/viewer/objecttreeviewersource.cpp18
-rw-r--r--messageviewer/src/viewer/objecttreeviewersource.h14
-rw-r--r--messageviewer/src/viewer/pluginloader.h21
-rw-r--r--messageviewer/src/viewer/pluginloaderbase.cpp45
-rw-r--r--messageviewer/src/viewer/pluginloaderbase.h17
-rw-r--r--messageviewer/src/viewer/stl_util.h9
-rw-r--r--messageviewer/src/viewer/urlhandlermanager.cpp288
-rw-r--r--messageviewer/src/viewer/urlhandlermanager.h17
-rw-r--r--messageviewer/src/viewer/viewer.cpp19
-rw-r--r--messageviewer/src/viewer/viewer.h41
-rw-r--r--messageviewer/src/viewer/viewer_p.cpp705
-rw-r--r--messageviewer/src/viewer/viewer_p.h49
-rw-r--r--messageviewer/src/viewer/webengine/autotests/mailwebenginescripttest.cpp14
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp37
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h6
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.cpp11
-rw-r--r--messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.h6
-rw-r--r--messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp4
-rw-r--r--messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.h3
-rw-r--r--messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp11
-rw-r--r--messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h6
-rw-r--r--messageviewer/src/viewer/webengine/mailwebenginepage.cpp5
-rw-r--r--messageviewer/src/viewer/webengine/mailwebenginepage.h3
-rw-r--r--messageviewer/src/viewer/webengine/mailwebenginescript.cpp38
-rw-r--r--messageviewer/src/viewer/webengine/mailwebenginescript.h6
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.cpp65
-rw-r--r--messageviewer/src/viewer/webengine/mailwebengineview.h6
-rw-r--r--messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.cpp7
-rw-r--r--messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.h3
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmaildndattachment.cpp6
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmailmboxwebengine.cpp4
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmailwebengine.cpp15
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmailwebengine.h3
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmailwebengineselection.cpp18
-rw-r--r--messageviewer/src/viewer/webengine/tests/testmailwebengineselection.h3
-rw-r--r--messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.cpp6
-rw-r--r--messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.h3
-rw-r--r--messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.cpp4
-rw-r--r--messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.h3
-rw-r--r--messageviewer/src/viewerplugins/tests/viewerplugin_gui.cpp17
-rw-r--r--messageviewer/src/viewerplugins/tests/viewerplugin_gui.h3
-rw-r--r--messageviewer/src/viewerplugins/viewerplugin.cpp8
-rw-r--r--messageviewer/src/viewerplugins/viewerplugin.h6
-rw-r--r--messageviewer/src/viewerplugins/viewerplugininterface.cpp6
-rw-r--r--messageviewer/src/viewerplugins/viewerplugininterface.h3
-rw-r--r--messageviewer/src/viewerplugins/viewerpluginmanager.cpp37
-rw-r--r--messageviewer/src/viewerplugins/viewerpluginmanager.h3
-rw-r--r--messageviewer/src/viewerplugins/viewerplugintoolmanager.cpp31
-rw-r--r--messageviewer/src/viewerplugins/viewerplugintoolmanager.h6
-rw-r--r--messageviewer/src/widgets/attachmentdialog.cpp10
-rw-r--r--messageviewer/src/widgets/attachmentdialog.h9
-rw-r--r--messageviewer/src/widgets/configurewidget.cpp24
-rw-r--r--messageviewer/src/widgets/configurewidget.h5
-rw-r--r--messageviewer/src/widgets/htmlstatusbar.cpp9
-rw-r--r--messageviewer/src/widgets/htmlstatusbar.h5
-rw-r--r--messageviewer/src/widgets/invitationsettings.cpp89
-rw-r--r--messageviewer/src/widgets/invitationsettings.h6
-rw-r--r--messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp33
-rw-r--r--messageviewer/src/widgets/mailsourceviewtextbrowserwidget.h13
-rw-r--r--messageviewer/src/widgets/mailsourcewebengineviewer.cpp19
-rw-r--r--messageviewer/src/widgets/mailsourcewebengineviewer.h4
-rw-r--r--messageviewer/src/widgets/openattachmentfolderwidget.cpp7
-rw-r--r--messageviewer/src/widgets/openattachmentfolderwidget.h3
-rw-r--r--messageviewer/src/widgets/printingsettings.cpp42
-rw-r--r--messageviewer/src/widgets/printingsettings.h3
-rw-r--r--messageviewer/src/widgets/submittedformwarningwidget.h3
-rw-r--r--messageviewer/src/widgets/vcardviewer.cpp5
-rw-r--r--messageviewer/src/widgets/vcardviewer.h9
-rw-r--r--messageviewer/tests/viewertest_gui.cpp17
215 files changed, 3100 insertions, 2126 deletions
diff --git a/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.cpp b/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.cpp
index 8c512a7..4e1c356 100644
--- a/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.cpp
+++ b/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.cpp
@@ -24,29 +24,29 @@
MailSourceViewTextBrowserWidgetTest::MailSourceViewTextBrowserWidgetTest(QObject *parent)
: QObject(parent)
{
-
}
MailSourceViewTextBrowserWidgetTest::~MailSourceViewTextBrowserWidgetTest()
{
-
}
void MailSourceViewTextBrowserWidgetTest::shouldHaveDefaultValue()
{
MessageViewer::MailSourceViewTextBrowserWidget widget(QStringLiteral("Email"));
- MessageViewer::MailSourceViewTextBrowser *textbrowser = widget.findChild<MessageViewer::MailSourceViewTextBrowser *>(QStringLiteral("textbrowser"));
+ MessageViewer::MailSourceViewTextBrowser *textbrowser
+ = widget.findChild<MessageViewer::MailSourceViewTextBrowser *>(QStringLiteral("textbrowser"));
QVERIFY(textbrowser);
QVERIFY(!textbrowser->isHidden());
- MessageViewer::FindBarSourceView *findbar = widget.findChild<MessageViewer::FindBarSourceView *>(QStringLiteral("findbar"));
+ MessageViewer::FindBarSourceView *findbar
+ = widget.findChild<MessageViewer::FindBarSourceView *>(QStringLiteral("findbar"));
QVERIFY(findbar);
QVERIFY(findbar->isHidden());
- KPIMTextEdit::TextToSpeechWidget *texttospeechwidget = widget.findChild<KPIMTextEdit::TextToSpeechWidget *>(QStringLiteral("texttospeech"));
+ KPIMTextEdit::TextToSpeechWidget *texttospeechwidget
+ = widget.findChild<KPIMTextEdit::TextToSpeechWidget *>(QStringLiteral("texttospeech"));
QVERIFY(texttospeechwidget);
QVERIFY(texttospeechwidget->isHidden());
-
}
QTEST_MAIN(MailSourceViewTextBrowserWidgetTest)
diff --git a/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.h b/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.h
index 7d453c5..b328c18 100644
--- a/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.h
+++ b/messageviewer/autotests/mailsourceviewtextbrowserwidgettest.h
@@ -31,4 +31,3 @@ private Q_SLOTS:
};
#endif // MAILSOURCEVIEWTEXTBROWSERWIDGETTEST_H
-
diff --git a/messageviewer/autotests/messagedisplayformatattributetest.cpp b/messageviewer/autotests/messagedisplayformatattributetest.cpp
index 747a9f6..584e3fe 100644
--- a/messageviewer/autotests/messagedisplayformatattributetest.cpp
+++ b/messageviewer/autotests/messagedisplayformatattributetest.cpp
@@ -25,12 +25,10 @@
MessageDisplayFormatAttributeTest::MessageDisplayFormatAttributeTest(QObject *parent)
: QObject(parent)
{
-
}
MessageDisplayFormatAttributeTest::~MessageDisplayFormatAttributeTest()
{
-
}
void MessageDisplayFormatAttributeTest::shouldHaveDefaultValue()
@@ -61,7 +59,6 @@ void MessageDisplayFormatAttributeTest::shouldChangeMessageFormat()
format = MessageViewer::Viewer::UseGlobalSetting;
attr.setMessageFormat(format);
QCOMPARE(attr.messageFormat(), format);
-
}
void MessageDisplayFormatAttributeTest::shouldDeserializeValue()
diff --git a/messageviewer/autotests/setupenv.cpp b/messageviewer/autotests/setupenv.cpp
index 756dfc6..ba8e05c 100644
--- a/messageviewer/autotests/setupenv.cpp
+++ b/messageviewer/autotests/setupenv.cpp
@@ -28,7 +28,7 @@
void MessageViewer::Test::setupEnv()
{
setenv("LC_ALL", "C", 1);
- setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")).constData(), 1);
+ setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1(
+ "/.qttest")).constData(), 1);
QStandardPaths::setTestModeEnabled(true);
}
-
diff --git a/messageviewer/autotests/setupenv.h b/messageviewer/autotests/setupenv.h
index 42cdbc7..d57728f 100644
--- a/messageviewer/autotests/setupenv.h
+++ b/messageviewer/autotests/setupenv.h
@@ -25,21 +25,15 @@
#include <viewer/objecttreeemptysource.h>
#include <viewer/attachmentstrategy.h>
-namespace MessageViewer
-{
-
-namespace Test
-{
-
+namespace MessageViewer {
+namespace Test {
/**
* setup a environment variables for tests:
* * set LC_ALL to C
* * set KDEHOME
*/
void setupEnv();
-
}
-
}
#endif
diff --git a/messageviewer/autotests/viewergrantleethemesupporttest.cpp b/messageviewer/autotests/viewergrantleethemesupporttest.cpp
index 42b31ac..04e0288 100644
--- a/messageviewer/autotests/viewergrantleethemesupporttest.cpp
+++ b/messageviewer/autotests/viewergrantleethemesupporttest.cpp
@@ -31,7 +31,6 @@ ViewerGrantleeThemeSupportTest::ViewerGrantleeThemeSupportTest(QObject *parent)
ViewerGrantleeThemeSupportTest::~ViewerGrantleeThemeSupportTest()
{
-
}
void ViewerGrantleeThemeSupportTest::initTestCase()
@@ -46,7 +45,8 @@ void ViewerGrantleeThemeSupportTest::initTestCase()
void ViewerGrantleeThemeSupportTest::shouldUpdateThemeMenu()
{
- MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(this));
+ MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(
+ this));
viewer->show();
QTest::qWaitForWindowExposed(viewer);
}
diff --git a/messageviewer/autotests/viewertest.cpp b/messageviewer/autotests/viewertest.cpp
index 928a6fd..1e947e8 100644
--- a/messageviewer/autotests/viewertest.cpp
+++ b/messageviewer/autotests/viewertest.cpp
@@ -27,7 +27,8 @@ ViewerTest::ViewerTest()
void ViewerTest::shouldHaveDefaultValuesOnCreation()
{
- MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(this));
+ MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(
+ this));
viewer->show();
QTest::qWaitForWindowExposed(viewer);
@@ -42,11 +43,13 @@ void ViewerTest::shouldHaveDefaultValuesOnCreation()
QWidget *colorBar = viewer->findChild<QWidget *>(QStringLiteral("mColorBar"));
QVERIFY(colorBar);
- QWidget *scandetectionWidget = viewer->findChild<QWidget *>(QStringLiteral("scandetectionwarning"));
+ QWidget *scandetectionWidget
+ = viewer->findChild<QWidget *>(QStringLiteral("scandetectionwarning"));
QVERIFY(scandetectionWidget);
QCOMPARE(scandetectionWidget->isVisible(), false);
- QWidget *openattachementfolderwidget = viewer->findChild<QWidget *>(QStringLiteral("openattachementfolderwidget"));
+ QWidget *openattachementfolderwidget
+ = viewer->findChild<QWidget *>(QStringLiteral("openattachementfolderwidget"));
QVERIFY(openattachementfolderwidget);
QCOMPARE(openattachementfolderwidget->isVisible(), false);
@@ -70,29 +73,29 @@ void ViewerTest::shouldHaveDefaultValuesOnCreation()
delete viewer;
}
-static const char s_mail1[] =
- "From: Konqui <[email protected]>\n"
- "To: Friends <[email protected]>\n"
- "Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST)\n"
- "Subject: Sample message\n"
- "MIME-Version: 1.0\n"
- "Content-type: text/plain; charset=us-ascii\n"
- "\n"
- "\n"
- "This is a test message.\n"
- "\n";
-
-static const char s_mail2[] =
- "From: David Faure <[email protected]>\n"
- "To: Friends <[email protected]>\n"
- "Date: Sun, 31 Aug 2016 23:56:48 +0200 (CEST)\n"
- "Subject: Second mail\n"
- "MIME-Version: 1.0\n"
- "Content-type: text/plain; charset=\"us-ascii\"\n"
- "\n"
- "\n"
- "This is the second message.\n"
- "\n";
+static const char s_mail1[]
+ = "From: Konqui <[email protected]>\n"
+ "To: Friends <[email protected]>\n"
+ "Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST)\n"
+ "Subject: Sample message\n"
+ "MIME-Version: 1.0\n"
+ "Content-type: text/plain; charset=us-ascii\n"
+ "\n"
+ "\n"
+ "This is a test message.\n"
+ "\n";
+
+static const char s_mail2[]
+ = "From: David Faure <[email protected]>\n"
+ "To: Friends <[email protected]>\n"
+ "Date: Sun, 31 Aug 2016 23:56:48 +0200 (CEST)\n"
+ "Subject: Second mail\n"
+ "MIME-Version: 1.0\n"
+ "Content-type: text/plain; charset=\"us-ascii\"\n"
+ "\n"
+ "\n"
+ "This is the second message.\n"
+ "\n";
KMime::Message::Ptr createMsg(const char *data)
{
diff --git a/messageviewer/autotests/zoomactionmenutest.cpp b/messageviewer/autotests/zoomactionmenutest.cpp
index eb96bd6..43baa62 100644
--- a/messageviewer/autotests/zoomactionmenutest.cpp
+++ b/messageviewer/autotests/zoomactionmenutest.cpp
@@ -23,12 +23,10 @@
ZoomActionMenuTest::ZoomActionMenuTest(QObject *parent)
: QObject(parent)
{
-
}
ZoomActionMenuTest::~ZoomActionMenuTest()
{
-
}
void ZoomActionMenuTest::shouldHaveDefaultValue()
diff --git a/messageviewer/src/antispam/antispamconfig.cpp b/messageviewer/src/antispam/antispamconfig.cpp
index 10a2a7b..46941ec 100644
--- a/messageviewer/src/antispam/antispamconfig.cpp
+++ b/messageviewer/src/antispam/antispamconfig.cpp
@@ -79,13 +79,13 @@ void AntiSpamConfig::readConfig()
for (unsigned int i = 1; i <= totalTools; ++i) {
KConfigGroup tool(&config, QStringLiteral("Spamtool #%1").arg(i));
if (tool.hasKey("ScoreHeader")) {
- const QString name = tool.readEntry("ScoreName");
- const QByteArray header = tool.readEntry("ScoreHeader").toLatin1();
- const QByteArray cheader = tool.readEntry("ConfidenceHeader").toLatin1();
- const QByteArray type = tool.readEntry("ScoreType").toLatin1();
- const QString score = tool.readEntryUntranslated("ScoreValueRegexp");
- const QString threshold = tool.readEntryUntranslated("ScoreThresholdRegexp");
- const QString confidence = tool.readEntryUntranslated("ScoreConfidenceRegexp");
+ const QString name = tool.readEntry("ScoreName");
+ const QByteArray header = tool.readEntry("ScoreHeader").toLatin1();
+ const QByteArray cheader = tool.readEntry("ConfidenceHeader").toLatin1();
+ const QByteArray type = tool.readEntry("ScoreType").toLatin1();
+ const QString score = tool.readEntryUntranslated("ScoreValueRegexp");
+ const QString threshold = tool.readEntryUntranslated("ScoreThresholdRegexp");
+ const QString confidence = tool.readEntryUntranslated("ScoreConfidenceRegexp");
SpamAgentTypes typeE = SpamAgentNone;
if (qstricmp(type.data(), "bool") == 0) {
typeE = SpamAgentBool;
diff --git a/messageviewer/src/antispam/antispamconfig.h b/messageviewer/src/antispam/antispamconfig.h
index 04da40e..25ae4eb 100644
--- a/messageviewer/src/antispam/antispamconfig.h
+++ b/messageviewer/src/antispam/antispamconfig.h
@@ -40,9 +40,7 @@
class QString;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/// Valid types of SpamAgent
enum SpamAgentTypes {
SpamAgentNone, //!< Invalid SpamAgent, skip this agent
@@ -55,36 +53,53 @@ enum SpamAgentTypes {
class SpamAgent
{
public:
- SpamAgent() : mType(SpamAgentNone) {}
- SpamAgent(const QString &name, SpamAgentTypes type, const QByteArray &field, const QByteArray &cfield,
- const QRegExp &score, const QRegExp &threshold, const QRegExp &confidence)
- : mName(name), mType(type), mField(field), mConfidenceField(cfield),
- mScore(score), mThreshold(threshold), mConfidence(confidence) {}
+ SpamAgent() : mType(SpamAgentNone)
+ {
+ }
+
+ SpamAgent(const QString &name, SpamAgentTypes type, const QByteArray &field,
+ const QByteArray &cfield, const QRegExp &score, const QRegExp &threshold,
+ const QRegExp &confidence)
+ : mName(name)
+ , mType(type)
+ , mField(field)
+ , mConfidenceField(cfield)
+ , mScore(score)
+ , mThreshold(threshold)
+ , mConfidence(confidence)
+ {
+ }
QString name() const
{
return mName;
}
+
SpamAgentTypes scoreType() const
{
return mType;
}
+
QByteArray header() const
{
return mField;
}
+
QByteArray confidenceHeader() const
{
return mConfidenceField;
}
+
QRegExp scorePattern() const
{
return mScore;
}
+
QRegExp thresholdPattern() const
{
return mThreshold;
}
+
QRegExp confidencePattern() const
{
return mConfidence;
@@ -141,7 +156,6 @@ private:
void readConfig();
};
-
}
#endif // __MESSAGEVIEWER_ANTISPAMCONFIG_H__
diff --git a/messageviewer/src/antispam/spamheaderanalyzer.cpp b/messageviewer/src/antispam/spamheaderanalyzer.cpp
index 49b6cc1..0400eaf 100644
--- a/messageviewer/src/antispam/spamheaderanalyzer.cpp
+++ b/messageviewer/src/antispam/spamheaderanalyzer.cpp
@@ -170,7 +170,7 @@ SpamScores SpamHeaderAnalyzer::getSpamScores(KMime::Message *message)
KMime::Headers::Base *cHeader = message->headerByType(confidenceHeaderName.constData());
if (cHeader) {
mCField = cHeader->asUnicodeString();
- if (! mCField.isEmpty()) {
+ if (!mCField.isEmpty()) {
// Can we extract the confidence?
QRegExp cScorePattern = (*it).confidencePattern();
if (cScorePattern.indexIn(mCField) != -1) {
@@ -179,7 +179,8 @@ SpamScores SpamHeaderAnalyzer::getSpamScores(KMime::Message *message)
confidence = confidenceString.toFloat(&confidenceValid);
if (!confidenceValid) {
spamError = couldNotConvertConfidenceToFloat;
- qCDebug(MESSAGEVIEWER_LOG) << "Unable to convert confidence to float:" << confidenceString;
+ qCDebug(MESSAGEVIEWER_LOG) << "Unable to convert confidence to float:"
+ << confidenceString;
}
}
}
diff --git a/messageviewer/src/antispam/spamheaderanalyzer.h b/messageviewer/src/antispam/spamheaderanalyzer.h
index 480dfce..21564af 100644
--- a/messageviewer/src/antispam/spamheaderanalyzer.h
+++ b/messageviewer/src/antispam/spamheaderanalyzer.h
@@ -39,9 +39,7 @@
#include <QString>
#include <QVector>
-namespace MessageViewer
-{
-
+namespace MessageViewer {
enum SpamError {
noError,
uninitializedStructUsed,
@@ -72,40 +70,48 @@ class SpamScore
public:
SpamScore()
- : mError(noError), mScore(-2.0), mConfidence(-2.0)
+ : mError(noError)
+ , mScore(-2.0)
+ , mConfidence(-2.0)
{
}
SpamScore(const QString &agent, SpamError error, float score, float confidence,
const QString &header, const QString &cheader)
- : mAgent(agent),
- mError(error),
- mScore(score),
- mConfidence(confidence),
- mHeader(header),
- mConfidenceHeader(cheader)
+ : mAgent(agent)
+ , mError(error)
+ , mScore(score)
+ , mConfidence(confidence)
+ , mHeader(header)
+ , mConfidenceHeader(cheader)
{
}
+
QString agent() const
{
return mAgent;
}
+
float score() const
{
return mScore;
}
+
float confidence() const
{
return mConfidence;
}
+
SpamError error() const
{
return mError;
}
+
QString spamHeader() const
{
return mHeader;
}
+
QString confidenceHeader() const
{
return mConfidenceHeader;
@@ -135,7 +141,6 @@ public:
*/
static SpamScores getSpamScores(KMime::Message *message);
};
-
}
#endif // __SPAMHEADERANALYZER_H__
diff --git a/messageviewer/src/findbar/findbarsourceview.cpp b/messageviewer/src/findbar/findbarsourceview.cpp
index f83b747..b47be93 100644
--- a/messageviewer/src/findbar/findbarsourceview.cpp
+++ b/messageviewer/src/findbar/findbarsourceview.cpp
@@ -24,7 +24,8 @@
using namespace MessageViewer;
FindBarSourceView::FindBarSourceView(QPlainTextEdit *view, QWidget *parent)
- : WebEngineViewer::FindBarBase(parent), mView(view)
+ : WebEngineViewer::FindBarBase(parent)
+ , mView(view)
{
}
@@ -80,4 +81,3 @@ void FindBarSourceView::updateSensitivity(bool)
const bool found = mView->find(mLastSearchStr, searchOptions);
setFoundMatch(found);
}
-
diff --git a/messageviewer/src/findbar/findbarsourceview.h b/messageviewer/src/findbar/findbarsourceview.h
index 0a912a5..ef56bc7 100644
--- a/messageviewer/src/findbar/findbarsourceview.h
+++ b/messageviewer/src/findbar/findbarsourceview.h
@@ -23,8 +23,7 @@
class QPlainTextEdit;
-namespace MessageViewer
-{
+namespace MessageViewer {
class FindBarSourceView : public WebEngineViewer::FindBarBase
{
Q_OBJECT
@@ -38,6 +37,7 @@ private:
{
Q_UNUSED(parent);
}
+
void clearSelections() override;
void searchText(bool backward, bool isAutoSearch) override;
void updateHighLight(bool) override;
@@ -49,4 +49,3 @@ private:
}
#endif /* FINDBARSOURCEVIEW_H */
-
diff --git a/messageviewer/src/header/contactdisplaymessagememento.cpp b/messageviewer/src/header/contactdisplaymessagememento.cpp
index 743b756..aadb882 100644
--- a/messageviewer/src/header/contactdisplaymessagememento.cpp
+++ b/messageviewer/src/header/contactdisplaymessagememento.cpp
@@ -29,17 +29,20 @@
using namespace MessageViewer;
ContactDisplayMessageMemento::ContactDisplayMessageMemento(const QString &emailAddress)
- : QObject(nullptr),
- mForceDisplayTo(Viewer::UseGlobalSetting),
- mEmailAddress(emailAddress),
- mFinished(false),
- mMailAllowToRemoteContent(false),
- mSearchJob(nullptr)
+ : QObject(nullptr)
+ , mForceDisplayTo(Viewer::UseGlobalSetting)
+ , mEmailAddress(emailAddress)
+ , mFinished(false)
+ , mMailAllowToRemoteContent(false)
+ , mSearchJob(nullptr)
{
if (!emailAddress.isEmpty()) {
mSearchJob = new Akonadi::ContactSearchJob();
- mSearchJob->setQuery(Akonadi::ContactSearchJob::Email, emailAddress.toLower(), Akonadi::ContactSearchJob::ExactMatch);
- connect(mSearchJob.data(), &Akonadi::ContactSearchJob::result, this, &ContactDisplayMessageMemento::slotSearchJobFinished);
+ mSearchJob->setQuery(Akonadi::ContactSearchJob::Email,
+ emailAddress.toLower(), Akonadi::ContactSearchJob::ExactMatch);
+ connect(
+ mSearchJob.data(), &Akonadi::ContactSearchJob::result, this,
+ &ContactDisplayMessageMemento::slotSearchJobFinished);
} else {
mFinished = true;
}
@@ -48,7 +51,9 @@ ContactDisplayMessageMemento::ContactDisplayMessageMemento(const QString &emailA
ContactDisplayMessageMemento::~ContactDisplayMessageMemento()
{
if (mSearchJob) {
- disconnect(mSearchJob.data(), &Akonadi::ContactSearchJob::result, this, &ContactDisplayMessageMemento::slotSearchJobFinished);
+ disconnect(
+ mSearchJob.data(), &Akonadi::ContactSearchJob::result, this,
+ &ContactDisplayMessageMemento::slotSearchJobFinished);
mSearchJob->kill();
}
}
@@ -89,7 +94,7 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
QByteArray imageData;
KIO::TransferJob *job = KIO::get(url, KIO::NoReload);
QObject::connect(job, &KIO::TransferJob::data,
- [&imageData](KIO::Job *, const QByteArray & data) {
+ [&imageData](KIO::Job *, const QByteArray &data) {
imageData.append(data);
});
if (job->exec()) {
@@ -111,12 +116,14 @@ void ContactDisplayMessageMemento::slotSearchJobFinished(KJob *job)
if (Gravatar::GravatarSettings::self()->gravatarSupportEnabled()) {
Gravatar::GravatarResolvUrlJob *job = new Gravatar::GravatarResolvUrlJob(this);
job->setEmail(mEmailAddress);
- job->setUseDefaultPixmap(Gravatar::GravatarSettings::self()->gravatarUseDefaultImage());
+ job->setUseDefaultPixmap(
+ Gravatar::GravatarSettings::self()->gravatarUseDefaultImage());
job->setUseLibravatar(Gravatar::GravatarSettings::self()->libravatarSupportEnabled());
job->setFallbackGravatar(Gravatar::GravatarSettings::self()->fallbackToGravatar());
job->setUseHttps(true);
if (job->canStart()) {
- connect(job, &Gravatar::GravatarResolvUrlJob::finished, this, &ContactDisplayMessageMemento::slotGravatarResolvUrlFinished);
+ connect(job, &Gravatar::GravatarResolvUrlJob::finished, this,
+ &ContactDisplayMessageMemento::slotGravatarResolvUrlFinished);
job->start();
} else {
job->deleteLater();
@@ -134,7 +141,8 @@ bool ContactDisplayMessageMemento::finished() const
void ContactDisplayMessageMemento::detach()
{
disconnect(this, SIGNAL(update(MimeTreeParser::UpdateMode)), nullptr, nullptr);
- disconnect(this, SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)), nullptr, nullptr);
+ disconnect(this, SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)), nullptr,
+ nullptr);
}
bool ContactDisplayMessageMemento::allowToRemoteContent() const
@@ -170,7 +178,9 @@ void ContactDisplayMessageMemento::processAddress(const KContacts::Addressee &ad
const QStringList customs = addressee.customs();
for (const QString &custom : customs) {
if (custom.contains(QStringLiteral("MailPreferedFormatting"))) {
- const QString value = addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("MailPreferedFormatting"));
+ const QString value
+ = addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral(
+ "MailPreferedFormatting"));
if (value == QLatin1String("TEXT")) {
mForceDisplayTo = Viewer::Text;
} else if (value == QLatin1String("HTML")) {
@@ -179,7 +189,9 @@ void ContactDisplayMessageMemento::processAddress(const KContacts::Addressee &ad
mForceDisplayTo = Viewer::UseGlobalSetting;
}
} else if (custom.contains(QStringLiteral("MailAllowToRemoteContent"))) {
- const QString value = addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("MailAllowToRemoteContent"));
+ const QString value
+ = addressee.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral(
+ "MailAllowToRemoteContent"));
mMailAllowToRemoteContent = (value == QLatin1String("TRUE"));
}
}
diff --git a/messageviewer/src/header/contactdisplaymessagememento.h b/messageviewer/src/header/contactdisplaymessagememento.h
index 48ca1bc..67ebc36 100644
--- a/messageviewer/src/header/contactdisplaymessagememento.h
+++ b/messageviewer/src/header/contactdisplaymessagememento.h
@@ -29,19 +29,16 @@
#include <QPointer>
class KJob;
-namespace Gravatar
-{
+namespace Gravatar {
class GravatarResolvUrlJob;
}
-namespace Akonadi
-{
+namespace Akonadi {
class ContactSearchJob;
}
-namespace MessageViewer
-{
-
-class ContactDisplayMessageMemento : public QObject, public MimeTreeParser::Interface::BodyPartMemento
+namespace MessageViewer {
+class ContactDisplayMessageMemento : public QObject,
+ public MimeTreeParser::Interface::BodyPartMemento
{
Q_OBJECT
public:
@@ -79,8 +76,6 @@ private:
bool mMailAllowToRemoteContent;
QPointer<Akonadi::ContactSearchJob> mSearchJob;
};
-
}
#endif /* CONTACTDISPLAYMESSAGE_H */
-
diff --git a/messageviewer/src/header/grantleeheaderformatter.cpp b/messageviewer/src/header/grantleeheaderformatter.cpp
index 98bc2dc..5dada62 100644
--- a/messageviewer/src/header/grantleeheaderformatter.cpp
+++ b/messageviewer/src/header/grantleeheaderformatter.cpp
@@ -24,7 +24,6 @@
#include "utils/iconnamecache.h"
#include "config-messageviewer.h"
-
#include <MessageCore/StringUtil>
#include <kmime/kmime_message.h>
@@ -48,9 +47,11 @@ public:
{
iconSize = KIconLoader::global()->currentSize(KIconLoader::Toolbar);
engine = new Grantlee::Engine;
- templateLoader = QSharedPointer<Grantlee::FileSystemTemplateLoader>(new Grantlee::FileSystemTemplateLoader);
+ templateLoader = QSharedPointer<Grantlee::FileSystemTemplateLoader>(
+ new Grantlee::FileSystemTemplateLoader);
engine->addTemplateLoader(templateLoader);
}
+
~Private()
{
delete engine;
@@ -72,7 +73,8 @@ GrantleeHeaderFormatter::~GrantleeHeaderFormatter()
delete d;
}
-QString GrantleeHeaderFormatter::toHtml(const GrantleeHeaderFormatter::GrantleeHeaderFormatterSettings &settings) const
+QString GrantleeHeaderFormatter::toHtml(
+ const GrantleeHeaderFormatter::GrantleeHeaderFormatterSettings &settings) const
{
QString errorMessage;
if (!settings.theme.isValid()) {
@@ -85,10 +87,16 @@ QString GrantleeHeaderFormatter::toHtml(const GrantleeHeaderFormatter::GrantleeH
errorMessage = headerTemplate->errorString();
return errorMessage;
}
- return format(settings.theme.absolutePath(), headerTemplate, settings.theme.displayExtraVariables(), settings.isPrinting, settings.style, settings.message, settings.showMailAction);
+ return format(
+ settings.theme.absolutePath(), headerTemplate,
+ settings.theme.displayExtraVariables(), settings.isPrinting, settings.style, settings.message,
+ settings.showMailAction);
}
-QString GrantleeHeaderFormatter::toHtml(const QStringList &displayExtraHeaders, const QString &absolutPath, const QString &filename, const MessageViewer::HeaderStyle *style, KMime::Message *message, bool isPrinting) const
+QString GrantleeHeaderFormatter::toHtml(const QStringList &displayExtraHeaders,
+ const QString &absolutPath, const QString &filename,
+ const MessageViewer::HeaderStyle *style,
+ KMime::Message *message, bool isPrinting) const
{
d->templateLoader->setTemplateDirs(QStringList() << absolutPath);
Grantlee::Template headerTemplate = d->engine->loadByName(filename);
@@ -98,7 +106,11 @@ QString GrantleeHeaderFormatter::toHtml(const QStringList &displayExtraHeaders,
return format(absolutPath, headerTemplate, displayExtraHeaders, isPrinting, style, message);
}
-QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grantlee::Template &headerTemplate, const QStringList &displayExtraHeaders, bool isPrinting, const MessageViewer::HeaderStyle *style, KMime::Message *message, bool showMailAction) const
+QString GrantleeHeaderFormatter::format(const QString &absolutePath,
+ const Grantlee::Template &headerTemplate,
+ const QStringList &displayExtraHeaders, bool isPrinting,
+ const MessageViewer::HeaderStyle *style,
+ KMime::Message *message, bool showMailAction) const
{
QVariantHash headerObject;
@@ -110,58 +122,85 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
const QString absoluteThemePath = QUrl::fromLocalFile(absolutePath + QLatin1Char('/')).url();
headerObject.insert(QStringLiteral("absoluteThemePath"), absoluteThemePath);
headerObject.insert(QStringLiteral("showMailAction"), showMailAction);
- headerObject.insert(QStringLiteral("applicationDir"), QApplication::isRightToLeft() ? QStringLiteral("rtl") : QStringLiteral("ltr"));
- headerObject.insert(QStringLiteral("subjectDir"), d->headerStyleUtil.subjectDirectionString(message));
+ headerObject.insert(QStringLiteral("applicationDir"),
+ QApplication::isRightToLeft() ? QStringLiteral("rtl") : QStringLiteral(
+ "ltr"));
+ headerObject.insert(QStringLiteral("subjectDir"),
+ d->headerStyleUtil.subjectDirectionString(message));
headerObject.insert(QStringLiteral("subjecti18n"), i18n("Subject:"));
const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces | KTextToHTML::ReplaceSmileys;
- headerObject.insert(QStringLiteral("subject"), d->headerStyleUtil.subjectString(message, flags));
+ headerObject.insert(QStringLiteral("subject"),
+ d->headerStyleUtil.subjectString(message, flags));
if (message->to(false)) {
headerObject.insert(QStringLiteral("toi18n"), i18n("To:"));
- headerObject.insert(QStringLiteral("to"), StringUtil::emailAddrAsAnchor(message->to(), StringUtil::DisplayFullAddress));
- headerObject.insert(QStringLiteral("toNameOnly"), StringUtil::emailAddrAsAnchor(message->to(), StringUtil::DisplayNameOnly));
+ headerObject.insert(QStringLiteral("to"),
+ StringUtil::emailAddrAsAnchor(message->to(),
+ StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("toNameOnly"),
+ StringUtil::emailAddrAsAnchor(
+ message->to(), StringUtil::DisplayNameOnly));
headerObject.insert(QStringLiteral("toStr"), message->to()->asUnicodeString());
- const QString val = MessageCore::StringUtil::emailAddrAsAnchor(message->to(), MessageCore::StringUtil::DisplayFullAddress,
- QString(), MessageCore::StringUtil::ShowLink,
- MessageCore::StringUtil::ExpandableAddresses, QStringLiteral("FullToAddressList"));
+ const QString val = MessageCore::StringUtil::emailAddrAsAnchor(
+ message->to(), MessageCore::StringUtil::DisplayFullAddress,
+ QString(), MessageCore::StringUtil::ShowLink,
+ MessageCore::StringUtil::ExpandableAddresses,
+ QStringLiteral("FullToAddressList"));
headerObject.insert(QStringLiteral("toExpandable"), val);
headerObject.insert(QStringLiteral("toMailbox"), QVariant::fromValue(message->to()));
}
if (message->replyTo(false)) {
headerObject.insert(QStringLiteral("replyToi18n"), i18n("Reply to:"));
- headerObject.insert(QStringLiteral("replyTo"), StringUtil::emailAddrAsAnchor(message->replyTo(), StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("replyTo"),
+ StringUtil::emailAddrAsAnchor(message->replyTo(),
+ StringUtil::DisplayFullAddress));
headerObject.insert(QStringLiteral("replyToStr"), message->replyTo()->asUnicodeString());
- headerObject.insert(QStringLiteral("replyToNameOnly"), StringUtil::emailAddrAsAnchor(message->replyTo(), StringUtil::DisplayNameOnly));
+ headerObject.insert(QStringLiteral("replyToNameOnly"),
+ StringUtil::emailAddrAsAnchor(message->replyTo(),
+ StringUtil::DisplayNameOnly));
}
if (message->cc(false)) {
headerObject.insert(QStringLiteral("cci18n"), i18n("CC:"));
- headerObject.insert(QStringLiteral("cc"), StringUtil::emailAddrAsAnchor(message->cc(), StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("cc"),
+ StringUtil::emailAddrAsAnchor(message->cc(),
+ StringUtil::DisplayFullAddress));
headerObject.insert(QStringLiteral("ccStr"), message->cc()->asUnicodeString());
- headerObject.insert(QStringLiteral("ccNameOnly"), StringUtil::emailAddrAsAnchor(message->cc(), StringUtil::DisplayNameOnly));
+ headerObject.insert(QStringLiteral("ccNameOnly"),
+ StringUtil::emailAddrAsAnchor(
+ message->cc(), StringUtil::DisplayNameOnly));
headerObject.insert(QStringLiteral("ccMailbox"), QVariant::fromValue(message->cc()));
- const QString val = MessageCore::StringUtil::emailAddrAsAnchor(message->cc(), MessageCore::StringUtil::DisplayFullAddress,
- QString(), MessageCore::StringUtil::ShowLink,
- MessageCore::StringUtil::ExpandableAddresses, QStringLiteral("FullCcAddressList"));
+ const QString val = MessageCore::StringUtil::emailAddrAsAnchor(
+ message->cc(), MessageCore::StringUtil::DisplayFullAddress,
+ QString(), MessageCore::StringUtil::ShowLink,
+ MessageCore::StringUtil::ExpandableAddresses,
+ QStringLiteral("FullCcAddressList"));
headerObject.insert(QStringLiteral("ccExpandable"), val);
}
if (message->bcc(false)) {
headerObject.insert(QStringLiteral("bcci18n"), i18n("BCC:"));
- headerObject.insert(QStringLiteral("bcc"), StringUtil::emailAddrAsAnchor(message->bcc(), StringUtil::DisplayFullAddress));
- headerObject.insert(QStringLiteral("bccNameOnly"), StringUtil::emailAddrAsAnchor(message->bcc(), StringUtil::DisplayNameOnly));
+ headerObject.insert(QStringLiteral("bcc"),
+ StringUtil::emailAddrAsAnchor(message->bcc(),
+ StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("bccNameOnly"),
+ StringUtil::emailAddrAsAnchor(message->bcc(),
+ StringUtil::DisplayNameOnly));
headerObject.insert(QStringLiteral("bccStr"), message->bcc()->asUnicodeString());
headerObject.insert(QStringLiteral("bccMailbox"), QVariant::fromValue(message->bcc()));
}
headerObject.insert(QStringLiteral("fromi18n"), i18n("From:"));
- headerObject.insert(QStringLiteral("from"), StringUtil::emailAddrAsAnchor(message->from(), StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("from"),
+ StringUtil::emailAddrAsAnchor(message->from(),
+ StringUtil::DisplayFullAddress));
headerObject.insert(QStringLiteral("fromStr"), message->from()->asUnicodeString());
//Sender
- headerObject.insert(QStringLiteral("sender"), d->headerStyleUtil.strToHtml(message->sender()->asUnicodeString()));
+ headerObject.insert(QStringLiteral("sender"),
+ d->headerStyleUtil.strToHtml(message->sender()->asUnicodeString()));
headerObject.insert(QStringLiteral("senderi18n"), i18n("Sender:"));
headerObject.insert(QStringLiteral("listidi18n"), i18n("List-Id:"));
@@ -176,37 +215,72 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
}
headerObject.insert(QStringLiteral("datei18n"), i18n("Date:"));
- headerObject.insert(QStringLiteral("dateshort"), d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message, isPrinting, MessageViewer::HeaderStyleUtil::ShortDate)));
- headerObject.insert(QStringLiteral("datelong"), d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message, isPrinting, MessageViewer::HeaderStyleUtil::CustomDate)));
- headerObject.insert(QStringLiteral("date"), d->headerStyleUtil.dateStr(message->date()->dateTime()));
- headerObject.insert(QStringLiteral("datefancylong"), d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message, isPrinting, MessageViewer::HeaderStyleUtil::FancyLongDate)));
- headerObject.insert(QStringLiteral("datefancyshort"), d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message, isPrinting, MessageViewer::HeaderStyleUtil::FancyShortDate)));
- headerObject.insert(QStringLiteral("datelocalelong"), d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message, isPrinting, MessageViewer::HeaderStyleUtil::LongDate)));
+ headerObject.insert(QStringLiteral("dateshort"),
+ d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message,
+ isPrinting,
+ MessageViewer::
+ HeaderStyleUtil::
+ ShortDate)));
+ headerObject.insert(QStringLiteral("datelong"),
+ d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message,
+ isPrinting,
+ MessageViewer::
+ HeaderStyleUtil::
+ CustomDate)));
+ headerObject.insert(QStringLiteral("date"),
+ d->headerStyleUtil.dateStr(message->date()->dateTime()));
+ headerObject.insert(QStringLiteral("datefancylong"),
+ d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message,
+ isPrinting,
+ MessageViewer::
+ HeaderStyleUtil::
+ FancyLongDate)));
+ headerObject.insert(QStringLiteral("datefancyshort"),
+ d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message,
+ isPrinting,
+ MessageViewer::
+ HeaderStyleUtil::
+ FancyShortDate)));
+ headerObject.insert(QStringLiteral("datelocalelong"),
+ d->headerStyleUtil.strToHtml(d->headerStyleUtil.dateString(message,
+ isPrinting,
+ MessageViewer::
+ HeaderStyleUtil::
+ LongDate)));
if (MessageViewer::MessageViewerSettings::self()->showUserAgent()) {
if (auto hdr = message->userAgent(false)) {
- headerObject.insert(QStringLiteral("useragent"), d->headerStyleUtil.strToHtml(hdr->asUnicodeString()));
+ headerObject.insert(QStringLiteral("useragent"),
+ d->headerStyleUtil.strToHtml(hdr->asUnicodeString()));
}
if (auto hrd = message->headerByType("X-Mailer")) {
- headerObject.insert(QStringLiteral("xmailer"), d->headerStyleUtil.strToHtml(hrd->asUnicodeString()));
+ headerObject.insert(QStringLiteral("xmailer"),
+ d->headerStyleUtil.strToHtml(hrd->asUnicodeString()));
}
}
if (message->hasHeader("Resent-From")) {
headerObject.insert(QStringLiteral("resentfromi18n"), i18n("resent from"));
- const QVector<KMime::Types::Mailbox> resentFrom = d->headerStyleUtil.resentFromList(message);
- headerObject.insert(QStringLiteral("resentfrom"), StringUtil::emailAddrAsAnchor(resentFrom, StringUtil::DisplayFullAddress));
+ const QVector<KMime::Types::Mailbox> resentFrom
+ = d->headerStyleUtil.resentFromList(message);
+ headerObject.insert(QStringLiteral("resentfrom"),
+ StringUtil::emailAddrAsAnchor(resentFrom,
+ StringUtil::DisplayFullAddress));
}
if (message->hasHeader("Resent-To")) {
const QVector<KMime::Types::Mailbox> resentTo = d->headerStyleUtil.resentToList(message);
- headerObject.insert(QStringLiteral("resenttoi18n"), i18np("receiver was", "receivers were", resentTo.count()));
- headerObject.insert(QStringLiteral("resentto"), StringUtil::emailAddrAsAnchor(resentTo, StringUtil::DisplayFullAddress));
+ headerObject.insert(QStringLiteral("resenttoi18n"),
+ i18np("receiver was", "receivers were", resentTo.count()));
+ headerObject.insert(QStringLiteral("resentto"),
+ StringUtil::emailAddrAsAnchor(resentTo,
+ StringUtil::DisplayFullAddress));
}
if (auto organization = message->organization(false)) {
- headerObject.insert(QStringLiteral("organization"), d->headerStyleUtil.strToHtml(organization->asUnicodeString()));
+ headerObject.insert(QStringLiteral("organization"),
+ d->headerStyleUtil.strToHtml(organization->asUnicodeString()));
}
if (!style->vCardName().isEmpty()) {
@@ -229,7 +303,8 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
// colors depend on if it is encapsulated or not
QColor fontColor(Qt::white);
QString linkColor = QStringLiteral("white");
- const QColor activeColor = KColorScheme(QPalette::Active, KColorScheme::Selection).background().color();
+ const QColor activeColor
+ = KColorScheme(QPalette::Active, KColorScheme::Selection).background().color();
QColor activeColorDark = activeColor.dark(130);
// reverse colors for encapsulated
if (!style->isTopLevel()) {
@@ -266,8 +341,15 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
headerObject.insert(QStringLiteral("hasAttachment"), messageHasAttachment);
if (messageHasAttachment) {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("mail-attachment"), KIconLoader::Toolbar);
- const QString html = QStringLiteral("<img height=\"%2\" width=\"%2\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), QString::number(d->iconSize));
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "mail-attachment"),
+ KIconLoader::Toolbar);
+ const QString html = QStringLiteral("<img height=\"%2\" width=\"%2\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(
+ iconPath).url(),
+ QString::number(
+ d
+ ->iconSize));
headerObject.insert(QStringLiteral("attachmentIcon"), html);
}
diff --git a/messageviewer/src/header/grantleeheaderformatter.h b/messageviewer/src/header/grantleeheaderformatter.h
index c02c04b..65da6e5 100644
--- a/messageviewer/src/header/grantleeheaderformatter.h
+++ b/messageviewer/src/header/grantleeheaderformatter.h
@@ -24,26 +24,24 @@
#include <grantlee/templateloader.h>
#include <GrantleeTheme/GrantleeTheme>
#include "messageviewer_export.h"
-namespace KMime
-{
+namespace KMime {
class Message;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStyle;
class MESSAGEVIEWER_EXPORT GrantleeHeaderFormatter
{
public:
struct GrantleeHeaderFormatterSettings {
GrantleeHeaderFormatterSettings()
- : isPrinting(false),
- style(nullptr),
- message(nullptr),
- showMailAction(true)
+ : isPrinting(false)
+ , style(nullptr)
+ , message(nullptr)
+ , showMailAction(true)
{
-
}
+
GrantleeTheme::Theme theme;
bool isPrinting;
mutable const MessageViewer::HeaderStyle *style;
@@ -56,9 +54,14 @@ public:
QString toHtml(const GrantleeHeaderFormatterSettings &settings) const;
- QString toHtml(const QStringList &displayExtraHeaders, const QString &absolutPath, const QString &filename, const MessageViewer::HeaderStyle *style, KMime::Message *message, bool isPrinting) const;
+ QString toHtml(const QStringList &displayExtraHeaders, const QString &absolutPath,
+ const QString &filename, const MessageViewer::HeaderStyle *style,
+ KMime::Message *message, bool isPrinting) const;
private:
- QString format(const QString &absolutePath, const Grantlee::Template &headerTemplate, const QStringList &displayExtraHeaders, bool isPrinting, const MessageViewer::HeaderStyle *style, KMime::Message *message, bool showMailAction = true) const;
+ QString format(const QString &absolutePath, const Grantlee::Template &headerTemplate,
+ const QStringList &displayExtraHeaders, bool isPrinting,
+ const MessageViewer::HeaderStyle *style, KMime::Message *message,
+ bool showMailAction = true) const;
class Private;
Private *const d;
};
diff --git a/messageviewer/src/header/grantleeheaderstyle.cpp b/messageviewer/src/header/grantleeheaderstyle.cpp
index ac5361e..8ab6ac3 100644
--- a/messageviewer/src/header/grantleeheaderstyle.cpp
+++ b/messageviewer/src/header/grantleeheaderstyle.cpp
@@ -29,11 +29,12 @@ class MessageViewer::GrantleeHeaderStylePrivate
{
public:
GrantleeHeaderStylePrivate()
- : mGrantleeFormatter(nullptr),
- mShowMailAction(true)
+ : mGrantleeFormatter(nullptr)
+ , mShowMailAction(true)
{
mGrantleeFormatter = new GrantleeHeaderFormatter;
}
+
~GrantleeHeaderStylePrivate()
{
delete mGrantleeFormatter;
@@ -44,8 +45,8 @@ public:
};
GrantleeHeaderStyle::GrantleeHeaderStyle()
- : HeaderStyle(),
- d(new MessageViewer::GrantleeHeaderStylePrivate)
+ : HeaderStyle()
+ , d(new MessageViewer::GrantleeHeaderStylePrivate)
{
}
diff --git a/messageviewer/src/header/grantleeheaderstyle.h b/messageviewer/src/header/grantleeheaderstyle.h
index 590e085..066da60 100644
--- a/messageviewer/src/header/grantleeheaderstyle.h
+++ b/messageviewer/src/header/grantleeheaderstyle.h
@@ -22,8 +22,7 @@
#include "messageviewer/headerstyle.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class GrantleeHeaderStylePrivate;
class MESSAGEVIEWER_EXPORT GrantleeHeaderStyle : public HeaderStyle
{
diff --git a/messageviewer/src/header/grantleeheaderteststyle.cpp b/messageviewer/src/header/grantleeheaderteststyle.cpp
index b2be8d6..2b5cab6 100644
--- a/messageviewer/src/header/grantleeheaderteststyle.cpp
+++ b/messageviewer/src/header/grantleeheaderteststyle.cpp
@@ -32,8 +32,8 @@ public:
GrantleeHeaderTestStylePrivate()
: mGrantleeFormatter(new GrantleeHeaderFormatter)
{
-
}
+
~GrantleeHeaderTestStylePrivate()
{
delete mGrantleeFormatter;
@@ -46,8 +46,8 @@ public:
};
GrantleeHeaderTestStyle::GrantleeHeaderTestStyle()
- : HeaderStyle(),
- d(new MessageViewer::GrantleeHeaderTestStylePrivate)
+ : HeaderStyle()
+ , d(new MessageViewer::GrantleeHeaderTestStylePrivate)
{
}
@@ -66,7 +66,8 @@ QString GrantleeHeaderTestStyle::format(KMime::Message *message) const
if (!message) {
return QString();
}
- return d->mGrantleeFormatter->toHtml(d->mExtraDisplay, d->mAbsolutePath, d->mMainFilename, this, message, isPrinting());
+ return d->mGrantleeFormatter->toHtml(d->mExtraDisplay, d->mAbsolutePath, d->mMainFilename, this,
+ message, isPrinting());
}
void GrantleeHeaderTestStyle::setAbsolutePath(const QString &path)
diff --git a/messageviewer/src/header/grantleeheaderteststyle.h b/messageviewer/src/header/grantleeheaderteststyle.h
index f8d3f9d..e75dff1 100644
--- a/messageviewer/src/header/grantleeheaderteststyle.h
+++ b/messageviewer/src/header/grantleeheaderteststyle.h
@@ -23,8 +23,7 @@
#include "headerstyle.h"
#include "messageviewer_export.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class GrantleeHeaderTestStylePrivate;
class MESSAGEVIEWER_EXPORT GrantleeHeaderTestStyle : public HeaderStyle
{
diff --git a/messageviewer/src/header/headerstrategy.cpp b/messageviewer/src/header/headerstrategy.cpp
index ae6ad2c..08a41a7 100644
--- a/messageviewer/src/header/headerstrategy.cpp
+++ b/messageviewer/src/header/headerstrategy.cpp
@@ -39,12 +39,10 @@
using namespace MessageViewer;
HeaderStrategy::HeaderStrategy()
{
-
}
HeaderStrategy::~HeaderStrategy()
{
-
}
QStringList HeaderStrategy::headersToDisplay() const
diff --git a/messageviewer/src/header/headerstrategy.h b/messageviewer/src/header/headerstrategy.h
index 1d2f60a..4c81e30 100644
--- a/messageviewer/src/header/headerstrategy.h
+++ b/messageviewer/src/header/headerstrategy.h
@@ -35,9 +35,7 @@
#include "messageviewer_export.h"
#include <QStringList>
-namespace MessageViewer
-{
-
+namespace MessageViewer {
//
// Convenience function
//
@@ -58,16 +56,16 @@ public:
//
// HeaderStrategy interface:
//
- enum DefaultPolicy { Display, Hide };
+ enum DefaultPolicy {
+ Display, Hide
+ };
virtual QStringList headersToDisplay() const;
virtual QStringList headersToHide() const;
virtual DefaultPolicy defaultPolicy() const = 0;
virtual bool showHeader(const QString &header) const;
static QStringList stringList(const char *const headers[], int numHeaders);
-
};
-
}
#endif // __MESSAGEVIEWER_HEADERSTRATEGY_H__
diff --git a/messageviewer/src/header/headerstyle.cpp b/messageviewer/src/header/headerstyle.cpp
index d275e17..b57b59e 100644
--- a/messageviewer/src/header/headerstyle.cpp
+++ b/messageviewer/src/header/headerstyle.cpp
@@ -43,16 +43,16 @@ class MessageViewer::HeaderStylePrivate
{
public:
HeaderStylePrivate()
- : mStrategy(nullptr),
- mNodeHelper(nullptr),
- mSourceObject(nullptr),
- mPrinting(false),
- mTopLevel(true),
- mAllowAsync(false),
- mReadOnlyMessage(false)
+ : mStrategy(nullptr)
+ , mNodeHelper(nullptr)
+ , mSourceObject(nullptr)
+ , mPrinting(false)
+ , mTopLevel(true)
+ , mAllowAsync(false)
+ , mReadOnlyMessage(false)
{
-
}
+
GrantleeTheme::Theme mTheme;
QString mMessagePath;
const HeaderStrategy *mStrategy;
@@ -201,4 +201,3 @@ void HeaderStyle::setReadOnlyMessage(bool readOnlyMessage)
{
d->mReadOnlyMessage = readOnlyMessage;
}
-
diff --git a/messageviewer/src/header/headerstyle.h b/messageviewer/src/header/headerstyle.h
index 0a7b455..0d20b77 100644
--- a/messageviewer/src/header/headerstyle.h
+++ b/messageviewer/src/header/headerstyle.h
@@ -43,19 +43,15 @@
class QString;
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class NodeHelper;
}
-namespace GrantleeTheme
-{
+namespace GrantleeTheme {
class Theme;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class HeaderStrategy;
/** This class encapsulates the visual appearance of message
@@ -68,7 +64,7 @@ class HeaderStrategy;
@see HeaderStrategy
**/
class HeaderStylePrivate;
-class MESSAGEVIEWER_EXPORT HeaderStyle
+class MESSAGEVIEWER_EXPORT HeaderStyle
{
protected:
HeaderStyle();
diff --git a/messageviewer/src/header/headerstyle_util.cpp b/messageviewer/src/header/headerstyle_util.cpp
index 90e2295..8d444b0 100644
--- a/messageviewer/src/header/headerstyle_util.cpp
+++ b/messageviewer/src/header/headerstyle_util.cpp
@@ -63,7 +63,8 @@ QString HeaderStyleUtil::strToHtml(const QString &str, KTextToHTML::Options flag
}
// Prepare the date string (when printing always use the localized date)
-QString HeaderStyleUtil::dateString(KMime::Message *message, bool printing, HeaderStyleUtilDateFormat dateFormat) const
+QString HeaderStyleUtil::dateString(KMime::Message *message, bool printing,
+ HeaderStyleUtilDateFormat dateFormat) const
{
const QDateTime dateTime = message->date()->dateTime();
const time_t unixTime = dateTime.toTime_t();
@@ -123,18 +124,23 @@ QString HeaderStyleUtil::spamStatus(KMime::Message *message) const
QString spamHTML;
const SpamScores scores = SpamHeaderAnalyzer::getSpamScores(message);
- for (SpamScores::const_iterator it = scores.constBegin(), end = scores.constEnd(); it != end; ++it)
- spamHTML += (*it).agent() + QLatin1Char(' ') +
- drawSpamMeter((*it).error(), (*it).score(), (*it).confidence(), (*it).spamHeader(), (*it).confidenceHeader());
+ for (SpamScores::const_iterator it = scores.constBegin(), end = scores.constEnd(); it != end;
+ ++it) {
+ spamHTML += (*it).agent() + QLatin1Char(' ')
+ +drawSpamMeter((*it).error(), (*it).score(),
+ (*it).confidence(), (*it).spamHeader(),
+ (*it).confidenceHeader());
+ }
return spamHTML;
}
QString HeaderStyleUtil::drawSpamMeter(SpamError spamError, double percent, double confidence,
- const QString &filterHeader, const QString &confidenceHeader) const
+ const QString &filterHeader,
+ const QString &confidenceHeader) const
{
static const int meterWidth = 20;
static const int meterHeight = 5;
- QImage meterBar(meterWidth, 1, QImage::Format_Indexed8/*QImage::Format_RGB32*/);
+ QImage meterBar(meterWidth, 1, QImage::Format_Indexed8 /*QImage::Format_RGB32*/);
meterBar.setNumColors(24);
meterBar.setColor(meterWidth + 1, qRgb(255, 255, 255));
@@ -143,26 +149,26 @@ QString HeaderStyleUtil::drawSpamMeter(SpamError spamError, double percent, doub
meterBar.fill(meterWidth + 2);
} else {
static const unsigned short gradient[meterWidth][3] = {
- { 0, 255, 0 },
- { 27, 254, 0 },
- { 54, 252, 0 },
- { 80, 250, 0 },
- { 107, 249, 0 },
- { 135, 247, 0 },
- { 161, 246, 0 },
- { 187, 244, 0 },
- { 214, 242, 0 },
- { 241, 241, 0 },
- { 255, 228, 0 },
- { 255, 202, 0 },
- { 255, 177, 0 },
- { 255, 151, 0 },
- { 255, 126, 0 },
- { 255, 101, 0 },
- { 255, 76, 0 },
- { 255, 51, 0 },
- { 255, 25, 0 },
- { 255, 0, 0 }
+ { 0, 255, 0 },
+ { 27, 254, 0 },
+ { 54, 252, 0 },
+ { 80, 250, 0 },
+ { 107, 249, 0 },
+ { 135, 247, 0 },
+ { 161, 246, 0 },
+ { 187, 244, 0 },
+ { 214, 242, 0 },
+ { 241, 241, 0 },
+ { 255, 228, 0 },
+ { 255, 202, 0 },
+ { 255, 177, 0 },
+ { 255, 151, 0 },
+ { 255, 126, 0 },
+ { 255, 101, 0 },
+ { 255, 76, 0 },
+ { 255, 51, 0 },
+ { 255, 25, 0 },
+ { 255, 0, 0 }
};
meterBar.fill(meterWidth + 1);
@@ -181,7 +187,8 @@ QString HeaderStyleUtil::drawSpamMeter(SpamError spamError, double percent, doub
confidenceString = QString::number(confidence) + QLatin1String("% &nbsp;");
titleText = i18n("%1% probability of being spam with confidence %3%.\n\n"
"Full report:\nProbability=%2\nConfidence=%4",
- QString::number(percent, 'f', 2), filterHeader, confidence, confidenceHeader);
+ QString::number(percent, 'f',
+ 2), filterHeader, confidence, confidenceHeader);
} else { // do not show negative confidence
confidenceString = QString() + QLatin1String("&nbsp;");
titleText = i18n("%1% probability of being spam.\n\n"
@@ -215,7 +222,8 @@ QString HeaderStyleUtil::drawSpamMeter(SpamError spamError, double percent, doub
"Full report:\n%2",
errorMsg, filterHeader);
}
- return QStringLiteral("<img src=\"%1\" width=\"%2\" height=\"%3\" style=\"border: 1px solid black;\" title=\"%4\"> &nbsp;")
+ return QStringLiteral(
+ "<img src=\"%1\" width=\"%2\" height=\"%3\" style=\"border: 1px solid black;\" title=\"%4\"> &nbsp;")
.arg(imgToDataUrl(meterBar), QString::number(meterWidth),
QString::number(meterHeight), titleText) + confidenceString;
}
@@ -226,16 +234,17 @@ QString HeaderStyleUtil::imgToDataUrl(const QImage &image) const
QBuffer buffer(&ba);
buffer.open(QIODevice::WriteOnly);
image.save(&buffer, "PNG");
- return QStringLiteral("data:image/%1;base64,%2").arg(QStringLiteral("PNG"), QString::fromLatin1(ba.toBase64()));
+ return QStringLiteral("data:image/%1;base64,%2").arg(QStringLiteral("PNG"),
+ QString::fromLatin1(ba.toBase64()));
}
QString HeaderStyleUtil::dateStr(const QDateTime &dateTime) const
{
const time_t unixTime = dateTime.toTime_t();
return KMime::DateFormatter::formatDate(
- static_cast<KMime::DateFormatter::FormatType>(
- MessageCore::MessageCoreSettings::self()->dateFormat()),
- unixTime, MessageCore::MessageCoreSettings::self()->customDateFormat());
+ static_cast<KMime::DateFormatter::FormatType>(
+ MessageCore::MessageCoreSettings::self()->dateFormat()),
+ unixTime, MessageCore::MessageCoreSettings::self()->customDateFormat());
}
QString HeaderStyleUtil::dateShortStr(const QDateTime &dateTime) const
@@ -292,38 +301,42 @@ void HeaderStyleUtil::updateXFaceSettings(QImage photo, xfaceSettings &settings)
double ratio = (double)settings.photoHeight / (double)settings.photoWidth;
settings.photoHeight = 60;
settings.photoWidth = (int)(60 / ratio);
- photo = photo.scaled(settings.photoWidth, settings.photoHeight, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ photo = photo.scaled(settings.photoWidth, settings.photoHeight, Qt::IgnoreAspectRatio,
+ Qt::SmoothTransformation);
}
settings.photoURL = MessageViewer::HeaderStyleUtil::imgToDataUrl(photo);
}
}
-HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::HeaderStyle *style, KMime::Message *message) const
+HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::HeaderStyle *style,
+ KMime::Message *message) const
{
-
xfaceSettings settings;
bool useOtherPhotoSources = false;
if (style->allowAsync()) {
-
Q_ASSERT(style->nodeHelper());
Q_ASSERT(style->sourceObject());
- ContactDisplayMessageMemento *photoMemento =
- dynamic_cast<ContactDisplayMessageMemento *>(style->nodeHelper()->bodyPartMemento(message, "contactphoto"));
+ ContactDisplayMessageMemento *photoMemento
+ = dynamic_cast<ContactDisplayMessageMemento *>(style->nodeHelper()->bodyPartMemento(
+ message, "contactphoto"));
if (!photoMemento) {
- const QString email = QString::fromLatin1(KEmailAddress::firstEmailAddress(message->from()->as7BitString(false)));
+ const QString email
+ = QString::fromLatin1(KEmailAddress::firstEmailAddress(message->from()->as7BitString(
+ false)));
photoMemento = new ContactDisplayMessageMemento(email);
style->nodeHelper()->setBodyPartMemento(message, "contactphoto", photoMemento);
QObject::connect(photoMemento, SIGNAL(update(MimeTreeParser::UpdateMode)),
style->sourceObject(), SLOT(update(MimeTreeParser::UpdateMode)));
- QObject::connect(photoMemento, SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)),
- style->sourceObject(), SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)));
+ QObject::connect(photoMemento,
+ SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)),
+ style->sourceObject(),
+ SIGNAL(changeDisplayMail(Viewer::DisplayFormatMessage,bool)));
}
if (photoMemento->finished()) {
-
useOtherPhotoSources = true;
if (photoMemento->photo().isIntern()) {
// get photo data and convert to data: url
@@ -353,7 +366,6 @@ HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::Heade
// no photo, look for a Face header
const QString faceheader = hrd->asUnicodeString();
if (!faceheader.isEmpty()) {
-
qCDebug(MESSAGEVIEWER_LOG) << "Found Face: header";
const QByteArray facestring = faceheader.toUtf8();
@@ -366,15 +378,18 @@ HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::Heade
if (faceimage.loadFromData(facearray, "png")) {
// Spec says image must be 48x48 pixels
if ((48 == faceimage.width()) && (48 == faceimage.height())) {
- settings.photoURL = MessageViewer::HeaderStyleUtil::imgToDataUrl(faceimage);
+ settings.photoURL = MessageViewer::HeaderStyleUtil::imgToDataUrl(
+ faceimage);
settings.photoWidth = 48;
settings.photoHeight = 48;
} else {
- qCDebug(MESSAGEVIEWER_LOG) << "Face: header image is" << faceimage.width() << "by"
+ qCDebug(MESSAGEVIEWER_LOG) << "Face: header image is"
+ << faceimage.width() << "by"
<< faceimage.height() << "not 48x48 Pixels";
}
} else {
- qCDebug(MESSAGEVIEWER_LOG) << "Failed to load decoded png from Face: header";
+ qCDebug(MESSAGEVIEWER_LOG)
+ << "Failed to load decoded png from Face: header";
}
} else {
qCDebug(MESSAGEVIEWER_LOG) << "Face: header too long at" << facestring.length();
@@ -389,7 +404,8 @@ HeaderStyleUtil::xfaceSettings HeaderStyleUtil::xface(const MessageViewer::Heade
const QString xfhead = hrd->asUnicodeString();
if (!xfhead.isEmpty()) {
MessageViewer::KXFace xf;
- settings.photoURL = MessageViewer::HeaderStyleUtil::imgToDataUrl(xf.toImage(xfhead));
+ settings.photoURL
+ = MessageViewer::HeaderStyleUtil::imgToDataUrl(xf.toImage(xfhead));
settings.photoWidth = 48;
settings.photoHeight = 48;
}
@@ -407,46 +423,94 @@ void HeaderStyleUtil::addMailAction(QVariantHash &headerObject)
headerObject.insert(QStringLiteral("forwardaction"), mailAction(Viewer::Forward));
headerObject.insert(QStringLiteral("newmessageaction"), mailAction(Viewer::NewMessage));
headerObject.insert(QStringLiteral("printmessageaction"), mailAction(Viewer::Print));
- headerObject.insert(QStringLiteral("printpreviewmessageaction"), mailAction(Viewer::PrintPreview));
+ headerObject.insert(QStringLiteral("printpreviewmessageaction"), mailAction(
+ Viewer::PrintPreview));
}
QString HeaderStyleUtil::mailAction(Viewer::MailAction action) const
{
QString html;
switch (action) {
- case Viewer::Trash: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("user-trash"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:trash\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Move to Trash"), QString::number(mIconSize));
+ case Viewer::Trash:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "user-trash"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:trash\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Move to Trash"),
+ QString::number(mIconSize));
break;
}
- case Viewer::Reply: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-sender"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:reply\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply"), QString::number(mIconSize));
+ case Viewer::Reply:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "mail-reply-sender"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:reply\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply"), QString::number(mIconSize));
break;
}
- case Viewer::ReplyToAll: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("mail-reply-all"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:replyToAll\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply to All"), QString::number(mIconSize));
+ case Viewer::ReplyToAll:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "mail-reply-all"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:replyToAll\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Reply to All"),
+ QString::number(mIconSize));
break;
}
- case Viewer::Forward: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("mail-forward"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:forward\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Forward"), QString::number(mIconSize));
+ case Viewer::Forward:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "mail-forward"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:forward\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Forward"),
+ QString::number(mIconSize));
break;
}
- case Viewer::NewMessage: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("mail-message-new"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:newMessage\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("New Message"), QString::number(mIconSize));
+ case Viewer::NewMessage:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "mail-message-new"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:newMessage\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("New Message"), QString::number(
+ mIconSize));
break;
}
- case Viewer::Print: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("document-print"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:print\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print"), QString::number(mIconSize));
+ case Viewer::Print:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "document-print"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:print\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print"), QString::number(mIconSize));
break;
}
- case Viewer::PrintPreview: {
- const QString iconPath = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral("document-print-preview"), KIconLoader::Toolbar);
- html = QStringLiteral("<a href=\"kmailaction:printpreview\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>").arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print Preview"), QString::number(mIconSize));
+ case Viewer::PrintPreview:
+ {
+ const QString iconPath
+ = MessageViewer::IconNameCache::instance()->iconPath(QStringLiteral(
+ "document-print-preview"),
+ KIconLoader::Toolbar);
+ html = QStringLiteral(
+ "<a href=\"kmailaction:printpreview\"><img title=\"%2\" height=\"%3\" width=\"%3\" src=\"%1\"></a>")
+ .arg(QUrl::fromLocalFile(iconPath).url(), i18n("Print Preview"),
+ QString::number(mIconSize));
break;
}
}
diff --git a/messageviewer/src/header/headerstyle_util.h b/messageviewer/src/header/headerstyle_util.h
index 5c99413..051399d 100644
--- a/messageviewer/src/header/headerstyle_util.h
+++ b/messageviewer/src/header/headerstyle_util.h
@@ -31,16 +31,15 @@
#include "messageviewer/headerstyle.h"
#include "messageviewer/viewer.h"
#include "messageviewer_export.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT HeaderStyleUtil
{
public:
HeaderStyleUtil();
struct xfaceSettings {
xfaceSettings()
- : photoWidth(60),
- photoHeight(60)
+ : photoWidth(60)
+ , photoHeight(60)
{
}
@@ -62,11 +61,14 @@ public:
QString directionOf(const QString &str) const;
- QString strToHtml(const QString &str, KTextToHTML::Options flags = KTextToHTML::PreserveSpaces) const;
+ QString strToHtml(const QString &str,
+ KTextToHTML::Options flags = KTextToHTML::PreserveSpaces) const;
- QString dateString(KMime::Message *message, bool printing, HeaderStyleUtilDateFormat dateFormat) const;
+ QString dateString(KMime::Message *message, bool printing,
+ HeaderStyleUtilDateFormat dateFormat) const;
- QString subjectString(KMime::Message *message, KTextToHTML::Options flags = KTextToHTML::PreserveSpaces) const;
+ QString subjectString(KMime::Message *message,
+ KTextToHTML::Options flags = KTextToHTML::PreserveSpaces) const;
QString subjectDirectionString(KMime::Message *message) const;
diff --git a/messageviewer/src/header/headerstyleinterface.cpp b/messageviewer/src/header/headerstyleinterface.cpp
index 9694f18..4ca1186 100644
--- a/messageviewer/src/header/headerstyleinterface.cpp
+++ b/messageviewer/src/header/headerstyleinterface.cpp
@@ -26,11 +26,11 @@
#include <KToggleAction>
using namespace MessageViewer;
-HeaderStyleInterface::HeaderStyleInterface(MessageViewer::HeaderStylePlugin *headerStylePlugin, QObject *parent)
- : QObject(parent),
- mHeaderStylePlugin(headerStylePlugin)
+HeaderStyleInterface::HeaderStyleInterface(MessageViewer::HeaderStylePlugin *headerStylePlugin,
+ QObject *parent)
+ : QObject(parent)
+ , mHeaderStylePlugin(headerStylePlugin)
{
-
}
HeaderStyleInterface::~HeaderStyleInterface()
diff --git a/messageviewer/src/header/headerstyleinterface.h b/messageviewer/src/header/headerstyleinterface.h
index 733672b..3334da4 100644
--- a/messageviewer/src/header/headerstyleinterface.h
+++ b/messageviewer/src/header/headerstyleinterface.h
@@ -27,8 +27,7 @@ class KActionCollection;
class QAction;
class QActionGroup;
class KActionMenu;
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStyle;
class HeaderStylePlugin;
class MESSAGEVIEWER_EXPORT HeaderStyleInterface : public QObject
@@ -38,7 +37,8 @@ public:
explicit HeaderStyleInterface(MessageViewer::HeaderStylePlugin *, QObject *parent = nullptr);
virtual ~HeaderStyleInterface();
QList<KToggleAction * > action() const;
- virtual void createAction(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac) = 0;
+ virtual void createAction(KActionMenu *menu, QActionGroup *actionGroup,
+ KActionCollection *ac) = 0;
virtual void activateAction() = 0;
HeaderStylePlugin *headerStylePlugin() const;
diff --git a/messageviewer/src/header/headerstylemenumanager.cpp b/messageviewer/src/header/headerstylemenumanager.cpp
index a743f1f..b11a9fb 100644
--- a/messageviewer/src/header/headerstylemenumanager.cpp
+++ b/messageviewer/src/header/headerstylemenumanager.cpp
@@ -36,11 +36,12 @@ class MessageViewer::HeaderStyleMenuManagerPrivate
{
public:
HeaderStyleMenuManagerPrivate(HeaderStyleMenuManager *qq)
- : group(nullptr),
- headerMenu(nullptr),
- q(qq)
+ : group(nullptr)
+ , headerMenu(nullptr)
+ , q(qq)
{
}
+
void readSettings();
void writeSettings(const QString &pluginName);
void initialize(KActionCollection *ac);
@@ -87,26 +88,36 @@ void HeaderStyleMenuManagerPrivate::readSettings()
QString headerStyleName = MessageViewer::MessageViewerSettings::self()->headerPluginStyleName();
if (headerStyleName.isEmpty()) {
const QString headerStyle = MessageViewer::MessageViewerSettings::self()->headerStyle();
- const QString headerSetDisplayed = MessageViewer::MessageViewerSettings::self()->headerSetDisplayed();
+ const QString headerSetDisplayed
+ = MessageViewer::MessageViewerSettings::self()->headerSetDisplayed();
- if ((headerStyle == QLatin1String("custom")) && (headerSetDisplayed == QLatin1String("custom"))) { //Custom
+ if ((headerStyle == QLatin1String("custom"))
+ && (headerSetDisplayed == QLatin1String("custom"))) { //Custom
headerStyleName = QStringLiteral("custom");
- } else if ((headerStyle == QLatin1String("plain")) && (headerSetDisplayed == QLatin1String("all"))) { //all
+ } else if ((headerStyle == QLatin1String("plain"))
+ && (headerSetDisplayed == QLatin1String("all"))) { //all
headerStyleName = QStringLiteral("all-headers");
- } else if ((headerStyle == QLatin1String("brief")) && (headerSetDisplayed == QLatin1String("brief"))) { //brief
+ } else if ((headerStyle == QLatin1String("brief"))
+ && (headerSetDisplayed == QLatin1String("brief"))) { //brief
headerStyleName = QStringLiteral("brief");
- } else if ((headerStyle == QLatin1String("enterprise")) && (headerSetDisplayed == QLatin1String("rich"))) { //enterprise
+ } else if ((headerStyle == QLatin1String("enterprise"))
+ && (headerSetDisplayed == QLatin1String("rich"))) { //enterprise
headerStyleName = QStringLiteral("enterprise");
- } else if ((headerStyle == QLatin1String("fancy")) && (headerSetDisplayed == QLatin1String("rich"))) { //fancy
+ } else if ((headerStyle == QLatin1String("fancy"))
+ && (headerSetDisplayed == QLatin1String("rich"))) { //fancy
headerStyleName = QStringLiteral("fancy");
- } else if ((headerStyle == QLatin1String("grantlee")) && (headerSetDisplayed == QLatin1String("grantlee"))) { //grantlee
+ } else if ((headerStyle == QLatin1String("grantlee"))
+ && (headerSetDisplayed == QLatin1String("grantlee"))) { //grantlee
headerStyleName = QStringLiteral("grantlee");
- } else if ((headerStyle == QLatin1String("plain")) && (headerSetDisplayed == QLatin1String("rich"))) { //longheader
+ } else if ((headerStyle == QLatin1String("plain"))
+ && (headerSetDisplayed == QLatin1String("rich"))) { //longheader
headerStyleName = QStringLiteral("long-header");
- } else if ((headerStyle == QLatin1String("plain")) && (headerSetDisplayed == QLatin1String("standard"))) { //Standard
+ } else if ((headerStyle == QLatin1String("plain"))
+ && (headerSetDisplayed == QLatin1String("standard"))) { //Standard
headerStyleName = QStringLiteral("standards-header");
} else {
- qCDebug(MESSAGEVIEWER_LOG) << "unknown style : headerstyle " << headerStyle << " headerstrategy :" << headerSetDisplayed;
+ qCDebug(MESSAGEVIEWER_LOG) << "unknown style : headerstyle " << headerStyle
+ << " headerstrategy :" << headerSetDisplayed;
}
MessageViewer::MessageViewerSettings::self()->setHeaderPluginStyleName(headerStyleName);
}
@@ -132,20 +143,24 @@ void HeaderStyleMenuManagerPrivate::initialize(KActionCollection *ac)
addHelpTextAction(headerMenu, i18n("Choose display style of message headers"));
group = new QActionGroup(q);
- const QVector<MessageViewer::HeaderStylePlugin *> lstPlugin = MessageViewer::HeaderStylePluginManager::self()->pluginsList();
+ const QVector<MessageViewer::HeaderStylePlugin *> lstPlugin
+ = MessageViewer::HeaderStylePluginManager::self()->pluginsList();
for (MessageViewer::HeaderStylePlugin *plugin : lstPlugin) {
if (plugin->isEnabled()) {
- MessageViewer::HeaderStyleInterface *interface = plugin->createView(headerMenu, group, ac, q);
+ MessageViewer::HeaderStyleInterface *interface = plugin->createView(headerMenu, group,
+ ac, q);
lstInterface.insert(plugin->name(), interface);
- q->connect(interface, &HeaderStyleInterface::styleChanged, q, &HeaderStyleMenuManager::slotStyleChanged);
- q->connect(interface, &HeaderStyleInterface::styleUpdated, q, &HeaderStyleMenuManager::styleUpdated);
+ q->connect(interface, &HeaderStyleInterface::styleChanged, q,
+ &HeaderStyleMenuManager::slotStyleChanged);
+ q->connect(interface, &HeaderStyleInterface::styleUpdated, q,
+ &HeaderStyleMenuManager::styleUpdated);
}
}
}
HeaderStyleMenuManager::HeaderStyleMenuManager(KActionCollection *ac, QObject *parent)
- : QObject(parent),
- d(new MessageViewer::HeaderStyleMenuManagerPrivate(this))
+ : QObject(parent)
+ , d(new MessageViewer::HeaderStyleMenuManagerPrivate(this))
{
d->initialize(ac);
}
diff --git a/messageviewer/src/header/headerstylemenumanager.h b/messageviewer/src/header/headerstylemenumanager.h
index 5b480ee..121e7ff 100644
--- a/messageviewer/src/header/headerstylemenumanager.h
+++ b/messageviewer/src/header/headerstylemenumanager.h
@@ -25,8 +25,7 @@
#include <QObject>
class KActionMenu;
class KActionCollection;
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStylePlugin;
class HeaderStyleMenuManagerPrivate;
class MESSAGEVIEWER_EXPORT HeaderStyleMenuManager : public QObject
diff --git a/messageviewer/src/header/headerstyleplugin.cpp b/messageviewer/src/header/headerstyleplugin.cpp
index 3d936e2..5408f0b 100644
--- a/messageviewer/src/header/headerstyleplugin.cpp
+++ b/messageviewer/src/header/headerstyleplugin.cpp
@@ -26,16 +26,15 @@ public:
HeaderStylePluginPrivate()
: mIsEnabled(false)
{
-
}
+
bool mIsEnabled;
};
HeaderStylePlugin::HeaderStylePlugin(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::HeaderStylePluginPrivate)
+ : QObject(parent)
+ , d(new MessageViewer::HeaderStylePluginPrivate)
{
-
}
HeaderStylePlugin::~HeaderStylePlugin()
diff --git a/messageviewer/src/header/headerstyleplugin.h b/messageviewer/src/header/headerstyleplugin.h
index c444e47..23121bd 100644
--- a/messageviewer/src/header/headerstyleplugin.h
+++ b/messageviewer/src/header/headerstyleplugin.h
@@ -26,8 +26,7 @@
class KActionCollection;
class QActionGroup;
class KActionMenu;
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStyle;
class HeaderStrategy;
class HeaderStylePluginPrivate;
@@ -41,7 +40,8 @@ public:
virtual HeaderStyle *headerStyle() const = 0;
virtual HeaderStrategy *headerStrategy() const = 0;
- virtual HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) = 0;
+ virtual HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup,
+ KActionCollection *ac, QObject *parent = nullptr) = 0;
virtual QString name() const = 0;
virtual bool hasMargin() const;
virtual QString alignment() const;
diff --git a/messageviewer/src/header/headerstylepluginmanager.cpp b/messageviewer/src/header/headerstylepluginmanager.cpp
index cc6b432..2a30f7e 100644
--- a/messageviewer/src/header/headerstylepluginmanager.cpp
+++ b/messageviewer/src/header/headerstylepluginmanager.cpp
@@ -50,10 +50,9 @@ class HeaderStylePluginInfo
{
public:
HeaderStylePluginInfo()
- : plugin(nullptr),
- isEnabled(false)
+ : plugin(nullptr)
+ , isEnabled(false)
{
-
}
QString metaDataFileNameBaseName;
@@ -69,8 +68,8 @@ public:
HeaderStylePluginManagerPrivate(HeaderStylePluginManager *qq)
: q(qq)
{
-
}
+
QVector<MessageViewer::HeaderStylePlugin *> pluginsList() const;
QVector<PimCommon::PluginUtilData> pluginDataList() const;
void initializePluginList();
@@ -84,8 +83,7 @@ private:
HeaderStylePluginManager *q;
};
-namespace
-{
+namespace {
QString pluginVersion()
{
return QStringLiteral("1.0");
@@ -109,13 +107,16 @@ QString HeaderStylePluginManagerPrivate::configPrefixSettingKey() const
void HeaderStylePluginManagerPrivate::initializePluginList()
{
- const QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](const KPluginMetaData & md) {
+ const QVector<KPluginMetaData> plugins
+ = KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](
+ const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("MessageViewerHeaderStyle/Plugin"));
});
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
- const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
+ const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(
+ configGroupName(), configPrefixSettingKey());
QSet<QString> unique;
QVector<int> listOrder;
while (i.hasPrevious()) {
@@ -126,18 +127,21 @@ void HeaderStylePluginManagerPrivate::initializePluginList()
//1) get plugin data => name/description etc.
info.pluginData = PimCommon::PluginUtil::createPluginMetaData(data);
//2) look at if plugin is activated
- const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, info.pluginData.mEnableByDefault, info.pluginData.mIdentifier);
+ const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first,
+ pair.second,
+ info.pluginData.mEnableByDefault,
+ info.pluginData.mIdentifier);
info.isEnabled = isPluginActivated;
info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
info.metaDataFileName = data.fileName();
const QString version = data.version();
if (pluginVersion() == version) {
-
// only load plugins once, even if found multiple times!
if (unique.contains(info.metaDataFileNameBaseName)) {
continue;
}
- const QVariant p = data.rawData().value(QStringLiteral("X-KDE-MessageViewer-Header-Order")).toVariant();
+ const QVariant p
+ = data.rawData().value(QStringLiteral("X-KDE-MessageViewer-Header-Order")).toVariant();
int order = -1;
if (p.isValid()) {
order = p.toInt();
@@ -155,7 +159,9 @@ void HeaderStylePluginManagerPrivate::initializePluginList()
mPluginList.insert(pos, info);
unique.insert(info.metaDataFileNameBaseName);
} else {
- qCWarning(MESSAGEVIEWER_LOG) << "Plugin " << data.name() << " doesn't have correction plugin version. It will not be loaded.";
+ qCWarning(MESSAGEVIEWER_LOG) << "Plugin " << data.name()
+ <<
+ " doesn't have correction plugin version. It will not be loaded.";
}
}
QVector<HeaderStylePluginInfo>::iterator end(mPluginList.end());
@@ -168,7 +174,8 @@ QVector<MessageViewer::HeaderStylePlugin *> HeaderStylePluginManagerPrivate::plu
{
QVector<MessageViewer::HeaderStylePlugin *> lst;
QVector<HeaderStylePluginInfo>::ConstIterator end(mPluginList.constEnd());
- for (QVector<HeaderStylePluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ for (QVector<HeaderStylePluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end;
+ ++it) {
if (auto plugin = (*it).plugin) {
lst << plugin;
}
@@ -180,17 +187,21 @@ void HeaderStylePluginManagerPrivate::loadPlugin(HeaderStylePluginInfo *item)
{
KPluginLoader pluginLoader(item->metaDataFileName);
if (pluginLoader.factory()) {
- item->plugin = pluginLoader.factory()->create<MessageViewer::HeaderStylePlugin>(q, QVariantList() << item->metaDataFileNameBaseName);
+ item->plugin = pluginLoader.factory()->create<MessageViewer::HeaderStylePlugin>(q,
+ QVariantList()
+ << item->metaDataFileNameBaseName);
item->plugin->setIsEnabled(item->isEnabled);
item->pluginData.mHasConfigureDialog = false;
mPluginDataList.append(item->pluginData);
}
}
-MessageViewer::HeaderStylePlugin *HeaderStylePluginManagerPrivate::pluginFromIdentifier(const QString &id)
+MessageViewer::HeaderStylePlugin *HeaderStylePluginManagerPrivate::pluginFromIdentifier(
+ const QString &id)
{
QVector<HeaderStylePluginInfo>::ConstIterator end(mPluginList.constEnd());
- for (QVector<HeaderStylePluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end; ++it) {
+ for (QVector<HeaderStylePluginInfo>::ConstIterator it = mPluginList.constBegin(); it != end;
+ ++it) {
if ((*it).pluginData.mIdentifier == id) {
return (*it).plugin;
}
@@ -204,8 +215,8 @@ HeaderStylePluginManager *HeaderStylePluginManager::self()
}
HeaderStylePluginManager::HeaderStylePluginManager(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::HeaderStylePluginManagerPrivate(this))
+ : QObject(parent)
+ , d(new MessageViewer::HeaderStylePluginManagerPrivate(this))
{
d->initializePluginList();
}
diff --git a/messageviewer/src/header/headerstylepluginmanager.h b/messageviewer/src/header/headerstylepluginmanager.h
index fc172e1..6543715 100644
--- a/messageviewer/src/header/headerstylepluginmanager.h
+++ b/messageviewer/src/header/headerstylepluginmanager.h
@@ -23,8 +23,7 @@
#include <QObject>
#include "messageviewer_export.h"
#include <PimCommon/PluginUtil>
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStylePlugin;
class HeaderStylePluginManagerPrivate;
class MESSAGEVIEWER_EXPORT HeaderStylePluginManager : public QObject
diff --git a/messageviewer/src/header/kxface.cpp b/messageviewer/src/header/kxface.cpp
index 927a04a..59859a8 100644
--- a/messageviewer/src/header/kxface.cpp
+++ b/messageviewer/src/header/kxface.cpp
@@ -102,23 +102,47 @@ QString KXFace::fromImage(const QImage &image)
int len = tmp.length();
for (int i = 0; i < len; ++i) {
switch (tmp[i].toLatin1()) {
- case '1': tmp[i] = '8'; break;
- case '2': tmp[i] = '4'; break;
- case '3': tmp[i] = 'c'; break;
- case '4': tmp[i] = '2'; break;
- case '5': tmp[i] = 'a'; break;
- case '7': tmp[i] = 'e'; break;
- case '8': tmp[i] = '1'; break;
+ case '1':
+ tmp[i] = '8';
+ break;
+ case '2':
+ tmp[i] = '4';
+ break;
+ case '3':
+ tmp[i] = 'c';
+ break;
+ case '4':
+ tmp[i] = '2';
+ break;
+ case '5':
+ tmp[i] = 'a';
+ break;
+ case '7':
+ tmp[i] = 'e';
+ break;
+ case '8':
+ tmp[i] = '1';
+ break;
case 'A':
- case 'a': tmp[i] = '5'; break;
+ case 'a':
+ tmp[i] = '5';
+ break;
case 'B':
- case 'b': tmp[i] = 'd'; break;
+ case 'b':
+ tmp[i] = 'd';
+ break;
case 'C':
- case 'c': tmp[i] = '3'; break;
+ case 'c':
+ tmp[i] = '3';
+ break;
case 'D':
- case 'd': tmp[i] = 'b'; break;
+ case 'd':
+ tmp[i] = 'b';
+ break;
case 'E':
- case 'e': tmp[i] = '7'; break;
+ case 'e':
+ tmp[i] = '7';
+ break;
}
if (i % 2) {
QChar t = tmp[i];
@@ -173,7 +197,7 @@ void KXFace::RevPush(const Prob *p)
if (NumProbs >= PIXELS * 2 - 1) {
longjmp(comp_env, ERR_INTERNAL);
}
- ProbBuf[NumProbs++] = (Prob *) p;
+ ProbBuf[NumProbs++] = (Prob *)p;
}
void KXFace::BigPush(Prob *p)
@@ -231,7 +255,7 @@ void KXFace::BigDiv(unsigned char a, unsigned char *r)
c = 0;
while (i--) {
c <<= BITSPERWORD;
- c += (COMP) * --w;
+ c += (COMP)*--w;
d = c / (COMP)a;
c = c % (COMP)a;
*w = (unsigned char)(d & WORDMASK);
@@ -271,7 +295,7 @@ void KXFace::BigMul(unsigned char a)
w = B.b_word;
c = 0;
while (i--) {
- c += (COMP) * w * (COMP)a;
+ c += (COMP)*w * (COMP)a;
*(w++) = (unsigned char)(c & WORDMASK);
c >>= BITSPERWORD;
}
@@ -299,7 +323,7 @@ void KXFace::BigAdd(unsigned char a)
w = B.b_word;
c = a;
while ((i < B.b_words) && c) {
- c += (COMP) * w;
+ c += (COMP)*w;
*w++ = (unsigned char)(c & WORDMASK);
c >>= BITSPERWORD;
++i;
@@ -323,7 +347,8 @@ QByteArray KXFace::WriteFace()
int i, j, bits, digits, words;
//int digsperword = DIGSPERWORD;
//int wordsperline = WORDSPERLINE;
- QByteArray t("#define noname_width 48\n#define noname_height 48\nstatic char noname_bits[] = {\n ");
+ QByteArray t(
+ "#define noname_width 48\n#define noname_height 48\nstatic char noname_bits[] = {\n ");
j = t.length() - 1;
s = F;
@@ -388,12 +413,12 @@ void KXFace::UnCompAll(char *fbuf)
void KXFace::UnCompress(char *f, int wid, int hei, int lev)
{
switch (BigPop(&levels[lev][0])) {
- case WHITE :
+ case WHITE:
return;
- case BLACK :
+ case BLACK:
PopGreys(f, wid, hei);
return;
- default :
+ default:
wid /= 2;
hei /= 2;
lev++;
@@ -456,7 +481,7 @@ void KXFace::ReadFace(char *fbuf)
t = s = fbuf;
for (i = strlen(s); i > 0; --i) {
- c = (int) * (s++);
+ c = (int)*(s++);
if ((c >= '0') && (c <= '9')) {
if (t >= fbuf + DIGITS) {
status = ERR_EXCESS;
@@ -520,11 +545,11 @@ void KXFace::Gen(char *f)
{
int m, l, k, j, i, h;
- for (j = 0; j < HEIGHT; ++j) {
- for (i = 0; i < WIDTH; ++i) {
+ for (j = 0; j < HEIGHT; ++j) {
+ for (i = 0; i < WIDTH; ++i) {
h = i + j * WIDTH;
k = 0;
- for (l = i - 2; l <= i + 2; ++l)
+ for (l = i - 2; l <= i + 2; ++l) {
for (m = j - 2; m <= j; ++m) {
if ((l >= i) && (m == j)) {
continue;
@@ -533,26 +558,36 @@ void KXFace::Gen(char *f)
k = *(f + l + m * WIDTH) ? k * 2 + 1 : k * 2;
}
}
+ }
switch (i) {
- case 1 :
+ case 1:
switch (j) {
- case 1 : GEN(g_22);
- case 2 : GEN(g_21);
- default : GEN(g_20);
+ case 1:
+ GEN(g_22);
+ case 2:
+ GEN(g_21);
+ default:
+ GEN(g_20);
}
break;
- case 2 :
+ case 2:
switch (j) {
- case 1 : GEN(g_12);
- case 2 : GEN(g_11);
- default : GEN(g_10);
+ case 1:
+ GEN(g_12);
+ case 2:
+ GEN(g_11);
+ default:
+ GEN(g_10);
}
break;
- case WIDTH - 1 :
+ case WIDTH - 1:
switch (j) {
- case 1 : GEN(g_42);
- case 2 : GEN(g_41);
- default : GEN(g_40);
+ case 1:
+ GEN(g_42);
+ case 2:
+ GEN(g_41);
+ default:
+ GEN(g_40);
}
break;
/* i runs from 0 to WIDTH-1, so case can never occur. I leave the code in
@@ -566,11 +601,14 @@ void KXFace::Gen(char *f)
}
break;
*/
- default :
+ default:
switch (j) {
- case 1 : GEN(g_02);
- case 2 : GEN(g_01);
- default : GEN(g_00);
+ case 1:
+ GEN(g_02);
+ case 2:
+ GEN(g_01);
+ default:
+ GEN(g_00);
}
break;
}
@@ -645,7 +683,7 @@ void KXFace::Compress(char *f, int wid, int hei, int lev)
int KXFace::AllWhite(char *f, int wid, int hei)
{
- return ((*f == 0) && Same(f, wid, hei));
+ return (*f == 0) && Same(f, wid, hei);
}
int KXFace::AllBlack(char *f, int wid, int hei)
@@ -653,11 +691,11 @@ int KXFace::AllBlack(char *f, int wid, int hei)
if (wid > 3) {
wid /= 2;
hei /= 2;
- return (AllBlack(f, wid, hei) && AllBlack(f + wid, wid, hei) &&
- AllBlack(f + WIDTH * hei, wid, hei) &&
- AllBlack(f + WIDTH * hei + wid, wid, hei));
+ return AllBlack(f, wid, hei) && AllBlack(f + wid, wid, hei)
+ && AllBlack(f + WIDTH * hei, wid, hei)
+ && AllBlack(f + WIDTH * hei + wid, wid, hei);
} else {
- return (*f || *(f + 1) || *(f + WIDTH) || *(f + WIDTH + 1));
+ return *f || *(f + 1) || *(f + WIDTH) || *(f + WIDTH + 1);
}
}
@@ -670,10 +708,11 @@ int KXFace::Same(char *f, int wid, int hei)
while (hei--) {
row = f;
x = wid;
- while (x--)
+ while (x--) {
if (*(row++) != val) {
- return (0);
+ return 0;
}
+ }
f += WIDTH;
}
return 1;
@@ -688,8 +727,8 @@ void KXFace::PushGreys(char *f, int wid, int hei)
PushGreys(f + wid, wid, hei);
PushGreys(f + WIDTH * hei, wid, hei);
PushGreys(f + WIDTH * hei + wid, wid, hei);
- } else
- RevPush(freqs + *f + 2 * *(f + 1) + 4 * *(f + WIDTH) +
- 8 * *(f + WIDTH + 1));
+ } else {
+ RevPush(freqs + *f + 2 * *(f + 1) + 4 * *(f + WIDTH)
+ +8 * *(f + WIDTH + 1));
+ }
}
-
diff --git a/messageviewer/src/header/kxface.h b/messageviewer/src/header/kxface.h
index ef4c73d..ff52be0 100644
--- a/messageviewer/src/header/kxface.h
+++ b/messageviewer/src/header/kxface.h
@@ -491,17 +491,17 @@ typedef struct prob {
} Prob;
static const Prob levels[4][3] = {
- {{1, 255}, {251, 0}, {4, 251}}, /* Top of tree almost always grey */
- {{1, 255}, {200, 0}, {55, 200}},
+ {{1, 255}, {251, 0}, {4, 251}}, /* Top of tree almost always grey */
+ {{1, 255}, {200, 0}, {55, 200}},
{{33, 223}, {159, 0}, {64, 159}},
- {{131, 0}, {0, 0}, {125, 131}} /* Grey disallowed at bottom */
+ {{131, 0}, {0, 0}, {125, 131}} /* Grey disallowed at bottom */
};
static const Prob freqs[16] = {
- {0, 0}, {38, 0}, {38, 38}, {13, 152},
- {38, 76}, {13, 165}, {13, 178}, {6, 230},
+ {0, 0}, {38, 0}, {38, 38}, {13, 152},
+ {38, 76}, {13, 165}, {13, 178}, {6, 230},
{38, 114}, {13, 191}, {13, 204}, {6, 236},
- {13, 217}, {6, 242}, {5, 248}, {3, 253}
+ {13, 217}, {6, 242}, {5, 248}, {3, 253}
};
static const char HexDigits[] = "0123456789ABCDEF";
@@ -509,9 +509,7 @@ static const char HexDigits[] = "0123456789ABCDEF";
class QImage;
class QString;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT KXFace : public QObject
{
Q_OBJECT
@@ -577,7 +575,6 @@ private:
int AllBlack(char *f, int wid, int hei);
int Same(register char *f, register int wid, register int hei);
void PushGreys(char *f, int wid, int hei);
-
};
}
#endif
diff --git a/messageviewer/src/header/plainheaderstyle.cpp b/messageviewer/src/header/plainheaderstyle.cpp
index 688ccb0..6154b8d 100644
--- a/messageviewer/src/header/plainheaderstyle.cpp
+++ b/messageviewer/src/header/plainheaderstyle.cpp
@@ -38,8 +38,8 @@ class MessageViewer::PlainHeaderStylePrivate
public:
PlainHeaderStylePrivate()
{
-
}
+
QString formatAllMessageHeaders(KMime::Message *message) const;
MessageViewer::HeaderStyleUtil mHeaderStyleUtil;
};
@@ -50,7 +50,8 @@ QString PlainHeaderStylePrivate::formatAllMessageHeaders(KMime::Message *message
KMime::Headers::Base *header = KMime::HeaderParsing::extractFirstHeader(head);
QString result;
while (header) {
- result += mHeaderStyleUtil.strToHtml(QLatin1String(header->type()) + QLatin1String(": ") + header->asUnicodeString());
+ result += mHeaderStyleUtil.strToHtml(QLatin1String(header->type()) + QLatin1String(
+ ": ") + header->asUnicodeString());
result += QLatin1String("<br />\n");
delete header;
header = KMime::HeaderParsing::extractFirstHeader(head);
@@ -60,10 +61,9 @@ QString PlainHeaderStylePrivate::formatAllMessageHeaders(KMime::Message *message
}
PlainHeaderStyle::PlainHeaderStyle()
- : HeaderStyle(),
- d(new MessageViewer::PlainHeaderStylePrivate)
+ : HeaderStyle()
+ , d(new MessageViewer::PlainHeaderStylePrivate)
{
-
}
PlainHeaderStyle::~PlainHeaderStyle()
@@ -85,7 +85,8 @@ QString PlainHeaderStyle::format(KMime::Message *message) const
// The direction of the header is determined according to the direction
// of the application layout.
- const QString dir = QApplication::isRightToLeft() ? QStringLiteral("rtl") : QStringLiteral("ltr");
+ 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
@@ -97,7 +98,7 @@ QString PlainHeaderStyle::format(KMime::Message *message) const
QString headerStr;
if (strategy->headersToDisplay().isEmpty()
- && strategy->defaultPolicy() == HeaderStrategy::Display) {
+ && 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\">");
@@ -109,51 +110,74 @@ QString PlainHeaderStyle::format(KMime::Message *message) const
//case HdrLong:
if (strategy->showHeader(QStringLiteral("subject"))) {
- const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces | KTextToHTML::ReplaceSmileys;
+ const KTextToHTML::Options flags = KTextToHTML::PreserveSpaces
+ | KTextToHTML::ReplaceSmileys;
- headerStr += QStringLiteral("<div dir=\"%1\"><b style=\"font-size:130%\">").arg(subjectDir) +
- d->mHeaderStyleUtil.subjectString(message, flags) + QLatin1String("</b></div>\n");
+ headerStr += QStringLiteral("<div dir=\"%1\"><b style=\"font-size:130%\">").arg(subjectDir)
+ +d->mHeaderStyleUtil.subjectString(message, flags) + QLatin1String(
+ "</b></div>\n");
}
if (strategy->showHeader(QStringLiteral("date"))) {
- headerStr.append(i18n("Date: ") + d->mHeaderStyleUtil.strToHtml(d->mHeaderStyleUtil.dateString(message, isPrinting(), /* short = */ MessageViewer::HeaderStyleUtil::CustomDate)) + QLatin1String("<br/>\n"));
+ headerStr.append(i18n("Date: ")
+ + d->mHeaderStyleUtil.strToHtml(d->mHeaderStyleUtil.dateString(message,
+ isPrinting(),
+ /* short = */
+ MessageViewer
+ ::
+ HeaderStyleUtil::CustomDate)) + QLatin1String("<br/>\n"));
}
if (strategy->showHeader(QStringLiteral("from"))) {
- headerStr.append(i18n("From: ") +
- StringUtil::emailAddrAsAnchor(message->from(), StringUtil::DisplayFullAddress, QString(), StringUtil::ShowLink));
- if (!vCardName().isEmpty())
- headerStr.append(QLatin1String("&nbsp;&nbsp;<a href=\"") + vCardName() +
- QLatin1String("\">") + i18n("[vCard]") + QLatin1String("</a>"));
+ headerStr.append(i18n("From: ")
+ +StringUtil::emailAddrAsAnchor(message->from(),
+ StringUtil::DisplayFullAddress, QString(),
+ StringUtil::ShowLink));
+ if (!vCardName().isEmpty()) {
+ headerStr.append(QLatin1String("&nbsp;&nbsp;<a href=\"") + vCardName()
+ +QLatin1String("\">") + i18n("[vCard]") + QLatin1String("</a>"));
+ }
if (strategy->showHeader(QStringLiteral("organization"))
- && message->organization(false))
- headerStr.append(QLatin1String("&nbsp;&nbsp;(") +
- d->mHeaderStyleUtil.strToHtml(message->organization()->asUnicodeString()) + QLatin1Char(')'));
+ && message->organization(false)) {
+ headerStr.append(QLatin1String("&nbsp;&nbsp;(")
+ +d->mHeaderStyleUtil.strToHtml(
+ message->organization()->asUnicodeString()) + QLatin1Char(')'));
+ }
headerStr.append(QLatin1String("<br/>\n"));
}
- if (strategy->showHeader(QStringLiteral("to")))
- headerStr.append(i18nc("To-field of the mailheader.", "To: ") +
- StringUtil::emailAddrAsAnchor(message->to(), StringUtil::DisplayFullAddress) + QLatin1String("<br/>\n"));
+ if (strategy->showHeader(QStringLiteral("to"))) {
+ headerStr.append(i18nc("To-field of the mailheader.", "To: ")
+ +StringUtil::emailAddrAsAnchor(
+ message->to(),
+ StringUtil::DisplayFullAddress)
+ + QLatin1String("<br/>\n"));
+ }
if (strategy->showHeader(QStringLiteral("cc")) && message->cc(false)) {
- const QString str = StringUtil::emailAddrAsAnchor(message->cc(), StringUtil::DisplayFullAddress);
+ const QString str = StringUtil::emailAddrAsAnchor(
+ message->cc(), StringUtil::DisplayFullAddress);
if (!str.isEmpty()) {
headerStr.append(i18n("CC: ") + str + QLatin1String("<br/>\n"));
}
}
if (strategy->showHeader(QStringLiteral("bcc")) && message->bcc(false)) {
- const QString str = StringUtil::emailAddrAsAnchor(message->bcc(), StringUtil::DisplayFullAddress);
+ const QString str = StringUtil::emailAddrAsAnchor(
+ message->bcc(), StringUtil::DisplayFullAddress);
if (!str.isEmpty()) {
headerStr.append(i18n("BCC: ") + str + QLatin1String("<br/>\n"));
}
}
- if (strategy->showHeader(QStringLiteral("reply-to")) && message->replyTo(false))
- headerStr.append(i18n("Reply to: ") +
- StringUtil::emailAddrAsAnchor(message->replyTo(), StringUtil::DisplayFullAddress) + QLatin1String("<br/>\n"));
+ if (strategy->showHeader(QStringLiteral("reply-to")) && message->replyTo(false)) {
+ headerStr.append(i18n("Reply to: ")
+ +StringUtil::emailAddrAsAnchor(
+ message->replyTo(),
+ StringUtil::DisplayFullAddress)
+ + QLatin1String("<br/>\n"));
+ }
headerStr += QLatin1String("</div>\n");
@@ -164,4 +188,3 @@ const char *MessageViewer::PlainHeaderStyle::name() const
{
return "plain";
}
-
diff --git a/messageviewer/src/header/plainheaderstyle.h b/messageviewer/src/header/plainheaderstyle.h
index 2127ebf..3147291 100644
--- a/messageviewer/src/header/plainheaderstyle.h
+++ b/messageviewer/src/header/plainheaderstyle.h
@@ -22,8 +22,7 @@
#include "messageviewer/headerstyle.h"
#include "messageviewer_export.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class PlainHeaderStylePrivate;
class MESSAGEVIEWER_EXPORT PlainHeaderStyle : public HeaderStyle
{
diff --git a/messageviewer/src/header/richheaderstrategy.cpp b/messageviewer/src/header/richheaderstrategy.cpp
index 1aa4b87..7a5c9b7 100644
--- a/messageviewer/src/header/richheaderstrategy.cpp
+++ b/messageviewer/src/header/richheaderstrategy.cpp
@@ -36,13 +36,11 @@
using namespace MessageViewer;
RichHeaderStrategy::RichHeaderStrategy()
- : HeaderStrategy(),
- mHeadersToDisplay(stringList(richHeaders, numRichHeaders))
+ : HeaderStrategy()
+ , mHeadersToDisplay(stringList(richHeaders, numRichHeaders))
{
-
}
RichHeaderStrategy::~RichHeaderStrategy()
{
-
}
diff --git a/messageviewer/src/header/richheaderstrategy.h b/messageviewer/src/header/richheaderstrategy.h
index 9eb476b..a954b44 100644
--- a/messageviewer/src/header/richheaderstrategy.h
+++ b/messageviewer/src/header/richheaderstrategy.h
@@ -37,8 +37,7 @@
#include "messageviewer_export.h"
#include <QStringList>
//
-namespace MessageViewer
-{
+namespace MessageViewer {
//
// RichHeaderStrategy:
// Date, Subject, From, To, CC, ### what exactly?
@@ -48,7 +47,7 @@ static const char *const richHeaders[] = {
"organization", "organisation", "reply-to",
"user-agent", "x-mailer", "x-bugzilla-url", "disposition-notification-to"
};
-static const int numRichHeaders = sizeof richHeaders / sizeof * richHeaders;
+static const int numRichHeaders = sizeof richHeaders / sizeof *richHeaders;
class MESSAGEVIEWER_EXPORT RichHeaderStrategy : public HeaderStrategy
{
@@ -66,6 +65,7 @@ public:
{
return mHeadersToDisplay;
}
+
DefaultPolicy defaultPolicy() const override
{
return Hide;
@@ -74,7 +74,6 @@ public:
private:
const QStringList mHeadersToDisplay;
};
-
}
#endif
diff --git a/messageviewer/src/htmlwriter/autotests/webengineembedparttest.cpp b/messageviewer/src/htmlwriter/autotests/webengineembedparttest.cpp
index ca3c05a..2e85e0c 100644
--- a/messageviewer/src/htmlwriter/autotests/webengineembedparttest.cpp
+++ b/messageviewer/src/htmlwriter/autotests/webengineembedparttest.cpp
@@ -22,12 +22,10 @@
WebEngineEmbedPartTest::WebEngineEmbedPartTest(QObject *parent)
: QObject(parent)
{
-
}
WebEngineEmbedPartTest::~WebEngineEmbedPartTest()
{
-
}
void WebEngineEmbedPartTest::shouldHaveDefaultValue()
diff --git a/messageviewer/src/htmlwriter/autotests/webengineparthtmlwritertest.cpp b/messageviewer/src/htmlwriter/autotests/webengineparthtmlwritertest.cpp
index a4539cf..853607c 100644
--- a/messageviewer/src/htmlwriter/autotests/webengineparthtmlwritertest.cpp
+++ b/messageviewer/src/htmlwriter/autotests/webengineparthtmlwritertest.cpp
@@ -23,12 +23,10 @@
WebEnginePartHtmlWriterTest::WebEnginePartHtmlWriterTest(QObject *parent)
: QObject(parent)
{
-
}
WebEnginePartHtmlWriterTest::~WebEnginePartHtmlWriterTest()
{
-
}
void WebEnginePartHtmlWriterTest::removeScriptInHtml_data()
@@ -36,31 +34,56 @@ void WebEnginePartHtmlWriterTest::removeScriptInHtml_data()
QTest::addColumn<QString>("input");
QTest::addColumn<QString>("output");
QTest::newRow("noscript") << QStringLiteral("<a>boo</a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("onescript") << QStringLiteral("<a>boo<script>alert(1)</script></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("onescriptwithattribute") << QStringLiteral("<a>boo<script type=\"foo\">alert(1)</script></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("severalscriptwithattribute") << QStringLiteral("<p>foo</p><script>a</script><a>boo<script type=\"foo\">alert(1)</script></a>") << QStringLiteral("<p>foo</p><a>boo</a>");
- QTest::newRow("scriptwithspace") << QStringLiteral("<a>boo<script type=\"foo\" >alert(1)</script ></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("scriptwithremoveaccess") << QStringLiteral("<a>boo<script src=\"http://foo\"/></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("onescript") << QStringLiteral("<a>boo<script>alert(1)</script></a>")
+ << QStringLiteral("<a>boo</a>");
+ QTest::newRow("onescriptwithattribute") << QStringLiteral(
+ "<a>boo<script type=\"foo\">alert(1)</script></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("severalscriptwithattribute") << QStringLiteral(
+ "<p>foo</p><script>a</script><a>boo<script type=\"foo\">alert(1)</script></a>")
+ << QStringLiteral("<p>foo</p><a>boo</a>");
+ QTest::newRow("scriptwithspace") << QStringLiteral(
+ "<a>boo<script type=\"foo\" >alert(1)</script ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("scriptwithremoveaccess") << QStringLiteral(
+ "<a>boo<script src=\"http://foo\"/></a>") << QStringLiteral("<a>boo</a>");
QTest::newRow("empty") << QString() << QString();
//MultiLine
- QTest::newRow("multiline") << QStringLiteral("<a>boo<script>\nalert(1)</script></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("multiline-scriptwithspace") << QStringLiteral("<a>boo<script type=\"foo\" >\nalert(1)\n</script ></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("multiline-severalscriptwithattribute") << QStringLiteral("<p>foo</p><script>\na\n</script><a>boo<script type=\"foo\">\nalert(1)</script></a>") << QStringLiteral("<p>foo</p><a>boo</a>");
- QTest::newRow("multiline-scriptwithspace") << QStringLiteral("<a>boo<script type=\"foo\" >\nalert(1)\nbla\nsl</script ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline") << QStringLiteral("<a>boo<script>\nalert(1)</script></a>")
+ << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline-scriptwithspace") << QStringLiteral(
+ "<a>boo<script type=\"foo\" >\nalert(1)\n</script ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline-severalscriptwithattribute") << QStringLiteral(
+ "<p>foo</p><script>\na\n</script><a>boo<script type=\"foo\">\nalert(1)</script></a>")
+ << QStringLiteral("<p>foo</p><a>boo</a>");
+ QTest::newRow("multiline-scriptwithspace") << QStringLiteral(
+ "<a>boo<script type=\"foo\" >\nalert(1)\nbla\nsl</script ></a>") << QStringLiteral(
+ "<a>boo</a>");
//Insensitive case
- QTest::newRow("onescript-insensitive") << QStringLiteral("<a>boo<SCRIPT>alert(1)</script></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("onescriptwithattribute-insensitive") << QStringLiteral("<a>boo<SCRIPt type=\"foo\">alert(1)</SCRIPT></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("severalscriptwithattribute-insensitive") << QStringLiteral("<p>foo</p><script>a</SCRIPT><a>boo<SCRIPT type=\"foo\">alert(1)</script></a>") << QStringLiteral("<p>foo</p><a>boo</a>");
- QTest::newRow("scriptwithspace-insensitive") << QStringLiteral("<a>boo<SCRIPT type=\"foo\" >alert(1)</SCRIPT ></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("scriptwithremoveaccess-insensitive") << QStringLiteral("<a>boo<SCRIPT src=\"http://foo\"/></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("onescript-insensitive")
+ << QStringLiteral("<a>boo<SCRIPT>alert(1)</script></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("onescriptwithattribute-insensitive") << QStringLiteral(
+ "<a>boo<SCRIPt type=\"foo\">alert(1)</SCRIPT></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("severalscriptwithattribute-insensitive") << QStringLiteral(
+ "<p>foo</p><script>a</SCRIPT><a>boo<SCRIPT type=\"foo\">alert(1)</script></a>")
+ << QStringLiteral("<p>foo</p><a>boo</a>");
+ QTest::newRow("scriptwithspace-insensitive") << QStringLiteral(
+ "<a>boo<SCRIPT type=\"foo\" >alert(1)</SCRIPT ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("scriptwithremoveaccess-insensitive") << QStringLiteral(
+ "<a>boo<SCRIPT src=\"http://foo\"/></a>") << QStringLiteral("<a>boo</a>");
//MultiLine insensitive
- QTest::newRow("multiline-insensitive") << QStringLiteral("<a>boo<sCript>\nalert(1)</Script></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("multiline-scriptwithspace-insensitive") << QStringLiteral("<a>boo<SCRipT type=\"foo\" >\nalert(1)\n</script ></a>") << QStringLiteral("<a>boo</a>");
- QTest::newRow("multiline-severalscriptwithattribute-insensitive") << QStringLiteral("<p>foo</p><SCRIPT>\na\n</script><a>boo<script type=\"foo\">\nalert(1)</script></a>") << QStringLiteral("<p>foo</p><a>boo</a>");
- QTest::newRow("multiline-scriptwithspace-insensitive") << QStringLiteral("<a>boo<SCRIPT type=\"foo\" >\nalert(1)\nbla\nsl</script ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline-insensitive")
+ << QStringLiteral("<a>boo<sCript>\nalert(1)</Script></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline-scriptwithspace-insensitive") << QStringLiteral(
+ "<a>boo<SCRipT type=\"foo\" >\nalert(1)\n</script ></a>") << QStringLiteral("<a>boo</a>");
+ QTest::newRow("multiline-severalscriptwithattribute-insensitive") << QStringLiteral(
+ "<p>foo</p><SCRIPT>\na\n</script><a>boo<script type=\"foo\">\nalert(1)</script></a>")
+ << QStringLiteral(
+ "<p>foo</p><a>boo</a>");
+ QTest::newRow("multiline-scriptwithspace-insensitive") << QStringLiteral(
+ "<a>boo<SCRIPT type=\"foo\" >\nalert(1)\nbla\nsl</script ></a>") << QStringLiteral(
+ "<a>boo</a>");
}
void WebEnginePartHtmlWriterTest::removeScriptInHtml()
diff --git a/messageviewer/src/htmlwriter/teehtmlwriter.cpp b/messageviewer/src/htmlwriter/teehtmlwriter.cpp
index b32afbc..df2ca38 100644
--- a/messageviewer/src/htmlwriter/teehtmlwriter.cpp
+++ b/messageviewer/src/htmlwriter/teehtmlwriter.cpp
@@ -31,9 +31,7 @@
#include "teehtmlwriter.h"
-namespace MessageViewer
-{
-
+namespace MessageViewer {
TeeHtmlWriter::TeeHtmlWriter(HtmlWriter *writer1, MimeTreeParser::HtmlWriter *writer2)
: MimeTreeParser::HtmlWriter()
{
@@ -114,5 +112,8 @@ void TeeHtmlWriter::embedPart(const QByteArray &contentId, const QString &url)
(*it)->embedPart(contentId, url);
}
}
-void TeeHtmlWriter::extraHead(const QString &) {}
+
+void TeeHtmlWriter::extraHead(const QString &)
+{
+}
} //
diff --git a/messageviewer/src/htmlwriter/teehtmlwriter.h b/messageviewer/src/htmlwriter/teehtmlwriter.h
index 128138d..24894a9 100644
--- a/messageviewer/src/htmlwriter/teehtmlwriter.h
+++ b/messageviewer/src/htmlwriter/teehtmlwriter.h
@@ -38,9 +38,7 @@
class QString;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/** @short A HtmlWriter that dispatches all calls to a list of other HtmlWriters
@author Marc Mutz <[email protected]>
**/
@@ -69,7 +67,6 @@ private:
/** We own the HtmlWriters added to us! */
QList<HtmlWriter *> mWriters;
};
-
} // namespace MessageViewer
#endif // __MESSAGEVIEWER_TEEHTMLWRITER_H__
diff --git a/messageviewer/src/htmlwriter/webengineembedpart.cpp b/messageviewer/src/htmlwriter/webengineembedpart.cpp
index 9b37011..86b999a 100644
--- a/messageviewer/src/htmlwriter/webengineembedpart.cpp
+++ b/messageviewer/src/htmlwriter/webengineembedpart.cpp
@@ -40,12 +40,10 @@ Q_GLOBAL_STATIC(WebEngineEmbedPartInstancePrivate, sInstance)
WebEngineEmbedPart::WebEngineEmbedPart(QObject *parent)
: QObject(parent)
{
-
}
WebEngineEmbedPart::~WebEngineEmbedPart()
{
-
}
WebEngineEmbedPart *WebEngineEmbedPart::self()
diff --git a/messageviewer/src/htmlwriter/webengineembedpart.h b/messageviewer/src/htmlwriter/webengineembedpart.h
index 403911b..5acd1ac 100644
--- a/messageviewer/src/htmlwriter/webengineembedpart.h
+++ b/messageviewer/src/htmlwriter/webengineembedpart.h
@@ -20,8 +20,7 @@
#include <QObject>
#include <QMap>
-namespace MessageViewer
-{
+namespace MessageViewer {
class WebEngineEmbedPart : public QObject
{
Q_OBJECT
diff --git a/messageviewer/src/htmlwriter/webengineparthtmlwriter.cpp b/messageviewer/src/htmlwriter/webengineparthtmlwriter.cpp
index e23e995..a100a28 100644
--- a/messageviewer/src/htmlwriter/webengineparthtmlwriter.cpp
+++ b/messageviewer/src/htmlwriter/webengineparthtmlwriter.cpp
@@ -29,8 +29,10 @@
using namespace MessageViewer;
WebEnginePartHtmlWriter::WebEnginePartHtmlWriter(MailWebEngineView *view, QObject *parent)
- : QObject(parent), MimeTreeParser::HtmlWriter(),
- mHtmlView(view), mState(Ended)
+ : QObject(parent)
+ , MimeTreeParser::HtmlWriter()
+ , mHtmlView(view)
+ , mState(Ended)
{
assert(view);
}
@@ -100,8 +102,7 @@ void WebEnginePartHtmlWriter::flush()
end();
}
-void WebEnginePartHtmlWriter::embedPart(const QByteArray &contentId,
- const QString &contentURL)
+void WebEnginePartHtmlWriter::embedPart(const QByteArray &contentId, const QString &contentURL)
{
MessageViewer::WebEngineEmbedPart::self()->addEmbedPart(contentId, contentURL);
}
diff --git a/messageviewer/src/htmlwriter/webengineparthtmlwriter.h b/messageviewer/src/htmlwriter/webengineparthtmlwriter.h
index 5addfc9..04d2da9 100644
--- a/messageviewer/src/htmlwriter/webengineparthtmlwriter.h
+++ b/messageviewer/src/htmlwriter/webengineparthtmlwriter.h
@@ -24,14 +24,11 @@
#include <QByteArray>
#include <QMap>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MailWebEngineView;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class WebEnginePartHtmlWriter : public QObject, public MimeTreeParser::HtmlWriter
{
Q_OBJECT
@@ -64,6 +61,5 @@ private:
Ended
} mState;
};
-
}
#endif // WEBENGINEPARTHTMLWRITER_H
diff --git a/messageviewer/src/interfaces/bodyparturlhandler.h b/messageviewer/src/interfaces/bodyparturlhandler.h
index aefcfcd..f402186 100644
--- a/messageviewer/src/interfaces/bodyparturlhandler.h
+++ b/messageviewer/src/interfaces/bodyparturlhandler.h
@@ -36,24 +36,18 @@
class QString;
class QPoint;
-namespace MimeTreeParser
-{
-namespace Interface
-{
+namespace MimeTreeParser {
+namespace Interface {
class BodyPart;
}
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class Viewer;
}
-namespace MimeTreeParser
-{
-namespace Interface
-{
-
+namespace MimeTreeParser {
+namespace Interface {
/**
* @short An interface to body part reader link handlers
* @author Marc Mutz <[email protected]>
@@ -81,7 +75,9 @@ namespace Interface
class BodyPartURLHandler
{
public:
- virtual ~BodyPartURLHandler() {}
+ virtual ~BodyPartURLHandler()
+ {
+ }
/** Called when LMB-clicking on a link in the reader. Should
start processing equivalent to "opening" the link.
@@ -89,7 +85,9 @@ public:
@return true if the click was handled by this handler, false
otherwise.
*/
- virtual bool handleClick(MessageViewer::Viewer *viewerInstance, MimeTreeParser::Interface::BodyPart *part, const QString &path) const = 0;
+ virtual bool handleClick(MessageViewer::Viewer *viewerInstance,
+ MimeTreeParser::Interface::BodyPart *part,
+ const QString &path) const = 0;
/** Called when RMB-clicking on a link in the reader. Should
show a context menu at the specified point with the
@@ -98,7 +96,8 @@ public:
@return true if the right-click was handled by this handler,
false otherwise.
*/
- virtual bool handleContextMenuRequest(MimeTreeParser::Interface::BodyPart *part, const QString &path, const QPoint &p) const = 0;
+ virtual bool handleContextMenuRequest(MimeTreeParser::Interface::BodyPart *part,
+ const QString &path, const QPoint &p) const = 0;
/** Called when hovering over a link.
@@ -106,12 +105,10 @@ public:
hovering over this link or QString() if the link was not
handled by this handler.
*/
- virtual QString statusBarMessage(MimeTreeParser::Interface::BodyPart *part, const QString &path) const = 0;
+ virtual QString statusBarMessage(MimeTreeParser::Interface::BodyPart *part,
+ const QString &path) const = 0;
};
-
} // namespace Interface
-
}
#endif // __KMAIL_INTERFACES_BODYPARTURLHANDLER_H__
-
diff --git a/messageviewer/src/interfaces/urlhandler.h b/messageviewer/src/interfaces/urlhandler.h
index ce7b51c..b3b53de 100644
--- a/messageviewer/src/interfaces/urlhandler.h
+++ b/messageviewer/src/interfaces/urlhandler.h
@@ -37,14 +37,11 @@
class QString;
class QPoint;
-namespace MessasgeViewer
-{
+namespace MessasgeViewer {
class ViewerPrivate;
}
-namespace MimeTreeParser
-{
-
+namespace MimeTreeParser {
/**
* @short An interface to reader link handlers
* @author Marc Mutz <[email protected]>
@@ -53,7 +50,9 @@ namespace MimeTreeParser
class URLHandler
{
public:
- virtual ~URLHandler() {}
+ virtual ~URLHandler()
+ {
+ }
/**
* Called when LMB-clicking on a link in the reader. Should start
@@ -72,7 +71,8 @@ public:
* @return true if the right-click was handled by this
* URLHandler, false otherwise.
*/
- virtual bool handleContextMenuRequest(const QUrl &url, const QPoint &p, MessageViewer::ViewerPrivate *w) const = 0;
+ virtual bool handleContextMenuRequest(const QUrl &url, const QPoint &p,
+ MessageViewer::ViewerPrivate *w) const = 0;
/**
* Called when hovering over a link.
@@ -115,8 +115,6 @@ public:
return false;
}
};
-
}
#endif // __KMAIL_INTERFACES_URLHANDLER_H__
-
diff --git a/messageviewer/src/job/attachmenteditjob.cpp b/messageviewer/src/job/attachmenteditjob.cpp
index 2e9ee89..e1d6585 100644
--- a/messageviewer/src/job/attachmenteditjob.cpp
+++ b/messageviewer/src/job/attachmenteditjob.cpp
@@ -30,11 +30,10 @@
using namespace MessageViewer;
AttachmentEditJob::AttachmentEditJob(QObject *parent)
- : QObject(parent),
- mShowWarning(true),
- mMainWindow(nullptr)
+ : QObject(parent)
+ , mShowWarning(true)
+ , mMainWindow(nullptr)
{
-
}
AttachmentEditJob::~AttachmentEditJob()
@@ -45,10 +44,16 @@ AttachmentEditJob::~AttachmentEditJob()
bool AttachmentEditJob::addAttachment(KMime::Content *node, bool showWarning)
{
if (showWarning && KMessageBox::warningContinueCancel(mMainWindow,
- i18n("Modifying an attachment might invalidate any digital signature on this message."),
- i18n("Edit Attachment"), KGuiItem(i18n("Edit"), QStringLiteral("document-properties")), KStandardGuiItem::cancel(),
- QStringLiteral("EditAttachmentSignatureWarning"))
- != KMessageBox::Continue) {
+ i18n(
+ "Modifying an attachment might invalidate any digital signature on this message."),
+ i18n("Edit Attachment"),
+ KGuiItem(i18n("Edit"),
+ QStringLiteral(
+ "document-properties")),
+ KStandardGuiItem::cancel(),
+ QStringLiteral(
+ "EditAttachmentSignatureWarning"))
+ != KMessageBox::Continue) {
return false;
}
@@ -61,9 +66,10 @@ bool AttachmentEditJob::addAttachment(KMime::Content *node, bool showWarning)
file.write(node->decodedContent());
file.flush();
- EditorWatcher *watcher =
- new EditorWatcher(QUrl::fromLocalFile(file.fileName()), QLatin1String(node->contentType()->mimeType()),
- MessageViewer::EditorWatcher::NoOpenWithDialog, this, mMainWindow);
+ EditorWatcher *watcher
+ = new EditorWatcher(QUrl::fromLocalFile(file.fileName()),
+ QLatin1String(node->contentType()->mimeType()),
+ MessageViewer::EditorWatcher::NoOpenWithDialog, this, mMainWindow);
mEditorWatchers[ watcher ] = node;
connect(watcher, &EditorWatcher::editDone, this, &AttachmentEditJob::slotAttachmentEditDone);
@@ -123,7 +129,8 @@ void AttachmentEditJob::canDeleteJob()
}
}
-void AttachmentEditJob::removeEditorWatcher(MessageViewer::EditorWatcher *editorWatcher, const QString &name)
+void AttachmentEditJob::removeEditorWatcher(MessageViewer::EditorWatcher *editorWatcher,
+ const QString &name)
{
mEditorWatchers.remove(editorWatcher);
QFile::remove(name);
@@ -133,4 +140,3 @@ void AttachmentEditJob::setMessage(const KMime::Message::Ptr &message)
{
mMessage = message;
}
-
diff --git a/messageviewer/src/job/attachmenteditjob.h b/messageviewer/src/job/attachmenteditjob.h
index 9f459e6..5c85e8f 100644
--- a/messageviewer/src/job/attachmenteditjob.h
+++ b/messageviewer/src/job/attachmenteditjob.h
@@ -24,12 +24,10 @@
#include <AkonadiCore/Item>
#include <QHash>
#include <kmime/kmime_message.h>
-namespace KMime
-{
+namespace KMime {
class Content;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class EditorWatcher;
class AttachmentEditJob : public QObject
{
diff --git a/messageviewer/src/job/modifymessagedisplayformatjob.cpp b/messageviewer/src/job/modifymessagedisplayformatjob.cpp
index ae69f08..f4aea99 100644
--- a/messageviewer/src/job/modifymessagedisplayformatjob.cpp
+++ b/messageviewer/src/job/modifymessagedisplayformatjob.cpp
@@ -26,17 +26,15 @@
using namespace MessageViewer;
ModifyMessageDisplayFormatJob::ModifyMessageDisplayFormatJob(QObject *parent)
- : QObject(parent),
- mMessageFormat(Viewer::UseGlobalSetting),
- mRemoteContent(false),
- mResetFormat(false)
+ : QObject(parent)
+ , mMessageFormat(Viewer::UseGlobalSetting)
+ , mRemoteContent(false)
+ , mResetFormat(false)
{
-
}
ModifyMessageDisplayFormatJob::~ModifyMessageDisplayFormatJob()
{
-
}
void ModifyMessageDisplayFormatJob::setRemoteContent(bool remote)
@@ -57,7 +55,7 @@ void ModifyMessageDisplayFormatJob::setResetFormat(bool resetFormat)
void ModifyMessageDisplayFormatJob::start()
{
if (mMessageItem.isValid()) {
- if (mResetFormat) {
+ if (mResetFormat) {
resetDisplayFormat();
} else {
modifyDisplayFormat();
@@ -84,7 +82,9 @@ void ModifyMessageDisplayFormatJob::resetDisplayFormat()
void ModifyMessageDisplayFormatJob::modifyDisplayFormat()
{
- MessageViewer::MessageDisplayFormatAttribute *attr = mMessageItem.attribute<MessageViewer::MessageDisplayFormatAttribute>(Akonadi::Item::AddIfMissing);
+ MessageViewer::MessageDisplayFormatAttribute *attr
+ = mMessageItem.attribute<MessageViewer::MessageDisplayFormatAttribute>(
+ Akonadi::Item::AddIfMissing);
attr->setRemoteContent(mRemoteContent);
attr->setMessageFormat(mMessageFormat);
Akonadi::ItemModifyJob *modify = new Akonadi::ItemModifyJob(mMessageItem);
diff --git a/messageviewer/src/job/modifymessagedisplayformatjob.h b/messageviewer/src/job/modifymessagedisplayformatjob.h
index f277970..e68a8cf 100644
--- a/messageviewer/src/job/modifymessagedisplayformatjob.h
+++ b/messageviewer/src/job/modifymessagedisplayformatjob.h
@@ -22,8 +22,7 @@
#include <QObject>
#include "viewer/viewer_p.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class ModifyMessageDisplayFormatJob : public QObject
{
Q_OBJECT
diff --git a/messageviewer/src/messagepartthemes/default/autotests/converthtmltoplaintexttest.cpp b/messageviewer/src/messagepartthemes/default/autotests/converthtmltoplaintexttest.cpp
index 3a802ee..e83f449 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/converthtmltoplaintexttest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/converthtmltoplaintexttest.cpp
@@ -25,12 +25,10 @@
ConvertHtmlToPlainTextTest::ConvertHtmlToPlainTextTest(QObject *parent)
: QObject(parent)
{
-
}
ConvertHtmlToPlainTextTest::~ConvertHtmlToPlainTextTest()
{
-
}
void ConvertHtmlToPlainTextTest::shouldHaveDefaultValue()
@@ -61,10 +59,14 @@ void ConvertHtmlToPlainTextTest::shouldConvertToPlainText_data()
QTest::addColumn<QString>("inputText");
QTest::addColumn<QString>("convertedText");
QTest::newRow("plainText") << "foo" << "foo\n";
- QTest::newRow("htmlText") << "<html><body>Hi! This is a KDE test</body></html>" << "Hi! This is a KDE test\n";
- QTest::newRow("htmlTextWithBold") << "<html><body><b>Hi!</b> This is a KDE test</body></html>" << "*Hi!* This is a KDE test\n";
- QTest::newRow("htmlTextWithH1") << "<html><body><h1>Hi!</h1> This is a KDE test</body></html>" << "*Hi!*\nThis is a KDE test\n";
- QTest::newRow("htmlTextWithUnderLine") << "<html><body><u>Hi!</u> This is a KDE test</body></html>" << "_Hi!_ This is a KDE test\n";
+ QTest::newRow("htmlText") << "<html><body>Hi! This is a KDE test</body></html>"
+ << "Hi! This is a KDE test\n";
+ QTest::newRow("htmlTextWithBold")
+ << "<html><body><b>Hi!</b> This is a KDE test</body></html>" << "*Hi!* This is a KDE test\n";
+ QTest::newRow("htmlTextWithH1")
+ << "<html><body><h1>Hi!</h1> This is a KDE test</body></html>" << "*Hi!*\nThis is a KDE test\n";
+ QTest::newRow("htmlTextWithUnderLine")
+ << "<html><body><u>Hi!</u> This is a KDE test</body></html>" << "_Hi!_ This is a KDE test\n";
}
void ConvertHtmlToPlainTextTest::shouldConvertToPlainText()
diff --git a/messageviewer/src/messagepartthemes/default/autotests/objecttreeparsertest.cpp b/messageviewer/src/messagepartthemes/default/autotests/objecttreeparsertest.cpp
index 230f7bf..cf0b43e 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/objecttreeparsertest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/objecttreeparsertest.cpp
@@ -69,14 +69,14 @@ void ObjectTreeParserTester::test_parsePlainMessage()
// Test that the charset of messages without an explicit charset declaration
// is correct
- content =
- "From: Thomas McGuire <[email protected]>\n"
- "Subject: Plain Message Test\n"
- "Date: Wed, 5 Aug 2009 10:58:27 +0200\n"
- "MIME-Version: 1.0\n"
- "Content-Type: text/plain;\n"
- "\n"
- "This is the message text.\n";
+ content
+ = "From: Thomas McGuire <[email protected]>\n"
+ "Subject: Plain Message Test\n"
+ "Date: Wed, 5 Aug 2009 10:58:27 +0200\n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain;\n"
+ "\n"
+ "This is the message text.\n";
msg->setContent(content);
msg->parse();
ObjectTreeParser otp2(&emptySource);
@@ -86,7 +86,8 @@ void ObjectTreeParserTester::test_parsePlainMessage()
void ObjectTreeParserTester::test_parseEncapsulatedMessage()
{
- KMime::Message::Ptr msg = Test::readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox"));
+ KMime::Message::Ptr msg
+ = Test::readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox"));
QCOMPARE(msg->subject()->as7BitString(false).constData(), "Fwd: Test with attachment");
QCOMPARE(msg->contents().size(), 2);
@@ -123,7 +124,8 @@ void ObjectTreeParserTester::test_parseEncapsulatedMessage()
void ObjectTreeParserTester::test_missingContentTypeHeader()
{
KMime::Message::Ptr msg = Test::readAndParseMail(QStringLiteral("no-content-type.mbox"));
- QCOMPARE(msg->subject()->as7BitString(false).constData(), "Simple Mail Without Content-Type Header");
+ QCOMPARE(msg->subject()->as7BitString(
+ false).constData(), "Simple Mail Without Content-Type Header");
QCOMPARE(msg->contents().size(), 0);
Test::HtmlWriter testWriter;
@@ -195,7 +197,8 @@ void ObjectTreeParserTester::test_HTML()
otp.parseObjectTree(msg.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "Some HTML text");
- QVERIFY(otp.htmlContent().contains(QStringLiteral("Some <span style=\" font-weight:600;\">HTML</span> text")));
+ QVERIFY(otp.htmlContent().contains(QStringLiteral(
+ "Some <span style=\" font-weight:600;\">HTML</span> text")));
QCOMPARE(otp.htmlContentCharset().data(), "windows-1252");
}
@@ -252,7 +255,8 @@ void ObjectTreeParserTester::test_HTMLOnlyText()
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
- QVERIFY(testWriter.html.contains(QStringLiteral("This is an HTML message. For security reasons, only the raw HTML code is shown.")));
+ QVERIFY(testWriter.html.contains(QStringLiteral(
+ "This is an HTML message. For security reasons, only the raw HTML code is shown.")));
QVERIFY(testWriter.html.contains(QStringLiteral("*SOME* HTML text. <br>")));
}
@@ -274,7 +278,8 @@ void ObjectTreeParserTester::test_HTMLExternal()
QVERIFY(otp.plainTextContent().isEmpty());
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(testWriter.html.contains(QStringLiteral("<b>SOME</b> HTML text.")));
- QVERIFY(testWriter.html.contains(QStringLiteral("This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded.")));
+ QVERIFY(testWriter.html.contains(QStringLiteral(
+ "This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded.")));
}
{
Test::HtmlWriter testWriter;
@@ -287,7 +292,8 @@ void ObjectTreeParserTester::test_HTMLExternal()
QVERIFY(otp.htmlContent().contains(QStringLiteral("<b>SOME</b> HTML text.")));
QVERIFY(testWriter.html.contains(QStringLiteral("<b>SOME</b> HTML text.")));
- QVERIFY(!testWriter.html.contains(QStringLiteral("This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded.")));
+ QVERIFY(!testWriter.html.contains(QStringLiteral(
+ "This HTML message may contain external references to images etc. For security/privacy reasons external references are not loaded.")));
}
}
@@ -305,8 +311,10 @@ void ObjectTreeParserTester::test_Alternative()
otp.parseObjectTree(msg.data());
QVERIFY(otp.htmlContent().isEmpty());
- QVERIFY(otp.plainTextContent().contains(QStringLiteral("If you can see this text it means that your email client couldn't display our newsletter properly.")));
- QVERIFY(testWriter.html.contains(QStringLiteral("If you can see this text it means that your email client couldn't display our newsletter properly.")));
+ QVERIFY(otp.plainTextContent().contains(QStringLiteral(
+ "If you can see this text it means that your email client couldn't display our newsletter properly.")));
+ QVERIFY(testWriter.html.contains(QStringLiteral(
+ "If you can see this text it means that your email client couldn't display our newsletter properly.")));
}
{
@@ -318,9 +326,12 @@ void ObjectTreeParserTester::test_Alternative()
emptySource.setPreferredMode(MimeTreeParser::Util::MultipartHtml);
otp.parseObjectTree(msg.data());
- QVERIFY(otp.plainTextContent().contains(QStringLiteral("If you can see this text it means that your email client couldn't display our newsletter properly.")));
- QVERIFY(otp.htmlContent().contains(QStringLiteral("Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
- QVERIFY(testWriter.html.contains(QStringLiteral("Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
+ QVERIFY(otp.plainTextContent().contains(QStringLiteral(
+ "If you can see this text it means that your email client couldn't display our newsletter properly.")));
+ QVERIFY(otp.htmlContent().contains(QStringLiteral(
+ "Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
+ QVERIFY(testWriter.html.contains(QStringLiteral(
+ "Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
}
msg = Test::readAndParseMail(QStringLiteral("alternative-notext.mbox"));
@@ -349,7 +360,9 @@ void ObjectTreeParserTester::test_Alternative()
otp.parseObjectTree(msg.data());
QVERIFY(otp.plainTextContent().isEmpty());
- QVERIFY(otp.htmlContent().contains(QStringLiteral("Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
- QVERIFY(testWriter.html.contains(QStringLiteral("Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
+ QVERIFY(otp.htmlContent().contains(QStringLiteral(
+ "Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
+ QVERIFY(testWriter.html.contains(QStringLiteral(
+ "Some <span style=\" font-weight:600;\">HTML</span> text</p>")));
}
}
diff --git a/messageviewer/src/messagepartthemes/default/autotests/quotehtmltest.cpp b/messageviewer/src/messagepartthemes/default/autotests/quotehtmltest.cpp
index efa8f72..f2bd919 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/quotehtmltest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/quotehtmltest.cpp
@@ -36,8 +36,12 @@ QTEST_GUILESS_MAIN(QuoteHtmlTest)
void QuoteHtmlTest::initTestCase()
{
MessageViewer::Test::setupEnv();
- mCollapseIcon = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quotecollapse.png"));
- mExpandIcon = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quoteexpand.png"));
+ mCollapseIcon
+ = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral(
+ "quotecollapse.png"));
+ mExpandIcon
+ = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral(
+ "quoteexpand.png"));
}
void QuoteHtmlTest::testQuoteHtml_data()
@@ -47,64 +51,85 @@ void QuoteHtmlTest::testQuoteHtml_data()
QTest::addColumn<bool>("showExpandQuotesMark");
QTest::addColumn<int>("quotelevel");
//No Expand Quotes
- QTest::newRow("simpletext") << QStringLiteral("http") << QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">http</div></div>") << false << 1;
- QTest::newRow("simplequote") << QStringLiteral(">") << QStringLiteral("<blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div></div></blockquote>") << false << 1;
- QTest::newRow("doublequotewithtext") << QStringLiteral(">> sddf") << QStringLiteral("<blockquote><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>> </span><font color=\"#007000\">sddf</font></div></div></blockquote></blockquote>") << false << 1;
- QTest::newRow("doublequote") << QStringLiteral(">>") << QStringLiteral("<blockquote><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">>></span></div></div></blockquote></blockquote>") << false << 1;
- QTest::newRow("simplespace") << QStringLiteral(" ") << QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">&nbsp;</div></div>") << false << 1;
- QTest::newRow("multispace") << QStringLiteral(" Bug ID: 358324") << QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bug ID: 358324</div></div>") << false << 1;
-
- QTest::newRow("bug-369072") << QStringLiteral("test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text") <<
- QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div>"
- "</div><blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div>"
- "</div><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div>"
- "</div><blockquote><div class=\"quotelevel3\"><div dir=\"ltr\"><span class=\"quotemarks\">>>></span><font color=\"#006000\">quote3</font></div>"
- "</div></blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div>"
- "</div></blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div>"
- "</div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>") << false << 1;
+ QTest::newRow("simpletext") << QStringLiteral("http") << QStringLiteral(
+ "<div class=\"noquote\"><div dir=\"ltr\">http</div></div>") << false << 1;
+ QTest::newRow("simplequote") << QStringLiteral(">") << QStringLiteral(
+ "<blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div></div></blockquote>")
+ << false << 1;
+ QTest::newRow("doublequotewithtext") << QStringLiteral(">> sddf") << QStringLiteral(
+ "<blockquote><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>> </span><font color=\"#007000\">sddf</font></div></div></blockquote></blockquote>")
+ << false << 1;
+ QTest::newRow("doublequote") << QStringLiteral(">>") << QStringLiteral(
+ "<blockquote><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">>></span></div></div></blockquote></blockquote>")
+ << false << 1;
+ QTest::newRow("simplespace") << QStringLiteral(" ") << QStringLiteral(
+ "<div class=\"noquote\"><div dir=\"ltr\">&nbsp;</div></div>") << false << 1;
+ QTest::newRow("multispace") << QStringLiteral(" Bug ID: 358324") << QStringLiteral(
+ "<div class=\"noquote\"><div dir=\"ltr\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Bug ID: 358324</div></div>")
+ << false << 1;
+
+ QTest::newRow("bug-369072") << QStringLiteral(
+ "test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text")
+ <<QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div>"
+ "</div><blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div>"
+ "</div><blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div>"
+ "</div><blockquote><div class=\"quotelevel3\"><div dir=\"ltr\"><span class=\"quotemarks\">>>></span><font color=\"#006000\">quote3</font></div>"
+ "</div></blockquote><div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div>"
+ "</div></blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div>"
+ "</div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>")
+ << false << 1;
//Show Expand Quotes
- QTest::newRow("simpletext-expand") << QStringLiteral("http") << QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">http</div></div>") << true << 1;
+ QTest::newRow("simpletext-expand") << QStringLiteral("http") << QStringLiteral(
+ "<div class=\"noquote\"><div dir=\"ltr\">http</div></div>") << true << 1;
- QString result = QStringLiteral("<blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div></div></blockquote>").arg(mCollapseIcon);
+ QString result = QStringLiteral(
+ "<blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div></div></blockquote>")
+ .arg(mCollapseIcon);
QTest::newRow("simplequote-expand") << QStringLiteral(">") << result << true << 1;
- QTest::newRow("simplespace-expand") << QStringLiteral(" ") << QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">&nbsp;</div></div>") << true << 1;
-
- QTest::newRow("bug-369072-expand-quotelevel3") << QStringLiteral("test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text") <<
- QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div>"
- "</div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?2 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel3\"><div dir=\"ltr\"><span class=\"quotemarks\">>>></span><font color=\"#006000\">quote3</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>").arg(mCollapseIcon)
- << true << 3;
-
- QTest::newRow("bug-369072-expand-quotelevel2") << QStringLiteral("test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text") <<
- QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?-1 \"><img src=\"%2\"/></a></div><br/></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>").arg(mCollapseIcon).arg(mExpandIcon)
- << true << 2;
-
- QTest::newRow("bug-369072-expand-quotelevel1") << QStringLiteral("test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text") <<
- QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?-1 \"><img src=\"%2\"/></a></div><br/>"
- "<blockquote></blockquote></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
- "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>").arg(mCollapseIcon).arg(mExpandIcon)
- << true << 1;
-
- QTest::newRow("bug-370452") << QStringLiteral("test\n> blo\n>\n>\n>\n> bla\nnew text") <<
- QStringLiteral("<div class=\"noquote\">"
- "<div dir=\"ltr\">test</div></div>"
- "<blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">> </span><font color=\"#008000\">blo</font></div>"
- "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
- "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
- "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
- "<div dir=\"ltr\"><span class=\"quotemarks\">> </span><font color=\"#008000\">bla</font></div></div></blockquote>"
- "<div class=\"noquote\"><div dir=\"ltr\">new text</div></div>") << false << 1;
-
+ QTest::newRow("simplespace-expand") << QStringLiteral(" ") << QStringLiteral(
+ "<div class=\"noquote\"><div dir=\"ltr\">&nbsp;</div></div>") << true << 1;
+
+ QTest::newRow("bug-369072-expand-quotelevel3") << QStringLiteral(
+ "test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text")
+ <<QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div>"
+ "</div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?2 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel3\"><div dir=\"ltr\"><span class=\"quotemarks\">>>></span><font color=\"#006000\">quote3</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>")
+ .arg(mCollapseIcon)
+ << true << 3;
+
+ QTest::newRow("bug-369072-expand-quotelevel2") << QStringLiteral(
+ "test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text")
+ <<QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">quote2</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?-1 \"><img src=\"%2\"/></a></div><br/></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?1 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel2\"><div dir=\"ltr\"><span class=\"quotemarks\">>></span><font color=\"#007000\">new quote2</font></div></div></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>")
+ .arg(mCollapseIcon).arg(mExpandIcon)
+ << true << 2;
+
+ QTest::newRow("bug-369072-expand-quotelevel1") << QStringLiteral(
+ "test\n>quote1\n>>quote2\n>>>quote3\n>>new quote2\n>new quote1\nnew text")
+ <<QStringLiteral("<div class=\"noquote\"><div dir=\"ltr\">test</div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">quote1</font></div></div><blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?-1 \"><img src=\"%2\"/></a></div><br/>"
+ "<blockquote></blockquote></blockquote><div class=\"quotelevelmark\" ><a href=\"kmail:levelquote?0 \"><img src=\"%1\"/></a></div>"
+ "<div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">></span><font color=\"#008000\">new quote1</font></div></div></blockquote><div class=\"noquote\"><div dir=\"ltr\">new text</div></div>")
+ .arg(mCollapseIcon).arg(mExpandIcon)
+ << true << 1;
+
+ QTest::newRow("bug-370452") << QStringLiteral("test\n> blo\n>\n>\n>\n> bla\nnew text")
+ <<QStringLiteral("<div class=\"noquote\">"
+ "<div dir=\"ltr\">test</div></div>"
+ "<blockquote><div class=\"quotelevel1\"><div dir=\"ltr\"><span class=\"quotemarks\">> </span><font color=\"#008000\">blo</font></div>"
+ "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
+ "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
+ "<div dir=\"ltr\"><span class=\"quotemarksemptyline\">></span></div>"
+ "<div dir=\"ltr\"><span class=\"quotemarks\">> </span><font color=\"#008000\">bla</font></div></div></blockquote>"
+ "<div class=\"noquote\"><div dir=\"ltr\">new text</div></div>") << false << 1;
}
void QuoteHtmlTest::testQuoteHtml()
diff --git a/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp b/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
index 8566c62..3f34d5e 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/rendertest.cpp
@@ -50,11 +50,17 @@ void RenderTest::testRenderSmart_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
if (!QFile::exists(dir.path() + QLatin1Char('/') + file + QStringLiteral(".html"))) {
continue;
}
- QTest::newRow(file.toLatin1().constData()) << file << QString(dir.path() + QLatin1Char('/') + file + QStringLiteral(".html")) << QString(file + QStringLiteral(".out")) << QStringLiteral("smart") << false << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << QString(dir.path() + QLatin1Char(
+ '/') + file
+ + QStringLiteral(".html"))
+ << QString(file + QStringLiteral(".out"))
+ << QStringLiteral("smart") << false << QString();
}
}
@@ -74,11 +80,21 @@ void RenderTest::testRenderSmartAsync_data()
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
- if (!QFile::exists(dir.path() + QLatin1Char('/') + file + QStringLiteral(".inProgress.html"))) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ if (!QFile::exists(dir.path() + QLatin1Char('/') + file
+ + QStringLiteral(".inProgress.html"))) {
continue;
}
- QTest::newRow(file.toLatin1().constData()) << file << QString(dir.path() + QLatin1Char('/') + file + QStringLiteral(".html")) << QString(file + QStringLiteral(".out")) << QStringLiteral("smart") << false << QString(dir.path() + QLatin1Char('/') + file + QStringLiteral(".inProgress.html"));
+ QTest::newRow(file.toLatin1().constData()) << file << QString(dir.path() + QLatin1Char(
+ '/') + file
+ + QStringLiteral(".html"))
+ << QString(file + QStringLiteral(".out"))
+ << QStringLiteral("smart") << false << QString(
+ dir.path() + QLatin1Char(
+ '/') + file
+ + QStringLiteral(".inProgress.html"));
}
}
@@ -97,12 +113,16 @@ void RenderTest::testRenderSmartDetails_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
QString fname = dir.path() + QStringLiteral("/details/") + file + QStringLiteral(".html");
if (!QFile::exists(fname)) {
continue;
}
- QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(".out")) << QStringLiteral("smart") << true << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(
+ ".out"))
+ << QStringLiteral("smart") << true << QString();
}
}
@@ -121,7 +141,9 @@ void RenderTest::testRenderInlined_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
QString fname = dir.path() + QStringLiteral("/inlined/") + file + QStringLiteral(".html");
if (!QFile::exists(fname)) {
fname = dir.path() + QStringLiteral("/") + file + QStringLiteral(".html");
@@ -129,7 +151,10 @@ void RenderTest::testRenderInlined_data()
continue;
}
}
- QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(".out")) << QStringLiteral("inlined") << false << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(
+ ".out"))
+ << QStringLiteral("inlined") << false
+ << QString();
}
}
@@ -148,7 +173,9 @@ void RenderTest::testRenderIconic_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
QString fname = dir.path() + QStringLiteral("/iconic/") + file + QStringLiteral(".html");
if (!QFile::exists(fname)) {
fname = dir.path() + QStringLiteral("/") + file + QStringLiteral(".html");
@@ -156,7 +183,10 @@ void RenderTest::testRenderIconic_data()
continue;
}
}
- QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(".out")) << QStringLiteral("iconic") << false << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(
+ ".out"))
+ << QStringLiteral("iconic") << false
+ << QString();
}
}
@@ -175,7 +205,9 @@ void RenderTest::testRenderHidden_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
QString fname = dir.path() + QStringLiteral("/hidden/") + file + QStringLiteral(".html");
if (!QFile::exists(fname)) {
fname = dir.path() + QStringLiteral("/") + file + QStringLiteral(".html");
@@ -183,7 +215,10 @@ void RenderTest::testRenderHidden_data()
continue;
}
}
- QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(".out")) << QStringLiteral("hidden") << false << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(
+ ".out"))
+ << QStringLiteral("hidden") << false
+ << QString();
}
}
@@ -202,15 +237,21 @@ void RenderTest::testRenderHeaderOnly_data()
QTest::addColumn<QString>("asyncFileName");
QDir dir(QStringLiteral(MAIL_DATA_DIR));
- foreach (const QString &file, dir.entryList(QStringList(QLatin1String("*.mbox")), QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
- QString fname = dir.path() + QStringLiteral("/headeronly/") + file + QStringLiteral(".html");
+ foreach (const QString &file,
+ dir.entryList(QStringList(QLatin1String("*.mbox")),
+ QDir::Files | QDir::Readable | QDir::NoSymLinks)) {
+ QString fname = dir.path() + QStringLiteral("/headeronly/") + file
+ + QStringLiteral(".html");
if (!QFile::exists(fname)) {
fname = dir.path() + QStringLiteral("/") + file + QStringLiteral(".html");
if (!QFile::exists(fname)) {
continue;
}
}
- QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(".out")) << QStringLiteral("headeronly") << false << QString();
+ QTest::newRow(file.toLatin1().constData()) << file << fname << QString(file + QStringLiteral(
+ ".out"))
+ << QStringLiteral("headeronly") << false
+ << QString();
}
}
@@ -219,9 +260,12 @@ void RenderTest::testRenderHeaderOnly()
testRender();
}
-QString renderTreeHelper(const MimeTreeParser::Interface::MessagePart::Ptr &messagePart, QString indent)
+QString renderTreeHelper(const MimeTreeParser::Interface::MessagePart::Ptr &messagePart,
+ QString indent)
{
- const QString line = QStringLiteral("%1 * %3\n").arg(indent, QString::fromUtf8(messagePart->metaObject()->className()));
+ const QString line
+ = QStringLiteral("%1 * %3\n").arg(indent,
+ QString::fromUtf8(messagePart->metaObject()->className()));
QString ret = line;
indent += QStringLiteral(" ");
@@ -240,7 +284,8 @@ void RenderTest::testRenderTree(const MimeTreeParser::MessagePart::Ptr &messageP
QFETCH(QString, mailFileName);
QFETCH(QString, outFileName);
- const QString treeFileName = QLatin1String(MAIL_DATA_DIR) + QLatin1Char('/') + mailFileName + QStringLiteral(".tree");
+ const QString treeFileName = QLatin1String(MAIL_DATA_DIR) + QLatin1Char('/') + mailFileName
+ + QStringLiteral(".tree");
const QString outTreeFileName = outFileName + QStringLiteral(".tree");
{
@@ -354,7 +399,7 @@ void RenderTest::compareFile(const QString &outFile, const QString &referenceFil
<< QStringLiteral("--output")
<< htmlFile
<< outFile;
- QCOMPARE(QProcess::execute(QStringLiteral("xmllint"), args), 0);
+ QCOMPARE(QProcess::execute(QStringLiteral("xmllint"), args), 0);
// get rid of system dependent or random paths
{
@@ -362,7 +407,9 @@ void RenderTest::compareFile(const QString &outFile, const QString &referenceFil
QVERIFY(f.open(QIODevice::ReadOnly));
QString content = QString::fromUtf8(f.readAll());
f.close();
- content.replace(QRegExp(QStringLiteral("\"file:[^\"]*[/(?:%2F)]([^\"/(?:%2F)]*)\"")), QStringLiteral("\"file:\\1\""));
+ content.replace(QRegExp(QStringLiteral(
+ "\"file:[^\"]*[/(?:%2F)]([^\"/(?:%2F)]*)\"")),
+ QStringLiteral("\"file:\\1\""));
QVERIFY(f.open(QIODevice::WriteOnly | QIODevice::Truncate));
f.write(content.toUtf8());
f.close();
diff --git a/messageviewer/src/messagepartthemes/default/autotests/setupenv.cpp b/messageviewer/src/messagepartthemes/default/autotests/setupenv.cpp
index 4640e95..5ddeb9c 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/setupenv.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/setupenv.cpp
@@ -29,9 +29,9 @@
void MessageViewer::Test::setupEnv()
{
- setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1("/.qttest")).constData(), 1);
+ setenv("KDEHOME", QFile::encodeName(QDir::homePath() + QString::fromLatin1(
+ "/.qttest")).constData(), 1);
QStandardPaths::setTestModeEnabled(true);
QIcon::setThemeName(QStringLiteral("breeze"));
QLocale::setDefault(QLocale(QStringLiteral("en_US")));
}
-
diff --git a/messageviewer/src/messagepartthemes/default/autotests/setupenv.h b/messageviewer/src/messagepartthemes/default/autotests/setupenv.h
index 28b162e..f8c0b61 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/setupenv.h
+++ b/messageviewer/src/messagepartthemes/default/autotests/setupenv.h
@@ -29,12 +29,8 @@
#include <MessageViewer/ObjectTreeEmptySource>
-namespace MessageViewer
-{
-
-namespace Test
-{
-
+namespace MessageViewer {
+namespace Test {
/**
* setup a environment variables for tests:
* * set LC_ALL to C
@@ -47,8 +43,7 @@ void setupEnv();
class ObjectTreeSource : public MessageViewer::EmptySource
{
public:
- ObjectTreeSource(MimeTreeParser::HtmlWriter *writer,
- MessageViewer::CSSHelperBase *cssHelper)
+ ObjectTreeSource(MimeTreeParser::HtmlWriter *writer, MessageViewer::CSSHelperBase *cssHelper)
: mWriter(writer)
, mCSSHelper(cssHelper)
, mAttachmentStrategy(QStringLiteral("smart"))
@@ -61,11 +56,13 @@ public:
{
}
- MimeTreeParser::HtmlWriter *htmlWriter() override {
+ MimeTreeParser::HtmlWriter *htmlWriter() override
+ {
return mWriter;
}
- CSSHelperBase *cssHelper() override {
+ CSSHelperBase *cssHelper() override
+ {
return mCSSHelper;
}
@@ -84,8 +81,9 @@ public:
mAttachmentStrategy = strategy;
}
- const MimeTreeParser::AttachmentStrategy *attachmentStrategy() override {
- return MimeTreeParser::AttachmentStrategy::create(mAttachmentStrategy);
+ const MimeTreeParser::AttachmentStrategy *attachmentStrategy() override
+ {
+ return MimeTreeParser::AttachmentStrategy::create(mAttachmentStrategy);
}
bool autoImportKeys() const override
@@ -108,7 +106,8 @@ public:
return mShowExpandQuotesMark;
}
- const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() override {
+ const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() override
+ {
return &mBodyPartFormatterBaseFactory;
}
@@ -132,7 +131,9 @@ public:
return mShowSignatureDetails;
}
- void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override {
+ void setHtmlMode(MimeTreeParser::Util::HtmlMode mode,
+ const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override
+ {
Q_UNUSED(mode);
Q_UNUSED(availableModes);
}
@@ -157,11 +158,13 @@ public:
mQuoteLevel = level;
}
- const QTextCodec *overrideCodec() override {
+ const QTextCodec *overrideCodec() override
+ {
return nullptr;
}
- QString createMessageHeader(KMime::Message *message) override {
+ QString createMessageHeader(KMime::Message *message) override
+ {
Q_UNUSED(message);
return QString(); //do nothing
}
@@ -178,10 +181,7 @@ private:
MimeTreeParser::Util::HtmlMode mPreferredMode;
int mQuoteLevel;
};
-
}
-
}
#endif //__MESSAGEVIEWER_TESTS_SETUPENV_H__
-
diff --git a/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.cpp b/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.cpp
index 0fcf238..2f15fae 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.cpp
@@ -26,24 +26,24 @@
using namespace MessageViewer::Test;
-TestCSSHelper::TestCSSHelper(const QPaintDevice *pd) :
- MessageViewer::CSSHelperBase(pd)
+TestCSSHelper::TestCSSHelper(const QPaintDevice *pd)
+ : MessageViewer::CSSHelperBase(pd)
{
mRecycleQuoteColors = false;
mBackgroundColor = QColor(0xff, 0xff, 0xff);
mForegroundColor = QColor(0x1f, 0x1c, 0x1b);
mLinkColor = QColor(0x00, 0x57, 0xae);
cPgpEncrH = QColor(0x00, 0x80, 0xff);
- cPgpOk1H = QColor(0x40, 0xff, 0x40);
- cPgpOk0H = QColor(0xff, 0xff, 0x40);
+ cPgpOk1H = QColor(0x40, 0xff, 0x40);
+ cPgpOk0H = QColor(0xff, 0xff, 0x40);
cPgpWarnH = QColor(0xff, 0xff, 0x40);
- cPgpErrH = QColor(0xff, 0x00, 0x00);
+ cPgpErrH = QColor(0xff, 0x00, 0x00);
cPgpEncrHT = QColor(0xff, 0xff, 0xff);
- cPgpOk1HT = QColor(0x27, 0xae, 0x60);
- cPgpOk0HT = QColor(0xf6, 0x74, 0x00);
+ cPgpOk1HT = QColor(0x27, 0xae, 0x60);
+ cPgpOk0HT = QColor(0xf6, 0x74, 0x00);
cPgpWarnHT = QColor(0xf6, 0x74, 0x00);
- cPgpErrHT = QColor(0xda, 0x44, 0x53);
+ cPgpErrHT = QColor(0xda, 0x44, 0x53);
cHtmlWarning = QColor(0xff, 0x40, 0x40);
for (int i = 0; i < 3; ++i) {
@@ -75,7 +75,6 @@ TestCSSHelper::TestCSSHelper(const QPaintDevice *pd) :
TestCSSHelper::~TestCSSHelper()
{
-
}
QString TestCSSHelper::htmlHead(bool fixed) const
diff --git a/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.h b/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.h
index 511b062..149e78c 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.h
+++ b/messageviewer/src/messagepartthemes/default/autotests/testcsshelper.h
@@ -22,11 +22,8 @@
#include <MessageViewer/CSSHelperBase>
-namespace MessageViewer
-{
-namespace Test
-{
-
+namespace MessageViewer {
+namespace Test {
class TestCSSHelper : public MessageViewer::CSSHelperBase
{
public:
@@ -35,7 +32,6 @@ public:
QString htmlHead(bool fixed) const override;
};
}
-
}
#endif // __MESSSAGEVIEWER_TESTCSSHELPER_H__
diff --git a/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.cpp b/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.cpp
index dcc3efe..25b2a71 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.cpp
+++ b/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.cpp
@@ -38,7 +38,8 @@ void UnencryptedMessageTest::initTestCase()
void UnencryptedMessageTest::testMailWithoutEncryption()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
MimeTreeParser::ObjectTreeParser otp(&emptySource, &nodeHelper);
@@ -48,7 +49,8 @@ void UnencryptedMessageTest::testMailWithoutEncryption()
void UnencryptedMessageTest::testSignedForwardedOpenPGPSignedEncrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("signed-forward-openpgp-signed-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("signed-forward-openpgp-signed-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::HtmlWriter testWriter;
@@ -58,8 +60,10 @@ void UnencryptedMessageTest::testSignedForwardedOpenPGPSignedEncrypted()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "bla bla bla"); // The textual content doesn't include the encrypted encapsulated message by design
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgPartiallyEncrypted);
- QCOMPARE(nodeHelper.overallSignatureState(originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgPartiallyEncrypted);
+ QCOMPARE(nodeHelper.overallSignatureState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QVERIFY(!unencryptedMessage); // We must not invalidate the outer signature
@@ -67,7 +71,8 @@ void UnencryptedMessageTest::testSignedForwardedOpenPGPSignedEncrypted()
void UnencryptedMessageTest::testForwardedOpenPGPSignedEncrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("forward-openpgp-signed-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("forward-openpgp-signed-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::HtmlWriter testWriter;
@@ -78,23 +83,28 @@ void UnencryptedMessageTest::testForwardedOpenPGPSignedEncrypted()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "bla bla bla"); // The textual content doesn't include the encrypted encapsulated message by design
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgPartiallyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgPartiallyEncrypted);
- QCOMPARE(nodeHelper.overallSignatureState(originalMessage.data()), MimeTreeParser::KMMsgPartiallySigned);
+ QCOMPARE(nodeHelper.overallSignatureState(
+ originalMessage.data()), MimeTreeParser::KMMsgPartiallySigned);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QVERIFY(unencryptedMessage.data());
QCOMPARE(unencryptedMessage->contentType()->mimeType().data(), "multipart/mixed");
QCOMPARE(unencryptedMessage->contents().size(), 2);
- QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(), "text/plain");
+ QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(),
+ "text/plain");
QCOMPARE(unencryptedMessage->contents().first()->decodedContent().data(), "bla bla bla");
- QCOMPARE(unencryptedMessage->contents().at(1)->contentType()->mimeType().data(), "message/rfc822");
+ QCOMPARE(unencryptedMessage->contents().at(
+ 1)->contentType()->mimeType().data(), "message/rfc822");
KMime::Message::Ptr encapsulated = unencryptedMessage->contents().at(1)->bodyAsMessage();
QCOMPARE(encapsulated->contentType()->mimeType().data(), "multipart/signed");
QCOMPARE(encapsulated->contents().size(), 2);
QCOMPARE(encapsulated->contents().first()->contentType()->mimeType().data(), "text/plain");
- QCOMPARE(encapsulated->contents().at(1)->contentType()->mimeType().data(), "application/pgp-signature");
+ QCOMPARE(encapsulated->contents().at(
+ 1)->contentType()->mimeType().data(), "application/pgp-signature");
QCOMPARE(encapsulated->contents().first()->decodedContent().data(), "encrypted message text");
// TODO: Check that the signature is valid
@@ -102,7 +112,8 @@ void UnencryptedMessageTest::testForwardedOpenPGPSignedEncrypted()
void UnencryptedMessageTest::testSMIMESignedEncrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("smime-signed-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("smime-signed-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
@@ -111,24 +122,30 @@ void UnencryptedMessageTest::testSMIMESignedEncrypted()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "encrypted message text");
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
- QCOMPARE(nodeHelper.overallSignatureState(originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
+ QCOMPARE(nodeHelper.overallSignatureState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QCOMPARE(unencryptedMessage->contentType()->mimeType().data(), "multipart/signed");
QCOMPARE(unencryptedMessage->contents().size(), 2);
- QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(), "text/plain");
- QCOMPARE(unencryptedMessage->contents().at(1)->contentType()->mimeType().data(), "application/pkcs7-signature");
- QCOMPARE(unencryptedMessage->contents().first()->decodedContent().data(), "encrypted message text");
+ QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(),
+ "text/plain");
+ QCOMPARE(unencryptedMessage->contents().at(
+ 1)->contentType()->mimeType().data(), "application/pkcs7-signature");
+ QCOMPARE(
+ unencryptedMessage->contents().first()->decodedContent().data(), "encrypted message text");
// TODO: Check that the signature is valid
}
void UnencryptedMessageTest::testOpenPGPSignedEncrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("openpgp-signed-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("openpgp-signed-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
@@ -137,24 +154,30 @@ void UnencryptedMessageTest::testOpenPGPSignedEncrypted()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "encrypted message text");
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
- QCOMPARE(nodeHelper.overallSignatureState(originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
+ QCOMPARE(nodeHelper.overallSignatureState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
QCOMPARE(unencryptedMessage->contentType()->mimeType().data(), "multipart/signed");
QCOMPARE(unencryptedMessage->contents().size(), 2);
- QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(), "text/plain");
- QCOMPARE(unencryptedMessage->contents().at(1)->contentType()->mimeType().data(), "application/pgp-signature");
- QCOMPARE(unencryptedMessage->contents().first()->decodedContent().data(), "encrypted message text");
+ QCOMPARE(unencryptedMessage->contents().first()->contentType()->mimeType().data(),
+ "text/plain");
+ QCOMPARE(unencryptedMessage->contents().at(
+ 1)->contentType()->mimeType().data(), "application/pgp-signature");
+ QCOMPARE(
+ unencryptedMessage->contents().first()->decodedContent().data(), "encrypted message text");
// TODO: Check that the signature is valid
}
void UnencryptedMessageTest::testOpenPGPEncryptedAndSigned()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("openpgp-encrypted+signed.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("openpgp-encrypted+signed.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
@@ -163,9 +186,11 @@ void UnencryptedMessageTest::testOpenPGPEncryptedAndSigned()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "encrypted message text");
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
- QCOMPARE(nodeHelper.overallSignatureState(originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
+ QCOMPARE(nodeHelper.overallSignatureState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullySigned);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
@@ -178,7 +203,8 @@ void UnencryptedMessageTest::testOpenPGPEncryptedAndSigned()
void UnencryptedMessageTest::testOpenPGPEncrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("openpgp-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("openpgp-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
@@ -187,7 +213,8 @@ void UnencryptedMessageTest::testOpenPGPEncrypted()
otp.parseObjectTree(originalMessage.data());
QCOMPARE(otp.plainTextContent().toLatin1().data(), "encrypted message text");
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
// Now, test that the unencrypted message is generated correctly
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
@@ -198,7 +225,8 @@ void UnencryptedMessageTest::testOpenPGPEncrypted()
void UnencryptedMessageTest::testOpenPGPEncryptedNotDecrypted()
{
- KMime::Message::Ptr originalMessage = Test::readAndParseMail(QStringLiteral("openpgp-encrypted.mbox"));
+ KMime::Message::Ptr originalMessage
+ = Test::readAndParseMail(QStringLiteral("openpgp-encrypted.mbox"));
MimeTreeParser::NodeHelper nodeHelper;
Test::ObjectTreeSource emptySource(nullptr, nullptr);
@@ -206,11 +234,12 @@ void UnencryptedMessageTest::testOpenPGPEncryptedNotDecrypted()
MimeTreeParser::ObjectTreeParser otp(&emptySource, &nodeHelper);
otp.parseObjectTree(originalMessage.data());
- QCOMPARE(nodeHelper.overallEncryptionState(originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
+ QCOMPARE(nodeHelper.overallEncryptionState(
+ originalMessage.data()), MimeTreeParser::KMMsgFullyEncrypted);
QCOMPARE(otp.plainTextContent().toLatin1().data(), "");
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
- QCOMPARE((bool) unencryptedMessage, false);
+ QCOMPARE((bool)unencryptedMessage, false);
}
void UnencryptedMessageTest::testAsync_data()
@@ -218,10 +247,15 @@ void UnencryptedMessageTest::testAsync_data()
QTest::addColumn<QString>("mailFileName");
QTest::addColumn<QString>("output");
- QTest::newRow("openpgp-encrypt") << QStringLiteral("openpgp-encrypted.mbox") << QStringLiteral("encrypted message text");
- QTest::newRow("smime-opaque-sign") << QStringLiteral("smime-opaque-sign.mbox") << QStringLiteral("A simple signed only test.");
- QTest::newRow("smime-encrypt") << QStringLiteral("smime-encrypted.mbox") << QStringLiteral("The quick brown fox jumped over the lazy dog.");
- QTest::newRow("openpgp-inline-encrypt") << QStringLiteral("openpgp-inline-charset-encrypted.mbox") << QStringLiteral("asdasd asd asd asdf sadf sdaf sadf \u00F6\u00E4\u00FC");
+ QTest::newRow("openpgp-encrypt") << QStringLiteral("openpgp-encrypted.mbox") << QStringLiteral(
+ "encrypted message text");
+ QTest::newRow("smime-opaque-sign") << QStringLiteral("smime-opaque-sign.mbox")
+ << QStringLiteral("A simple signed only test.");
+ QTest::newRow("smime-encrypt") << QStringLiteral("smime-encrypted.mbox") << QStringLiteral(
+ "The quick brown fox jumped over the lazy dog.");
+ QTest::newRow("openpgp-inline-encrypt") << QStringLiteral(
+ "openpgp-inline-charset-encrypted.mbox") << QStringLiteral(
+ "asdasd asd asd asdf sadf sdaf sadf \u00F6\u00E4\u00FC");
}
void UnencryptedMessageTest::testAsync()
@@ -259,10 +293,12 @@ void UnencryptedMessageTest::testNotDecrypted_data()
QTest::newRow("openpgp-inline") << QStringLiteral("inlinepgpencrypted.mbox") << true;
QTest::newRow("openpgp-encrypt") << QStringLiteral("openpgp-encrypted.mbox") << true;
QTest::newRow("smime-encrypt") << QStringLiteral("smime-encrypted.mbox") << true;
- QTest::newRow("openpgp-inline-encrypt") << QStringLiteral("openpgp-inline-charset-encrypted.mbox") << true;
+ QTest::newRow("openpgp-inline-encrypt") << QStringLiteral(
+ "openpgp-inline-charset-encrypted.mbox") << true;
QTest::newRow("smime-opaque-sign") << QStringLiteral("smime-opaque-sign.mbox") << false;
QTest::newRow("openpgp-inline-signed") << QStringLiteral("openpgp-inline-signed.mbox") << false;
- QTest::newRow("openpgp-mime-signed") << QStringLiteral("openpgp-signed-mailinglist.mbox") << false;
+ QTest::newRow("openpgp-mime-signed") << QStringLiteral("openpgp-signed-mailinglist.mbox")
+ << false;
}
void UnencryptedMessageTest::testNotDecrypted()
@@ -284,10 +320,11 @@ void UnencryptedMessageTest::testNotDecrypted()
} else {
QVERIFY(otp.plainTextContent().toLatin1().data());
}
- QCOMPARE(testWriter.html.contains(QStringLiteral("<a href=\"kmail:decryptMessage\">")), decryptMessage);
+ QCOMPARE(testWriter.html.contains(QStringLiteral(
+ "<a href=\"kmail:decryptMessage\">")), decryptMessage);
KMime::Message::Ptr unencryptedMessage = nodeHelper.unencryptedMessage(originalMessage);
- QCOMPARE((bool) unencryptedMessage, false);
+ QCOMPARE((bool)unencryptedMessage, false);
}
void UnencryptedMessageTest::testSMimeAutoCertImport()
@@ -303,4 +340,4 @@ void UnencryptedMessageTest::testSMimeAutoCertImport()
QCOMPARE(otp.plainTextContent().toLatin1().data(), "");
QVERIFY(testWriter.html.contains(QStringLiteral("Sorry, certificate could not be imported.")));
-} \ No newline at end of file
+}
diff --git a/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.h b/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.h
index 6dc4b6e..f63ff1f 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.h
+++ b/messageviewer/src/messagepartthemes/default/autotests/unencryptedmessagetest.h
@@ -43,4 +43,4 @@ private Q_SLOTS:
void testSMimeAutoCertImport();
};
-#endif //__MESSAGEVIEWER_TESTS_UNENCRYPTEDMESSSAGE_H__ \ No newline at end of file
+#endif //__MESSAGEVIEWER_TESTS_UNENCRYPTEDMESSSAGE_H__
diff --git a/messageviewer/src/messagepartthemes/default/autotests/util.h b/messageviewer/src/messagepartthemes/default/autotests/util.h
index 4106ddd..d5bacd4 100644
--- a/messageviewer/src/messagepartthemes/default/autotests/util.h
+++ b/messageviewer/src/messagepartthemes/default/autotests/util.h
@@ -25,28 +25,51 @@
#include <KMime/Message>
-namespace MessageViewer
-{
-
-namespace Test
-{
-
+namespace MessageViewer {
+namespace Test {
class HtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
- explicit HtmlWriter() {}
- virtual ~HtmlWriter() {}
-
- void begin(const QString &) override {}
- void write(const QString &) override {}
- void end() override {}
- void reset() override {}
- void queue(const QString &str) override {
+ explicit HtmlWriter()
+ {
+ }
+
+ virtual ~HtmlWriter()
+ {
+ }
+
+ void begin(const QString &) override
+ {
+ }
+
+ void write(const QString &) override
+ {
+ }
+
+ void end() override
+ {
+ }
+
+ void reset() override
+ {
+ }
+
+ void queue(const QString &str) override
+ {
html.append(str);
}
- void flush() override {}
- void embedPart(const QByteArray &, const QString &) override {}
- void extraHead(const QString &) override {}
+
+ void flush() override
+ {
+ }
+
+ void embedPart(const QByteArray &, const QString &) override
+ {
+ }
+
+ void extraHead(const QString &) override
+ {
+ }
QString html;
};
@@ -60,7 +83,10 @@ public:
mQuoteColor[i] = QColor(0x00, 0x80 - i * 0x10, 0x00);
}
}
- virtual ~CSSHelper() {}
+
+ virtual ~CSSHelper()
+ {
+ }
QString nonQuotedFontTag() const
{
@@ -74,7 +100,6 @@ public:
};
KMime::Message::Ptr readAndParseMail(const QString &mailFile);
-
}
}
diff --git a/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.cpp b/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.cpp
index 6602143..65a4fa3 100644
--- a/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.cpp
+++ b/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.cpp
@@ -25,12 +25,10 @@
using namespace MimeTreeParser;
ConvertHtmlToPlainText::ConvertHtmlToPlainText()
{
-
}
ConvertHtmlToPlainText::~ConvertHtmlToPlainText()
{
-
}
void ConvertHtmlToPlainText::setHtmlString(const QString &htmlString)
diff --git a/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.h b/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.h
index 88b5e42..59052c7 100644
--- a/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.h
+++ b/messageviewer/src/messagepartthemes/default/converthtmltoplaintext.h
@@ -22,8 +22,7 @@
#define __MIMETREEPARSER_CONVERTHTMLTOPLAINTEXT_H__
#include <QString>
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class ConvertHtmlToPlainText
{
public:
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
index eea3e08..a415a1b 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.cpp
@@ -68,11 +68,8 @@ static const int SIG_FRAME_COL_UNDEF = 99;
#define SIG_FRAME_COL_RED -1
#define SIG_FRAME_COL_YELLOW 0
#define SIG_FRAME_COL_GREEN 1
-QString sigStatusToString(const QGpgME::Protocol *cryptProto,
- int status_code,
- GpgME::Signature::Summary summary,
- int &frameColor,
- bool &showKeyInfos)
+QString sigStatusToString(const QGpgME::Protocol *cryptProto, int status_code,
+ GpgME::Signature::Summary summary, int &frameColor, bool &showKeyInfos)
{
// note: At the moment frameColor and showKeyInfos are
// used for CMS only but not for PGP signatures
@@ -193,7 +190,7 @@ QString sigStatusToString(const QGpgME::Protocol *cryptProto,
frameColor = SIG_FRAME_COL_RED;
}
if (summary & GpgME::Signature::Red) {
- if (result2.isEmpty())
+ if (result2.isEmpty()) {
// Note:
// Here we are work differently than KMail did before!
//
@@ -206,7 +203,6 @@ QString sigStatusToString(const QGpgME::Protocol *cryptProto,
// in the body NOT the signature - so we don't show
// any key/signature information at all!
// (khz, according to LinuxTag 2002 meeting)
- {
showKeyInfos = false;
}
frameColor = SIG_FRAME_COL_RED;
@@ -246,9 +242,10 @@ QString sigStatusToString(const QGpgME::Protocol *cryptProto,
bool containsExternalReferences(const QString &str, const QString &extraHead)
{
- const bool hasBaseInHeader = extraHead.contains(QStringLiteral("<base href=\""), Qt::CaseInsensitive);
- if (hasBaseInHeader && (str.contains(QStringLiteral("href=\"/"), Qt::CaseInsensitive) ||
- str.contains(QStringLiteral("<img src=\"/"), Qt::CaseInsensitive))) {
+ const bool hasBaseInHeader = extraHead.contains(QStringLiteral(
+ "<base href=\""), Qt::CaseInsensitive);
+ if (hasBaseInHeader && (str.contains(QStringLiteral("href=\"/"), Qt::CaseInsensitive)
+ || str.contains(QStringLiteral("<img src=\"/"), Qt::CaseInsensitive))) {
return true;
}
int httpPos = str.indexOf(QLatin1String("\"http:"), Qt::CaseInsensitive);
@@ -266,11 +263,11 @@ bool containsExternalReferences(const QString &str, const QString &extraHead)
// is larger than 7 (7 is the distance in 'href = "http[s]:') then
// we assume that we have found an external reference
if ((hrefPos == -1) || (pos - hrefPos > 7)) {
-
// HTML messages created by KMail itself for now contain the following:
// <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
// Make sure not to show an external references warning for this string
- int dtdPos = str.indexOf(QLatin1String("http://www.w3.org/TR/html4/loose.dtd"), pos + 1);
+ int dtdPos = str.indexOf(QLatin1String(
+ "http://www.w3.org/TR/html4/loose.dtd"), pos + 1);
if (dtdPos != (pos + 1)) {
return true;
}
@@ -291,27 +288,60 @@ class CacheHtmlWriter : public MimeTreeParser::HtmlWriter
public:
explicit CacheHtmlWriter(MimeTreeParser::HtmlWriter *baseWriter)
: mBaseWriter(baseWriter)
- {}
- virtual ~CacheHtmlWriter() {}
+ {
+ }
+
+ virtual ~CacheHtmlWriter()
+ {
+ }
+
+ void begin(const QString &text) override
+ {
+ mBaseWriter->begin(text);
+ }
- void begin(const QString &text) override {mBaseWriter->begin(text);}
- void write(const QString &str) override {
+ void write(const QString &str) override
+ {
html.append(str);
}
- void end() override {mBaseWriter->end();}
- void reset() override {mBaseWriter->reset();}
- void queue(const QString &str) override {
+
+ void end() override
+ {
+ mBaseWriter->end();
+ }
+
+ void reset() override
+ {
+ mBaseWriter->reset();
+ }
+
+ void queue(const QString &str) override
+ {
html.append(str);
}
- void flush() override {mBaseWriter->flush();}
- void embedPart(const QByteArray &contentId, const QString &url) override {mBaseWriter->embedPart(contentId, url);}
- void extraHead(const QString &extra) override {mBaseWriter->extraHead(extra);}
+
+ void flush() override
+ {
+ mBaseWriter->flush();
+ }
+
+ void embedPart(const QByteArray &contentId, const QString &url) override
+ {
+ mBaseWriter->embedPart(contentId, url);
+ }
+
+ void extraHead(const QString &extra) override
+ {
+ mBaseWriter->extraHead(extra);
+ }
QString html;
MimeTreeParser::HtmlWriter *mBaseWriter;
};
-DefaultRendererPrivate::DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, const MessagePartRendererFactoryBase *rendererFactory)
+DefaultRendererPrivate::DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart,
+ CSSHelperBase *cssHelper,
+ const MessagePartRendererFactoryBase *rendererFactory)
: mMsgPart(msgPart)
, mOldWriter(msgPart->htmlWriter())
, mCSSHelper(cssHelper)
@@ -347,7 +377,8 @@ Interface::ObjectTreeSource *DefaultRendererPrivate::source() const
return nullptr;
}
-void DefaultRendererPrivate::renderSubParts(const MessagePart::Ptr &msgPart, const QSharedPointer<CacheHtmlWriter> &htmlWriter)
+void DefaultRendererPrivate::renderSubParts(const MessagePart::Ptr &msgPart,
+ const QSharedPointer<CacheHtmlWriter> &htmlWriter)
{
foreach (const auto &_m, msgPart->subParts()) {
const auto m = _m.dynamicCast<MessagePart>();
@@ -375,7 +406,8 @@ QString DefaultRendererPrivate::render(const MessagePartList::Ptr &mp)
}
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
mp->setHtmlWriter(htmlWriter.data());
@@ -393,7 +425,8 @@ QString DefaultRendererPrivate::render(const MimeMessagePart::Ptr &mp)
HTMLBlock::Ptr aBlock;
HTMLBlock::Ptr rBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
if (mp->isRoot()) {
@@ -411,13 +444,15 @@ QString DefaultRendererPrivate::render(const EncapsulatedRfc822MessagePart::Ptr
if (!mp->hasSubParts()) {
return QString();
}
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/encapsulatedrfc822messagepart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/encapsulatedrfc822messagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
c.insert(QStringLiteral("block"), &block);
block.setProperty("dir", alignText());
- block.setProperty("link", mp->mOtp->nodeHelper()->asHREF(mp->mMessage.data(), QStringLiteral("body")));
+ block.setProperty("link",
+ mp->mOtp->nodeHelper()->asHREF(mp->mMessage.data(), QStringLiteral("body")));
c.insert(QStringLiteral("msgHeader"), mp->source()->createMessageHeader(mp->mMessage.data()));
{
@@ -430,7 +465,8 @@ QString DefaultRendererPrivate::render(const EncapsulatedRfc822MessagePart::Ptr
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
const auto html = t->render(&c);
htmlWriter->queue(html);
@@ -440,7 +476,8 @@ QString DefaultRendererPrivate::render(const EncapsulatedRfc822MessagePart::Ptr
QString DefaultRendererPrivate::render(const HtmlMessagePart::Ptr &mp)
{
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/htmlmessagepart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/htmlmessagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
@@ -462,7 +499,8 @@ QString DefaultRendererPrivate::render(const HtmlMessagePart::Ptr &mp)
mOldWriter->extraHead(extraHead);
}
- block.setProperty("containsExternalReferences", containsExternalReferences(bodyText, extraHead));
+ block.setProperty("containsExternalReferences",
+ containsExternalReferences(bodyText, extraHead));
c.insert(QStringLiteral("content"), bodyText);
}
@@ -479,13 +517,13 @@ QString DefaultRendererPrivate::render(const HtmlMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
const auto html = t->render(&c);
htmlWriter->queue(html);
}
return htmlWriter->html;
-
}
QString DefaultRendererPrivate::renderEncrypted(const EncryptedMessagePart::Ptr &mp)
@@ -493,7 +531,8 @@ QString DefaultRendererPrivate::renderEncrypted(const EncryptedMessagePart::Ptr
KMime::Content *node = mp->mNode;
const auto metaData = mp->mMetaData;
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/encryptedmessagepart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/encryptedmessagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
@@ -518,7 +557,8 @@ QString DefaultRendererPrivate::renderEncrypted(const EncryptedMessagePart::Ptr
c.insert(QStringLiteral("cryptoProto"), QVariant::fromValue(mp->mCryptoProto));
if (mp->mDecryptRecipients.size() > 0) {
- c.insert(QStringLiteral("decryptedRecipients"), QVariant::fromValue(mp->mDecryptRecipients));
+ c.insert(QStringLiteral("decryptedRecipients"),
+ QVariant::fromValue(mp->mDecryptRecipients));
}
c.insert(QStringLiteral("block"), &block);
@@ -526,10 +566,14 @@ QString DefaultRendererPrivate::renderEncrypted(const EncryptedMessagePart::Ptr
block.setProperty("inProgress", metaData.inProgress);
block.setProperty("isDecrypted", mp->decryptMessage());
block.setProperty("isDecryptable", metaData.isDecryptable);
- block.setProperty("decryptIcon", QUrl::fromLocalFile(IconNameCache::instance()->iconPath(QStringLiteral("document-decrypt"), KIconLoader::Small)).url());
+ block.setProperty("decryptIcon",
+ QUrl::fromLocalFile(IconNameCache::instance()->iconPath(QStringLiteral(
+ "document-decrypt"),
+ KIconLoader::Small)).url());
block.setProperty("errorText", metaData.errorText);
block.setProperty("noSecKey", mp->mNoSecKey);
- block.setProperty("iconSize", MessageViewer::MessagePartRendererManager::self()->iconCurrentSize());
+ block.setProperty("iconSize",
+ MessageViewer::MessagePartRendererManager::self()->iconCurrentSize());
const auto html = t->render(&c);
@@ -544,7 +588,8 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
const bool isSMIME = cryptoProto && (cryptoProto == QGpgME::smime());
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/signedmessagepart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/signedmessagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
@@ -580,7 +625,8 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
block.setProperty("technicalProblem", metaData.technicalProblem);
block.setProperty("keyId", metaData.keyId);
if (metaData.creationTime.isValid()) { //should be handled inside grantlee but currently not possible see: https://bugs.kde.org/363475
- block.setProperty("creationTime", QLocale().toString(metaData.creationTime, QLocale::ShortFormat));
+ block.setProperty("creationTime",
+ QLocale().toString(metaData.creationTime, QLocale::ShortFormat));
}
block.setProperty("isGoodSignature", metaData.isGoodSignature);
block.setProperty("isSMIME", isSMIME);
@@ -601,13 +647,17 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
{
QString keyWithWithoutURL;
if (cryptoProto) {
- startKeyHREF =
- QStringLiteral("<a href=\"kmail:showCertificate#%1 ### %2 ### %3\">")
- .arg(cryptoProto->displayName(),
- cryptoProto->name(),
- QString::fromLatin1(metaData.keyId));
-
- keyWithWithoutURL = QStringLiteral("%1%2</a>").arg(startKeyHREF, QString::fromLatin1(QByteArray(QByteArrayLiteral("0x") + metaData.keyId)));
+ startKeyHREF
+ = QStringLiteral("<a href=\"kmail:showCertificate#%1 ### %2 ### %3\">")
+ .arg(cryptoProto->displayName(),
+ cryptoProto->name(),
+ QString::fromLatin1(metaData.keyId));
+
+ keyWithWithoutURL
+ = QStringLiteral("%1%2</a>").arg(startKeyHREF,
+ QString::fromLatin1(QByteArray(QByteArrayLiteral(
+ "0x")
+ + metaData.keyId)));
} else {
keyWithWithoutURL = QStringLiteral("0x") + QString::fromUtf8(metaData.keyId);
}
@@ -660,7 +710,6 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
showKeyInfos = true;
if (isSMIME && (SIG_FRAME_COL_UNDEF != frameColor)) {
-
switch (frameColor) {
case SIG_FRAME_COL_RED:
mClass = QStringLiteral("signErr");
@@ -687,17 +736,18 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
if (!blockAddrs.empty()) {
if (!blockAddrs.contains(msgFrom, Qt::CaseInsensitive)) {
- greenCaseWarning =
- QStringLiteral("<u>") +
- i18nc("Start of warning message.", "Warning:") +
- QStringLiteral("</u> ") +
- i18n("Sender's mail address is not stored in the %1 used for signing.",
- certificate) +
- QStringLiteral("<br />") +
- i18n("sender: ") +
- msgFrom +
- QStringLiteral("<br />") +
- i18n("stored: ");
+ greenCaseWarning
+ = QStringLiteral("<u>")
+ +i18nc("Start of warning message.", "Warning:")
+ +QStringLiteral("</u> ")
+ +i18n(
+ "Sender's mail address is not stored in the %1 used for signing.",
+ certificate)
+ +QStringLiteral("<br />")
+ +i18n("sender: ")
+ +msgFrom
+ +QStringLiteral("<br />")
+ +i18n("stored: ");
// We cannot use Qt's join() function here but
// have to join the addresses manually to
// extract the mail addresses (without '<''>')
@@ -705,7 +755,7 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
bool bStart = true;
QStringList::ConstIterator end(blockAddrs.constEnd());
for (QStringList::ConstIterator it = blockAddrs.constBegin();
- it != end; ++it) {
+ it != end; ++it) {
if (!bStart) {
greenCaseWarning.append(QStringLiteral(", <br />&nbsp; &nbsp;"));
}
@@ -715,14 +765,14 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
}
}
} else {
- greenCaseWarning =
- QStringLiteral("<u>") +
- i18nc("Start of warning message.", "Warning:") +
- QStringLiteral("</u> ") +
- i18n("No mail address is stored in the %1 used for signing, "
- "so we cannot compare it to the sender's address %2.",
- certificate,
- msgFrom);
+ greenCaseWarning
+ = QStringLiteral("<u>")
+ +i18nc("Start of warning message.", "Warning:")
+ +QStringLiteral("</u> ")
+ +i18n("No mail address is stored in the %1 used for signing, "
+ "so we cannot compare it to the sender's address %2.",
+ certificate,
+ msgFrom);
}
break;
}
@@ -733,7 +783,13 @@ QString DefaultRendererPrivate::renderSigned(const SignedMessagePart::Ptr &mp)
} else {
if (!blockAddrs.empty()) {
const QUrl address = KEmailAddress::encodeMailtoUrl(blockAddrs.first());
- signer = QStringLiteral("<a href=\"mailto:%1\">%2</a>").arg(QLatin1String(QUrl::toPercentEncoding(address.path())), signer);
+ signer
+ = QStringLiteral("<a href=\"mailto:%1\">%2</a>").arg(QLatin1String(QUrl
+ ::
+ toPercentEncoding(
+ address
+ .
+ path())), signer);
}
}
}
@@ -779,7 +835,9 @@ QString DefaultRendererPrivate::render(const SignedMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(),
+ mp->attachmentNode()));
}
htmlWriter->queue(renderSigned(mp));
}
@@ -788,7 +846,8 @@ QString DefaultRendererPrivate::render(const SignedMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
if (mp->hasSubParts()) {
renderSubParts(mp, htmlWriter);
@@ -811,7 +870,9 @@ QString DefaultRendererPrivate::render(const EncryptedMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(),
+ mp->attachmentNode()));
}
htmlWriter->queue(renderEncrypted(mp));
}
@@ -821,7 +882,8 @@ QString DefaultRendererPrivate::render(const EncryptedMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
if (mp->hasSubParts()) {
@@ -842,7 +904,8 @@ QString DefaultRendererPrivate::render(const AlternativeMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
auto mode = mp->preferredMode();
@@ -867,7 +930,8 @@ QString DefaultRendererPrivate::render(const AlternativeMessagePart::Ptr &mp)
QString DefaultRendererPrivate::render(const CertMessagePart::Ptr &mp)
{
const GpgME::ImportResult &importResult(mp->mImportResult);
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/certmessagepart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/certmessagepart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
@@ -894,7 +958,8 @@ QString DefaultRendererPrivate::render(const CertMessagePart::Ptr &mp)
{
HTMLBlock::Ptr aBlock;
if (mp->isAttachment()) {
- aBlock = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
+ aBlock
+ = HTMLBlock::Ptr(new AttachmentMarkBlock(htmlWriter.data(), mp->attachmentNode()));
}
const auto html = t->render(&c);
htmlWriter->queue(html);
@@ -902,7 +967,8 @@ QString DefaultRendererPrivate::render(const CertMessagePart::Ptr &mp)
return htmlWriter->html;
}
-QSharedPointer<PartRendered> DefaultRendererPrivate::renderWithFactory(QString className, const Interface::MessagePart::Ptr &msgPart)
+QSharedPointer<PartRendered> DefaultRendererPrivate::renderWithFactory(QString className,
+ const Interface::MessagePart::Ptr &msgPart)
{
if (mRendererFactory) {
const auto registry = mRendererFactory->typeRegistry(className);
@@ -916,25 +982,25 @@ QSharedPointer<PartRendered> DefaultRendererPrivate::renderWithFactory(QString c
return QSharedPointer<PartRendered>();
}
-QString DefaultRendererPrivate::renderFactory(const Interface::MessagePart::Ptr &msgPart, const QSharedPointer<CacheHtmlWriter> &htmlWriter)
+QString DefaultRendererPrivate::renderFactory(const Interface::MessagePart::Ptr &msgPart,
+ const QSharedPointer<CacheHtmlWriter> &htmlWriter)
{
const QString className = QString::fromUtf8(msgPart->metaObject()->className());
const auto rendered = renderWithFactory(className, msgPart);
if (rendered) {
const auto parts = rendered->embededParts();
- foreach(auto key, parts.keys()) {
+ foreach (auto key, parts.keys()) {
htmlWriter->embedPart(key, parts.value(key));
}
- foreach(auto entry, rendered->extraHeader()) {
+ foreach (auto entry, rendered->extraHeader()) {
htmlWriter->extraHead(entry);
}
return rendered->html();
}
-
if (className == QStringLiteral("MimeTreeParser::MessagePartList")) {
auto mp = msgPart.dynamicCast<MessagePartList>();
if (mp) {
@@ -977,7 +1043,8 @@ QString DefaultRendererPrivate::renderFactory(const Interface::MessagePart::Ptr
}
}
- qCDebug(MESSAGEVIEWER_LOG) << "We got a unkonwn classname, using default behaviour for " << className;
+ qCDebug(MESSAGEVIEWER_LOG) << "We got a unkonwn classname, using default behaviour for "
+ << className;
auto _htmlWriter = htmlWriter;
if (!_htmlWriter) {
@@ -993,8 +1060,10 @@ QString DefaultRendererPrivate::renderFactory(const Interface::MessagePart::Ptr
return QString();
}
-DefaultRenderer::DefaultRenderer(const MimeTreeParser::Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper)
- : d(new MimeTreeParser::DefaultRendererPrivate(msgPart, cssHelper, rendererPluginFactoryInstance()))
+DefaultRenderer::DefaultRenderer(const MimeTreeParser::Interface::MessagePart::Ptr &msgPart,
+ CSSHelperBase *cssHelper)
+ : d(new MimeTreeParser::DefaultRendererPrivate(msgPart, cssHelper,
+ rendererPluginFactoryInstance()))
{
}
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer.h b/messageviewer/src/messagepartthemes/default/defaultrenderer.h
index 38919c3..b2e8cf4 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer.h
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer.h
@@ -22,27 +22,24 @@
#include <MimeTreeParser/MessagePartRenderer>
-#include<QSharedPointer>
+#include <QSharedPointer>
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class DefaultRendererPrivate;
-namespace Interface
-{
+namespace Interface {
class MessagePart;
typedef QSharedPointer<MessagePart> MessagePartPtr;
}
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class CSSHelperBase;
class DefaultRenderer : public MimeTreeParser::Interface::MessagePartRenderer
{
public:
- DefaultRenderer(const MimeTreeParser::Interface::MessagePartPtr &msgPart, CSSHelperBase *cssHelder);
+ DefaultRenderer(const MimeTreeParser::Interface::MessagePartPtr &msgPart,
+ CSSHelperBase *cssHelder);
~DefaultRenderer();
QString html() const override;
diff --git a/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h b/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
index 11e30b6..a869378 100644
--- a/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
+++ b/messageviewer/src/messagepartthemes/default/defaultrenderer_p.h
@@ -29,19 +29,17 @@ using namespace MessageViewer;
class CacheHtmlWriter;
class PartRendered;
-namespace MessageViewer
-{
+namespace MessageViewer {
class MessagePartRendererFactoryBase;
class CSSHelperBase;
}
-namespace MimeTreeParser
-{
-
+namespace MimeTreeParser {
class DefaultRendererPrivate
{
public:
- DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper, const MessagePartRendererFactoryBase *rendererFactory);
+ DefaultRendererPrivate(const Interface::MessagePart::Ptr &msgPart, CSSHelperBase *cssHelper,
+ const MessagePartRendererFactoryBase *rendererFactory);
~DefaultRendererPrivate();
QString alignText();
@@ -49,7 +47,8 @@ public:
Interface::ObjectTreeSource *source() const;
- void renderSubParts(const MessagePart::Ptr &msgPart, const QSharedPointer<CacheHtmlWriter> &htmlWriter);
+ void renderSubParts(const MessagePart::Ptr &msgPart,
+ const QSharedPointer<CacheHtmlWriter> &htmlWriter);
QString render(const MessagePartList::Ptr &mp);
QString render(const MimeMessagePart::Ptr &mp);
@@ -61,9 +60,10 @@ public:
QString render(const EncryptedMessagePart::Ptr &mp);
QString render(const AlternativeMessagePart::Ptr &mp);
QString render(const CertMessagePart::Ptr &mp);
- QSharedPointer<PartRendered> renderWithFactory(QString className, const Interface::MessagePart::Ptr &msgPart);
- QString renderFactory(const Interface::MessagePart::Ptr &msgPart, const QSharedPointer<CacheHtmlWriter> &htmlWriter);
-
+ QSharedPointer<PartRendered> renderWithFactory(QString className,
+ const Interface::MessagePart::Ptr &msgPart);
+ QString renderFactory(const Interface::MessagePart::Ptr &msgPart,
+ const QSharedPointer<CacheHtmlWriter> &htmlWriter);
QString mHtml;
Interface::MessagePart::Ptr mMsgPart;
@@ -72,6 +72,5 @@ public:
CSSHelperBase *mCSSHelper;
const MessageViewer::MessagePartRendererFactoryBase *mRendererFactory;
};
-
}
#endif
diff --git a/messageviewer/src/messagepartthemes/default/htmlblock.cpp b/messageviewer/src/messagepartthemes/default/htmlblock.cpp
index 46781cf..5c228c3 100644
--- a/messageviewer/src/messagepartthemes/default/htmlblock.cpp
+++ b/messageviewer/src/messagepartthemes/default/htmlblock.cpp
@@ -44,7 +44,7 @@ QString HTMLBlock::dir() const
QString HTMLBlock::enter()
{
- if(!entered) {
+ if (!entered) {
entered = true;
return enterString();
}
diff --git a/messageviewer/src/messagepartthemes/default/htmlblock.h b/messageviewer/src/messagepartthemes/default/htmlblock.h
index 65601fb..f0cc7a1 100644
--- a/messageviewer/src/messagepartthemes/default/htmlblock.h
+++ b/messageviewer/src/messagepartthemes/default/htmlblock.h
@@ -24,13 +24,11 @@
#include <QSharedPointer>
#include <QVector>
-namespace KMime
-{
+namespace KMime {
class Content;
}
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class HtmlWriter;
class HTMLBlock
@@ -93,6 +91,5 @@ private:
HtmlWriter *mWriter;
};
-
}
#endif //__MIMETREEPARSER_HTMLBLOCK_H__
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrendererbase.h b/messageviewer/src/messagepartthemes/default/messagepartrendererbase.h
index d4a1135..5bbb53e 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrendererbase.h
+++ b/messageviewer/src/messagepartthemes/default/messagepartrendererbase.h
@@ -1,4 +1,3 @@
-
/*
Copyright (c) 2017 Sandro Knauß <[email protected]>
@@ -40,11 +39,9 @@
#include <QString>
#include <QSharedPointer>
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class DefaultRendererPrivate;
-namespace Interface
-{
+namespace Interface {
class MessagePart;
typedef QSharedPointer<MessagePart> MessagePartPtr;
}
@@ -52,10 +49,13 @@ typedef QSharedPointer<MessagePart> MessagePartPtr;
class PartRendered;
-class MessagePartRendererBase {
+class MessagePartRendererBase
+{
public:
MessagePartRendererBase();
virtual ~MessagePartRendererBase();
- virtual QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *, const MimeTreeParser::Interface::MessagePartPtr &) const = 0;
+ virtual QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *,
+ const MimeTreeParser::Interface::MessagePartPtr &)
+ const = 0;
};
#endif
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.cpp b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.cpp
index c4f1dd2..c9b3477 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.cpp
+++ b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.cpp
@@ -37,7 +37,8 @@
using namespace MessageViewer;
-MessagePartRendererFactoryBasePrivate::MessagePartRendererFactoryBasePrivate(MessagePartRendererFactoryBase *factory)
+MessagePartRendererFactoryBasePrivate::MessagePartRendererFactoryBasePrivate(
+ MessagePartRendererFactoryBase *factory)
: q(factory)
, mAll(std::unique_ptr<TypeRegistry>(new TypeRegistry()))
{
@@ -55,7 +56,8 @@ void MessagePartRendererFactoryBasePrivate::setup()
}
}
-void MessagePartRendererFactoryBasePrivate::insert(const QString &type, MessagePartRendererBase *formatter)
+void MessagePartRendererFactoryBasePrivate::insert(const QString &type,
+ MessagePartRendererBase *formatter)
{
if (type.isEmpty() || !formatter) {
return;
@@ -65,7 +67,9 @@ void MessagePartRendererFactoryBasePrivate::insert(const QString &type, MessageP
}
MessagePartRendererFactoryBase::MessagePartRendererFactoryBase()
- : d(std::unique_ptr<MessagePartRendererFactoryBasePrivate>(new MessagePartRendererFactoryBasePrivate(this)))
+ : d(std::unique_ptr<MessagePartRendererFactoryBasePrivate>(new
+ MessagePartRendererFactoryBasePrivate(
+ this)))
{
}
@@ -78,7 +82,8 @@ void MessagePartRendererFactoryBase::insert(const QString &type, MessagePartRend
d->insert(type, formatter);
}
-std::vector<MessagePartRendererBase *> MessagePartRendererFactoryBase::typeRegistry(const QString &type) const
+std::vector<MessagePartRendererBase *> MessagePartRendererFactoryBase::typeRegistry(
+ const QString &type) const
{
d->setup();
Q_ASSERT(!d->mAll->isEmpty());
@@ -89,4 +94,3 @@ void MessagePartRendererFactoryBase::loadPlugins()
{
qCDebug(MESSAGEVIEWER_LOG) << "plugin loading is not enabled in libmimetreeparser";
}
-
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.h b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.h
index bff6a07..8b70c2d 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.h
+++ b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase.h
@@ -42,9 +42,7 @@
class MessagePartRendererBase;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MessagePartRendererFactoryBasePrivate;
class MESSAGEVIEWER_EXPORT MessagePartRendererFactoryBase
@@ -69,7 +67,6 @@ private:
const MessagePartRendererFactoryBase &operator=(const MessagePartRendererFactoryBase &);
MessagePartRendererFactoryBase(const MessagePartRendererFactoryBase &);
};
-
}
#endif
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase_p.h b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase_p.h
index c84ca8d..5662591 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase_p.h
+++ b/messageviewer/src/messagepartthemes/default/messagepartrendererfactorybase_p.h
@@ -36,11 +36,10 @@
class MessagePartRendererBase;
-namespace MessageViewer
-{
+namespace MessageViewer {
class MessagePartRendererFactoryBase;
-typedef QMap<QString, std::vector<MessagePartRendererBase*>> TypeRegistry;
+typedef QMap<QString, std::vector<MessagePartRendererBase *> > TypeRegistry;
class MessagePartRendererFactoryBasePrivate
{
@@ -55,7 +54,6 @@ public:
MessagePartRendererFactoryBase *q;
std::unique_ptr<TypeRegistry> mAll;
};
-
}
#endif
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
index 6cd9256..e7d2667 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
+++ b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.cpp
@@ -39,16 +39,15 @@ Q_DECLARE_METATYPE(GpgME::DecryptionResult::Recipient)
Q_DECLARE_METATYPE(const QGpgME::Protocol *)
// Read-only introspection of GpgME::DecryptionResult::Recipient object.
GRANTLEE_BEGIN_LOOKUP(GpgME::DecryptionResult::Recipient)
-if (property == QStringLiteral("keyID"))
-{
+if (property == QStringLiteral("keyID")) {
return QString::fromLatin1(object.keyID());
}
GRANTLEE_END_LOOKUP
// Read-only introspection of QGpgME::Protocol object.
-namespace Grantlee
-{
+namespace Grantlee {
template<>
-inline QVariant TypeAccessor<const QGpgME::Protocol *>::lookUp(const QGpgME::Protocol *const object, const QString &property)
+inline QVariant TypeAccessor<const QGpgME::Protocol *>::lookUp(const QGpgME::Protocol *const object,
+ const QString &property)
{
if (property == QStringLiteral("name")) {
return object->name();
@@ -80,8 +79,8 @@ public:
Q_GLOBAL_STATIC(MessagePartRendererManagerInstancePrivate, sInstance)
MessagePartRendererManager::MessagePartRendererManager(QObject *parent)
- : QObject(parent),
- m_engine(nullptr)
+ : QObject(parent)
+ , m_engine(nullptr)
{
initializeRenderer();
}
@@ -103,7 +102,8 @@ void MessagePartRendererManager::initializeRenderer()
m_engine = new GrantleeTheme::Engine;
m_engine->localizer()->setApplicationDomain(QByteArrayLiteral("libmessageviewer"));
- auto loader = QSharedPointer<Grantlee::FileSystemTemplateLoader>(new GrantleeTheme::QtResourceTemplateLoader());
+ auto loader = QSharedPointer<Grantlee::FileSystemTemplateLoader>(
+ new GrantleeTheme::QtResourceTemplateLoader());
m_engine->addTemplateLoader(loader);
mCurrentIconSize = KIconLoader::global()->currentSize(KIconLoader::Desktop);
@@ -113,7 +113,11 @@ Grantlee::Template MessagePartRendererManager::loadByName(const QString &name)
{
Grantlee::Template t = m_engine->loadByName(name);
if (t->error()) {
- qCWarning(MESSAGEVIEWER_LOG) << t->errorString() << ". Searched in subdir mimetreeparser/themes/default in these locations" << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
+ qCWarning(MESSAGEVIEWER_LOG) << t->errorString()
+ <<
+ ". Searched in subdir mimetreeparser/themes/default in these locations"
+ << QStandardPaths::standardLocations(
+ QStandardPaths::GenericDataLocation);
}
return t;
}
diff --git a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.h b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.h
index 84b5632..cf09761 100644
--- a/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.h
+++ b/messageviewer/src/messagepartthemes/default/messagepartrenderermanager.h
@@ -24,14 +24,11 @@
#include "messageviewer_export.h"
#include <grantlee/template.h>
-namespace GrantleeTheme
-{
+namespace GrantleeTheme {
class Engine;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT MessagePartRendererManager : public QObject
{
Q_OBJECT
diff --git a/messageviewer/src/messagepartthemes/default/partrendered.cpp b/messageviewer/src/messagepartthemes/default/partrendered.cpp
index f284474..0dbc9e0 100644
--- a/messageviewer/src/messagepartthemes/default/partrendered.cpp
+++ b/messageviewer/src/messagepartthemes/default/partrendered.cpp
@@ -44,17 +44,49 @@ using namespace MessageViewer;
class CacheHtmlWriter : public MimeTreeParser::HtmlWriter
{
public:
- explicit CacheHtmlWriter() {}
- virtual ~CacheHtmlWriter() {}
-
- void begin(const QString &text) override {}
- void write(const QString &str) override {html.append(str);}
- void end() override {}
- void reset() override {}
- void queue(const QString &str) override {html.append(str);}
- void flush() override {}
- void embedPart(const QByteArray &contentId, const QString &url) override {embedParts.insert(contentId, url);}
- void extraHead(const QString &extra) override {head.append(extra);}
+ explicit CacheHtmlWriter()
+ {
+ }
+
+ virtual ~CacheHtmlWriter()
+ {
+ }
+
+ void begin(const QString &text) override
+ {
+ }
+
+ void write(const QString &str) override
+ {
+ html.append(str);
+ }
+
+ void end() override
+ {
+ }
+
+ void reset() override
+ {
+ }
+
+ void queue(const QString &str) override
+ {
+ html.append(str);
+ }
+
+ void flush() override
+ {
+ }
+
+ void embedPart(const QByteArray &contentId, const QString &url) override
+ {
+ embedParts.insert(contentId, url);
+ }
+
+ void extraHead(const QString &extra) override
+ {
+ head.append(extra);
+ }
QString html;
QString head;
@@ -74,11 +106,12 @@ inline QString PartRendered::alignText()
return QApplication::isRightToLeft() ? QStringLiteral("rtl") : QStringLiteral("ltr");
}
-QVector<QSharedPointer<PartRendered>> PartRendered::renderSubParts(MimeTreeParser::MessagePart::Ptr mp)
+QVector<QSharedPointer<PartRendered> > PartRendered::renderSubParts(
+ MimeTreeParser::MessagePart::Ptr mp)
{
Test::CSSHelper testCSSHelper;
- QVector<QSharedPointer<PartRendered>> ret;
+ QVector<QSharedPointer<PartRendered> > ret;
foreach (const auto &_m, mp->subParts()) {
CacheHtmlWriter cacheWriter;
DefaultRenderer::Ptr renderer = mp->source()->messagePartTheme(_m);
@@ -178,7 +211,6 @@ TextPartRendered::TextPartRendered(MimeTreeParser::TextMessagePart::Ptr mp)
: mShowAttachmentBlock(false)
, mAttachmentNode(nullptr)
{
-
auto node = mp->mNode;
auto nodeHelper = mp->mOtp->nodeHelper();
@@ -192,16 +224,22 @@ TextPartRendered::TextPartRendered(MimeTreeParser::TextMessagePart::Ptr mp)
c.insert(QStringLiteral("block"), &block);
block.setProperty("showTextFrame", mp->showTextFrame());
- block.setProperty("label", MessageCore::StringUtil::quoteHtmlChars(MimeTreeParser::NodeHelper::fileName(node), true));
- block.setProperty("comment", MessageCore::StringUtil::quoteHtmlChars(node->contentDescription()->asUnicodeString(), true));
+ block.setProperty("label",
+ MessageCore::StringUtil::quoteHtmlChars(MimeTreeParser::NodeHelper::fileName(
+ node), true));
+ block.setProperty("comment",
+ MessageCore::StringUtil::quoteHtmlChars(node->contentDescription()->
+ asUnicodeString(), true));
block.setProperty("link", nodeHelper->asHREF(node, QStringLiteral("body")));
block.setProperty("showLink", mp->showLink());
block.setProperty("dir", alignText());
- t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/textmessagepart.html"));
+ t
+ = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/textmessagepart.html"));
mSubList = renderSubParts(mp);
QString content;
- foreach(auto part, mSubList) {
+ foreach (auto part, mSubList) {
content += part->html();
}
c.insert(QStringLiteral("content"), content);
@@ -215,11 +253,10 @@ TextPartRendered::~TextPartRendered()
{
}
-
QMap<QByteArray, QString> TextPartRendered::embededParts()
{
QMap<QByteArray, QString> ret;
- foreach(auto part, mSubList) {
+ foreach (auto part, mSubList) {
//ret += part->embededParts();
}
return ret;
@@ -228,7 +265,7 @@ QMap<QByteArray, QString> TextPartRendered::embededParts()
QString TextPartRendered::extraHeader()
{
QString ret;
- foreach(auto part, mSubList) {
+ foreach (auto part, mSubList) {
ret += part->extraHeader();
}
return ret;
diff --git a/messageviewer/src/messagepartthemes/default/partrendered.h b/messageviewer/src/messagepartthemes/default/partrendered.h
index 2097ac2..f04d09e 100644
--- a/messageviewer/src/messagepartthemes/default/partrendered.h
+++ b/messageviewer/src/messagepartthemes/default/partrendered.h
@@ -25,18 +25,16 @@
#include <QSharedPointer>
#include <QVector>
-namespace MimeTreeParser
-{
- class MessagePart;
- typedef QSharedPointer<MessagePart> MessagePartPtr;
- class TextMessagePart;
- typedef QSharedPointer<TextMessagePart> TextMessagePartPtr;
- class DefaultRendererPrivate;
+namespace MimeTreeParser {
+class MessagePart;
+typedef QSharedPointer<MessagePart> MessagePartPtr;
+class TextMessagePart;
+typedef QSharedPointer<TextMessagePart> TextMessagePartPtr;
+class DefaultRendererPrivate;
}
-namespace KMime
-{
- class Content;
+namespace KMime {
+class Content;
}
class CacheHtmlWriter;
@@ -53,7 +51,7 @@ public:
virtual QString extraHeader() = 0;
protected:
- QVector<QSharedPointer<PartRendered>> renderSubParts(MimeTreeParser::MessagePartPtr mp);
+ QVector<QSharedPointer<PartRendered> > renderSubParts(MimeTreeParser::MessagePartPtr mp);
};
class EmptyPartRendered : public PartRendered
{
@@ -113,7 +111,7 @@ public:
private:
QString mHtml;
- QVector<QSharedPointer<PartRendered>> mSubList;
+ QVector<QSharedPointer<PartRendered> > mSubList;
bool mShowAttachmentBlock;
KMime::Content *mAttachmentNode;
};
diff --git a/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp b/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp
index 66330cc..348a8f6 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.cpp
@@ -40,7 +40,9 @@ AttachmentMessagePartRenderer::~AttachmentMessagePartRenderer()
{
}
-QSharedPointer<PartRendered> AttachmentMessagePartRenderer::render(DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const
+QSharedPointer<PartRendered> AttachmentMessagePartRenderer::render(DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart)
+const
{
auto mp = msgPart.dynamicCast<AttachmentMessagePart>();
if (!mp) {
@@ -60,18 +62,23 @@ QSharedPointer<PartRendered> AttachmentMessagePartRenderer::render(DefaultRender
return drp->renderWithFactory(QStringLiteral("MimeTreeParser::TextMessagePart"), mp);
}
- Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(":/asiconpart.html"));
+ Grantlee::Template t = MessageViewer::MessagePartRendererManager::self()->loadByName(QStringLiteral(
+ ":/asiconpart.html"));
Grantlee::Context c = MessageViewer::MessagePartRendererManager::self()->createContext();
QObject block;
c.insert(QStringLiteral("block"), &block);
block.setProperty("showTextFrame", mp->showTextFrame());
- block.setProperty("label", MessageCore::StringUtil::quoteHtmlChars(NodeHelper::fileName(node), true));
- block.setProperty("comment", MessageCore::StringUtil::quoteHtmlChars(node->contentDescription()->asUnicodeString(), true));
+ block.setProperty("label",
+ MessageCore::StringUtil::quoteHtmlChars(NodeHelper::fileName(node), true));
+ block.setProperty("comment",
+ MessageCore::StringUtil::quoteHtmlChars(node->contentDescription()->
+ asUnicodeString(), true));
block.setProperty("link", nodeHelper->asHREF(node, QStringLiteral("body")));
block.setProperty("showLink", mp->showLink());
block.setProperty("dir", drp->alignText());
- block.setProperty("iconSize", MessageViewer::MessagePartRendererManager::self()->iconCurrentSize());
+ block.setProperty("iconSize",
+ MessageViewer::MessagePartRendererManager::self()->iconCurrentSize());
block.setProperty("inline", (tmpAsIcon == MimeTreeParser::IconInline));
QString iconPath;
diff --git a/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.h b/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.h
index 7c490ec..8a47d44 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.h
+++ b/messageviewer/src/messagepartthemes/default/plugins/attachmentmessagepartrenderer.h
@@ -29,7 +29,9 @@ class AttachmentMessagePartRenderer : public MessagePartRendererBase
public:
AttachmentMessagePartRenderer();
virtual ~AttachmentMessagePartRenderer();
- QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const override;
+ QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart)
+ const override;
};
#endif
diff --git a/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.cpp b/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.cpp
index 0ecd9ccd..ff814fb 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.cpp
@@ -32,11 +32,16 @@ MessagePartRenderer::~MessagePartRenderer()
{
}
-QSharedPointer<PartRendered> MessagePartRenderer::render(MimeTreeParser::DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const
+QSharedPointer<PartRendered> MessagePartRenderer::render(
+ MimeTreeParser::DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart) const
{
auto mp = msgPart.dynamicCast<MimeTreeParser::MessagePart>();
if (mp) {
- return QSharedPointer<PartRendered>(new HtmlOnlyPartRendered(mp, quotedHTML(mp->text(), mp->source(), drp->cssHelper())));
+ return QSharedPointer<PartRendered>(new HtmlOnlyPartRendered(mp,
+ quotedHTML(mp->text(),
+ mp->source(),
+ drp->cssHelper())));
}
return QSharedPointer<PartRendered>();
}
diff --git a/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.h b/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.h
index 7c4e96d..7803ff9 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.h
+++ b/messageviewer/src/messagepartthemes/default/plugins/messagepartrenderer.h
@@ -29,7 +29,9 @@ class MessagePartRenderer : public MessagePartRendererBase
public:
MessagePartRenderer();
virtual ~MessagePartRenderer();
- QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const override;
+ QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart)
+ const override;
};
#endif
diff --git a/messageviewer/src/messagepartthemes/default/plugins/plugins.cpp b/messageviewer/src/messagepartthemes/default/plugins/plugins.cpp
index d4d1c7c..c8a4927 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/plugins.cpp
+++ b/messageviewer/src/messagepartthemes/default/plugins/plugins.cpp
@@ -29,5 +29,6 @@ void MessagePartRendererFactoryBasePrivate::initalize_builtin_renderers()
{
insert(QStringLiteral("MimeTreeParser::MessagePart"), new MessagePartRenderer());
insert(QStringLiteral("MimeTreeParser::TextMessagePart"), new TextMessagePartRenderer());
- insert(QStringLiteral("MimeTreeParser::AttachmentMessagePart"), new AttachmentMessagePartRenderer());
+ insert(QStringLiteral(
+ "MimeTreeParser::AttachmentMessagePart"), new AttachmentMessagePartRenderer());
}
diff --git a/messageviewer/src/messagepartthemes/default/plugins/quotehtml.cpp b/messageviewer/src/messagepartthemes/default/plugins/quotehtml.cpp
index 59b4bd9..1409a70 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/quotehtml.cpp
+++ b/messageviewer/src/messagepartthemes/default/plugins/quotehtml.cpp
@@ -106,7 +106,8 @@ bool looksLikeParaBreak(const QString &s, unsigned int newLinePos)
return prevLineLength + wordLength + 1 < WRAP_COL;
}
-QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource *source, MessageViewer::CSSHelperBase *cssHelper)
+QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource *source,
+ MessageViewer::CSSHelperBase *cssHelper)
{
Q_ASSERT(cssHelper);
@@ -131,8 +132,8 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
unsigned int pos, beg;
// skip leading empty lines
- for (pos = 0; pos < length && s[pos] <= QLatin1Char(' '); ++pos)
- ;
+ for (pos = 0; pos < length && s[pos] <= QLatin1Char(' '); ++pos) {
+ }
while (pos > 0 && (s[pos - 1] == QLatin1Char(' ') || s[pos - 1] == QLatin1Char('\t'))) {
pos--;
}
@@ -144,8 +145,11 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
QString collapseIconPath;
QString expandIconPath;
if (source->showExpandQuotesMark()) {
- collapseIconPath = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quotecollapse.png"));
- expandIconPath = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral("quoteexpand.png"));
+ collapseIconPath = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral(
+ "quotecollapse.png"));
+ expandIconPath
+ = MessageViewer::IconNameCache::instance()->iconPathFromLocal(QStringLiteral(
+ "quoteexpand.png"));
}
int previousQuoteDepth = -1;
@@ -189,7 +193,7 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
// This quoted line needs be hidden
if (source->showExpandQuotesMark() && source->levelQuote() >= 0
- && source->levelQuote() <= actQuoteLevel) {
+ && source->levelQuote() <= actQuoteLevel) {
actHidden = true;
}
@@ -212,7 +216,8 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
if (source->showExpandQuotesMark()) {
// Add blockquote
if (previousQuoteDepth < actQuoteLevel) {
- htmlStr += cssHelper->addStartBlockQuote(actQuoteLevel - previousQuoteDepth);
+ htmlStr
+ += cssHelper->addStartBlockQuote(actQuoteLevel - previousQuoteDepth);
}
if (actHidden) {
//only show the QuoteMark when is the first line of the level hidden
@@ -220,17 +225,17 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
//Expand all quotes
htmlStr += QLatin1String("<div class=\"quotelevelmark\" >");
htmlStr += QStringLiteral("<a href=\"kmail:levelquote?%1 \">"
- "<img src=\"%2\"/></a>")
- .arg(-1)
- .arg(expandIconPath);
+ "<img src=\"%2\"/></a>")
+ .arg(-1)
+ .arg(expandIconPath);
htmlStr += QLatin1String("</div><br/>");
}
} else {
htmlStr += QLatin1String("<div class=\"quotelevelmark\" >");
htmlStr += QStringLiteral("<a href=\"kmail:levelquote?%1 \">"
- "<img src=\"%2\"/></a>")
- .arg(actQuoteLevel)
- .arg(collapseIconPath);
+ "<img src=\"%2\"/></a>")
+ .arg(actQuoteLevel)
+ .arg(collapseIconPath);
htmlStr += QLatin1String("</div>");
if (actQuoteLevel < 3) {
htmlStr += quoteFontTag[actQuoteLevel];
@@ -241,7 +246,8 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
} else {
// Add blockquote
if (previousQuoteDepth < actQuoteLevel) {
- htmlStr += cssHelper->addStartBlockQuote(actQuoteLevel - previousQuoteDepth);
+ htmlStr
+ += cssHelper->addStartBlockQuote(actQuoteLevel - previousQuoteDepth);
}
if (actQuoteLevel < 3) {
@@ -262,16 +268,25 @@ QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource
if (startNewPara) {
paraIsRTL = line.isRightToLeft();
}
- htmlStr += QStringLiteral("<div dir=\"%1\">").arg(paraIsRTL ? QStringLiteral("rtl") : QStringLiteral("ltr"));
+ htmlStr += QStringLiteral("<div dir=\"%1\">").arg(paraIsRTL ? QStringLiteral(
+ "rtl") : QStringLiteral("ltr"));
// if quoteLengh == 0 && foundQuote => a simple quote
if (foundQuote) {
quoteLength++;
const int rightString = (line.length()) - quoteLength;
if (rightString > 0) {
- htmlStr += QStringLiteral("<span class=\"quotemarks\">%1</span>").arg(line.left(quoteLength));
- htmlStr += QStringLiteral("<font color=\"%1\">").arg(cssHelper->quoteColorName(actQuoteLevel)) + KTextToHTML::convertToHtml(line.right(rightString), convertFlags) + QStringLiteral("</font>");
+ htmlStr += QStringLiteral("<span class=\"quotemarks\">%1</span>").arg(line.left(
+ quoteLength));
+ htmlStr += QStringLiteral("<font color=\"%1\">").arg(cssHelper->quoteColorName(
+ actQuoteLevel))
+ + KTextToHTML::convertToHtml(line.right(
+ rightString),
+ convertFlags) + QStringLiteral(
+ "</font>");
} else {
- htmlStr += QStringLiteral("<span class=\"quotemarksemptyline\">%1</span>").arg(line.left(quoteLength));
+ htmlStr
+ += QStringLiteral("<span class=\"quotemarksemptyline\">%1</span>").arg(line.left(
+ quoteLength));
}
} else {
htmlStr += KTextToHTML::convertToHtml(line, convertFlags);
diff --git a/messageviewer/src/messagepartthemes/default/plugins/quotehtml.h b/messageviewer/src/messagepartthemes/default/plugins/quotehtml.h
index 8bd036b..798591a 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/quotehtml.h
+++ b/messageviewer/src/messagepartthemes/default/plugins/quotehtml.h
@@ -22,19 +22,17 @@
#include <QString>
-namespace MimeTreeParser
-{
-namespace Interface
-{
+namespace MimeTreeParser {
+namespace Interface {
class ObjectTreeSource;
}
}
-namespace MessageViewer
-{
- class CSSHelperBase;
+namespace MessageViewer {
+class CSSHelperBase;
}
-QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource *source, MessageViewer::CSSHelperBase *cssHelper);
+QString quotedHTML(const QString &s, MimeTreeParser::Interface::ObjectTreeSource *source,
+ MessageViewer::CSSHelperBase *cssHelper);
#endif
diff --git a/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.cpp b/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.cpp
index 553543f..b81f44e 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.cpp
+++ b/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.cpp
@@ -27,11 +27,14 @@
TextMessagePartRenderer::TextMessagePartRenderer()
{
}
+
TextMessagePartRenderer::~TextMessagePartRenderer()
{
}
-QSharedPointer<PartRendered> TextMessagePartRenderer::render(DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const
+QSharedPointer<PartRendered> TextMessagePartRenderer::render(DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart)
+const
{
auto mp = msgPart.dynamicCast<TextMessagePart>();
if (mp) {
diff --git a/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.h b/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.h
index 2d934cf..c8ff1e5 100644
--- a/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.h
+++ b/messageviewer/src/messagepartthemes/default/plugins/textmessagepartrenderer.h
@@ -29,7 +29,9 @@ class TextMessagePartRenderer : public MessagePartRendererBase
public:
TextMessagePartRenderer();
virtual ~TextMessagePartRenderer();
- QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp, const MimeTreeParser::Interface::MessagePartPtr &msgPart) const override;
+ QSharedPointer<PartRendered> render(MimeTreeParser::DefaultRendererPrivate *drp,
+ const MimeTreeParser::Interface::MessagePartPtr &msgPart)
+ const override;
};
#endif
diff --git a/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.cpp b/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.cpp
index f9fe289..64ec9d3 100644
--- a/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.cpp
+++ b/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.cpp
@@ -39,7 +39,8 @@ static QSharedPointer<MessagePartRendererFactoryBase> singeltonRendererFactory;
const MessagePartRendererFactoryBase *rendererPluginFactoryInstance()
{
if (!singeltonRendererFactory) {
- singeltonRendererFactory = QSharedPointer<MessagePartRendererFactoryBase>(new MessagePartRendererFactoryBase());
+ singeltonRendererFactory = QSharedPointer<MessagePartRendererFactoryBase>(
+ new MessagePartRendererFactoryBase());
}
return singeltonRendererFactory.data();
diff --git a/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.h b/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.h
index bff4b22..9f9f08f 100644
--- a/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.h
+++ b/messageviewer/src/messagepartthemes/default/rendererpluginfactorysingleton.h
@@ -30,8 +30,7 @@
#ifndef __MESSAGEVIEWER_DEFAULTRRENDERER_RENDERERRPLUGINFACTORYSIGNLETON_P_H__
#define __MESSAGEVIEWER_DEFAULTRRENDERER_RENDERERRPLUGINFACTORYSIGNLETON_P_H__
-namespace MessageViewer
-{
+namespace MessageViewer {
class MessagePartRendererFactoryBase;
}
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.cpp b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.cpp
index 830ddbc..644a8d7 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.cpp
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.cpp
@@ -23,10 +23,8 @@ using namespace MessageViewer;
DefaultGrantleeHeaderStrategy::DefaultGrantleeHeaderStrategy()
{
-
}
DefaultGrantleeHeaderStrategy::~DefaultGrantleeHeaderStrategy()
{
-
}
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.h b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.h
index 8efc7cb..bf421ed 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.h
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstrategy.h
@@ -22,8 +22,7 @@
#include <messageviewer/headerstrategy.h>
-namespace MessageViewer
-{
+namespace MessageViewer {
class DefaultGrantleeHeaderStrategy : public HeaderStrategy
{
public:
@@ -35,6 +34,7 @@ public:
{
return "defaultgrantlee";
}
+
DefaultPolicy defaultPolicy() const override
{
return Hide;
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.cpp b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.cpp
index e8b2282..fd90c27 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.cpp
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.cpp
@@ -27,29 +27,36 @@
#include <QStandardPaths>
using namespace MessageViewer;
-DefaultGrantleeHeaderStyleInterface::DefaultGrantleeHeaderStyleInterface(MessageViewer::HeaderStylePlugin *plugin, QObject *parent)
+DefaultGrantleeHeaderStyleInterface::DefaultGrantleeHeaderStyleInterface(
+ MessageViewer::HeaderStylePlugin *plugin, QObject *parent)
: MessageViewer::HeaderStyleInterface(plugin, parent)
{
}
DefaultGrantleeHeaderStyleInterface::~DefaultGrantleeHeaderStyleInterface()
{
-
}
-void DefaultGrantleeHeaderStyleInterface::createAction(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac)
+void DefaultGrantleeHeaderStyleInterface::createAction(KActionMenu *menu, QActionGroup *actionGroup,
+ KActionCollection *ac)
{
- const QStringList defaultThemePath = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QStringLiteral("messageviewer/defaultthemes/"), QStandardPaths::LocateDirectory);
+ 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"));
+ 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);
+ KToggleAction *act = new KToggleAction(mDefaultTheme.name(), this);
ac->addAction(QStringLiteral("default_grantlee_theme"), act);
- connect(act, &KToggleAction::triggered, this, &DefaultGrantleeHeaderStyleInterface::slotDefaultGrantleeHeaders);
+ connect(act, &KToggleAction::triggered, this,
+ &DefaultGrantleeHeaderStyleInterface::slotDefaultGrantleeHeaders);
mAction.append(act);
addActionToMenu(menu, actionGroup);
}
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.h b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.h
index 52b6061..76d72ed 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.h
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleinterface.h
@@ -23,14 +23,13 @@
#include <messageviewer/headerstyleinterface.h>
#include <grantleetheme/grantleetheme.h>
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class DefaultGrantleeHeaderStyleInterface : public MessageViewer::HeaderStyleInterface
{
Q_OBJECT
public:
- explicit DefaultGrantleeHeaderStyleInterface(HeaderStylePlugin *plugin, QObject *parent = nullptr);
+ explicit DefaultGrantleeHeaderStyleInterface(HeaderStylePlugin *plugin,
+ QObject *parent = nullptr);
~DefaultGrantleeHeaderStyleInterface();
void createAction(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac) override;
@@ -39,7 +38,6 @@ private:
void slotDefaultGrantleeHeaders();
GrantleeTheme::Theme mDefaultTheme;
};
-
}
#endif // DEFAULTGRANTLEEHEADERSTYLEINTERFACE_H
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.cpp b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.cpp
index 33158e0..c310c2c 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.cpp
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.cpp
@@ -25,12 +25,16 @@
#include <kpluginfactory.h>
using namespace MessageViewer;
-K_PLUGIN_FACTORY_WITH_JSON(MessageViewerDefaultGrantleeHeaderStylePluginFactory, "messageviewer_defaultgrantleeheaderstyleplugin.json", registerPlugin<DefaultGrantleeHeaderStylePlugin>();)
+K_PLUGIN_FACTORY_WITH_JSON(MessageViewerDefaultGrantleeHeaderStylePluginFactory,
+ "messageviewer_defaultgrantleeheaderstyleplugin.json",
+ registerPlugin<DefaultGrantleeHeaderStylePlugin>();
+ )
-DefaultGrantleeHeaderStylePlugin::DefaultGrantleeHeaderStylePlugin(QObject *parent, const QList<QVariant> &)
- : MessageViewer::HeaderStylePlugin(parent),
- mHeaderStyle(new GrantleeHeaderStyle),
- mHeaderStrategy(new DefaultGrantleeHeaderStrategy)
+DefaultGrantleeHeaderStylePlugin::DefaultGrantleeHeaderStylePlugin(QObject *parent,
+ const QList<QVariant> &)
+ : MessageViewer::HeaderStylePlugin(parent)
+ , mHeaderStyle(new GrantleeHeaderStyle)
+ , mHeaderStrategy(new DefaultGrantleeHeaderStrategy)
{
initializePlugin();
}
@@ -43,7 +47,8 @@ DefaultGrantleeHeaderStylePlugin::~DefaultGrantleeHeaderStylePlugin()
void DefaultGrantleeHeaderStylePlugin::initializePlugin()
{
- mHeaderStyle->setShowMailAction(DefaultGrantleeHeaderStylePluginSettings::self()->showActionMail());
+ mHeaderStyle->setShowMailAction(
+ DefaultGrantleeHeaderStylePluginSettings::self()->showActionMail());
}
HeaderStyle *DefaultGrantleeHeaderStylePlugin::headerStyle() const
@@ -56,9 +61,13 @@ HeaderStrategy *DefaultGrantleeHeaderStylePlugin::headerStrategy() const
return mHeaderStrategy;
}
-HeaderStyleInterface *DefaultGrantleeHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent)
+HeaderStyleInterface *DefaultGrantleeHeaderStylePlugin::createView(KActionMenu *menu,
+ QActionGroup *actionGroup,
+ KActionCollection *ac,
+ QObject *parent)
{
- MessageViewer::HeaderStyleInterface *view = new MessageViewer::DefaultGrantleeHeaderStyleInterface(this, parent);
+ MessageViewer::HeaderStyleInterface *view
+ = new MessageViewer::DefaultGrantleeHeaderStyleInterface(this, parent);
if (ac) {
view->createAction(menu, actionGroup, ac);
}
diff --git a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.h b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.h
index bbe519c..49e3a13 100644
--- a/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.h
+++ b/messageviewer/src/messageviewerheaderplugins/defaultgrantleeheaderstyleplugin/defaultgrantleeheaderstyleplugin.h
@@ -24,19 +24,20 @@
#include <QVariant>
-namespace MessageViewer
-{
+namespace MessageViewer {
class GrantleeHeaderStyle;
class DefaultGrantleeHeaderStylePlugin : public MessageViewer::HeaderStylePlugin
{
Q_OBJECT
public:
- explicit DefaultGrantleeHeaderStylePlugin(QObject *parent = nullptr, const QList<QVariant> & = QList<QVariant>());
+ explicit DefaultGrantleeHeaderStylePlugin(QObject *parent = nullptr,
+ const QList<QVariant> & = QList<QVariant>());
~DefaultGrantleeHeaderStylePlugin();
HeaderStyle *headerStyle() const override;
HeaderStrategy *headerStrategy() const override;
- HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent = nullptr) override;
+ HeaderStyleInterface *createView(KActionMenu *menu, QActionGroup *actionGroup,
+ KActionCollection *ac, QObject *parent = nullptr) override;
QString name() const override;
private:
void initializePlugin();
diff --git a/messageviewer/src/scamdetection/autotests/scamattributetest.cpp b/messageviewer/src/scamdetection/autotests/scamattributetest.cpp
index 854dc58..3be66d2 100644
--- a/messageviewer/src/scamdetection/autotests/scamattributetest.cpp
+++ b/messageviewer/src/scamdetection/autotests/scamattributetest.cpp
@@ -23,12 +23,10 @@
ScamAttributeTest::ScamAttributeTest(QObject *parent)
: QObject(parent)
{
-
}
ScamAttributeTest::~ScamAttributeTest()
{
-
}
void ScamAttributeTest::shouldHaveDefaultValue()
diff --git a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
index 8ed994b..ea30754 100644
--- a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
+++ b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.cpp
@@ -30,14 +30,15 @@ TestWebEngineScamDetection::TestWebEngineScamDetection(QWidget *parent)
QHBoxLayout *hbox = new QHBoxLayout(this);
mEngineView = new QWebEngineView(this);
mScamDetectionWebEngine = new MessageViewer::ScamDetectionWebEngine(this);
- connect(mScamDetectionWebEngine, &MessageViewer::ScamDetectionWebEngine::resultScanDetection, this, &TestWebEngineScamDetection::resultScanDetection);
- connect(mEngineView, &QWebEngineView::loadFinished, this, &TestWebEngineScamDetection::loadFinished);
+ connect(mScamDetectionWebEngine, &MessageViewer::ScamDetectionWebEngine::resultScanDetection,
+ this, &TestWebEngineScamDetection::resultScanDetection);
+ connect(mEngineView, &QWebEngineView::loadFinished, this,
+ &TestWebEngineScamDetection::loadFinished);
hbox->addWidget(mEngineView);
}
TestWebEngineScamDetection::~TestWebEngineScamDetection()
{
-
}
void TestWebEngineScamDetection::setHtml(const QString &html)
@@ -54,12 +55,10 @@ void TestWebEngineScamDetection::loadFinished(bool b)
ScamDetectionWebEngineTest::ScamDetectionWebEngineTest(QObject *parent)
: QObject(parent)
{
-
}
ScamDetectionWebEngineTest::~ScamDetectionWebEngineTest()
{
-
}
void ScamDetectionWebEngineTest::scamtest_data()
@@ -68,32 +67,58 @@ void ScamDetectionWebEngineTest::scamtest_data()
QTest::addColumn<bool>("result");
//No Scam
- QTest::newRow("noscam1") << QStringLiteral("<html><body><a href=\"www.kde.org\">kde</a></body></html>") << false;
- QTest::newRow("noscam2") << QStringLiteral("<html><body><a href=\"http://www.kde.org\" title=\"http://www.kde.org\">kde</a></body></html>") << false;
- QTest::newRow("noscam3") << QStringLiteral("<html><body><a href=\"https://www.kde.org\" title=\"https://www.kde.org\">kde</a></body></html>") << false;
+ QTest::newRow("noscam1") << QStringLiteral(
+ "<html><body><a href=\"www.kde.org\">kde</a></body></html>") << false;
+ QTest::newRow("noscam2") << QStringLiteral(
+ "<html><body><a href=\"http://www.kde.org\" title=\"http://www.kde.org\">kde</a></body></html>")
+ << false;
+ QTest::newRow("noscam3") << QStringLiteral(
+ "<html><body><a href=\"https://www.kde.org\" title=\"https://www.kde.org\">kde</a></body></html>")
+ << false;
//Hexa value
- QTest::newRow("hexavalue") << QStringLiteral("<html><body><a href=\"http://125.15.55.88/\" title=\"http://0x12.0x1e.0x0A.0x00\">test</a></body></html>") << true;
+ QTest::newRow("hexavalue") << QStringLiteral(
+ "<html><body><a href=\"http://125.15.55.88/\" title=\"http://0x12.0x1e.0x0A.0x00\">test</a></body></html>")
+ << true;
//Ip
- QTest::newRow("Ip value") << QStringLiteral("<html><body><a href=\"http://127.0.0.1/\">test</a></body></html>") << false;
- QTest::newRow("Ip scam1") << QStringLiteral("<html><body><a href=\"http://125.15.55.88/\" title=\"http://www.kde.org\">test</a></body></html>") << true;
- QTest::newRow("Ip scam2") << QStringLiteral("<html><body><a href=\"http://125.15.55.88/\" title=\"http://125.15.55.88/\">test</a></body></html>") << true;
+ QTest::newRow("Ip value") << QStringLiteral(
+ "<html><body><a href=\"http://127.0.0.1/\">test</a></body></html>") << false;
+ QTest::newRow("Ip scam1") << QStringLiteral(
+ "<html><body><a href=\"http://125.15.55.88/\" title=\"http://www.kde.org\">test</a></body></html>")
+ << true;
+ QTest::newRow("Ip scam2") << QStringLiteral(
+ "<html><body><a href=\"http://125.15.55.88/\" title=\"http://125.15.55.88/\">test</a></body></html>")
+ << true;
//Href no scam
- QTest::newRow("Href no scam") << QStringLiteral("<html><body><a href=\"http://www.kde.org/\" title=\"http://www.kde.org\">test</a></body></html>") << false;
+ QTest::newRow("Href no scam") << QStringLiteral(
+ "<html><body><a href=\"http://www.kde.org/\" title=\"http://www.kde.org\">test</a></body></html>")
+ << false;
//Redirect href
- QTest::newRow("Redirect scam") << QStringLiteral("<html><body><a href=\"http://www.google.fr/url?q=http://www.yahoo.com\">test</a></body></html>") << true;
- QTest::newRow("Redirect no scam") << QStringLiteral("<html><body><a href=\"kmail:showAuditLog?log=http://www.foo.com%3http://www.bla.com\">test</a></body></html>") << false;
+ QTest::newRow("Redirect scam") << QStringLiteral(
+ "<html><body><a href=\"http://www.google.fr/url?q=http://www.yahoo.com\">test</a></body></html>")
+ << true;
+ QTest::newRow("Redirect no scam") << QStringLiteral(
+ "<html><body><a href=\"kmail:showAuditLog?log=http://www.foo.com%3http://www.bla.com\">test</a></body></html>")
+ << false;
//Numeric value
- QTest::newRow("numeric no scam") << QStringLiteral("<html><body><a href=\"http://baseball2.2ndhalfplays.com/nested/attribs/\">http://baseball2.2ndhalfplays.com/nested/attribs</html>") << false;
- QTest::newRow("numeric scam1") << QStringLiteral("<html><body><a href=\"http://25.15.55.88/\">test</a></body></html>") << true;
- QTest::newRow("numeric scam2") << QStringLiteral("<html><body><a href=\"http://255.0.1.1/\">test</a></body></html>") << true;
- QTest::newRow("numeric scam3") << QStringLiteral("<html><body><a href=\"http://1.0.1.1/\">test</a></body></html>") << true;
- QTest::newRow("numeric scam4") << QStringLiteral("<html><body><a href=\"http://255.500.1.1/\">test</a></body></html>") << true;
- QTest::newRow("numeric no scam5") << QStringLiteral("<html><body><a href=\"http://baseball.2ndhalfplays.com/nested/attribs/\">http://baseball2.2ndhalfplays.com/nested/attribs</html>") << false;
+ QTest::newRow("numeric no scam") << QStringLiteral(
+ "<html><body><a href=\"http://baseball2.2ndhalfplays.com/nested/attribs/\">http://baseball2.2ndhalfplays.com/nested/attribs</html>")
+ << false;
+ QTest::newRow("numeric scam1") << QStringLiteral(
+ "<html><body><a href=\"http://25.15.55.88/\">test</a></body></html>") << true;
+ QTest::newRow("numeric scam2") << QStringLiteral(
+ "<html><body><a href=\"http://255.0.1.1/\">test</a></body></html>") << true;
+ QTest::newRow("numeric scam3") << QStringLiteral(
+ "<html><body><a href=\"http://1.0.1.1/\">test</a></body></html>") << true;
+ QTest::newRow("numeric scam4") << QStringLiteral(
+ "<html><body><a href=\"http://255.500.1.1/\">test</a></body></html>") << true;
+ QTest::newRow("numeric no scam5") << QStringLiteral(
+ "<html><body><a href=\"http://baseball.2ndhalfplays.com/nested/attribs/\">http://baseball2.2ndhalfplays.com/nested/attribs</html>")
+ << false;
}
void ScamDetectionWebEngineTest::scamtest()
diff --git a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.h b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.h
index 856140c..5da716d 100644
--- a/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.h
+++ b/messageviewer/src/scamdetection/autotests/scamdetectionwebenginetest.h
@@ -23,8 +23,7 @@
#include <QObject>
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamDetectionWebEngine;
}
class QWebEngineView;
diff --git a/messageviewer/src/scamdetection/scamattribute.cpp b/messageviewer/src/scamdetection/scamattribute.cpp
index 4b56cbe..dc67605 100644
--- a/messageviewer/src/scamdetection/scamattribute.cpp
+++ b/messageviewer/src/scamdetection/scamattribute.cpp
@@ -32,6 +32,7 @@ public:
: isAScam(false)
{
}
+
bool isAScam;
};
@@ -86,5 +87,5 @@ void ScamAttribute::setIsAScam(bool b)
bool ScamAttribute::operator==(const ScamAttribute &other) const
{
- return (d->isAScam == other.isAScam());
+ return d->isAScam == other.isAScam();
}
diff --git a/messageviewer/src/scamdetection/scamattribute.h b/messageviewer/src/scamdetection/scamattribute.h
index a813d4a..61a3a59 100644
--- a/messageviewer/src/scamdetection/scamattribute.h
+++ b/messageviewer/src/scamdetection/scamattribute.h
@@ -22,8 +22,7 @@
#define SCAMATTRIBUTE_H
#include <AkonadiCore/attribute.h>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamAttributePrivate;
class ScamAttribute : public Akonadi::Attribute
diff --git a/messageviewer/src/scamdetection/scamcheckshorturl.cpp b/messageviewer/src/scamdetection/scamcheckshorturl.cpp
index d7b0274..20a0b4e 100644
--- a/messageviewer/src/scamdetection/scamcheckshorturl.cpp
+++ b/messageviewer/src/scamdetection/scamcheckshorturl.cpp
@@ -48,16 +48,19 @@ void ScamCheckShortUrl::expandedUrl(const QUrl &url)
bool ScamCheckShortUrl::isShortUrl(const QUrl &url)
{
- if (!url.path().isEmpty() && QString::compare(url.path(), QStringLiteral("/")) && sSupportedServices.contains(url.host())) {
+ if (!url.path().isEmpty()
+ && QString::compare(url.path(),
+ QStringLiteral("/")) && sSupportedServices.contains(url.host())) {
return true;
- } else {
+ } else {
return false;
}
}
void ScamCheckShortUrl::loadLongUrlServices()
{
- QFile servicesFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("messageviewer/longurlServices.json")));
+ QFile servicesFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(
+ "messageviewer/longurlServices.json")));
if (servicesFile.open(QIODevice::ReadOnly)) {
QJsonParseError error;
const QJsonDocument json = QJsonDocument::fromJson(servicesFile.readAll(), &error);
diff --git a/messageviewer/src/scamdetection/scamcheckshorturl.h b/messageviewer/src/scamdetection/scamcheckshorturl.h
index a05dc81..4b37fdc 100644
--- a/messageviewer/src/scamdetection/scamcheckshorturl.h
+++ b/messageviewer/src/scamdetection/scamcheckshorturl.h
@@ -27,8 +27,7 @@
#include <QUrl>
#include <QStringList>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT ScamCheckShortUrl : public QObject
{
Q_OBJECT
diff --git a/messageviewer/src/scamdetection/scamcheckshorturlmanager.cpp b/messageviewer/src/scamdetection/scamcheckshorturlmanager.cpp
index 50c647a..66e60a7 100644
--- a/messageviewer/src/scamdetection/scamcheckshorturlmanager.cpp
+++ b/messageviewer/src/scamdetection/scamcheckshorturlmanager.cpp
@@ -47,14 +47,14 @@ public:
ScamCheckShortUrlManagerPrivate()
: mCheckShortUrl(nullptr)
{
-
}
+
ScamCheckShortUrl *mCheckShortUrl;
};
ScamCheckShortUrlManager::ScamCheckShortUrlManager(QObject *parent)
- : QObject(parent),
- d(new ScamCheckShortUrlManagerPrivate)
+ : QObject(parent)
+ , d(new ScamCheckShortUrlManagerPrivate)
{
d->mCheckShortUrl = new ScamCheckShortUrl(this);
}
diff --git a/messageviewer/src/scamdetection/scamcheckshorturlmanager.h b/messageviewer/src/scamdetection/scamcheckshorturlmanager.h
index 1822805..da0fb89 100644
--- a/messageviewer/src/scamdetection/scamcheckshorturlmanager.h
+++ b/messageviewer/src/scamdetection/scamcheckshorturlmanager.h
@@ -23,8 +23,7 @@
#include <QObject>
#include "messageviewer_export.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamCheckShortUrl;
class ScamCheckShortUrlManagerPrivate;
class MESSAGEVIEWER_EXPORT ScamCheckShortUrlManager : public QObject
diff --git a/messageviewer/src/scamdetection/scamdetectiondetailsdialog.cpp b/messageviewer/src/scamdetection/scamdetectiondetailsdialog.cpp
index d1a0b54..5e14a4a 100644
--- a/messageviewer/src/scamdetection/scamdetectiondetailsdialog.cpp
+++ b/messageviewer/src/scamdetection/scamdetectiondetailsdialog.cpp
@@ -86,7 +86,9 @@ void ScamDetectionDetailsDialog::slotSaveAs()
QTextStream ts(&file);
ts.setCodec("UTF-8");
QString htmlStr = mDetails->toHtml();
- htmlStr.replace(QStringLiteral("meta name=\"qrichtext\" content=\"1\""), QStringLiteral("meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\""));
+ htmlStr.replace(QStringLiteral("meta name=\"qrichtext\" content=\"1\""),
+ QStringLiteral(
+ "meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\""));
ts << htmlStr;
file.close();
}
@@ -100,7 +102,8 @@ void ScamDetectionDetailsDialog::setDetails(const QString &details)
void ScamDetectionDetailsDialog::readConfig()
{
- KConfigGroup group(MessageViewer::MessageViewerSettings::self()->config(), "ScamDetectionDetailsDialog");
+ KConfigGroup group(
+ MessageViewer::MessageViewerSettings::self()->config(), "ScamDetectionDetailsDialog");
const QSize size = group.readEntry("Size", QSize(600, 400));
if (size.isValid()) {
resize(size);
@@ -109,8 +112,8 @@ void ScamDetectionDetailsDialog::readConfig()
void ScamDetectionDetailsDialog::writeConfig()
{
- KConfigGroup group(MessageViewer::MessageViewerSettings::self()->config(), "ScamDetectionDetailsDialog");
+ KConfigGroup group(
+ MessageViewer::MessageViewerSettings::self()->config(), "ScamDetectionDetailsDialog");
group.writeEntry("Size", size());
group.sync();
}
-
diff --git a/messageviewer/src/scamdetection/scamdetectiondetailsdialog.h b/messageviewer/src/scamdetection/scamdetectiondetailsdialog.h
index ed51c8f..24b7164 100644
--- a/messageviewer/src/scamdetection/scamdetectiondetailsdialog.h
+++ b/messageviewer/src/scamdetection/scamdetectiondetailsdialog.h
@@ -23,13 +23,11 @@
#include <QDialog>
-namespace KPIMTextEdit
-{
+namespace KPIMTextEdit {
class RichTextEditorWidget;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamDetectionDetailsDialog : public QDialog
{
Q_OBJECT
diff --git a/messageviewer/src/scamdetection/scamdetectionwarningwidget.cpp b/messageviewer/src/scamdetection/scamdetectionwarningwidget.cpp
index d80b0d6..a287fc4 100644
--- a/messageviewer/src/scamdetection/scamdetectionwarningwidget.cpp
+++ b/messageviewer/src/scamdetection/scamdetectionwarningwidget.cpp
@@ -33,14 +33,14 @@ public:
ScamDetectionWarningWidgetPrivate()
: mUseInTestApps(false)
{
-
}
+
bool mUseInTestApps;
};
ScamDetectionWarningWidget::ScamDetectionWarningWidget(QWidget *parent)
- : KMessageWidget(parent),
- d(new MessageViewer::ScamDetectionWarningWidgetPrivate)
+ : KMessageWidget(parent)
+ , d(new MessageViewer::ScamDetectionWarningWidgetPrivate)
{
setVisible(false);
setCloseButtonVisible(true);
@@ -48,7 +48,8 @@ ScamDetectionWarningWidget::ScamDetectionWarningWidget(QWidget *parent)
setWordWrap(true);
setText(i18n("This message may be a scam. <a href=\"scamdetails\">(Details...)</a>"));
- connect(this, &ScamDetectionWarningWidget::linkActivated, this, &ScamDetectionWarningWidget::slotShowDetails);
+ connect(this, &ScamDetectionWarningWidget::linkActivated, this,
+ &ScamDetectionWarningWidget::slotShowDetails);
QMenu *menu = new QMenu();
QAction *action = new QAction(i18n("Move to Trash"), this);
@@ -66,7 +67,8 @@ ScamDetectionWarningWidget::ScamDetectionWarningWidget(QWidget *parent)
action = new QAction(i18n("Disable scam detection for all messages"), this);
menu->addAction(action);
- connect(action, &QAction::triggered, this, &ScamDetectionWarningWidget::slotDisableScamDetection);
+ connect(action, &QAction::triggered, this,
+ &ScamDetectionWarningWidget::slotDisableScamDetection);
}
ScamDetectionWarningWidget::~ScamDetectionWarningWidget()
@@ -111,4 +113,3 @@ void ScamDetectionWarningWidget::slotAddToWhiteList()
setVisible(false);
Q_EMIT addToWhiteList();
}
-
diff --git a/messageviewer/src/scamdetection/scamdetectionwarningwidget.h b/messageviewer/src/scamdetection/scamdetectionwarningwidget.h
index 16de000..52f28df 100644
--- a/messageviewer/src/scamdetection/scamdetectionwarningwidget.h
+++ b/messageviewer/src/scamdetection/scamdetectionwarningwidget.h
@@ -25,8 +25,7 @@
#include <KMessageWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamDetectionWarningWidgetPrivate;
class MESSAGEVIEWER_EXPORT ScamDetectionWarningWidget : public KMessageWidget
{
diff --git a/messageviewer/src/scamdetection/scamdetectionwebengine.cpp b/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
index 24f4d7c..8887f6f 100644
--- a/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
+++ b/messageviewer/src/scamdetection/scamdetectionwebengine.cpp
@@ -64,17 +64,16 @@ class MessageViewer::ScamDetectionWebEnginePrivate
public:
ScamDetectionWebEnginePrivate()
{
-
}
+
QString mDetails;
QPointer<MessageViewer::ScamDetectionDetailsDialog> mDetailsDialog;
};
ScamDetectionWebEngine::ScamDetectionWebEngine(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::ScamDetectionWebEnginePrivate)
+ : QObject(parent)
+ , d(new MessageViewer::ScamDetectionWebEnginePrivate)
{
-
}
ScamDetectionWebEngine::~ScamDetectionWebEngine()
@@ -102,7 +101,8 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
return;
}
d->mDetails = QLatin1String("<b>") + i18n("Details:") + QLatin1String("</b><ul>");
- QRegularExpression ip4regExp(QStringLiteral("\\b[0-9]{1,3}\\.[0-9]{1,3}(?:\\.[0-9]{0,3})?(?:\\.[0-9]{0,3})?"));
+ QRegularExpression ip4regExp(QStringLiteral(
+ "\\b[0-9]{1,3}\\.[0-9]{1,3}(?:\\.[0-9]{0,3})?(?:\\.[0-9]{0,3})?"));
const QVariantMap mapResult = resultList.at(0).toMap();
const QList<QVariant> lst = mapResult.value(QStringLiteral("anchors")).toList();
for (const QVariant &var : lst) {
@@ -115,12 +115,12 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
const QUrl url(href);
if (!title.isEmpty()) {
if (title.startsWith(QStringLiteral("http:"))
- || title.startsWith(QStringLiteral("https:"))
- || title.startsWith(QStringLiteral("www."))) {
+ || title.startsWith(QStringLiteral("https:"))
+ || title.startsWith(QStringLiteral("www."))) {
if (title.startsWith(QStringLiteral("www."))) {
- const QString completUrl = url.scheme() + QLatin1String("://") + title;
- if (completUrl != href &&
- href != (completUrl + QLatin1Char('/'))) {
+ const QString completUrl = url.scheme() + QLatin1String("://") + title;
+ if (completUrl != href
+ && href != (completUrl + QLatin1Char('/'))) {
foundScam = true;
}
} else {
@@ -132,7 +132,9 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
}
}
if (foundScam) {
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a link which reads as '%1' in the text, but actually points to '%2'. This is often the case in scam emails to mislead the recipient", addWarningColor(title), addWarningColor(href)) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link which reads as '%1' in the text, but actually points to '%2'. This is often the case in scam emails to mislead the recipient",
+ addWarningColor(title), addWarningColor(href)) + QLatin1String("</li>");
}
}
}
@@ -140,18 +142,26 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
//2) detect if url href has ip and not server name.
const QString hostname = url.host();
if (hostname.contains(ip4regExp) && !hostname.contains(QStringLiteral("127.0.0.1"))) { //hostname
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a link which points to a numerical IP address (%1) instead of a typical textual website address. This is often the case in scam emails.", addWarningColor(hostname)) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link which points to a numerical IP address (%1) instead of a typical textual website address. This is often the case in scam emails.",
+ addWarningColor(hostname)) + QLatin1String("</li>");
foundScam = true;
} else if (hostname.contains(QLatin1Char('%'))) { //Hexa value for ip
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a link which points to a hexadecimal IP address (%1) instead of a typical textual website address. This is often the case in scam emails.", addWarningColor(hostname)) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link which points to a hexadecimal IP address (%1) instead of a typical textual website address. This is often the case in scam emails.",
+ addWarningColor(hostname)) + QLatin1String("</li>");
foundScam = true;
} else if (url.toString().contains(QStringLiteral("url?q="))) { //4) redirect url.
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a link (%1) which has a redirection", addWarningColor(url.toString())) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link (%1) which has a redirection",
+ addWarningColor(url.toString())) + QLatin1String("</li>");
foundScam = true;
- } else if ((url.toString().count(QStringLiteral("http://")) > 1) ||
- (url.toString().count(QStringLiteral("https://")) > 1)) { //5) more that 1 http in url.
+ } else if ((url.toString().count(QStringLiteral("http://")) > 1)
+ || (url.toString().count(QStringLiteral("https://")) > 1)) { //5) more that 1 http in url.
if (!url.toString().contains(QStringLiteral("kmail:showAuditLog"))) {
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a link (%1) which contains multiple http://. This is often the case in scam emails.", addWarningColor(url.toString())) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a link (%1) which contains multiple http://. This is often the case in scam emails.",
+ addWarningColor(url.toString())) + QLatin1String("</li>");
foundScam = true;
}
}
@@ -159,13 +169,17 @@ void ScamDetectionWebEngine::handleScanPage(const QVariant &result)
//Check shortUrl
if (!foundScam) {
if (ScamCheckShortUrl::isShortUrl(url)) {
- d->mDetails += QLatin1String("<li>") + i18n("This email contains a shorturl (%1). It can redirect to another server.", addWarningColor(url.toString())) + QLatin1String("</li>");
+ d->mDetails += QLatin1String("<li>") + i18n(
+ "This email contains a shorturl (%1). It can redirect to another server.", addWarningColor(
+ url.toString())) + QLatin1String("</li>");
foundScam = true;
}
}
}
if (mapResult.value(QStringLiteral("forms")).toInt() > 0) {
- d->mDetails += QLatin1String("<li></b>") + i18n("Message contains form element. This is often the case in scam emails.") + QLatin1String("</b></li>");
+ d->mDetails += QLatin1String("<li></b>") + i18n(
+ "Message contains form element. This is often the case in scam emails.")
+ + QLatin1String("</b></li>");
foundScam = true;
}
d->mDetails += QLatin1String("</ul>");
diff --git a/messageviewer/src/scamdetection/scamdetectionwebengine.h b/messageviewer/src/scamdetection/scamdetectionwebengine.h
index 49fb819..733fed9 100644
--- a/messageviewer/src/scamdetection/scamdetectionwebengine.h
+++ b/messageviewer/src/scamdetection/scamdetectionwebengine.h
@@ -25,8 +25,7 @@
#include <QVariant>
#include "messageviewer_export.h"
class QWebEnginePage;
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamDetectionWebEnginePrivate;
class MESSAGEVIEWER_EXPORT ScamDetectionWebEngine : public QObject
{
diff --git a/messageviewer/src/scamdetection/scamexpandurljob.cpp b/messageviewer/src/scamdetection/scamexpandurljob.cpp
index e82611e..c7dde5b 100644
--- a/messageviewer/src/scamdetection/scamexpandurljob.cpp
+++ b/messageviewer/src/scamdetection/scamexpandurljob.cpp
@@ -38,8 +38,8 @@ public:
ScamExpandUrlJobPrivate()
: mNetworkAccessManager(nullptr)
{
-
}
+
~ScamExpandUrlJobPrivate()
{
}
@@ -48,12 +48,13 @@ public:
};
ScamExpandUrlJob::ScamExpandUrlJob(QObject *parent)
- : QObject(parent),
- d(new ScamExpandUrlJobPrivate)
+ : QObject(parent)
+ , d(new ScamExpandUrlJobPrivate)
{
d->mNetworkAccessManager = new QNetworkAccessManager(this);
- connect(d->mNetworkAccessManager, &QNetworkAccessManager::finished, this, &ScamExpandUrlJob::slotExpandFinished);
+ connect(d->mNetworkAccessManager, &QNetworkAccessManager::finished, this,
+ &ScamExpandUrlJob::slotExpandFinished);
}
ScamExpandUrlJob::~ScamExpandUrlJob()
@@ -64,16 +65,21 @@ ScamExpandUrlJob::~ScamExpandUrlJob()
void ScamExpandUrlJob::expandedUrl(const QUrl &url)
{
if (!PimCommon::NetworkManager::self()->networkConfigureManager()->isOnline()) {
- KPIM::BroadcastStatus::instance()->setStatusMsg(i18n("No network connection detected, we cannot expand url."));
+ KPIM::BroadcastStatus::instance()->setStatusMsg(i18n(
+ "No network connection detected, we cannot expand url."));
deleteLater();
return;
}
- const QUrl newUrl(QStringLiteral("http://api.longurl.org/v2/expand?url=%1&format=json").arg(url.url()));
+ const QUrl newUrl(QStringLiteral("http://api.longurl.org/v2/expand?url=%1&format=json").arg(
+ url.url()));
qCDebug(MESSAGEVIEWER_LOG) << " newUrl " << newUrl;
QNetworkReply *reply = d->mNetworkAccessManager->get(QNetworkRequest(newUrl));
reply->setProperty("shortUrl", url.url());
- connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &ScamExpandUrlJob::slotError);
+ connect(reply,
+ static_cast<void (QNetworkReply::*)(
+ QNetworkReply::NetworkError)>(&QNetworkReply::error), this,
+ &ScamExpandUrlJob::slotError);
}
void ScamExpandUrlJob::slotExpandFinished(QNetworkReply *reply)
@@ -94,7 +100,9 @@ void ScamExpandUrlJob::slotExpandFinished(QNetworkReply *reply)
deleteLater();
return;
}
- KPIM::BroadcastStatus::instance()->setStatusMsg(i18n("Short url \'%1\' redirects to \'%2\'.", shortUrl.url(), longUrl.toDisplayString()));
+ KPIM::BroadcastStatus::instance()->setStatusMsg(i18n("Short url \'%1\' redirects to \'%2\'.",
+ shortUrl.url(),
+ longUrl.toDisplayString()));
}
deleteLater();
}
diff --git a/messageviewer/src/scamdetection/scamexpandurljob.h b/messageviewer/src/scamdetection/scamexpandurljob.h
index cdfeb6f..cd415d6 100644
--- a/messageviewer/src/scamdetection/scamexpandurljob.h
+++ b/messageviewer/src/scamdetection/scamexpandurljob.h
@@ -24,8 +24,7 @@
#include <QObject>
#include <QNetworkReply>
#include "messageviewer_export.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamExpandUrlJobPrivate;
class MESSAGEVIEWER_EXPORT ScamExpandUrlJob : public QObject
{
diff --git a/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.cpp b/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.cpp
index 8e49100..33a6af2 100644
--- a/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.cpp
+++ b/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.cpp
@@ -34,7 +34,8 @@
#include <QCommandLineOption>
#include <QWebEngineView>
-ScamDetectionWebEngineTestWidget::ScamDetectionWebEngineTestWidget(const QString &filename, QWidget *parent)
+ScamDetectionWebEngineTestWidget::ScamDetectionWebEngineTestWidget(const QString &filename,
+ QWidget *parent)
: QWidget(parent)
{
mScamDetection = new MessageViewer::ScamDetectionWebEngine(this);
@@ -45,11 +46,14 @@ ScamDetectionWebEngineTestWidget::ScamDetectionWebEngineTestWidget(const QString
lay->addWidget(mScamWarningWidget);
mWebEngineView = new QWebEngineView;
- connect(mWebEngineView, &QWebEngineView::loadFinished, this, &ScamDetectionWebEngineTestWidget::slotLoadFinished);
+ connect(mWebEngineView, &QWebEngineView::loadFinished, this,
+ &ScamDetectionWebEngineTestWidget::slotLoadFinished);
lay->addWidget(mWebEngineView);
- connect(mScamDetection, &MessageViewer::ScamDetectionWebEngine::messageMayBeAScam, mScamWarningWidget, &MessageViewer::ScamDetectionWarningWidget::slotShowWarning);
- connect(mScamWarningWidget, &MessageViewer::ScamDetectionWarningWidget::showDetails, mScamDetection, &MessageViewer::ScamDetectionWebEngine::showDetails);
+ connect(mScamDetection, &MessageViewer::ScamDetectionWebEngine::messageMayBeAScam,
+ mScamWarningWidget, &MessageViewer::ScamDetectionWarningWidget::slotShowWarning);
+ connect(mScamWarningWidget, &MessageViewer::ScamDetectionWarningWidget::showDetails,
+ mScamDetection, &MessageViewer::ScamDetectionWebEngine::showDetails);
mWebEngineView->load(QUrl::fromLocalFile(filename));
@@ -71,7 +75,8 @@ void ScamDetectionWebEngineTestWidget::slotLoadFinished()
void ScamDetectionWebEngineTestWidget::slotOpenHtml()
{
- const QString fileName = QFileDialog::getOpenFileName(nullptr, QString(), QString(), QStringLiteral("*.html"));
+ const QString fileName = QFileDialog::getOpenFileName(nullptr, QString(),
+ QString(), QStringLiteral("*.html"));
if (!fileName.isEmpty()) {
mScamWarningWidget->setVisible(false);
mWebEngineView->load(QUrl::fromLocalFile(fileName));
@@ -83,13 +88,15 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
QStandardPaths::setTestModeEnabled(true);
- KAboutData aboutData(QStringLiteral("scamdetection_gui"), i18n("ScamDetectionTest_Gui"), QStringLiteral("1.0"));
+ KAboutData aboutData(QStringLiteral("scamdetection_gui"), i18n(
+ "ScamDetectionTest_Gui"), QStringLiteral("1.0"));
aboutData.setShortDescription(i18n("Test for scamdetection widget"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
parser.addVersionOption();
parser.addHelpOption();
- parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"), i18n("URL of an html file to be opened")));
+ parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[url]"),
+ i18n("URL of an html file to be opened")));
aboutData.setupCommandLine(&parser);
parser.process(app);
@@ -99,7 +106,9 @@ int main(int argc, char **argv)
if (parser.positionalArguments().count()) {
fileName = parser.positionalArguments().at(0);
} else {
- fileName = QFileDialog::getOpenFileName(nullptr, QString(), QString(), i18n("HTML File (*.html)"));
+ fileName
+ = QFileDialog::getOpenFileName(nullptr, QString(), QString(),
+ i18n("HTML File (*.html)"));
}
if (fileName.isEmpty()) {
return 0;
@@ -112,4 +121,3 @@ int main(int argc, char **argv)
delete w;
return 0;
}
-
diff --git a/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.h b/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.h
index 91b29aa..2aaa8f9 100644
--- a/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.h
+++ b/messageviewer/src/scamdetection/tests/scamdetectionwebengine_gui.h
@@ -22,8 +22,7 @@
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ScamDetectionWarningWidget;
class ScamDetectionWebEngine;
}
diff --git a/messageviewer/src/settings/messageviewersettings.cpp b/messageviewer/src/settings/messageviewersettings.cpp
index 4f65118..c6eff7d 100644
--- a/messageviewer/src/settings/messageviewersettings.cpp
+++ b/messageviewer/src/settings/messageviewersettings.cpp
@@ -60,4 +60,3 @@ void MessageViewerSettings::slotSyncNow()
MessageViewerSettings::~MessageViewerSettings()
{
}
-
diff --git a/messageviewer/src/settings/messageviewersettings.h b/messageviewer/src/settings/messageviewersettings.h
index a3b5fd8..ebd6b22 100644
--- a/messageviewer/src/settings/messageviewersettings.h
+++ b/messageviewer/src/settings/messageviewersettings.h
@@ -28,9 +28,7 @@
class QTimer;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT MessageViewerSettings : public MessageViewer::MessageViewerSettingsBase
{
Q_OBJECT
@@ -53,9 +51,7 @@ private:
static MessageViewerSettings *mSelf;
QTimer *mConfigSyncTimer;
-
};
-
}
#endif
diff --git a/messageviewer/src/utils/iconnamecache.cpp b/messageviewer/src/utils/iconnamecache.cpp
index ac0667a..e523e51 100644
--- a/messageviewer/src/utils/iconnamecache.cpp
+++ b/messageviewer/src/utils/iconnamecache.cpp
@@ -31,7 +31,7 @@ IconNameCache *IconNameCache::instance()
return s_iconNameCache;
}
-bool IconNameCache::Entry::operator < (const Entry &other) const
+bool IconNameCache::Entry::operator <(const Entry &other) const
{
const int fileNameCompare = fileName.compare(other.fileName);
if (fileNameCompare != 0) {
@@ -76,7 +76,10 @@ QString IconNameCache::iconPathFromLocal(const QString &name) const
QString IconNameCache::picsPath() const
{
if (mPicsPath.isEmpty()) {
- mPicsPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmessageviewer/pics/"), QStandardPaths::LocateDirectory);
+ mPicsPath
+ = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(
+ "libmessageviewer/pics/"),
+ QStandardPaths::LocateDirectory);
}
return mPicsPath;
}
diff --git a/messageviewer/src/utils/iconnamecache.h b/messageviewer/src/utils/iconnamecache.h
index 4861f44..f3c44ab 100644
--- a/messageviewer/src/utils/iconnamecache.h
+++ b/messageviewer/src/utils/iconnamecache.h
@@ -23,9 +23,7 @@
#include <QString>
#include "messageviewer_export.h"
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* This class is a replacement for KIconLoader::iconPath(), because the iconPath()
* function can be slow for non-existing icons or icons that fall back to a generic icon.
@@ -50,12 +48,11 @@ private:
QString fileName;
int size;
- bool operator < (const Entry &other) const;
+ bool operator <(const Entry &other) const;
};
mutable QMap<Entry, QString> mCachedEntries;
mutable QString mPicsPath;
};
-
}
#endif
diff --git a/messageviewer/src/utils/markmessagereadhandler.cpp b/messageviewer/src/utils/markmessagereadhandler.cpp
index 1edcece..ab28707 100644
--- a/messageviewer/src/utils/markmessagereadhandler.cpp
+++ b/messageviewer/src/utils/markmessagereadhandler.cpp
@@ -59,7 +59,8 @@ void MarkMessageReadHandler::Private::handleMessages()
}
MarkMessageReadHandler::MarkMessageReadHandler(QObject *parent)
- : QObject(parent), d(new Private(this))
+ : QObject(parent)
+ , d(new Private(this))
{
d->mTimer.setSingleShot(true);
connect(&d->mTimer, SIGNAL(timeout()), this, SLOT(handleMessages()));
@@ -75,7 +76,8 @@ MarkMessageReadHandler::~MarkMessageReadHandler()
void MarkMessageReadHandler::setItem(const Akonadi::Item &item)
{
- if (sListItem->contains(item) || d->mItemQueue == item || item.hasFlag(Akonadi::MessageFlags::Queued)) {
+ if (sListItem->contains(item) || d->mItemQueue == item
+ || item.hasFlag(Akonadi::MessageFlags::Queued)) {
return;
}
d->mTimer.stop();
diff --git a/messageviewer/src/utils/markmessagereadhandler.h b/messageviewer/src/utils/markmessagereadhandler.h
index 7ee5f33..36a5bb3 100644
--- a/messageviewer/src/utils/markmessagereadhandler.h
+++ b/messageviewer/src/utils/markmessagereadhandler.h
@@ -28,13 +28,12 @@
#include <QObject>
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* @short A viewer handler to mark viewed messages as read.
*/
-class MESSAGEVIEWER_EXPORT MarkMessageReadHandler : public QObject, public AbstractMessageLoadedHandler
+class MESSAGEVIEWER_EXPORT MarkMessageReadHandler : public QObject,
+ public AbstractMessageLoadedHandler
{
Q_OBJECT
@@ -64,7 +63,6 @@ private:
Q_PRIVATE_SLOT(d, void handleMessages())
//@endcond
};
-
}
#endif
diff --git a/messageviewer/src/utils/messageviewerutil.cpp b/messageviewer/src/utils/messageviewerutil.cpp
index 7cb93e1..7a80d9f 100644
--- a/messageviewer/src/utils/messageviewerutil.cpp
+++ b/messageviewer/src/utils/messageviewerutil.cpp
@@ -45,7 +45,6 @@
#include "MessageCore/NodeHelper"
#include "MessageCore/StringUtil"
-
#include "PimCommon/RenameFileDialog"
#include <AkonadiCore/item.h>
@@ -86,18 +85,17 @@ bool Util::checkOverwrite(const QUrl &url, QWidget *w)
}
if (fileExists) {
if (KMessageBox::Cancel == KMessageBox::warningContinueCancel(
- w,
- i18n("A file named \"%1\" already exists. "
- "Are you sure you want to overwrite it?", url.toDisplayString()),
- i18n("Overwrite File?"),
- KStandardGuiItem::overwrite())) {
+ w,
+ i18n("A file named \"%1\" already exists. "
+ "Are you sure you want to overwrite it?", url.toDisplayString()),
+ i18n("Overwrite File?"),
+ KStandardGuiItem::overwrite())) {
return false;
}
}
return true;
}
-
bool Util::handleUrlWithQDesktopServices(const QUrl &url)
{
#if defined Q_OS_WIN || defined Q_OS_MACX
@@ -137,7 +135,11 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
const bool multiple = (contents.count() > 1);
if (multiple) {
// get the dir
- dirUrl = QFileDialog::getExistingDirectoryUrl(parent, i18n("Save Attachments To"), KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///attachmentDir")), recentDirClass));
+ dirUrl = QFileDialog::getExistingDirectoryUrl(parent, i18n(
+ "Save Attachments To"),
+ KFileWidget::getStartUrl(QUrl(QStringLiteral(
+ "kfiledialog:///attachmentDir")),
+ recentDirClass));
if (!dirUrl.isValid()) {
return false;
}
@@ -156,10 +158,13 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
fileName = i18nc("filename for an unnamed attachment", "attachment.1");
}
- QUrl localUrl = KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///attachmentDir")), recentDirClass);
+ QUrl localUrl = KFileWidget::getStartUrl(QUrl(QStringLiteral(
+ "kfiledialog:///attachmentDir")),
+ recentDirClass);
localUrl.setPath(localUrl.path() + QLatin1Char('/') + fileName);
QFileDialog::Options options = QFileDialog::DontConfirmOverwrite;
- url = QFileDialog::getSaveFileUrl(parent, i18n("Save Attachment"), localUrl, QString(), nullptr, options);
+ url = QFileDialog::getSaveFileUrl(parent, i18n("Save Attachment"), localUrl,
+ QString(), nullptr, options);
if (url.isEmpty()) {
return false;
}
@@ -174,7 +179,8 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
bool globalResult = true;
int unnamedAtmCount = 0;
- PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
+ PimCommon::RenameFileDialog::RenameFileDialogResult result
+ = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
for (KMime::Content *content : qAsConst(contents)) {
QUrl curUrl;
if (!dirUrl.isEmpty()) {
@@ -207,7 +213,8 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
file = origFile;
int num = renameNumbering[file] + 1;
int dotIdx = file.lastIndexOf(QLatin1Char('.'));
- file = file.insert((dotIdx >= 0) ? dotIdx : file.length(), QLatin1Char('_') + QString::number(num));
+ file = file.insert((dotIdx >= 0) ? dotIdx : file.length(), QLatin1Char(
+ '_') + QString::number(num));
}
curUrl = curUrl.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash);
curUrl.setPath(curUrl.path() + QLatin1Char('/') + file);
@@ -227,8 +234,8 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
}
}
- if (!(result == PimCommon::RenameFileDialog::RENAMEFILE_OVERWRITEALL ||
- result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL)) {
+ if (!(result == PimCommon::RenameFileDialog::RENAMEFILE_OVERWRITEALL
+ || result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL)) {
bool fileExists = false;
if (curUrl.isLocalFile()) {
fileExists = QFile::exists(curUrl.toLocalFile());
@@ -238,10 +245,13 @@ bool Util::saveContents(QWidget *parent, const KMime::Content::List &contents, Q
fileExists = job->exec();
}
if (fileExists) {
- PimCommon::RenameFileDialog *dlg = new PimCommon::RenameFileDialog(curUrl, multiple, parent);
- result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dlg->exec());
- if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE ||
- result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL) {
+ PimCommon::RenameFileDialog *dlg = new PimCommon::RenameFileDialog(curUrl,
+ multiple,
+ parent);
+ result
+ = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dlg->exec());
+ if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE
+ || result == PimCommon::RenameFileDialog::RENAMEFILE_IGNOREALL) {
delete dlg;
continue;
} else if (result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME) {
@@ -272,28 +282,35 @@ bool Util::saveContent(QWidget *parent, KMime::Content *content, const QUrl &url
// parsed the message, or creating an OTP here (which would have the downside that the
// password dialog for decrypting messages is shown twice)
#if 0 // totally broken
- KMime::Content *topContent = content->topLevel();
+ KMime::Content *topContent = content->topLevel();
MimeTreeParser::NodeHelper *mNodeHelper = new MimeTreeParser::NodeHelper;
bool bSaveEncrypted = false;
- bool bEncryptedParts = mNodeHelper->encryptionState(content) != MimeTreeParser::KMMsgNotEncrypted;
- if (bEncryptedParts)
+ bool bEncryptedParts = mNodeHelper->encryptionState(content)
+ != MimeTreeParser::KMMsgNotEncrypted;
+ if (bEncryptedParts) {
if (KMessageBox::questionYesNo(parent,
- i18n("The part %1 of the message is encrypted. Do you want to keep the encryption when saving?",
- url.fileName()),
- i18n("KMail Question"), KGuiItem(i18n("Keep Encryption")), KGuiItem(i18n("Do Not Keep"))) ==
- KMessageBox::Yes) {
+ i18n(
+ "The part %1 of the message is encrypted. Do you want to keep the encryption when saving?",
+ url.fileName()),
+ i18n("KMail Question"), KGuiItem(i18n("Keep Encryption")),
+ KGuiItem(i18n("Do Not Keep")))
+ == KMessageBox::Yes) {
bSaveEncrypted = true;
}
+ }
bool bSaveWithSig = true;
- if (mNodeHelper->signatureState(content) != MessageViewer::MimeTreeParser::KMMsgNotSigned)
+ if (mNodeHelper->signatureState(content) != MessageViewer::MimeTreeParser::KMMsgNotSigned) {
if (KMessageBox::questionYesNo(parent,
- i18n("The part %1 of the message is signed. Do you want to keep the signature when saving?",
- url.fileName()),
- i18n("KMail Question"), KGuiItem(i18n("Keep Signature")), KGuiItem(i18n("Do Not Keep"))) !=
- KMessageBox::Yes) {
+ i18n(
+ "The part %1 of the message is signed. Do you want to keep the signature when saving?",
+ url.fileName()),
+ i18n("KMail Question"), KGuiItem(i18n("Keep Signature")),
+ KGuiItem(i18n("Do Not Keep")))
+ != KMessageBox::Yes) {
bSaveWithSig = false;
}
+ }
QByteArray data;
if (bSaveEncrypted || !bEncryptedParts) {
@@ -301,14 +318,26 @@ bool Util::saveContent(QWidget *parent, KMime::Content *content, const QUrl &url
QByteArray rawDecryptedBody;
bool gotRawDecryptedBody = false;
if (!bSaveWithSig) {
- if (topContent->contentType()->mimeType() == "multipart/signed") {
+ if (topContent->contentType()->mimeType() == "multipart/signed") {
// carefully look for the part that is *not* the signature part:
- if (MimeTreeParser::ObjectTreeParser::findType(topContent, "application/pgp-signature", true, false)) {
- dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent, "application", "pgp-signature", true, false);
- } else if (MimeTreeParser::ObjectTreeParser::findType(topContent, "application/pkcs7-mime", true, false)) {
- dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent, "application", "pkcs7-mime", true, false);
+ if (MimeTreeParser::ObjectTreeParser::findType(topContent,
+ "application/pgp-signature", true,
+ false)) {
+ dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent,
+ "application",
+ "pgp-signature", true,
+ false);
+ } else if (MimeTreeParser::ObjectTreeParser::findType(topContent,
+ "application/pkcs7-mime",
+ true, false)) {
+ dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent,
+ "application",
+ "pkcs7-mime", true,
+ false);
} else {
- dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent, "multipart", "", true, false);
+ dataNode = MimeTreeParser::ObjectTreeParser ::findTypeNot(topContent,
+ "multipart", "", true,
+ false);
}
} else {
EmptySource emptySource;
@@ -329,7 +358,8 @@ bool Util::saveContent(QWidget *parent, KMime::Content *content, const QUrl &url
}
#else
const QByteArray data = content->decodedContent();
- qCWarning(MESSAGEVIEWER_LOG) << "Port the encryption/signature handling when saving a KMime::Content.";
+ qCWarning(MESSAGEVIEWER_LOG)
+ << "Port the encryption/signature handling when saving a KMime::Content.";
#endif
QDataStream ds;
QFile file;
@@ -389,7 +419,8 @@ bool Util::saveContent(QWidget *parent, KMime::Content *content, const QUrl &url
return true;
}
-bool Util::saveAttachments(const KMime::Content::List &contents, QWidget *parent, QUrl &currentFolder)
+bool Util::saveAttachments(const KMime::Content::List &contents, QWidget *parent,
+ QUrl &currentFolder)
{
if (contents.isEmpty()) {
KMessageBox::information(parent, i18n("Found no attachments to save."));
@@ -399,9 +430,9 @@ bool Util::saveAttachments(const KMime::Content::List &contents, QWidget *parent
return Util::saveContents(parent, contents, currentFolder);
}
-bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages)
+bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *parent,
+ bool appendMessages)
{
-
QString fileName;
if (retrievedMsgs.isEmpty()) {
return true;
@@ -409,7 +440,11 @@ bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *
const Akonadi::Item msgBase = retrievedMsgs.first();
if (msgBase.hasPayload<KMime::Message::Ptr>()) {
- fileName = MessageCore::StringUtil::cleanFileName(MimeTreeParser::NodeHelper::cleanSubject(msgBase.payload<KMime::Message::Ptr>().data()).trimmed());
+ fileName
+ = MessageCore::StringUtil::cleanFileName(MimeTreeParser::NodeHelper::cleanSubject(
+ msgBase.
+ payload
+ <KMime::Message::Ptr>().data()).trimmed());
fileName.remove(QLatin1Char('\"'));
} else {
fileName = i18n("message");
@@ -422,13 +457,19 @@ bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *
const QString filter = i18n("email messages (*.mbox);;all files (*)");
QString fileClass;
- const QUrl startUrl = KFileWidget::getStartUrl(QUrl(QStringLiteral("kfiledialog:///savemessage")), fileClass);
+ const QUrl startUrl = KFileWidget::getStartUrl(QUrl(QStringLiteral(
+ "kfiledialog:///savemessage")),
+ fileClass);
QFileDialog::Options opt;
if (appendMessages) {
opt |= QFileDialog::DontConfirmOverwrite;
}
QString localFile = startUrl.toLocalFile() + QLatin1Char('/') + fileName;
- QString saveFileName = QFileDialog::getSaveFileName(parent, i18np("Save Message", "Save Messages", retrievedMsgs.count()), localFile, filter, nullptr, opt);
+ QString saveFileName
+ = QFileDialog::getSaveFileName(parent,
+ i18np("Save Message", "Save Messages",
+ retrievedMsgs.count()), localFile, filter, nullptr,
+ opt);
if (!saveFileName.isEmpty()) {
const QString localFileName = saveFileName;
@@ -439,9 +480,11 @@ bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *
KMBox::MBox mbox;
if (!mbox.load(localFileName)) {
if (appendMessages) {
- KMessageBox::error(parent, i18n("File %1 could not be loaded.", localFileName), i18n("Error loading message"));
+ KMessageBox::error(parent, i18n("File %1 could not be loaded.",
+ localFileName), i18n("Error loading message"));
} else {
- KMessageBox::error(parent, i18n("File %1 could not be created.", localFileName), i18n("Error saving message"));
+ KMessageBox::error(parent, i18n("File %1 could not be created.",
+ localFileName), i18n("Error saving message"));
}
return false;
}
@@ -452,18 +495,21 @@ bool Util::saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *
}
if (!mbox.save()) {
- KMessageBox::error(parent, i18n("We cannot save message."), i18n("Error saving message"));
+ KMessageBox::error(parent, i18n("We cannot save message."),
+ i18n("Error saving message"));
return false;
}
QUrl url = QUrl::fromLocalFile(saveFileName);
if (url.isLocalFile()) {
- KRecentDirs::add(fileClass, url.adjusted(QUrl::RemoveFilename | QUrl::StripTrailingSlash).path());
+ KRecentDirs::add(fileClass, url.adjusted(
+ QUrl::RemoveFilename | QUrl::StripTrailingSlash).path());
}
}
return true;
}
-QAction *Util::createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent)
+QAction *Util::createAppAction(const KService::Ptr &service, bool singleOffer,
+ QActionGroup *actionGroup, QObject *parent)
{
QString actionName(service->name().replace(QLatin1Char('&'), QStringLiteral("&&")));
if (singleOffer) {
diff --git a/messageviewer/src/utils/messageviewerutil.h b/messageviewer/src/utils/messageviewerutil.h
index 17b3eb2..8c7a487 100644
--- a/messageviewer/src/utils/messageviewerutil.h
+++ b/messageviewer/src/utils/messageviewerutil.h
@@ -47,30 +47,27 @@ class QWidget;
class QActionGroup;
class QAction;
-namespace KMime
-{
+namespace KMime {
class Message;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* The Util namespace contains a collection of helper functions use in
* various places.
*/
-namespace Util
-{
-
+namespace Util {
// return true if we should proceed, false if we should abort
bool MESSAGEVIEWER_EXPORT checkOverwrite(const QUrl &url, QWidget *w);
-MESSAGEVIEWER_EXPORT bool saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs, QWidget *parent, bool appendMessages = false);
+MESSAGEVIEWER_EXPORT bool saveMessageInMbox(const Akonadi::Item::List &retrievedMsgs,
+ QWidget *parent, bool appendMessages = false);
-MESSAGEVIEWER_EXPORT bool saveAttachments(const KMime::Content::List &contents, QWidget *parent, QUrl &currentFolder);
+MESSAGEVIEWER_EXPORT bool saveAttachments(const KMime::Content::List &contents, QWidget *parent,
+ QUrl &currentFolder);
-MESSAGEVIEWER_EXPORT QAction *createAppAction(const KService::Ptr &service, bool singleOffer, QActionGroup *actionGroup, QObject *parent);
+MESSAGEVIEWER_EXPORT QAction *createAppAction(const KService::Ptr &service, bool singleOffer,
+ QActionGroup *actionGroup, QObject *parent);
}
-
}
Q_DECLARE_METATYPE(KService::Ptr)
#endif
diff --git a/messageviewer/src/utils/messageviewerutil_p.h b/messageviewer/src/utils/messageviewerutil_p.h
index 9ffb099..93e0cd3 100644
--- a/messageviewer/src/utils/messageviewerutil_p.h
+++ b/messageviewer/src/utils/messageviewerutil_p.h
@@ -42,15 +42,12 @@
class QUrl;
class QWidget;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* The Util namespace contains a collection of helper functions use in
* various places.
*/
-namespace Util
-{
+namespace Util {
bool handleUrlWithQDesktopServices(const QUrl &url);
KMime::Content::List allContents(const KMime::Content *message);
@@ -58,6 +55,5 @@ KMime::Content::List allContents(const KMime::Content *message);
bool saveContents(QWidget *parent, const KMime::Content::List &contents, QUrl &currentFolder);
bool saveContent(QWidget *parent, KMime::Content *content, const QUrl &url);
}
-
}
#endif
diff --git a/messageviewer/src/utils/mimetype.cpp b/messageviewer/src/utils/mimetype.cpp
index 6d19f78..6f40ea9 100644
--- a/messageviewer/src/utils/mimetype.cpp
+++ b/messageviewer/src/utils/mimetype.cpp
@@ -30,21 +30,26 @@
#include <QMimeDatabase>
QString MessageViewer::Util::iconPathForMimetype(const QString &mimeType, int iconSize,
- const QString &fallbackFileName1,
- const QString &fallbackFileName2)
+ const QString &fallbackFileName1,
+ const QString &fallbackFileName2)
{
- return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForMimetype(mimeType, fallbackFileName1, fallbackFileName2), iconSize);
+ return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForMimetype(mimeType,
+ fallbackFileName1,
+ fallbackFileName2),
+ iconSize);
}
QString MessageViewer::Util::iconPathForContent(KMime::Content *node, int size)
{
- return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForContent(node), size);
+ return IconNameCache::instance()->iconPath(MimeTreeParser::Util::iconNameForContent(node),
+ size);
}
-MessageViewer::Util::AttachmentDisplayInfo MessageViewer::Util::attachmentDisplayInfo(KMime::Content *node)
+MessageViewer::Util::AttachmentDisplayInfo MessageViewer::Util::attachmentDisplayInfo(
+ KMime::Content *node)
{
AttachmentDisplayInfo info;
- info.icon = iconPathForContent(node, KIconLoader::Small);
+ info.icon = iconPathForContent(node, KIconLoader::Small);
info.label = MimeTreeParser::Util::labelForContent(node);
bool typeBlacklisted = MimeTreeParser::Util::isTypeBlacklisted(node);
diff --git a/messageviewer/src/utils/mimetype.h b/messageviewer/src/utils/mimetype.h
index e0d9e99..adcd2c8 100644
--- a/messageviewer/src/utils/mimetype.h
+++ b/messageviewer/src/utils/mimetype.h
@@ -24,21 +24,16 @@
#include <QString>
-namespace KMime
-{
+namespace KMime {
class Content;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* The Util namespace contains a collection of helper functions use in
* various places.
*/
-namespace Util
-{
-
+namespace Util {
/**
* Finds the filename of an icon based on the given mimetype or filenames.
*
@@ -56,8 +51,8 @@ namespace Util
* @return the full file name of the icon file
*/
QString MESSAGEVIEWER_EXPORT iconPathForMimetype(const QString &mimeType, int iconSize,
- const QString &fallbackFileName1 = QString(),
- const QString &fallbackFileName2 = QString());
+ const QString &fallbackFileName1 = QString(),
+ const QString &fallbackFileName2 = QString());
QString MESSAGEVIEWER_EXPORT iconPathForContent(KMime::Content *node, int iconSize);
@@ -68,7 +63,6 @@ struct AttachmentDisplayInfo {
};
AttachmentDisplayInfo attachmentDisplayInfo(KMime::Content *node);
-
}
}
#endif
diff --git a/messageviewer/src/viewer/bodypartformatterfactory.cpp b/messageviewer/src/viewer/bodypartformatterfactory.cpp
index 981d609..7a56b61 100644
--- a/messageviewer/src/viewer/bodypartformatterfactory.cpp
+++ b/messageviewer/src/viewer/bodypartformatterfactory.cpp
@@ -40,14 +40,11 @@
using namespace MessageViewer;
-namespace
-{
-
+namespace {
DEFINE_PLUGIN_LOADER(BodyPartFormatterPluginLoader,
MimeTreeParser::Interface::BodyPartFormatterPlugin,
"create_bodypart_formatter_plugin",
"messageviewer/plugins/bodypartformatter/")
-
}
BodyPartFormatterFactory::BodyPartFormatterFactory()
@@ -63,7 +60,8 @@ void BodyPartFormatterFactory::loadPlugins()
{
const BodyPartFormatterPluginLoader *pl = BodyPartFormatterPluginLoader::instance();
if (!pl) {
- qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: cannot instantiate plugin loader!";
+ qCWarning(MESSAGEVIEWER_LOG)
+ << "BodyPartFormatterFactory: cannot instantiate plugin loader!";
return;
}
const QStringList types = pl->types();
@@ -71,7 +69,8 @@ void BodyPartFormatterFactory::loadPlugins()
for (QStringList::const_iterator it = types.begin(); it != types.end(); ++it) {
const MimeTreeParser::Interface::BodyPartFormatterPlugin *plugin = pl->createForName(*it);
if (!plugin) {
- qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: plugin" << *it << "is not valid!";
+ qCWarning(MESSAGEVIEWER_LOG) << "BodyPartFormatterFactory: plugin" << *it
+ << "is not valid!";
continue;
}
const MimeTreeParser::Interface::BodyPartFormatter *bfp;
diff --git a/messageviewer/src/viewer/bodypartformatterfactory.h b/messageviewer/src/viewer/bodypartformatterfactory.h
index a493c4d..085667d 100644
--- a/messageviewer/src/viewer/bodypartformatterfactory.h
+++ b/messageviewer/src/viewer/bodypartformatterfactory.h
@@ -38,10 +38,9 @@
#include <MimeTreeParser/BodyPartFormatterBaseFactory>
-namespace MessageViewer
-{
-
-class MESSAGEVIEWER_EXPORT BodyPartFormatterFactory : public MimeTreeParser::BodyPartFormatterBaseFactory
+namespace MessageViewer {
+class MESSAGEVIEWER_EXPORT BodyPartFormatterFactory : public MimeTreeParser::
+ BodyPartFormatterBaseFactory
{
public:
BodyPartFormatterFactory();
@@ -50,7 +49,6 @@ public:
protected:
void loadPlugins() override;
};
-
}
#endif // __MESSAGEVIEWER_BODYPARTFORMATTERFACTORY_H__
diff --git a/messageviewer/src/viewer/bodypartformatterfactorysingleton.cpp b/messageviewer/src/viewer/bodypartformatterfactorysingleton.cpp
index 685eb3a..cb8baea 100644
--- a/messageviewer/src/viewer/bodypartformatterfactorysingleton.cpp
+++ b/messageviewer/src/viewer/bodypartformatterfactorysingleton.cpp
@@ -36,10 +36,12 @@ using namespace MessageViewer;
static QSharedPointer<MimeTreeParser::BodyPartFormatterBaseFactory> singleton;
-const MimeTreeParser::BodyPartFormatterBaseFactory *MessageViewer::bodyPartFormatterBaseFactoryInstance()
+const MimeTreeParser::BodyPartFormatterBaseFactory *MessageViewer::
+bodyPartFormatterBaseFactoryInstance()
{
if (!singleton) {
- singleton = QSharedPointer<MimeTreeParser::BodyPartFormatterBaseFactory>(new BodyPartFormatterFactory());
+ singleton = QSharedPointer<MimeTreeParser::BodyPartFormatterBaseFactory>(
+ new BodyPartFormatterFactory());
}
return singleton.data();
diff --git a/messageviewer/src/viewer/bodypartformatterfactorysingleton.h b/messageviewer/src/viewer/bodypartformatterfactorysingleton.h
index 098cb0b..9caba2b 100644
--- a/messageviewer/src/viewer/bodypartformatterfactorysingleton.h
+++ b/messageviewer/src/viewer/bodypartformatterfactorysingleton.h
@@ -30,13 +30,11 @@
#ifndef __MESSAGEVIEWER_BODYPARTFORMATTERFACTORYSIGNLETON_P_H__
#define __MESSAGEVIEWER_BODYPARTFORMATTERFACTORYSIGNLETON_P_H__
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class BodyPartFormatterBaseFactory;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterBaseFactoryInstance();
}
#endif
diff --git a/messageviewer/src/viewer/csshelper.cpp b/messageviewer/src/viewer/csshelper.cpp
index d237969..9d807c4 100644
--- a/messageviewer/src/viewer/csshelper.cpp
+++ b/messageviewer/src/viewer/csshelper.cpp
@@ -54,16 +54,16 @@ CSSHelper::CSSHelper(const QPaintDevice *pd)
mBackgroundColor = QApplication::palette().color(QPalette::Base);
cHtmlWarning = QColor(0xFF, 0x40, 0x40); // warning frame color: light red
- cPgpEncrH = MessageCore::ColorUtil::self()->pgpEncryptedMessageColor();
+ cPgpEncrH = MessageCore::ColorUtil::self()->pgpEncryptedMessageColor();
cPgpEncrHT = MessageCore::ColorUtil::self()->pgpEncryptedTextColor();
- cPgpOk1H = MessageCore::ColorUtil::self()->pgpSignedTrustedMessageColor();
- cPgpOk1HT = MessageCore::ColorUtil::self()->pgpSignedTrustedTextColor();
- cPgpOk0H = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
- cPgpOk0HT = MessageCore::ColorUtil::self()->pgpSignedUntrustedTextColor();
- cPgpWarnH = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
+ cPgpOk1H = MessageCore::ColorUtil::self()->pgpSignedTrustedMessageColor();
+ cPgpOk1HT = MessageCore::ColorUtil::self()->pgpSignedTrustedTextColor();
+ cPgpOk0H = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
+ cPgpOk0HT = MessageCore::ColorUtil::self()->pgpSignedUntrustedTextColor();
+ cPgpWarnH = MessageCore::ColorUtil::self()->pgpSignedUntrustedMessageColor();
cPgpWarnHT = MessageCore::ColorUtil::self()->pgpSignedUntrustedTextColor();
- cPgpErrH = MessageCore::ColorUtil::self()->pgpSignedBadMessageColor();
- cPgpErrHT = MessageCore::ColorUtil::self()->pgpSignedBadTextColor();
+ cPgpErrH = MessageCore::ColorUtil::self()->pgpSignedBadMessageColor();
+ cPgpErrHT = MessageCore::ColorUtil::self()->pgpSignedBadTextColor();
if (MessageCore::MessageCoreSettings::self()->useDefaultColors()) {
mQuoteColor[0] = MessageCore::ColorUtil::self()->quoteLevel1DefaultTextColor();
@@ -79,8 +79,14 @@ CSSHelper::CSSHelper(const QPaintDevice *pd)
QFont defaultFont = QFontDatabase::systemFont(QFontDatabase::GeneralFont);
QFont defaultFixedFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
- mBodyFont = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer::MessageViewerSettings::self()->bodyFont();
- mPrintFont = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer::MessageViewerSettings::self()->printFont();
+ mBodyFont
+ = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer
+ ::
+ MessageViewerSettings::self()->bodyFont();
+ mPrintFont
+ = MessageCore::MessageCoreSettings::self()->useDefaultFonts() ? defaultFont : MessageViewer
+ ::
+ MessageViewerSettings::self()->printFont();
mFixedFont = mFixedPrintFont = defaultFixedFont;
defaultFont.setItalic(true);
mQuoteFont = defaultFont;
@@ -94,18 +100,18 @@ CSSHelper::CSSHelper(const QPaintDevice *pd)
mForegroundColor = KColorScheme(QPalette::Active).foreground().color();
if (!MessageCore::MessageCoreSettings::self()->useDefaultColors()) {
- mLinkColor =
- reader.readEntry("LinkColor", mLinkColor);
- cPgpEncrH =
- reader.readEntry("PGPMessageEncr", cPgpEncrH);
- cPgpOk1H =
- reader.readEntry("PGPMessageOkKeyOk", cPgpOk1H);
- cPgpOk0H =
- reader.readEntry("PGPMessageOkKeyBad", cPgpOk0H);
- cPgpWarnH =
- reader.readEntry("PGPMessageWarn", cPgpWarnH);
- cPgpErrH =
- reader.readEntry("PGPMessageErr", cPgpErrH);
+ mLinkColor
+ = reader.readEntry("LinkColor", mLinkColor);
+ cPgpEncrH
+ = reader.readEntry("PGPMessageEncr", cPgpEncrH);
+ cPgpOk1H
+ = reader.readEntry("PGPMessageOkKeyOk", cPgpOk1H);
+ cPgpOk0H
+ = reader.readEntry("PGPMessageOkKeyBad", cPgpOk0H);
+ cPgpWarnH
+ = reader.readEntry("PGPMessageWarn", cPgpWarnH);
+ cPgpErrH
+ = reader.readEntry("PGPMessageErr", cPgpErrH);
for (int i = 0; i < 3; ++i) {
const QString key = QLatin1String("QuotedText") + QString::number(i + 1);
mQuoteColor[i] = reader.readEntry(key, mQuoteColor[i]);
@@ -113,7 +119,7 @@ CSSHelper::CSSHelper(const QPaintDevice *pd)
}
if (!MessageCore::MessageCoreSettings::self()->useDefaultFonts()) {
- mBodyFont = fonts.readEntry("body-font", mBodyFont);
+ mBodyFont = fonts.readEntry("body-font", mBodyFont);
mPrintFont = fonts.readEntry("print-font", mPrintFont);
mFixedFont = fonts.readEntry("fixed-font", mFixedFont);
mFixedPrintFont = mFixedFont; // FIXME when we have a separate fixed print font
@@ -133,7 +139,7 @@ QString CSSHelper::htmlHead(bool fixed) const
return
QLatin1String("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
"<html><head><title></title><style>\n")
- + cssDefinitions(fixed) +
- QLatin1String("</style></head>\n"
- "<body>\n");
+ + cssDefinitions(fixed)
+ +QLatin1String("</style></head>\n"
+ "<body>\n");
}
diff --git a/messageviewer/src/viewer/csshelper.h b/messageviewer/src/viewer/csshelper.h
index 3e93311..a1928a4 100644
--- a/messageviewer/src/viewer/csshelper.h
+++ b/messageviewer/src/viewer/csshelper.h
@@ -36,9 +36,7 @@
#include "messageviewer_export.h"
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT CSSHelper : public CSSHelperBase
{
public:
@@ -49,7 +47,6 @@ public:
&gt;body&lt; tag */
QString htmlHead(bool fixedFont = false) const override;
};
-
}
#endif // __MESSAGEVIEWER_CSSHELPER_H__
diff --git a/messageviewer/src/viewer/csshelperbase.cpp b/messageviewer/src/viewer/csshelperbase.cpp
index b63dc0e..b6d1a3c 100644
--- a/messageviewer/src/viewer/csshelperbase.cpp
+++ b/messageviewer/src/viewer/csshelperbase.cpp
@@ -35,11 +35,8 @@
#include <QPaintDevice>
#include <QPalette>
-namespace MessageViewer
-{
-
-namespace
-{
+namespace MessageViewer {
+namespace {
// some QColor manipulators that hide the ugly QColor API w.r.t. HSV:
inline QColor darker(const QColor &c)
{
@@ -81,7 +78,6 @@ CSSHelperBase::CSSHelperBase(const QPaintDevice *pd)
CSSHelperBase::~CSSHelperBase()
{
-
}
void CSSHelperBase::recalculatePGPColors()
@@ -212,8 +208,7 @@ int CSSHelperBase::fontSize(bool fixed, bool print) const
return bodyFont(fixed, print).pointSize();
}
-namespace
-{
+namespace {
int pointsToPixel(const QPaintDevice *pd, int pointSize)
{
return (pointSize * pd->logicalDpiY() + 36) / 72;
@@ -225,7 +220,7 @@ static const char *const quoteFontSizes[] = { "85", "80", "75" };
QString CSSHelperBase::printCssDefinitions(bool fixed) const
{
const QString headerFont = QStringLiteral(" font-family: \"%1\" ! important;\n"
- " font-size: %2pt ! important;\n")
+ " font-size: %2pt ! important;\n")
.arg(mPrintFont.family())
.arg(mPrintFont.pointSize());
const QPalette &pal = QApplication::palette();
@@ -308,7 +303,7 @@ QString CSSHelperBase::printCssDefinitions(bool fixed) const
"div.noprint {\n"
" display:none ! important;\n"
"}\n\n"
- )
+ )
.arg(headerFont,
pal.color(QPalette::Background).name(),
pal.color(QPalette::Foreground).name())
@@ -346,11 +341,12 @@ QString CSSHelperBase::screenCssDefinitions(const CSSHelperBase *helper, bool fi
const QString bgColor = mBackgroundColor.name();
const QString linkColor = mLinkColor.name();
const QString headerFont = QStringLiteral(" font-family: \"%1\" ! important;\n"
- " font-size: %2px ! important;\n")
+ " font-size: %2px ! important;\n")
.arg(mBodyFont.family())
.arg(pointsToPixel(helper->mPaintDevice, mBodyFont.pointSize()));
- const QString background = QStringLiteral(" background-color: %1 ! important;\n").arg(bgColor);
- const QString bodyFontSize = QString::number(pointsToPixel(helper->mPaintDevice, fontSize(fixed))) + QLatin1String("px");
+ const QString background = QStringLiteral(" background-color: %1 ! important;\n").arg(bgColor);
+ const QString bodyFontSize = QString::number(pointsToPixel(helper->mPaintDevice, fontSize(
+ fixed))) + QLatin1String("px");
const QPalette &pal = QApplication::palette();
QString quoteCSS;
@@ -375,9 +371,10 @@ QString CSSHelperBase::screenCssDefinitions(const CSSHelperBase *helper, bool fi
if (mQuoteFont.bold()) {
quoteCSS += QLatin1String(" font-weight: bold ! important;\n");
}
- if (mShrinkQuotes)
+ if (mShrinkQuotes) {
quoteCSS += QLatin1String(" font-size: ") + QString::fromLatin1(quoteFontSizes[i])
+ QLatin1String("% ! important;\n");
+ }
quoteCSS += QLatin1String("}\n\n");
}
@@ -592,7 +589,7 @@ QString CSSHelperBase::screenCssDefinitions(const CSSHelperBase *helper, bool fi
"div.senderstatus{\n"
" text-align:center ! important;\n"
"}\n\n"
- )
+ )
.arg(headerFont)
.arg(pal.color(QPalette::Highlight).name(),
@@ -607,7 +604,7 @@ QString CSSHelperBase::commonCssDefinitions() const
{
const QPalette &pal = QApplication::palette();
const QString headerFont = QStringLiteral("font-family: \"%1\" ! important;\n"
- " font-size: %2px ! important;\n")
+ " font-size: %2px ! important;\n")
.arg(mBodyFont.family())
.arg(pointsToPixel(this->mPaintDevice, mBodyFont.pointSize()));
@@ -723,8 +720,10 @@ QString CSSHelperBase::commonCssDefinitions() const
"div.quotelevelmark {\n"
" position: absolute;\n"
" margin-left:-10px;\n"
- "}\n\n").arg(pal.color(QPalette::Background).name()).arg(pal.color(QPalette::Foreground).name()).arg(headerFont)
- ;
+ "}\n\n").arg(pal.color(QPalette::Background).name()).arg(pal.color(QPalette::
+ Foreground).name())
+ .arg(headerFont)
+ ;
}
void CSSHelperBase::setBodyFont(const QFont &font)
@@ -752,5 +751,4 @@ QColor CSSHelperBase::pgpWarnColor() const
{
return cPgpWarnH;
}
-
}
diff --git a/messageviewer/src/viewer/csshelperbase.h b/messageviewer/src/viewer/csshelperbase.h
index 309bf6a..9440974 100644
--- a/messageviewer/src/viewer/csshelperbase.h
+++ b/messageviewer/src/viewer/csshelperbase.h
@@ -40,9 +40,7 @@
class QString;
class QPaintDevice;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT CSSHelperBase
{
public:
@@ -133,9 +131,7 @@ private:
private:
const QPaintDevice *mPaintDevice;
-
};
-
}
#endif
diff --git a/messageviewer/src/viewer/editorwatcher.cpp b/messageviewer/src/viewer/editorwatcher.cpp
index e09fd02..72fb696 100644
--- a/messageviewer/src/viewer/editorwatcher.cpp
+++ b/messageviewer/src/viewer/editorwatcher.cpp
@@ -44,19 +44,20 @@
using namespace MessageViewer;
EditorWatcher::EditorWatcher(const QUrl &url, const QString &mimeType, OpenWithOption option,
- QObject *parent, QWidget *parentWidget) :
- QObject(parent),
- mUrl(url),
- mMimeType(mimeType),
- mEditor(nullptr),
- mParentWidget(parentWidget),
- mInotifyFd(-1),
- mInotifyWatch(-1),
- mOpenWithOption(option),
- mHaveInotify(false),
- mFileOpen(false),
- mEditorRunning(false),
- mFileModified(true), // assume the worst unless we know better
+ QObject *parent, QWidget *parentWidget)
+ : QObject(parent)
+ , mUrl(url)
+ , mMimeType(mimeType)
+ , mEditor(nullptr)
+ , mParentWidget(parentWidget)
+ , mInotifyFd(-1)
+ , mInotifyWatch(-1)
+ , mOpenWithOption(option)
+ , mHaveInotify(false)
+ , mFileOpen(false)
+ , mEditorRunning(false)
+ , mFileModified(true)
+ , // assume the worst unless we know better
mDone(false)
{
assert(mUrl.isLocalFile());
@@ -76,10 +77,11 @@ EditorWatcher::ErrorEditorWatcher EditorWatcher::start()
// find an editor
QList<QUrl> list;
list.append(mUrl);
- KService::Ptr offer = KMimeTypeTrader::self()->preferredService(mMimeType, QStringLiteral("Application"));
+ KService::Ptr offer
+ = KMimeTypeTrader::self()->preferredService(mMimeType, QStringLiteral("Application"));
if ((mOpenWithOption == OpenWithDialog) || !offer) {
std::unique_ptr<KOpenWithDialog> dlg(new KOpenWithDialog(list, i18n("Edit with:"),
- QString(), mParentWidget));
+ QString(), mParentWidget));
const int dlgrc = dlg->exec();
if (dlgrc && dlg) {
offer = dlg->service();
@@ -97,7 +99,9 @@ EditorWatcher::ErrorEditorWatcher EditorWatcher::start()
mInotifyFd = inotify_init();
if (mInotifyFd > 0) {
(void)fcntl(mInotifyFd, F_SETFD, FD_CLOEXEC);
- mInotifyWatch = inotify_add_watch(mInotifyFd, mUrl.path().toLatin1().constData(), IN_CLOSE | IN_OPEN | IN_MODIFY | IN_ATTRIB);
+ mInotifyWatch = inotify_add_watch(mInotifyFd,
+ mUrl.path().toLatin1().constData(),
+ IN_CLOSE | IN_OPEN | IN_MODIFY | IN_ATTRIB);
if (mInotifyWatch >= 0) {
QSocketNotifier *sn = new QSocketNotifier(mInotifyFd, QSocketNotifier::Read, this);
connect(sn, &QSocketNotifier::activated, this, &EditorWatcher::inotifyEvent);
@@ -115,7 +119,9 @@ EditorWatcher::ErrorEditorWatcher EditorWatcher::start()
const QStringList params = parser.resultingArguments();
mEditor = new KProcess(this);
mEditor->setProgram(params);
- connect(mEditor, static_cast<void (KProcess::*)(int, QProcess::ExitStatus)>(&KProcess::finished), this, &EditorWatcher::editorExited);
+ connect(mEditor, static_cast<void (KProcess::*)(int,
+ QProcess::ExitStatus)>(&KProcess::finished),
+ this, &EditorWatcher::editorExited);
mEditor->start();
if (!mEditor->waitForStarted()) {
return CannotStart;
@@ -148,7 +154,6 @@ void EditorWatcher::inotifyEvent()
ioctl(mInotifyFd, FIONREAD, &pending);
while (pending > 0) {
-
const int bytesToRead = qMin(pending, (int)sizeof(buf) - offsetStartRead);
int bytesAvailable = read(mInotifyFd, &buf[offsetStartRead], bytesToRead);
@@ -158,7 +163,7 @@ void EditorWatcher::inotifyEvent()
int offsetCurrent = 0;
while (bytesAvailable >= (int)sizeof(struct inotify_event)) {
- const struct inotify_event *const event = (struct inotify_event *) &buf[offsetCurrent];
+ const struct inotify_event *const event = (struct inotify_event *)&buf[offsetCurrent];
const int eventSize = sizeof(struct inotify_event) + event->len;
if (bytesAvailable < eventSize) {
break;
@@ -175,7 +180,6 @@ void EditorWatcher::inotifyEvent()
if (event->mask & (IN_MODIFY | IN_ATTRIB)) {
mFileModified = true;
}
-
}
if (bytesAvailable > 0) {
// copy partial event to beginning of buffer
@@ -185,7 +189,6 @@ void EditorWatcher::inotifyEvent()
}
#endif
mTimer.start(500);
-
}
void EditorWatcher::editorExited()
@@ -211,8 +214,8 @@ void EditorWatcher::checkEditDone()
mDone = true;
// check if it's a mime type that's mostly handled read-only
- const bool isReadOnlyMimeType = (readOnlyMimeTypes.contains(mMimeType) ||
- mMimeType.startsWith(QStringLiteral("image/")));
+ const bool isReadOnlyMimeType = (readOnlyMimeTypes.contains(mMimeType)
+ || mMimeType.startsWith(QStringLiteral("image/")));
// nobody can edit that fast, we seem to be unable to detect
// when the editor will be closed
diff --git a/messageviewer/src/viewer/editorwatcher.h b/messageviewer/src/viewer/editorwatcher.h
index 05c8c48..e8d4eae 100644
--- a/messageviewer/src/viewer/editorwatcher.h
+++ b/messageviewer/src/viewer/editorwatcher.h
@@ -27,9 +27,7 @@
#include <QTime>
class KProcess;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
Starts an editor for the given URL and emits an signal when
editing has been finished. Both, the editor process as well
@@ -59,8 +57,8 @@ public:
* @param parentWidget the parent widget of this EditorWatcher, which will be used as the parent
* widget for message dialogs.
*/
- EditorWatcher(const QUrl &url, const QString &mimeType, OpenWithOption option,
- QObject *parent, QWidget *parentWidget);
+ EditorWatcher(const QUrl &url, const QString &mimeType, OpenWithOption option, QObject *parent,
+ QWidget *parentWidget);
~EditorWatcher();
ErrorEditorWatcher start();
@@ -90,7 +88,6 @@ private:
bool mFileModified;
bool mDone;
};
-
}
#endif
diff --git a/messageviewer/src/viewer/messagedisplayformatattribute.cpp b/messageviewer/src/viewer/messagedisplayformatattribute.cpp
index f300d78..2576401 100644
--- a/messageviewer/src/viewer/messagedisplayformatattribute.cpp
+++ b/messageviewer/src/viewer/messagedisplayformatattribute.cpp
@@ -28,11 +28,11 @@ class MessageViewer::MessageDisplayFormatAttributePrivate
{
public:
MessageDisplayFormatAttributePrivate()
- : messageFormat(Viewer::UseGlobalSetting),
- remoteContent(false)
+ : messageFormat(Viewer::UseGlobalSetting)
+ , remoteContent(false)
{
-
}
+
Viewer::DisplayFormatMessage messageFormat;
bool remoteContent;
};
@@ -88,7 +88,8 @@ bool MessageDisplayFormatAttribute::remoteContent() const
bool MessageDisplayFormatAttribute::operator==(const MessageDisplayFormatAttribute &other) const
{
- return (d->messageFormat == other.messageFormat()) && (d->remoteContent == other.remoteContent());
+ return (d->messageFormat == other.messageFormat())
+ && (d->remoteContent == other.remoteContent());
}
Viewer::DisplayFormatMessage MessageDisplayFormatAttribute::messageFormat() const
diff --git a/messageviewer/src/viewer/messagedisplayformatattribute.h b/messageviewer/src/viewer/messagedisplayformatattribute.h
index d8ccd80..53004aa 100644
--- a/messageviewer/src/viewer/messagedisplayformatattribute.h
+++ b/messageviewer/src/viewer/messagedisplayformatattribute.h
@@ -24,8 +24,7 @@
#include <AkonadiCore/attribute.h>
#include "messageviewer_export.h"
#include "messageviewer/viewer.h"
-namespace MessageViewer
-{
+namespace MessageViewer {
class MessageDisplayFormatAttributePrivate;
class MESSAGEVIEWER_EXPORT MessageDisplayFormatAttribute : public Akonadi::Attribute
diff --git a/messageviewer/src/viewer/mimeparttree/mimeparttreeview.h b/messageviewer/src/viewer/mimeparttree/mimeparttreeview.h
index f64ca60..2e72ab3 100644
--- a/messageviewer/src/viewer/mimeparttree/mimeparttreeview.h
+++ b/messageviewer/src/viewer/mimeparttree/mimeparttreeview.h
@@ -23,8 +23,7 @@
#include <QTreeView>
#include <KMime/Message>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MimeTreeModel;
class MimePartTreeView : public QTreeView
{
diff --git a/messageviewer/src/viewer/mimeparttree/mimetreemodel.cpp b/messageviewer/src/viewer/mimeparttree/mimetreemodel.cpp
index 0727995..08e5589 100644
--- a/messageviewer/src/viewer/mimeparttree/mimetreemodel.cpp
+++ b/messageviewer/src/viewer/mimeparttree/mimetreemodel.cpp
@@ -40,9 +40,11 @@ using namespace MessageViewer;
class Q_DECL_HIDDEN MimeTreeModel::Private
{
public:
- Private() :
- root(nullptr)
- {}
+ Private()
+ : root(nullptr)
+ {
+ }
+
~Private()
{
qDeleteAll(tempDirs);
@@ -106,10 +108,14 @@ public:
QIcon iconForContent(KMime::Content *content)
{
if (content->contentType(false)) {
- auto iconName = MimeTreeParser::Util::iconNameForMimetype(QLatin1String(content->contentType()->mimeType()));
-
- auto mimeType = m_mimeDb.mimeTypeForName(QString::fromLatin1(content->contentType()->mimeType()));
- if (!mimeType.isValid() || mimeType.name() == QLatin1String("application/octet-stream")) {
+ auto iconName
+ = MimeTreeParser::Util::iconNameForMimetype(QLatin1String(content->contentType()->
+ mimeType()));
+
+ auto mimeType
+ = m_mimeDb.mimeTypeForName(QString::fromLatin1(content->contentType()->mimeType()));
+ if (!mimeType.isValid()
+ || mimeType.name() == QLatin1String("application/octet-stream")) {
const QString name = descriptionForContent(content);
mimeType = MimeTreeParser::Util::mimetype(name);
}
@@ -133,9 +139,9 @@ public:
QMimeDatabase m_mimeDb;
};
-MimeTreeModel::MimeTreeModel(QObject *parent) :
- QAbstractItemModel(parent),
- d(new Private)
+MimeTreeModel::MimeTreeModel(QObject *parent)
+ : QAbstractItemModel(parent)
+ , d(new Private)
{
}
@@ -306,7 +312,8 @@ QMimeData *MimeTreeModel::mimeData(const QModelIndexList &indexes) const
QTemporaryDir *tempDir = new QTemporaryDir; // Will remove the directory on destruction.
d->tempDirs.append(tempDir);
- const QString fileName = tempDir->path() + QLatin1Char('/') + d->descriptionForContent(content);
+ const QString fileName = tempDir->path() + QLatin1Char('/') + d->descriptionForContent(
+ content);
QFile f(fileName);
if (!f.open(QIODevice::WriteOnly)) {
qCWarning(MESSAGEVIEWER_LOG) << "Cannot write attachment:" << f.errorString();
diff --git a/messageviewer/src/viewer/mimeparttree/mimetreemodel.h b/messageviewer/src/viewer/mimeparttree/mimetreemodel.h
index cb9f957..97320bc 100644
--- a/messageviewer/src/viewer/mimeparttree/mimetreemodel.h
+++ b/messageviewer/src/viewer/mimeparttree/mimetreemodel.h
@@ -22,14 +22,11 @@
#include <QAbstractItemModel>
-namespace KMime
-{
+namespace KMime {
class Content;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
A model representing the mime part tree of a message.
*/
@@ -53,12 +50,14 @@ public:
KMime::Content *root();
- QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex index(int row, int column,
+ const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const override;
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation,
+ int role = Qt::DisplayRole) const override;
QMimeData *mimeData(const QModelIndexList &indexes) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QStringList mimeTypes() const override;
@@ -66,7 +65,6 @@ private:
class Private;
Private *const d;
};
-
}
#endif
diff --git a/messageviewer/src/viewer/objecttreeemptysource.cpp b/messageviewer/src/viewer/objecttreeemptysource.cpp
index 5c1945d..41c0675 100644
--- a/messageviewer/src/viewer/objecttreeemptysource.cpp
+++ b/messageviewer/src/viewer/objecttreeemptysource.cpp
@@ -30,25 +30,22 @@
using namespace MessageViewer;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class EmptySourcePrivate
{
public:
EmptySourcePrivate()
: mAllowDecryption(false)
{
-
}
+
bool mAllowDecryption;
};
-
}
EmptySource::EmptySource()
- : MimeTreeParser::Interface::ObjectTreeSource(),
- d(new MessageViewer::EmptySourcePrivate)
+ : MimeTreeParser::Interface::ObjectTreeSource()
+ , d(new MessageViewer::EmptySourcePrivate)
{
}
@@ -72,7 +69,8 @@ bool EmptySource::showSignatureDetails() const
return false;
}
-void EmptySource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes)
+void EmptySource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode,
+ const QList<MimeTreeParser::Util::HtmlMode> &availableModes)
{
Q_UNUSED(mode);
Q_UNUSED(availableModes);
@@ -144,8 +142,9 @@ bool EmptySource::isPrinting() const
return false;
}
-MimeTreeParser::Interface::MessagePartRendererPtr EmptySource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart)
+MimeTreeParser::Interface::MessagePartRendererPtr EmptySource::messagePartTheme(
+ MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
- return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart, cssHelper()));
+ return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart,
+ cssHelper()));
}
-
diff --git a/messageviewer/src/viewer/objecttreeemptysource.h b/messageviewer/src/viewer/objecttreeemptysource.h
index 77c44ee..56bcba9 100644
--- a/messageviewer/src/viewer/objecttreeemptysource.h
+++ b/messageviewer/src/viewer/objecttreeemptysource.h
@@ -24,8 +24,7 @@
#include "messageviewer_export.h"
class QString;
-namespace MessageViewer
-{
+namespace MessageViewer {
class CSSHelperBase;
/** An ObjectTreeSource that does not work on anything */
@@ -38,7 +37,8 @@ public:
bool decryptMessage() const override;
bool htmlLoadExternal() const override;
bool showSignatureDetails() const override;
- void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override;
+ void setHtmlMode(MimeTreeParser::Util::HtmlMode mode,
+ const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override;
MimeTreeParser::Util::HtmlMode preferredMode() const override;
void setAllowDecryption(bool allowDecryption);
int levelQuote() const override;
@@ -52,13 +52,12 @@ public:
bool showEmoticons() const override;
bool showExpandQuotesMark() const override;
const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() override;
- MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(MimeTreeParser::Interface::MessagePartPtr msgPart) override;
+ MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(
+ MimeTreeParser::Interface::MessagePartPtr msgPart) override;
bool isPrinting() const override;
private:
EmptySourcePrivate *const d;
};
-
}
#endif
-
diff --git a/messageviewer/src/viewer/objecttreeviewersource.cpp b/messageviewer/src/viewer/objecttreeviewersource.cpp
index 19c56e6..996ae6f 100644
--- a/messageviewer/src/viewer/objecttreeviewersource.cpp
+++ b/messageviewer/src/viewer/objecttreeviewersource.cpp
@@ -30,8 +30,9 @@
using namespace MessageViewer;
-MailViewerSource::MailViewerSource(ViewerPrivate *viewer) :
- MimeTreeParser::Interface::ObjectTreeSource(), mViewer(viewer)
+MailViewerSource::MailViewerSource(ViewerPrivate *viewer)
+ : MimeTreeParser::Interface::ObjectTreeSource()
+ , mViewer(viewer)
{
}
@@ -54,7 +55,8 @@ bool MailViewerSource::showSignatureDetails() const
return mViewer->mShowSignatureDetails;
}
-void MailViewerSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes)
+void MailViewerSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode,
+ const QList<MimeTreeParser::Util::HtmlMode> &availableModes)
{
mViewer->mColorBar->setAvailableModes(availableModes);
mViewer->mColorBar->setMode(mode);
@@ -65,7 +67,8 @@ MimeTreeParser::Util::HtmlMode MailViewerSource::preferredMode() const
switch (mViewer->displayFormatMessageOverwrite()) {
case MessageViewer::Viewer::UseGlobalSetting:
case MessageViewer::Viewer::Unknown:
- return mViewer->htmlMailGlobalSetting() ? MimeTreeParser::Util::Html : MimeTreeParser::Util::Normal;
+ return mViewer->htmlMailGlobalSetting() ? MimeTreeParser::Util::Html : MimeTreeParser::Util
+ ::Normal;
case MessageViewer::Viewer::Html:
return MimeTreeParser::Util::MultipartHtml;
case MessageViewer::Viewer::Text:
@@ -127,7 +130,10 @@ bool MailViewerSource::isPrinting() const
return mViewer->mPrinting;
}
-MimeTreeParser::Interface::MessagePartRendererPtr MailViewerSource::messagePartTheme(MimeTreeParser::Interface::MessagePart::Ptr msgPart)
+MimeTreeParser::Interface::MessagePartRendererPtr MailViewerSource::messagePartTheme(
+ MimeTreeParser::Interface::MessagePart::Ptr msgPart)
{
- return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart, mViewer->cssHelper()));
+ return MimeTreeParser::Interface::MessagePartRenderer::Ptr(new DefaultRenderer(msgPart,
+ mViewer->
+ cssHelper()));
}
diff --git a/messageviewer/src/viewer/objecttreeviewersource.h b/messageviewer/src/viewer/objecttreeviewersource.h
index 4b9dbec..ea0bfa0 100644
--- a/messageviewer/src/viewer/objecttreeviewersource.h
+++ b/messageviewer/src/viewer/objecttreeviewersource.h
@@ -24,9 +24,7 @@
class QString;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
class ViewerPrivate;
/** An ObjectTreeParser source working on a MailViewer object */
@@ -38,7 +36,8 @@ public:
bool decryptMessage() const override;
bool htmlLoadExternal() const override;
bool showSignatureDetails() const override;
- void setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override;
+ void setHtmlMode(MimeTreeParser::Util::HtmlMode mode,
+ const QList<MimeTreeParser::Util::HtmlMode> &availableModes) override;
MimeTreeParser::Util::HtmlMode preferredMode() const override;
int levelQuote() const override;
const QTextCodec *overrideCodec() override;
@@ -50,13 +49,12 @@ public:
bool showEmoticons() const override;
bool showExpandQuotesMark() const override;
const MimeTreeParser::BodyPartFormatterBaseFactory *bodyPartFormatterFactory() override;
- MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(MimeTreeParser::Interface::MessagePartPtr msgPart) override;
- bool isPrinting() const override;
+ MimeTreeParser::Interface::MessagePartRendererPtr messagePartTheme(
+ MimeTreeParser::Interface::MessagePartPtr msgPart) override;
+ bool isPrinting() const override;
private:
ViewerPrivate *mViewer;
};
-
}
#endif
-
diff --git a/messageviewer/src/viewer/pluginloader.h b/messageviewer/src/viewer/pluginloader.h
index 95cd038..0dd4a0e 100644
--- a/messageviewer/src/viewer/pluginloader.h
+++ b/messageviewer/src/viewer/pluginloader.h
@@ -77,7 +77,9 @@ template< typename T, typename T_config >
class PluginLoader : public PluginLoaderBase
{
protected:
- PluginLoader() : PluginLoaderBase() {}
+ PluginLoader() : PluginLoaderBase()
+ {
+ }
private:
static PluginLoader<T, T_config> *mSelf;
@@ -101,7 +103,8 @@ public:
/** Rescans the plugin directory to find any newly installed
plugins.
**/
- void scan() override {
+ void scan() override
+ {
doScan(T_config::path);
}
@@ -124,15 +127,15 @@ public:
template< typename T, typename T_config >
PluginLoader<T, T_config> *PluginLoader<T, T_config>::mSelf = nullptr;
-#define DEFINE_PLUGIN_LOADER( pl, t, mf, p ) \
+#define DEFINE_PLUGIN_LOADER(pl, t, mf, p) \
namespace { /* don't pollute namespaces */ \
- struct Q_DECL_EXPORT pl##Config { \
- static const char * const mainfunc; \
- static const char * const path; \
+ struct Q_DECL_EXPORT pl ## Config { \
+ static const char *const mainfunc; \
+ static const char *const path; \
}; \
- const char * const pl##Config::mainfunc = mf; \
- const char * const pl##Config::path = p; \
+ const char *const pl ## Config::mainfunc = mf; \
+ const char *const pl ## Config::path = p; \
} \
- typedef PluginLoader< t, pl##Config > pl; \
+ typedef PluginLoader< t, pl ## Config > pl; \
#endif // PLUGINLOADER_H
diff --git a/messageviewer/src/viewer/pluginloaderbase.cpp b/messageviewer/src/viewer/pluginloaderbase.cpp
index 6fb210c..6f5dedd 100644
--- a/messageviewer/src/viewer/pluginloaderbase.cpp
+++ b/messageviewer/src/viewer/pluginloaderbase.cpp
@@ -30,15 +30,21 @@
#include <QDir>
#include <QStringList>
-PluginLoaderBase::PluginLoaderBase() : d(nullptr) {}
-PluginLoaderBase::~PluginLoaderBase() {}
+PluginLoaderBase::PluginLoaderBase() : d(nullptr)
+{
+}
+
+PluginLoaderBase::~PluginLoaderBase()
+{
+}
QStringList PluginLoaderBase::types() const
{
QStringList result;
result.reserve(mPluginMap.count());
QMap< QString, PluginMetaData >::const_iterator end(mPluginMap.constEnd());
- for (QMap< QString, PluginMetaData >::const_iterator it = mPluginMap.constBegin(); it != end; ++it) {
+ for (QMap< QString, PluginMetaData >::const_iterator it = mPluginMap.constBegin(); it != end;
+ ++it) {
result.push_back(it.key());
}
return result;
@@ -46,14 +52,16 @@ QStringList PluginLoaderBase::types() const
const PluginMetaData *PluginLoaderBase::infoForName(const QString &type) const
{
- return mPluginMap.contains(type) ? &(const_cast<PluginLoaderBase *>(this)->mPluginMap[type]) : nullptr;
+ return mPluginMap.contains(type) ? &(const_cast<PluginLoaderBase *>(this)->mPluginMap[type]) :
+ nullptr;
}
void PluginLoaderBase::doScan(const char *path)
{
mPluginMap.clear();
- const QStringList list = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1(path), QStandardPaths::LocateDirectory);
+ const QStringList list = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, QString::fromLatin1(
+ path), QStandardPaths::LocateDirectory);
for (const QString &folder : list) {
doScanOneFolder(folder);
}
@@ -62,7 +70,8 @@ void PluginLoaderBase::doScan(const char *path)
void PluginLoaderBase::doScanOneFolder(const QString &folder)
{
QDir dir(folder);
- const auto list = dir.entryList(QStringList() << QStringLiteral("*.desktop"), QDir::Files | QDir::Readable);
+ const auto list = dir.entryList(QStringList() << QStringLiteral(
+ "*.desktop"), QDir::Files | QDir::Readable);
for (QStringList::const_iterator it = list.constBegin(); it != list.constEnd(); ++it) {
const QString fileName = folder + QLatin1Char('/') + *it;
KConfig config(fileName, KConfig::SimpleConfig);
@@ -71,13 +80,16 @@ void PluginLoaderBase::doScanOneFolder(const QString &folder)
const QString type = group.readEntry("Type").toLower();
if (type.isEmpty()) {
- qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Plugin]Type value in \"" << *it << "\" - skipping";
+ qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Plugin]Type value in \""
+ << *it << "\" - skipping";
continue;
}
const QString library = group.readEntry("X-KDE-Library");
if (library.isEmpty()) {
- qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Plugin]X-KDE-Library value in \"" << *it << "\" - skipping";
+ qCWarning(MESSAGEVIEWER_LOG)
+ << "missing or empty [Plugin]X-KDE-Library value in \"" << *it
+ << "\" - skipping";
continue;
}
@@ -85,19 +97,23 @@ void PluginLoaderBase::doScanOneFolder(const QString &folder)
QString name = group2.readEntry("Name");
if (name.isEmpty()) {
- qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Misc]Name value in \"" << *it << "\" - inserting default name";
+ qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Misc]Name value in \"" << *it
+ << "\" - inserting default name";
name = i18n("Unnamed plugin");
}
QString comment = group2.readEntry("Comment");
if (comment.isEmpty()) {
- qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Misc]Comment value in \"" << *it << "\" - inserting default name";
+ qCWarning(MESSAGEVIEWER_LOG) << "missing or empty [Misc]Comment value in \""
+ << *it << "\" - inserting default name";
comment = i18n("No description available");
}
mPluginMap.insert(type, PluginMetaData(library, name, comment));
} else {
- qCWarning(MESSAGEVIEWER_LOG) << "Desktop file \"" << *it << "\" doesn't seem to describe a plugin " << "(misses Misc and/or Plugin group)";
+ qCWarning(MESSAGEVIEWER_LOG) << "Desktop file \"" << *it
+ << "\" doesn't seem to describe a plugin "
+ << "(misses Misc and/or Plugin group)";
}
}
}
@@ -125,7 +141,9 @@ QFunctionPointer PluginLoaderBase::mainFunc(const QString &type, const char *mf_
const QString factory_name = libName + QLatin1Char('_') + QString::fromLatin1(mf_name);
auto sym = const_cast<QLibrary *>(lib)->resolve(factory_name.toLatin1().constData());
if (!sym) {
- qCWarning(MESSAGEVIEWER_LOG) << "No symbol named \"" << factory_name.toLatin1() << "\" (" << factory_name << ") was found in library \"" << libName << "\"";
+ qCWarning(MESSAGEVIEWER_LOG) << "No symbol named \"" << factory_name.toLatin1() << "\" ("
+ << factory_name << ") was found in library \"" << libName
+ << "\"";
return nullptr;
}
@@ -136,7 +154,8 @@ const QLibrary *PluginLoaderBase::openLibrary(const QString &libName) const
{
auto library = new QLibrary(KPluginLoader::findPlugin(libName));
if (library->fileName().isEmpty() || !library->load()) {
- qCWarning(MESSAGEVIEWER_LOG) << "Could not load plugin library" << libName << "error:" << library->errorString() << library->fileName();
+ qCWarning(MESSAGEVIEWER_LOG) << "Could not load plugin library" << libName << "error:"
+ << library->errorString() << library->fileName();
delete library;
return nullptr;
}
diff --git a/messageviewer/src/viewer/pluginloaderbase.h b/messageviewer/src/viewer/pluginloaderbase.h
index 47e905e..985d27c 100644
--- a/messageviewer/src/viewer/pluginloaderbase.h
+++ b/messageviewer/src/viewer/pluginloaderbase.h
@@ -31,11 +31,18 @@ class QStringList;
class PluginMetaData
{
public:
- PluginMetaData() : loaded(false) {}
- PluginMetaData(const QString &lib, const QString &name,
- const QString &comment)
- : library(lib), nameLabel(name),
- descriptionLabel(comment), loaded(false) {}
+ PluginMetaData() : loaded(false)
+ {
+ }
+
+ PluginMetaData(const QString &lib, const QString &name, const QString &comment)
+ : library(lib)
+ , nameLabel(name)
+ , descriptionLabel(comment)
+ , loaded(false)
+ {
+ }
+
QString library;
QString nameLabel;
QString descriptionLabel;
diff --git a/messageviewer/src/viewer/stl_util.h b/messageviewer/src/viewer/stl_util.h
index 6a59657..14e70dd 100644
--- a/messageviewer/src/viewer/stl_util.h
+++ b/messageviewer/src/viewer/stl_util.h
@@ -32,18 +32,15 @@
#ifndef __KDEPIM__MESSAGEVIEWER__STL_UTIL_H__
#define __KDEPIM__MESSAGEVIEWER__STL_UTIL_H__
-namespace MessageViewer
-{
-
-template <typename T>
+namespace MessageViewer {
+template<typename T>
struct DeleteAndSetToZero {
- void operator()(const T *&t)
+ void operator()(const T * &t)
{
delete t;
t = nullptr;
}
};
-
}
#endif // __KDEPIM__MESSAGEVIEWER__STL_UTIL_H__
diff --git a/messageviewer/src/viewer/urlhandlermanager.cpp b/messageviewer/src/viewer/urlhandlermanager.cpp
index ba45d0c..f36c8e0 100644
--- a/messageviewer/src/viewer/urlhandlermanager.cpp
+++ b/messageviewer/src/viewer/urlhandlermanager.cpp
@@ -1,4 +1,3 @@
-
/* -*- c++ -*-
urlhandlermanager.cpp
@@ -83,13 +82,17 @@ using namespace MessageCore;
URLHandlerManager *URLHandlerManager::self = nullptr;
-namespace
-{
+namespace {
class KMailActionURLHandler : public MimeTreeParser::URLHandler
{
public:
- KMailActionURLHandler() : MimeTreeParser::URLHandler() {}
- ~KMailActionURLHandler() {}
+ KMailActionURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~KMailActionURLHandler()
+ {
+ }
bool handleClick(const QUrl &url, ViewerPrivate *viewer) const override
{
@@ -122,10 +125,12 @@ public:
}
return false;
}
+
bool handleContextMenuRequest(const QUrl &url, const QPoint &, ViewerPrivate *) const override
{
return url.scheme() == QLatin1String("kmailaction");
}
+
QString statusBarMessage(const QUrl &url, ViewerPrivate *) const override
{
if (url.scheme() == QLatin1String("kmailaction")) {
@@ -155,22 +160,33 @@ public:
class KMailProtocolURLHandler : public MimeTreeParser::URLHandler
{
public:
- KMailProtocolURLHandler() : MimeTreeParser::URLHandler() {}
- ~KMailProtocolURLHandler() {}
+ KMailProtocolURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~KMailProtocolURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &url, const QPoint &, ViewerPrivate *) const override
{
return url.scheme() == QLatin1String("kmail");
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override;
};
class ExpandCollapseQuoteURLManager : public MimeTreeParser::URLHandler
{
public:
- ExpandCollapseQuoteURLManager() : MimeTreeParser::URLHandler() {}
- ~ExpandCollapseQuoteURLManager() {}
+ ExpandCollapseQuoteURLManager() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~ExpandCollapseQuoteURLManager()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleDrag(const QUrl &url, ViewerPrivate *window) const override;
@@ -178,46 +194,64 @@ public:
{
return false;
}
- QString statusBarMessage(const QUrl &, ViewerPrivate *) const override;
+ QString statusBarMessage(const QUrl &, ViewerPrivate *) const override;
};
class SMimeURLHandler : public MimeTreeParser::URLHandler
{
public:
- SMimeURLHandler() : MimeTreeParser::URLHandler() {}
- ~SMimeURLHandler() {}
+ SMimeURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~SMimeURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override;
};
class MailToURLHandler : public MimeTreeParser::URLHandler
{
public:
- MailToURLHandler() : MimeTreeParser::URLHandler() {}
- ~MailToURLHandler() {}
+ MailToURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~MailToURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override
{
return false;
}
+
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override;
};
class ContactUidURLHandler : public MimeTreeParser::URLHandler
{
public:
- ContactUidURLHandler() : MimeTreeParser::URLHandler() {}
- ~ContactUidURLHandler() {}
+ ContactUidURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~ContactUidURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *) const override;
@@ -227,14 +261,20 @@ public:
class HtmlAnchorHandler : public MimeTreeParser::URLHandler
{
public:
- HtmlAnchorHandler() : MimeTreeParser::URLHandler() {}
- ~HtmlAnchorHandler() {}
+ HtmlAnchorHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~HtmlAnchorHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override
{
return QString();
@@ -244,8 +284,13 @@ public:
class AttachmentURLHandler : public MimeTreeParser::URLHandler
{
public:
- AttachmentURLHandler() : MimeTreeParser::URLHandler() {}
- ~AttachmentURLHandler() {}
+ AttachmentURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~AttachmentURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleShiftClick(const QUrl &, ViewerPrivate *window) const override;
@@ -261,8 +306,13 @@ private:
class ShowAuditLogURLHandler : public MimeTreeParser::URLHandler
{
public:
- ShowAuditLogURLHandler() : MimeTreeParser::URLHandler() {}
- ~ShowAuditLogURLHandler() {}
+ ShowAuditLogURLHandler() : MimeTreeParser::URLHandler()
+ {
+ }
+
+ ~ShowAuditLogURLHandler()
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override;
@@ -276,19 +326,25 @@ class InternalImageURLHandler : public MimeTreeParser::URLHandler
{
public:
InternalImageURLHandler() : MimeTreeParser::URLHandler()
- {}
+ {
+ }
+
~InternalImageURLHandler()
- {}
+ {
+ }
+
bool handleDrag(const QUrl &url, ViewerPrivate *window) const override;
bool willHandleDrag(const QUrl &url, ViewerPrivate *window) const override;
bool handleClick(const QUrl &, ViewerPrivate *) const override
{
return false;
}
+
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override
{
return QString();
@@ -299,19 +355,25 @@ class EmbeddedImageURLHandler : public MimeTreeParser::URLHandler
{
public:
EmbeddedImageURLHandler() : MimeTreeParser::URLHandler()
- {}
+ {
+ }
+
~EmbeddedImageURLHandler()
- {}
+ {
+ }
+
bool handleDrag(const QUrl &url, ViewerPrivate *window) const override;
bool willHandleDrag(const QUrl &url, ViewerPrivate *window) const override;
bool handleClick(const QUrl &, ViewerPrivate *) const override
{
return false;
}
+
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &url, ViewerPrivate *) const override
{
Q_UNUSED(url);
@@ -323,21 +385,24 @@ class KRunURLHandler : public MimeTreeParser::URLHandler
{
public:
KRunURLHandler() : MimeTreeParser::URLHandler()
- {}
+ {
+ }
+
~KRunURLHandler()
- {}
+ {
+ }
bool handleClick(const QUrl &, ViewerPrivate *) const override;
bool handleContextMenuRequest(const QUrl &, const QPoint &, ViewerPrivate *) const override
{
return false;
}
+
QString statusBarMessage(const QUrl &, ViewerPrivate *) const override
{
return QString();
}
};
-
} // anon namespace
//
@@ -349,7 +414,10 @@ public:
class URLHandlerManager::BodyPartURLHandlerManager : public MimeTreeParser::URLHandler
{
public:
- BodyPartURLHandlerManager() : MimeTreeParser::URLHandler() {}
+ BodyPartURLHandlerManager() : MimeTreeParser::URLHandler()
+ {
+ }
+
~BodyPartURLHandlerManager();
bool handleClick(const QUrl &, ViewerPrivate *) const override;
@@ -370,7 +438,8 @@ URLHandlerManager::BodyPartURLHandlerManager::~BodyPartURLHandlerManager()
DeleteAndSetToZero<MimeTreeParser::Interface::BodyPartURLHandler>());
}
-void URLHandlerManager::BodyPartURLHandlerManager::registerHandler(const MimeTreeParser::Interface::BodyPartURLHandler *handler)
+void URLHandlerManager::BodyPartURLHandlerManager::registerHandler(
+ const MimeTreeParser::Interface::BodyPartURLHandler *handler)
{
if (!handler) {
return;
@@ -379,7 +448,8 @@ void URLHandlerManager::BodyPartURLHandlerManager::registerHandler(const MimeTre
mHandlers.push_back(handler);
}
-void URLHandlerManager::BodyPartURLHandlerManager::unregisterHandler(const MimeTreeParser::Interface::BodyPartURLHandler *handler)
+void URLHandlerManager::BodyPartURLHandlerManager::unregisterHandler(
+ const MimeTreeParser::Interface::BodyPartURLHandler *handler)
{
// don't delete them, only remove them from the list!
mHandlers.erase(remove(mHandlers.begin(), mHandlers.end(), handler), mHandlers.end());
@@ -410,7 +480,8 @@ static KMime::Content *partNodeFromXKMailUrl(const QUrl &url, ViewerPrivate *w,
return w->nodeFromUrl(QUrl(urlParts.at(1)));
}
-bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url, ViewerPrivate *w) const
+bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url,
+ ViewerPrivate *w) const
{
QString path;
KMime::Content *node = partNodeFromXKMailUrl(url, w, &path);
@@ -418,7 +489,8 @@ bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url,
return false;
}
- MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr, w->message().data(), node, w->nodeHelper());
+ MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr,
+ w->message().data(), node, w->nodeHelper());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
@@ -430,7 +502,9 @@ bool URLHandlerManager::BodyPartURLHandlerManager::handleClick(const QUrl &url,
return false;
}
-bool URLHandlerManager::BodyPartURLHandlerManager::handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w) const
+bool URLHandlerManager::BodyPartURLHandlerManager::handleContextMenuRequest(const QUrl &url,
+ const QPoint &p,
+ ViewerPrivate *w) const
{
QString path;
KMime::Content *node = partNodeFromXKMailUrl(url, w, &path);
@@ -438,16 +512,19 @@ bool URLHandlerManager::BodyPartURLHandlerManager::handleContextMenuRequest(cons
return false;
}
- MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr, w->message().data(), node, w->nodeHelper());
+ MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr,
+ w->message().data(), node, w->nodeHelper());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
- for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->handleContextMenuRequest(&part, path, p)) {
return true;
}
+ }
return false;
}
-QString URLHandlerManager::BodyPartURLHandlerManager::statusBarMessage(const QUrl &url, ViewerPrivate *w) const
+QString URLHandlerManager::BodyPartURLHandlerManager::statusBarMessage(const QUrl &url,
+ ViewerPrivate *w) const
{
QString path;
KMime::Content *node = partNodeFromXKMailUrl(url, w, &path);
@@ -455,7 +532,8 @@ QString URLHandlerManager::BodyPartURLHandlerManager::statusBarMessage(const QUr
return QString();
}
- MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr, w->message().data(), node, w->nodeHelper());
+ MimeTreeParser::PartNodeBodyPart part(nullptr, nullptr,
+ w->message().data(), node, w->nodeHelper());
BodyPartHandlerList::const_iterator end(mHandlers.constEnd());
for (BodyPartHandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
const QString msg = (*it)->statusBarMessage(&part, path);
@@ -525,7 +603,8 @@ void URLHandlerManager::registerHandler(const MimeTreeParser::Interface::BodyPar
}
}
-void URLHandlerManager::unregisterHandler(const MimeTreeParser::Interface::BodyPartURLHandler *handler)
+void URLHandlerManager::unregisterHandler(
+ const MimeTreeParser::Interface::BodyPartURLHandler *handler)
{
if (mBodyPartURLHandlerManager) {
mBodyPartURLHandlerManager->unregisterHandler(handler);
@@ -535,20 +614,22 @@ void URLHandlerManager::unregisterHandler(const MimeTreeParser::Interface::BodyP
bool URLHandlerManager::handleClick(const QUrl &url, ViewerPrivate *w) const
{
HandlerList::const_iterator end(mHandlers.constEnd());
- for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->handleClick(url, w)) {
return true;
}
+ }
return false;
}
bool URLHandlerManager::handleShiftClick(const QUrl &url, ViewerPrivate *window) const
{
HandlerList::const_iterator end(mHandlers.constEnd());
- for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->handleShiftClick(url, window)) {
return true;
}
+ }
return false;
}
@@ -556,31 +637,34 @@ bool URLHandlerManager::willHandleDrag(const QUrl &url, ViewerPrivate *window) c
{
HandlerList::const_iterator end(mHandlers.constEnd());
- for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->willHandleDrag(url, window)) {
return true;
}
+ }
return false;
}
bool URLHandlerManager::handleDrag(const QUrl &url, ViewerPrivate *window) const
{
HandlerList::const_iterator end(mHandlers.constEnd());
- for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->handleDrag(url, window)) {
return true;
}
+ }
return false;
}
-bool URLHandlerManager::handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w) const
+bool URLHandlerManager::handleContextMenuRequest(const QUrl &url, const QPoint &p,
+ ViewerPrivate *w) const
{
-
HandlerList::const_iterator end(mHandlers.constEnd());
- for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it)
+ for (HandlerList::const_iterator it = mHandlers.constBegin(); it != end; ++it) {
if ((*it)->handleContextMenuRequest(url, p, w)) {
return true;
}
+ }
return false;
}
@@ -602,8 +686,7 @@ QString URLHandlerManager::statusBarMessage(const QUrl &url, ViewerPrivate *w) c
//
//
-namespace
-{
+namespace {
bool KMailProtocolURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
{
if (url.scheme() == QLatin1String("kmail")) {
@@ -700,9 +783,7 @@ QString KMailProtocolURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate
}
}
-namespace
-{
-
+namespace {
bool ExpandCollapseQuoteURLManager::handleClick(const QUrl &url, ViewerPrivate *w) const
{
// kmail:levelquote/?num -> the level quote to collapse.
@@ -740,13 +821,9 @@ QString ExpandCollapseQuoteURLManager::statusBarMessage(const QUrl &url, ViewerP
}
return QString();
}
-
}
-bool foundSMIMEData(const QString &aUrl,
- QString &displayName,
- QString &libName,
- QString &keyId)
+bool foundSMIMEData(const QString &aUrl, QString &displayName, QString &libName, QString &keyId)
{
static QString showCertMan(QStringLiteral("showCertificate#"));
displayName.clear();
@@ -783,16 +860,15 @@ bool foundSMIMEData(const QString &aUrl,
return !keyId.isEmpty();
}
-namespace
-{
+namespace {
bool SMimeURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
{
if (!url.hasFragment()) {
return false;
}
QString displayName, libName, keyId;
- if (!foundSMIMEData(url.path() + QLatin1Char('#') +
- QUrl::fromPercentEncoding(url.fragment().toLatin1()),
+ if (!foundSMIMEData(url.path() + QLatin1Char('#')
+ +QUrl::fromPercentEncoding(url.fragment().toLatin1()),
displayName, libName, keyId)) {
return false;
}
@@ -800,18 +876,19 @@ bool SMimeURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
lst << QStringLiteral("--parent-windowid")
<< QString::number((qlonglong)w->viewer()->mainWindow()->winId())
<< QStringLiteral("--query") << keyId;
- if (!QProcess::startDetached(QStringLiteral("kleopatra"), lst))
+ if (!QProcess::startDetached(QStringLiteral("kleopatra"), lst)) {
KMessageBox::error(w->mMainWindow, i18n("Could not start certificate manager. "
"Please check your installation."),
i18n("KMail Error"));
+ }
return true;
}
QString SMimeURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *) const
{
QString displayName, libName, keyId;
- if (!foundSMIMEData(url.path() + QLatin1Char('#') +
- QUrl::fromPercentEncoding(url.fragment().toLatin1()),
+ if (!foundSMIMEData(url.path() + QLatin1Char('#')
+ +QUrl::fromPercentEncoding(url.fragment().toLatin1()),
displayName, libName, keyId)) {
return QString();
}
@@ -819,8 +896,7 @@ QString SMimeURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *) cons
}
}
-namespace
-{
+namespace {
bool HtmlAnchorHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
{
if (!url.host().isEmpty() || !url.hasFragment()) {
@@ -832,8 +908,7 @@ bool HtmlAnchorHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
}
}
-namespace
-{
+namespace {
QString MailToURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *) const
{
if (url.scheme() == QLatin1String("mailto")) {
@@ -843,14 +918,14 @@ QString MailToURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *) con
}
}
-namespace
-{
+namespace {
static QString searchFullEmailByUid(const QString &uid)
{
QString fullEmail;
Akonadi::ContactSearchJob *job = new Akonadi::ContactSearchJob();
job->setLimit(1);
- job->setQuery(Akonadi::ContactSearchJob::ContactUid, uid, Akonadi::ContactSearchJob::ExactMatch);
+ job->setQuery(Akonadi::ContactSearchJob::ContactUid, uid,
+ Akonadi::ContactSearchJob::ExactMatch);
job->exec();
const KContacts::Addressee::List res = job->contacts();
if (!res.isEmpty()) {
@@ -877,18 +952,20 @@ bool ContactUidURLHandler::handleClick(const QUrl &url, ViewerPrivate *) const
}
bool ContactUidURLHandler::handleContextMenuRequest(const QUrl &url, const QPoint &p,
- ViewerPrivate *) const
+ ViewerPrivate *) const
{
if (url.scheme() != QLatin1String("uid") || url.path().isEmpty()) {
return false;
}
QMenu *menu = new QMenu();
- QAction *open =
- menu->addAction(QIcon::fromTheme(QStringLiteral("view-pim-contacts")), i18n("&Open in Address Book"));
+ QAction *open
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("view-pim-contacts")),
+ i18n("&Open in Address Book"));
#ifndef QT_NO_CLIPBOARD
- QAction *copy =
- menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")), i18n("&Copy Email Address"));
+ QAction *copy
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-copy")),
+ i18n("&Copy Email Address"));
#endif
QAction *a = menu->exec(p);
@@ -920,8 +997,7 @@ QString ContactUidURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *)
}
}
-namespace
-{
+namespace {
KMime::Content *AttachmentURLHandler::nodeForUrl(const QUrl &url, ViewerPrivate *w) const
{
if (!w || !w->mMessage) {
@@ -1003,7 +1079,9 @@ bool AttachmentURLHandler::handleDrag(const QUrl &url, ViewerPrivate *window) co
const QString fileName = tUrl.path();
if (!fileName.isEmpty()) {
QFile f(fileName);
- f.setPermissions(QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup | QFile::ReadOther);
+ f.setPermissions(
+ QFile::ReadOwner | QFile::WriteOwner | QFile::ReadUser | QFile::ReadGroup
+ | QFile::ReadOther);
const QString icon = Util::iconPathForContent(node, KIconLoader::Small);
QDrag *drag = new QDrag(window->viewer());
QMimeData *mimeData = new QMimeData();
@@ -1016,10 +1094,11 @@ bool AttachmentURLHandler::handleDrag(const QUrl &url, ViewerPrivate *window) co
return true;
} else
#endif
- return false;
+ return false;
}
-bool AttachmentURLHandler::handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w) const
+bool AttachmentURLHandler::handleContextMenuRequest(const QUrl &url, const QPoint &p,
+ ViewerPrivate *w) const
{
KMime::Content *node = nodeForUrl(url, w);
if (!node) {
@@ -1051,12 +1130,11 @@ QString AttachmentURLHandler::statusBarMessage(const QUrl &url, ViewerPrivate *w
}
}
-namespace
-{
+namespace {
static QString extractAuditLog(const QUrl &url)
{
if (url.scheme() != QLatin1String("kmail")
- || url.path() != QLatin1String("showAuditLog")) {
+ || url.path() != QLatin1String("showAuditLog")) {
return QString();
}
QUrlQuery query(url);
@@ -1074,7 +1152,8 @@ bool ShowAuditLogURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) cons
return true;
}
-bool ShowAuditLogURLHandler::handleContextMenuRequest(const QUrl &url, const QPoint &, ViewerPrivate *w) const
+bool ShowAuditLogURLHandler::handleContextMenuRequest(const QUrl &url, const QPoint &,
+ ViewerPrivate *w) const
{
Q_UNUSED(w);
// disable RMB for my own links:
@@ -1096,11 +1175,9 @@ bool ShowAuditLogURLHandler::handleDrag(const QUrl &url, ViewerPrivate *window)
Q_UNUSED(window);
return true;
}
-
}
-namespace
-{
+namespace {
bool InternalImageURLHandler::handleDrag(const QUrl &url, ViewerPrivate *window) const
{
Q_UNUSED(window);
@@ -1118,33 +1195,38 @@ bool InternalImageURLHandler::willHandleDrag(const QUrl &url, ViewerPrivate *win
return true;
}
- const QString imagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("libmessageviewer/pics/"), QStandardPaths::LocateDirectory);
+ const QString imagePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(
+ "libmessageviewer/pics/"),
+ QStandardPaths::LocateDirectory);
return url.path().contains(imagePath);
}
}
-namespace
-{
+namespace {
bool KRunURLHandler::handleClick(const QUrl &url, ViewerPrivate *w) const
{
const QString scheme(url.scheme());
- if ((scheme == QLatin1String("http")) || (scheme == QLatin1String("https")) ||
- (scheme == QLatin1String("ftp")) || (scheme == QLatin1String("file")) ||
- (scheme == QLatin1String("ftps")) || (scheme == QLatin1String("sftp")) ||
- (scheme == QLatin1String("help")) || (scheme == QLatin1String("vnc")) ||
- (scheme == QLatin1String("smb")) || (scheme == QLatin1String("fish")) ||
- (scheme == QLatin1String("news"))) {
+ if ((scheme == QLatin1String("http")) || (scheme == QLatin1String("https"))
+ || (scheme == QLatin1String("ftp")) || (scheme == QLatin1String("file"))
+ || (scheme == QLatin1String("ftps")) || (scheme == QLatin1String("sftp"))
+ || (scheme == QLatin1String("help")) || (scheme == QLatin1String("vnc"))
+ || (scheme == QLatin1String("smb")) || (scheme == QLatin1String("fish"))
+ || (scheme == QLatin1String("news"))) {
KPIM::BroadcastStatus::instance()->setTransientStatusMsg(i18n("Opening URL..."));
QTimer::singleShot(2000, KPIM::BroadcastStatus::instance(), &KPIM::BroadcastStatus::reset);
QMimeDatabase mimeDb;
auto mime = mimeDb.mimeTypeForUrl(url);
- if (mime.name() == QLatin1String("application/x-desktop") ||
- mime.name() == QLatin1String("application/x-executable") ||
- mime.name() == QLatin1String("application/x-ms-dos-executable") ||
- mime.name() == QLatin1String("application/x-shellscript")) {
- if (KMessageBox::warningYesNo(nullptr, xi18nc("@info", "Do you really want to execute <filename>%1</filename>?",
- url.toDisplayString(QUrl::PreferLocalFile)), QString(), KGuiItem(i18n("Execute")), KStandardGuiItem::cancel()) != KMessageBox::Yes) {
+ if (mime.name() == QLatin1String("application/x-desktop")
+ || mime.name() == QLatin1String("application/x-executable")
+ || mime.name() == QLatin1String("application/x-ms-dos-executable")
+ || mime.name() == QLatin1String("application/x-shellscript")) {
+ if (KMessageBox::warningYesNo(nullptr,
+ xi18nc("@info",
+ "Do you really want to execute <filename>%1</filename>?",
+ url.toDisplayString(QUrl::PreferLocalFile)),
+ QString(), KGuiItem(i18n("Execute")),
+ KStandardGuiItem::cancel()) != KMessageBox::Yes) {
return true;
}
}
diff --git a/messageviewer/src/viewer/urlhandlermanager.h b/messageviewer/src/viewer/urlhandlermanager.h
index 9918659..7122b06 100644
--- a/messageviewer/src/viewer/urlhandlermanager.h
+++ b/messageviewer/src/viewer/urlhandlermanager.h
@@ -40,23 +40,18 @@ class QUrl;
class QString;
class QPoint;
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPrivate;
}
-namespace MimeTreeParser
-{
-namespace Interface
-{
+namespace MimeTreeParser {
+namespace Interface {
class BodyPartURLHandler;
}
class URLHandler;
}
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* @short Singleton to manage the list of URLHandlers
* @author Marc Mutz <[email protected]>
@@ -79,7 +74,8 @@ public:
bool handleClick(const QUrl &url, ViewerPrivate *w = nullptr) const;
bool handleShiftClick(const QUrl &url, ViewerPrivate *window = nullptr) const;
- bool handleContextMenuRequest(const QUrl &url, const QPoint &p, ViewerPrivate *w = nullptr) const;
+ bool handleContextMenuRequest(const QUrl &url, const QPoint &p,
+ ViewerPrivate *w = nullptr) const;
bool willHandleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
bool handleDrag(const QUrl &url, ViewerPrivate *window = nullptr) const;
QString statusBarMessage(const QUrl &url, ViewerPrivate *w = nullptr) const;
@@ -93,4 +89,3 @@ private:
}
#endif // __MESSAGEVIEWER_URLHANDLERMANAGER_H__
-
diff --git a/messageviewer/src/viewer/viewer.cpp b/messageviewer/src/viewer/viewer.cpp
index 3b1061e..e4f7e72 100644
--- a/messageviewer/src/viewer/viewer.cpp
+++ b/messageviewer/src/viewer/viewer.cpp
@@ -47,11 +47,10 @@
#include <QAction>
-namespace MessageViewer
-{
-
+namespace MessageViewer {
Viewer::Viewer(QWidget *aParent, QWidget *mainWindow, KActionCollection *actionCollection)
- : QWidget(aParent), d_ptr(new ViewerPrivate(this, mainWindow, actionCollection))
+ : QWidget(aParent)
+ , d_ptr(new ViewerPrivate(this, mainWindow, actionCollection))
{
initialize();
}
@@ -118,7 +117,7 @@ void Viewer::setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMod
d->setMessageItem(item, updateMode);
} else {
Akonadi::ItemFetchJob *job = createFetchJob(item);
- connect(job, SIGNAL(result(KJob*)), d, SLOT(itemFetchResult(KJob*)));
+ connect(job, SIGNAL(result(KJob *)), d, SLOT(itemFetchResult(KJob *)));
d->displaySplashPage(i18n("Loading message..."));
}
}
@@ -135,7 +134,8 @@ void Viewer::setMessagePath(const QString &path)
d->mMessagePath = path;
}
-void Viewer::displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain)
+void Viewer::displaySplashPage(const QString &templateName, const QVariantHash &data,
+ const QByteArray &domain)
{
Q_D(Viewer);
d->displaySplashPage(templateName, data, domain);
@@ -290,8 +290,8 @@ bool Viewer::isFixedFont() const
{
Q_D(const Viewer);
return d->mUseFixedFont;
-
}
+
void Viewer::setUseFixedFont(bool useFixedFont)
{
Q_D(Viewer);
@@ -363,7 +363,6 @@ void Viewer::setOverrideEncoding(const QString &encoding)
{
Q_D(Viewer);
d->setOverrideEncoding(encoding);
-
}
CSSHelper *Viewer::cssHelper() const
@@ -644,7 +643,8 @@ QList<QAction *> Viewer::viewerPluginActionList(ViewerPluginInterface::SpecificF
return d->viewerPluginActionList(features);
}
-QList<QAction *> Viewer::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const
+QList<QAction *> Viewer::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result)
+const
{
Q_D(const Viewer);
return d->interceptorUrlActions(result);
@@ -662,4 +662,3 @@ void Viewer::setPrintElementBackground(bool printElementBackground)
d->mViewer->setPrintElementBackground(printElementBackground);
}
}
-
diff --git a/messageviewer/src/viewer/viewer.h b/messageviewer/src/viewer/viewer.h
index 62d939b..69d6096 100644
--- a/messageviewer/src/viewer/viewer.h
+++ b/messageviewer/src/viewer/viewer.h
@@ -31,14 +31,12 @@
#include <QWidget>
-namespace Akonadi
-{
+namespace Akonadi {
class Item;
class ItemFetchJob;
}
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class AttachmentStrategy;
}
@@ -52,13 +50,11 @@ class QCloseEvent;
class QEvent;
class QResizeEvent;
-namespace WebEngineViewer
-{
+namespace WebEngineViewer {
class WebHitTestResult;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class WebHitTestResult;
class HeaderStylePlugin;
@@ -73,7 +69,9 @@ class AbstractMessageLoadedHandler
{
public:
- virtual ~AbstractMessageLoadedHandler() {}
+ virtual ~AbstractMessageLoadedHandler()
+ {
+ }
/**
* This method is called whenever a message item has been loaded
@@ -91,7 +89,7 @@ public:
* See the documentation of ViewerPrivate for implementation details.
* See Mainpage.dox for an overview of the classes in the messageviewer library.
*/
-class MESSAGEVIEWER_EXPORT Viewer: public QWidget
+class MESSAGEVIEWER_EXPORT Viewer : public QWidget
{
Q_OBJECT
@@ -105,7 +103,8 @@ public:
* @param actionCollection the action collection where the widget's actions will belong to
* @param f window flags
*/
- explicit Viewer(QWidget *parent, QWidget *widget = nullptr, KActionCollection *actionCollection = nullptr);
+ explicit Viewer(QWidget *parent, QWidget *widget = nullptr,
+ KActionCollection *actionCollection = nullptr);
virtual ~Viewer();
/**
@@ -160,7 +159,8 @@ public:
* @param msg - the message to be shown. If 0, an empty page is displayed.
* @param updateMode - update the display immediately or not. See UpdateMode.
*/
- void setMessage(const KMime::Message::Ptr &message, MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
+ void setMessage(const KMime::Message::Ptr &message,
+ MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
/**
* Set the Akonadi item that will be displayed.
@@ -168,7 +168,8 @@ public:
* an empty page is shown.
* @param updateMode - update the display immediately or not. See UpdateMode.
*/
- void setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
+ void setMessageItem(const Akonadi::Item &item,
+ MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
/**
* The path to the message in terms of Akonadi collection hierarchy.
@@ -230,7 +231,8 @@ public:
* @param templateName - the template to be loaded
* @param data - data for the template
*/
- void displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain = QByteArray());
+ void displaySplashPage(const QString &templateName, const QVariantHash &data,
+ const QByteArray &domain = QByteArray());
/** Enable the displaying of messages again after an splash (or other) page was displayed */
void enableMessageDisplay();
@@ -321,7 +323,8 @@ public:
bool mimePartTreeIsEmpty() const;
void showOpenAttachmentFolderWidget(const QUrl &url);
- QList<QAction *> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
+ QList<QAction *> viewerPluginActionList(
+ MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
QList<QAction *> interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const;
void runJavaScript(const QString &code);
@@ -347,8 +350,10 @@ Q_SIGNALS:
void replaceMsgByUnencryptedVersion();
/** The user presses the right mouse button. 'url' may be 0. */
- void popupMenu(const Akonadi::Item &msg, const QUrl &url, const QUrl &imageUrl, const QPoint &mousePos);
- void displayPopupMenu(const Akonadi::Item &msg, const WebEngineViewer::WebHitTestResult &result, const QPoint &mousePos);
+ void popupMenu(const Akonadi::Item &msg, const QUrl &url, const QUrl &imageUrl,
+ const QPoint &mousePos);
+ void displayPopupMenu(const Akonadi::Item &msg, const WebEngineViewer::WebHitTestResult &result,
+ const QPoint &mousePos);
/**
* The message viewer handles some types of urls itself, most notably http(s)
* and ftp(s). When it can't handle the url it will Q_EMIT this signal.
@@ -409,8 +414,6 @@ protected:
ViewerPrivate *const d_ptr;
};
-
}
#endif
-
diff --git a/messageviewer/src/viewer/viewer_p.cpp b/messageviewer/src/viewer/viewer_p.cpp
index 6cceb89..6f60e81 100644
--- a/messageviewer/src/viewer/viewer_p.cpp
+++ b/messageviewer/src/viewer/viewer_p.cpp
@@ -183,53 +183,54 @@ InvokeWrapper<Arg, R, C> invoke(R *receiver, void (C::*memberFun)(Arg))
ViewerPrivate::ViewerPrivate(Viewer *aParent, QWidget *mainWindow,
KActionCollection *actionCollection)
- : QObject(aParent),
- mNodeHelper(new MimeTreeParser::NodeHelper),
- mViewer(nullptr),
- mFindBar(nullptr),
- mAttachmentStrategy(nullptr),
- mUpdateReaderWinTimer(nullptr),
- mResizeTimer(nullptr),
- mOldGlobalOverrideEncoding(QStringLiteral("---")), // init with dummy value
- mMsgDisplay(true),
- mCSSHelper(nullptr),
- mMainWindow(mainWindow),
- mActionCollection(actionCollection),
- mCopyAction(nullptr),
- mCopyURLAction(nullptr),
- mUrlOpenAction(nullptr),
- mSelectAllAction(nullptr),
- mScrollUpAction(nullptr),
- mScrollDownAction(nullptr),
- mScrollUpMoreAction(nullptr),
- mScrollDownMoreAction(nullptr),
- mHeaderOnlyAttachmentsAction(nullptr),
- mSelectEncodingAction(nullptr),
- mToggleFixFontAction(nullptr),
- mToggleDisplayModeAction(nullptr),
- mToggleMimePartTreeAction(nullptr),
- mSpeakTextAction(nullptr),
- mCanStartDrag(false),
- mHtmlWriter(nullptr),
- mDecrytMessageOverwrite(false),
- mShowSignatureDetails(false),
- mShowAttachmentQuicklist(true),
- mForceEmoticons(true),
- mRecursionCountForDisplayMessage(0),
- mCurrentContent(nullptr),
- mMessagePartNode(nullptr),
- q(aParent),
- mPreviouslyViewedItem(-1),
- mScamDetectionWarning(nullptr),
- mOpenAttachmentFolderWidget(nullptr),
- mSliderContainer(nullptr),
- mShareServiceManager(nullptr),
- mHeaderStylePlugin(nullptr),
- mHeaderStyleMenuManager(nullptr),
- mViewerPluginToolManager(nullptr),
- mZoomActionMenu(nullptr),
- mCurrentPrinter(nullptr),
- mPhishingDatabase(nullptr)
+ : QObject(aParent)
+ , mNodeHelper(new MimeTreeParser::NodeHelper)
+ , mViewer(nullptr)
+ , mFindBar(nullptr)
+ , mAttachmentStrategy(nullptr)
+ , mUpdateReaderWinTimer(nullptr)
+ , mResizeTimer(nullptr)
+ , mOldGlobalOverrideEncoding(QStringLiteral("---"))
+ , // init with dummy value
+ mMsgDisplay(true)
+ , mCSSHelper(nullptr)
+ , mMainWindow(mainWindow)
+ , mActionCollection(actionCollection)
+ , mCopyAction(nullptr)
+ , mCopyURLAction(nullptr)
+ , mUrlOpenAction(nullptr)
+ , mSelectAllAction(nullptr)
+ , mScrollUpAction(nullptr)
+ , mScrollDownAction(nullptr)
+ , mScrollUpMoreAction(nullptr)
+ , mScrollDownMoreAction(nullptr)
+ , mHeaderOnlyAttachmentsAction(nullptr)
+ , mSelectEncodingAction(nullptr)
+ , mToggleFixFontAction(nullptr)
+ , mToggleDisplayModeAction(nullptr)
+ , mToggleMimePartTreeAction(nullptr)
+ , mSpeakTextAction(nullptr)
+ , mCanStartDrag(false)
+ , mHtmlWriter(nullptr)
+ , mDecrytMessageOverwrite(false)
+ , mShowSignatureDetails(false)
+ , mShowAttachmentQuicklist(true)
+ , mForceEmoticons(true)
+ , mRecursionCountForDisplayMessage(0)
+ , mCurrentContent(nullptr)
+ , mMessagePartNode(nullptr)
+ , q(aParent)
+ , mPreviouslyViewedItem(-1)
+ , mScamDetectionWarning(nullptr)
+ , mOpenAttachmentFolderWidget(nullptr)
+ , mSliderContainer(nullptr)
+ , mShareServiceManager(nullptr)
+ , mHeaderStylePlugin(nullptr)
+ , mHeaderStyleMenuManager(nullptr)
+ , mViewerPluginToolManager(nullptr)
+ , mZoomActionMenu(nullptr)
+ , mCurrentPrinter(nullptr)
+ , mPhishingDatabase(nullptr)
{
mMimePartTree = nullptr;
if (!mainWindow) {
@@ -241,7 +242,7 @@ ViewerPrivate::ViewerPrivate(Viewer *aParent, QWidget *mainWindow,
}
mPhishingDatabase = new WebEngineViewer::LocalDataBaseManager(this);
mPhishingDatabase->initialize();
- connect(mPhishingDatabase , &WebEngineViewer::LocalDataBaseManager::checkUrlFinished,
+ connect(mPhishingDatabase, &WebEngineViewer::LocalDataBaseManager::checkUrlFinished,
this, &ViewerPrivate::slotCheckedUrlFinished);
mShareServiceManager = new PimCommon::ShareServiceUrlManager(this);
@@ -297,8 +298,10 @@ ViewerPrivate::ViewerPrivate(Viewer *aParent, QWidget *mainWindow,
ViewerPrivate::~ViewerPrivate()
{
MessageViewer::MessageViewerSettings::self()->save();
- delete mHtmlWriter; mHtmlWriter = nullptr;
- delete mViewer; mViewer = nullptr;
+ delete mHtmlWriter;
+ mHtmlWriter = nullptr;
+ delete mViewer;
+ mViewer = nullptr;
delete mCSSHelper;
mNodeHelper->forceCleanTempFiles();
qDeleteAll(mListMailSourceViewer);
@@ -334,7 +337,6 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
const bool isEncapsulatedMessage = node->parent() && node->parent()->bodyIsMessage();
if (isEncapsulatedMessage) {
-
// the viewer/urlhandlermanager expects that the message (mMessage) it is passed is the root when doing index calculation
// in urls. Simply passing the result of bodyAsMessage() does not cut it as the resulting pointer is a child in its tree.
KMime::Message::Ptr m = KMime::Message::Ptr(new KMime::Message);
@@ -346,7 +348,8 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
// determine the MIME type of the attachment
// prefer the value of the Content-Type header
QMimeDatabase mimeDb;
- auto mimetype = mimeDb.mimeTypeForName(QString::fromLatin1(node->contentType()->mimeType().toLower()));
+ auto mimetype
+ = mimeDb.mimeTypeForName(QString::fromLatin1(node->contentType()->mimeType().toLower()));
if (mimetype.isValid() && mimetype.inherits(KContacts::Addressee::mimeType())) {
showVCard(node);
return;
@@ -362,10 +365,11 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
}
if (!mimetype.isValid() || mimetype.name() == QLatin1String("application/octet-stream")) {
- mimetype = MimeTreeParser::Util::mimetype(url.isLocalFile() ? url.toLocalFile() : url.fileName());
+ mimetype = MimeTreeParser::Util::mimetype(
+ url.isLocalFile() ? url.toLocalFile() : url.fileName());
}
- KService::Ptr offer =
- KMimeTypeTrader::self()->preferredService(mimetype.name(), QStringLiteral("Application"));
+ KService::Ptr offer
+ = KMimeTypeTrader::self()->preferredService(mimetype.name(), QStringLiteral("Application"));
const QString filenameText = MimeTreeParser::NodeHelper::fileName(node);
@@ -389,7 +393,6 @@ void ViewerPrivate::openAttachment(KMime::Content *node, const QUrl &url)
} else { // Cancel
qCDebug(MESSAGEVIEWER_LOG) << "Canceled opening attachment";
}
-
}
bool ViewerPrivate::deleteAttachment(KMime::Content *node, bool showWarning)
@@ -405,16 +408,21 @@ bool ViewerPrivate::deleteAttachment(KMime::Content *node, bool showWarning)
QList<KMime::Content *> extraNodes = mNodeHelper->extraContents(mMessage.data());
if (extraNodes.contains(node->topLevel())) {
KMessageBox::error(mMainWindow,
- i18n("Deleting an attachment from an encrypted or old-style mailman message is not supported."),
+ i18n(
+ "Deleting an attachment from an encrypted or old-style mailman message is not supported."),
i18n("Delete Attachment"));
return true; //cancelled
}
if (showWarning && KMessageBox::warningContinueCancel(mMainWindow,
- i18n("Deleting an attachment might invalidate any digital signature on this message."),
- i18n("Delete Attachment"), KStandardGuiItem::del(), KStandardGuiItem::cancel(),
- QStringLiteral("DeleteAttachmentSignatureWarning"))
- != KMessageBox::Continue) {
+ i18n(
+ "Deleting an attachment might invalidate any digital signature on this message."),
+ i18n("Delete Attachment"),
+ KStandardGuiItem::del(),
+ KStandardGuiItem::cancel(),
+ QStringLiteral(
+ "DeleteAttachmentSignatureWarning"))
+ != KMessageBox::Continue) {
return false; //cancelled
}
//don't confuse the model
@@ -442,7 +450,8 @@ bool ViewerPrivate::deleteAttachment(KMime::Content *node, bool showWarning)
deletePart->contentType()->setCharset("utf-8");
deletePart->contentTransferEncoding()->setEncoding(KMime::Headers::CE7Bit);
- QByteArray bodyMessage = QByteArrayLiteral("\nYou deleted an attachment from this message. The original MIME headers for the attachment were:");
+ QByteArray bodyMessage = QByteArrayLiteral(
+ "\nYou deleted an attachment from this message. The original MIME headers for the attachment were:");
bodyMessage += ("\nContent-Type: ") + mimetype;
bodyMessage += ("\nname=\"") + name.toUtf8() + "\"";
bodyMessage += ("\nfilename=\"") + filename.toUtf8() + "\"";
@@ -487,17 +496,21 @@ void ViewerPrivate::scrollToAnchor(const QString &anchor)
mViewer->scrollToAnchor(anchor);
}
-void ViewerPrivate::createOpenWithMenu(QMenu *topMenu, const QString &contentTypeStr, bool fromCurrentContent)
+void ViewerPrivate::createOpenWithMenu(QMenu *topMenu, const QString &contentTypeStr,
+ bool fromCurrentContent)
{
- const KService::List offers = KFileItemActions::associatedApplications(QStringList() << contentTypeStr, QString());
+ const KService::List offers = KFileItemActions::associatedApplications(
+ QStringList() << contentTypeStr, QString());
if (!offers.isEmpty()) {
QMenu *menu = topMenu;
QActionGroup *actionGroup = new QActionGroup(menu);
if (fromCurrentContent) {
- connect(actionGroup, &QActionGroup::triggered, this, &ViewerPrivate::slotOpenWithActionCurrentContent);
+ connect(actionGroup, &QActionGroup::triggered, this,
+ &ViewerPrivate::slotOpenWithActionCurrentContent);
} else {
- connect(actionGroup, &QActionGroup::triggered, this, &ViewerPrivate::slotOpenWithAction);
+ connect(actionGroup, &QActionGroup::triggered, this,
+ &ViewerPrivate::slotOpenWithAction);
}
if (offers.count() > 1) { // submenu 'open with'
@@ -511,8 +524,8 @@ void ViewerPrivate::createOpenWithMenu(QMenu *topMenu, const QString &contentTyp
KService::List::ConstIterator end = offers.constEnd();
for (; it != end; ++it) {
QAction *act = MessageViewer::Util::createAppAction(*it,
- // no submenu -> prefix single offer
- menu == topMenu, actionGroup, menu);
+ // no submenu -> prefix single offer
+ menu == topMenu, actionGroup, menu);
menu->addAction(act);
}
@@ -526,7 +539,8 @@ void ViewerPrivate::createOpenWithMenu(QMenu *topMenu, const QString &contentTyp
QAction *openWithAct = new QAction(menu);
openWithAct->setText(openWithActionName);
if (fromCurrentContent) {
- connect(openWithAct, &QAction::triggered, this, &ViewerPrivate::slotOpenWithDialogCurrentContent);
+ connect(openWithAct, &QAction::triggered, this,
+ &ViewerPrivate::slotOpenWithDialogCurrentContent);
} else {
connect(openWithAct, &QAction::triggered, this, &ViewerPrivate::slotOpenWithDialog);
}
@@ -536,7 +550,8 @@ void ViewerPrivate::createOpenWithMenu(QMenu *topMenu, const QString &contentTyp
QAction *act = new QAction(topMenu);
act->setText(i18nc("@title:menu", "&Open With..."));
if (fromCurrentContent) {
- connect(act, &QAction::triggered, this, &ViewerPrivate::slotOpenWithDialogCurrentContent);
+ connect(act, &QAction::triggered, this,
+ &ViewerPrivate::slotOpenWithDialogCurrentContent);
} else {
connect(act, &QAction::triggered, this, &ViewerPrivate::slotOpenWithDialog);
}
@@ -578,7 +593,8 @@ void ViewerPrivate::slotOpenWithAction(QAction *act)
}
}
-void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &name, const QPoint &globalPos)
+void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &name,
+ const QPoint &globalPos)
{
Q_UNUSED(name);
prepareHandleAttachment(node);
@@ -593,7 +609,9 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
connect(attachmentMapper, SIGNAL(mapped(int)),
this, SLOT(slotHandleAttachment(int)));
- QAction *action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-open")), i18nc("to open", "Open"));
+ QAction *action
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("document-open")), i18nc("to open",
+ "Open"));
action->setEnabled(!deletedAttachment);
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Open);
@@ -605,13 +623,13 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
auto mimetype = mimeDb.mimeTypeForName(contentTypeStr);
if (mimetype.isValid()) {
const QStringList parentMimeType = mimetype.parentMimeTypes();
- if ((contentTypeStr == QLatin1String("text/plain")) ||
- (contentTypeStr == QLatin1String("image/png")) ||
- (contentTypeStr == QLatin1String("image/jpeg")) ||
- parentMimeType.contains(QStringLiteral("text/plain")) ||
- parentMimeType.contains(QStringLiteral("image/png")) ||
- parentMimeType.contains(QStringLiteral("image/jpeg"))
- ) {
+ if ((contentTypeStr == QLatin1String("text/plain"))
+ || (contentTypeStr == QLatin1String("image/png"))
+ || (contentTypeStr == QLatin1String("image/jpeg"))
+ || parentMimeType.contains(QStringLiteral("text/plain"))
+ || parentMimeType.contains(QStringLiteral("image/png"))
+ || parentMimeType.contains(QStringLiteral("image/jpeg"))
+ ) {
action = menu->addAction(i18nc("to view something", "View"));
action->setEnabled(!deletedAttachment);
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
@@ -629,7 +647,8 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
}
#endif
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n("Save As..."));
+ action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n(
+ "Save As..."));
action->setEnabled(!deletedAttachment);
connect(action, SIGNAL(triggered(bool)), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Save);
@@ -640,30 +659,38 @@ void ViewerPrivate::showAttachmentPopup(KMime::Content *node, const QString &nam
attachmentMapper->setMapping(action, Viewer::Copy);
const bool isEncapsulatedMessage = node->parent() && node->parent()->bodyIsMessage();
- const bool canChange = mMessageItem.isValid() && mMessageItem.parentCollection().isValid() &&
- (mMessageItem.parentCollection().rights() != Akonadi::Collection::ReadOnly) &&
- !isEncapsulatedMessage;
+ const bool canChange = mMessageItem.isValid() && mMessageItem.parentCollection().isValid()
+ && (mMessageItem.parentCollection().rights()
+ != Akonadi::Collection::ReadOnly)
+ && !isEncapsulatedMessage;
if (MessageViewer::MessageViewerSettings::self()->allowAttachmentEditing()) {
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n("Edit Attachment"));
+ action
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n(
+ "Edit Attachment"));
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Edit);
action->setEnabled(canChange);
}
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Delete Attachment"));
+ action
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("edit-delete")),
+ i18n("Delete Attachment"));
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::Delete);
action->setEnabled(canChange && !deletedAttachment);
#if 0
menu->addSeparator();
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("mail-reply-sender")), i18n("Reply To Author"));
+ action
+ = menu->addAction(QIcon::fromTheme(QStringLiteral("mail-reply-sender")),
+ i18n("Reply To Author"));
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::ReplyMessageToAuthor);
menu->addSeparator();
- action = menu->addAction(QIcon::fromTheme(QStringLiteral("mail-reply-all")), i18n("Reply To All"));
+ action = menu->addAction(QIcon::fromTheme(QStringLiteral("mail-reply-all")), i18n(
+ "Reply To All"));
connect(action, SIGNAL(triggered()), attachmentMapper, SLOT(map()));
attachmentMapper->setMapping(action, Viewer::ReplyMessageToAll);
#endif
@@ -695,7 +722,8 @@ QString ViewerPrivate::createAtmFileLink(const QString &atmFileName) const
delete linkFile;
delete linkDir;
- if (::link(QFile::encodeName(atmFileName).constData(), QFile::encodeName(linkName).constData()) == 0) {
+ if (::link(QFile::encodeName(atmFileName).constData(),
+ QFile::encodeName(linkName).constData()) == 0) {
return linkName; // success
}
return QString();
@@ -721,7 +749,8 @@ KService::Ptr ViewerPrivate::getServiceOffer(KMime::Content *content)
/*TODO(Andris) port when on-demand loading is done && msgPart.isComplete() */
mimetype = MimeTreeParser::Util::mimetype(fileName);
}
- return KMimeTypeTrader::self()->preferredService(mimetype.name(), QStringLiteral("Application"));
+ return KMimeTypeTrader::self()->preferredService(mimetype.name(),
+ QStringLiteral("Application"));
}
KMime::Content::List ViewerPrivate::selectedContents()
@@ -734,7 +763,8 @@ void ViewerPrivate::attachmentOpenWith(KMime::Content *node, const KService::Ptr
QString name = mNodeHelper->writeNodeToTempFile(node);
// Make sure that it will not deleted when we switch from message.
- QTemporaryDir *tmpDir = new QTemporaryDir(QDir::tempPath() + QLatin1String("/messageviewer_attachment_XXXXXX"));
+ QTemporaryDir *tmpDir
+ = new QTemporaryDir(QDir::tempPath() + QLatin1String("/messageviewer_attachment_XXXXXX"));
if (tmpDir->isValid()) {
tmpDir->setAutoRemove(false);
const QString path = tmpDir->path();
@@ -744,7 +774,8 @@ void ViewerPrivate::attachmentOpenWith(KMime::Content *node, const KService::Ptr
const QString newPath = path + QLatin1Char('/') + tmpFileName.fileName();
if (!f.copy(newPath)) {
- qDebug(MESSAGEVIEWER_LOG) << " File was not able to copy: filename: " << name << " to " << path;
+ qDebug(MESSAGEVIEWER_LOG) << " File was not able to copy: filename: " << name
+ << " to " << path;
} else {
name = newPath;
}
@@ -763,7 +794,7 @@ void ViewerPrivate::attachmentOpenWith(KMime::Content *node, const KService::Ptr
QFile::remove(url.toLocalFile());
}
} else {
- if ((! KRun::displayOpenWithDialog(lst, mMainWindow, true))) {
+ if ((!KRun::displayOpenWithDialog(lst, mMainWindow, true))) {
QFile::remove(url.toLocalFile());
}
}
@@ -833,7 +864,8 @@ void ViewerPrivate::displaySplashPage(const QString &message)
});
}
-void ViewerPrivate::displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain)
+void ViewerPrivate::displaySplashPage(const QString &templateName, const QVariantHash &data,
+ const QByteArray &domain)
{
mMsgDisplay = false;
adjustLayout();
@@ -868,7 +900,8 @@ void ViewerPrivate::displayMessage()
mNodeHelper->setOverrideCodec(mMessage.data(), overrideCodec());
if (mMessageItem.hasAttribute<MessageViewer::MessageDisplayFormatAttribute>()) {
- const MessageViewer::MessageDisplayFormatAttribute *const attr = mMessageItem.attribute<MessageViewer::MessageDisplayFormatAttribute>();
+ const MessageViewer::MessageDisplayFormatAttribute *const attr
+ = mMessageItem.attribute<MessageViewer::MessageDisplayFormatAttribute>();
setHtmlLoadExtOverride(attr->remoteContent());
setDisplayFormatMessageOverwrite(attr->messageFormat());
}
@@ -894,9 +927,16 @@ void ViewerPrivate::displayMessage()
mBackgroundError = scheme.background(KColorScheme::NegativeBackground).color();
}
- htmlWriter()->queue(QStringLiteral("<div style=\"background:%1;color:%2;border:1px solid %3\">%4</div>").arg(mBackgroundError.name(),
- mForegroundError.name(),
- mForegroundError.name(), attr->message().toHtmlEscaped()));
+ htmlWriter()->queue(QStringLiteral(
+ "<div style=\"background:%1;color:%2;border:1px solid %3\">%4</div>").arg(
+ mBackgroundError.
+ name(),
+ mForegroundError
+ .
+ name(),
+ mForegroundError
+ .
+ name(), attr->message().toHtmlEscaped()));
htmlWriter()->queue(QStringLiteral("<p></p>"));
}
@@ -907,12 +947,18 @@ void ViewerPrivate::displayMessage()
mColorBar->update();
htmlWriter()->queue(QStringLiteral("</body></html>"));
- connect(mViewer, &MailWebEngineView::loadStarted, this, &ViewerPrivate::slotLoadStarted, Qt::UniqueConnection);
- connect(mViewer, &MailWebEngineView::loadFinished, this, &ViewerPrivate::executeCustomScriptsAfterLoading, Qt::UniqueConnection);
- connect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotMessageRendered, Qt::UniqueConnection);
+ connect(mViewer, &MailWebEngineView::loadStarted, this, &ViewerPrivate::slotLoadStarted,
+ Qt::UniqueConnection);
+ connect(mViewer, &MailWebEngineView::loadFinished, this,
+ &ViewerPrivate::executeCustomScriptsAfterLoading, Qt::UniqueConnection);
+ connect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotMessageRendered,
+ Qt::UniqueConnection);
const QString html = attachmentInjectionHtml();
- const QString js = html.isEmpty() ? QString() : MessageViewer::MailWebEngineScript::injectAttachments(html, QStringLiteral("attachmentInjectionPoint"));
+ const QString js
+ = html.isEmpty() ? QString() : MessageViewer::MailWebEngineScript::injectAttachments(html, QStringLiteral(
+ "attachmentInjectionPoint"));
mViewer->addScript(js, QStringLiteral("attachment_injection"), QWebEngineScript::DocumentReady);
htmlWriter()->flush();
@@ -929,7 +975,8 @@ void ViewerPrivate::collectionFetchedForStoringDecryptedMessage(KJob *job)
}
Akonadi::Collection col;
- const Akonadi::Collection::List lstCol = static_cast<Akonadi::CollectionFetchJob *>(job)->collections();
+ const Akonadi::Collection::List lstCol
+ = static_cast<Akonadi::CollectionFetchJob *>(job)->collections();
for (const Akonadi::Collection &c : lstCol) {
if (c == mMessageItem.parentCollection()) {
col = c;
@@ -951,7 +998,7 @@ void ViewerPrivate::collectionFetchedForStoringDecryptedMessage(KJob *job)
}
bool isInOutbox = true;
Akonadi::Collection outboxCollection = Akonadi::SpecialMailCollections::self()->collection(
- Akonadi::SpecialMailCollections::Outbox, resourceInstance);
+ Akonadi::SpecialMailCollections::Outbox, resourceInstance);
if (resourceInstance.isValid() && outboxCollection != col) {
isInOutbox = false;
}
@@ -966,10 +1013,10 @@ void ViewerPrivate::collectionFetchedForStoringDecryptedMessage(KJob *job)
}
}
-void ViewerPrivate::postProcessMessage(MimeTreeParser::ObjectTreeParser *otp, MimeTreeParser::KMMsgEncryptionState encryptionState)
+void ViewerPrivate::postProcessMessage(MimeTreeParser::ObjectTreeParser *otp,
+ MimeTreeParser::KMMsgEncryptionState encryptionState)
{
if (MessageViewer::MessageViewerSettings::self()->storeDisplayedMessagesUnencrypted()) {
-
// Hack to make sure the S/MIME CryptPlugs follows the strict requirement
// of german government:
// --> All received encrypted messages *must* be stored in unencrypted form
@@ -982,20 +1029,23 @@ void ViewerPrivate::postProcessMessage(MimeTreeParser::ObjectTreeParser *otp, Mi
// by deciding when (or when not, resp.) to set the 'dataNode' to
// something different than 'curNode'.
- const bool messageAtLeastPartiallyEncrypted = (MimeTreeParser::KMMsgFullyEncrypted == encryptionState) ||
- (MimeTreeParser::KMMsgPartiallyEncrypted == encryptionState);
+ const bool messageAtLeastPartiallyEncrypted
+ = (MimeTreeParser::KMMsgFullyEncrypted == encryptionState)
+ || (MimeTreeParser::KMMsgPartiallyEncrypted
+ == encryptionState);
// only proceed if we were called the normal way - not by
// double click on the message (==not running in a separate window)
- if (decryptMessage() && // only proceed if the message has actually been decrypted
- !otp->hasPendingAsyncJobs() && // only proceed if no pending async jobs are running:
- messageAtLeastPartiallyEncrypted) {
+ if (decryptMessage() // only proceed if the message has actually been decrypted
+ && !otp->hasPendingAsyncJobs() // only proceed if no pending async jobs are running:
+ && messageAtLeastPartiallyEncrypted) {
//check if the message is in the outbox folder
//FIXME: using root() is too much, but using mMessageItem.parentCollection() returns no collections in job->collections()
//FIXME: this is done async, which means it is possible that the user selects another message while
// this job is running. In that case, collectionFetchedForStoringDecryptedMessage() will work
// on the wrong item!
- Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(Akonadi::Collection::root(),
- Akonadi::CollectionFetchJob::Recursive);
+ Akonadi::CollectionFetchJob *job = new Akonadi::CollectionFetchJob(
+ Akonadi::Collection::root(),
+ Akonadi::CollectionFetchJob::Recursive);
connect(job, &KJob::result,
this, &ViewerPrivate::collectionFetchedForStoringDecryptedMessage);
}
@@ -1034,7 +1084,8 @@ void ViewerPrivate::parseContent(KMime::Content *content)
mNodeHelper->removeTempFiles();
mNodeHelper->setNodeUnprocessed(mMessage.data(), true);
MailViewerSource otpSource(this);
- MimeTreeParser::ObjectTreeParser otp(&otpSource, mNodeHelper, mMessage.data() != content /* show only single node */);
+ MimeTreeParser::ObjectTreeParser otp(&otpSource, mNodeHelper,
+ mMessage.data() != content /* show only single node */);
otp.setAllowAsync(!mPrinting);
otp.parseObjectTree(content);
@@ -1043,13 +1094,15 @@ void ViewerPrivate::parseContent(KMime::Content *content)
// of messages that were parsed at least once
// store encrypted/signed status information in the KMMessage
// - this can only be done *after* calling parseObjectTree()
- MimeTreeParser::KMMsgEncryptionState encryptionState = mNodeHelper->overallEncryptionState(content);
- MimeTreeParser::KMMsgSignatureState signatureState = mNodeHelper->overallSignatureState(content);
+ MimeTreeParser::KMMsgEncryptionState encryptionState = mNodeHelper->overallEncryptionState(
+ content);
+ MimeTreeParser::KMMsgSignatureState signatureState
+ = mNodeHelper->overallSignatureState(content);
mNodeHelper->setEncryptionState(content, encryptionState);
// Don't reset the signature state to "not signed" (e.g. if one canceled the
// decryption of a signed messages which has already been decrypted before).
- if (signatureState != MimeTreeParser::KMMsgNotSigned ||
- mNodeHelper->signatureState(content) == MimeTreeParser::KMMsgSignatureStateUnknown) {
+ if (signatureState != MimeTreeParser::KMMsgNotSigned
+ || mNodeHelper->signatureState(content) == MimeTreeParser::KMMsgSignatureStateUnknown) {
mNodeHelper->setSignatureState(content, signatureState);
}
@@ -1082,7 +1135,8 @@ QString ViewerPrivate::writeMsgHeader(KMime::Message *aMsg, KMime::Content *vCar
status.setStatusFromFlags(mMessageItem.flags());
headerStylePlugin()->headerStyle()->setMessageStatus(status);
- headerStylePlugin()->headerStyle()->setCollectionName(mMessageItem.parentCollection().displayName());
+ headerStylePlugin()->headerStyle()->setCollectionName(
+ mMessageItem.parentCollection().displayName());
} else {
headerStylePlugin()->headerStyle()->setCollectionName(QString());
headerStylePlugin()->headerStyle()->setReadOnlyMessage(true);
@@ -1119,13 +1173,20 @@ void ViewerPrivate::initHtmlWidget()
this, &ViewerPrivate::slotUrlPopup);
connect(mViewer, &MailWebEngineView::wheelZoomChanged,
this, &ViewerPrivate::slotWheelZoomChanged);
- connect(mViewer, &MailWebEngineView::messageMayBeAScam, this, &ViewerPrivate::slotMessageMayBeAScam);
- connect(mViewer, &MailWebEngineView::formSubmittedForbidden, this, &ViewerPrivate::slotFormSubmittedForbidden);
- connect(mScamDetectionWarning, &ScamDetectionWarningWidget::showDetails, mViewer, &MailWebEngineView::slotShowDetails);
- connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this, &ViewerPrivate::moveMessageToTrash);
- connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this, &ViewerPrivate::slotMessageIsNotAScam);
- connect(mScamDetectionWarning, &ScamDetectionWarningWidget::addToWhiteList, this, &ViewerPrivate::slotAddToWhiteList);
- connect(mViewer, &MailWebEngineView::pageIsScrolledToBottom, this, &ViewerPrivate::pageIsScrolledToBottom);
+ connect(mViewer, &MailWebEngineView::messageMayBeAScam, this,
+ &ViewerPrivate::slotMessageMayBeAScam);
+ connect(mViewer, &MailWebEngineView::formSubmittedForbidden, this,
+ &ViewerPrivate::slotFormSubmittedForbidden);
+ connect(mScamDetectionWarning, &ScamDetectionWarningWidget::showDetails, mViewer,
+ &MailWebEngineView::slotShowDetails);
+ connect(mScamDetectionWarning, &ScamDetectionWarningWidget::moveMessageToTrash, this,
+ &ViewerPrivate::moveMessageToTrash);
+ connect(mScamDetectionWarning, &ScamDetectionWarningWidget::messageIsNotAScam, this,
+ &ViewerPrivate::slotMessageIsNotAScam);
+ connect(mScamDetectionWarning, &ScamDetectionWarningWidget::addToWhiteList, this,
+ &ViewerPrivate::slotAddToWhiteList);
+ connect(mViewer, &MailWebEngineView::pageIsScrolledToBottom, this,
+ &ViewerPrivate::pageIsScrolledToBottom);
}
void ViewerPrivate::slotWheelZoomChanged(int numSteps)
@@ -1150,14 +1211,17 @@ void ViewerPrivate::readConfig()
}
mHtmlMailGlobalSetting = MessageViewer::MessageViewerSettings::self()->htmlMail();
- mHtmlLoadExternalGlobalSetting = MessageViewer::MessageViewerSettings::self()->htmlLoadExternal();
+ mHtmlLoadExternalGlobalSetting
+ = MessageViewer::MessageViewerSettings::self()->htmlLoadExternal();
readGravatarConfig();
if (mHeaderStyleMenuManager) {
mHeaderStyleMenuManager->readConfig();
}
- setAttachmentStrategy(MimeTreeParser::AttachmentStrategy::create(MessageViewer::MessageViewerSettings::self()->attachmentStrategy()));
+ setAttachmentStrategy(MimeTreeParser::AttachmentStrategy::create(MessageViewer::
+ MessageViewerSettings::self()->
+ attachmentStrategy()));
KToggleAction *raction = actionForAttachmentStrategy(attachmentStrategy());
if (raction) {
raction->setChecked(true);
@@ -1166,8 +1230,10 @@ void ViewerPrivate::readConfig()
adjustLayout();
readGlobalOverrideCodec();
- mViewer->settings()->setFontSize(QWebEngineSettings::MinimumFontSize, MessageViewer::MessageViewerSettings::self()->minimumFontSize());
- mViewer->settings()->setFontSize(QWebEngineSettings::MinimumLogicalFontSize, MessageViewer::MessageViewerSettings::self()->minimumFontSize());
+ mViewer->settings()->setFontSize(QWebEngineSettings::MinimumFontSize,
+ MessageViewer::MessageViewerSettings::self()->minimumFontSize());
+ mViewer->settings()->setFontSize(QWebEngineSettings::MinimumLogicalFontSize,
+ MessageViewer::MessageViewerSettings::self()->minimumFontSize());
if (mMessage) {
update();
}
@@ -1176,7 +1242,8 @@ void ViewerPrivate::readConfig()
void ViewerPrivate::readGravatarConfig()
{
- Gravatar::GravatarCache::self()->setMaximumSize(Gravatar::GravatarSettings::self()->gravatarCacheSize());
+ Gravatar::GravatarCache::self()->setMaximumSize(
+ Gravatar::GravatarSettings::self()->gravatarCacheSize());
if (!Gravatar::GravatarSettings::self()->gravatarSupportEnabled()) {
Gravatar::GravatarCache::self()->clear();
}
@@ -1195,7 +1262,9 @@ void ViewerPrivate::writeConfig(bool sync)
{
MessageViewer::MessageViewerSettings::self()->setUseFixedFont(mUseFixedFont);
if (attachmentStrategy()) {
- MessageViewer::MessageViewerSettings::self()->setAttachmentStrategy(QLatin1String(attachmentStrategy()->name()));
+ MessageViewer::MessageViewerSettings::self()->setAttachmentStrategy(QLatin1String(
+ attachmentStrategy()
+ ->name()));
}
saveSplitterSizes();
if (sync) {
@@ -1235,7 +1304,9 @@ void ViewerPrivate::setOverrideEncoding(const QString &encoding)
} else {
const QStringList encodings = mSelectEncodingAction->items();
int i = 0;
- for (QStringList::const_iterator it = encodings.constBegin(), end = encodings.constEnd(); it != end; ++it, ++i) {
+ for (QStringList::const_iterator it = encodings.constBegin(),
+ end = encodings.constEnd();
+ it != end; ++it, ++i) {
if (MimeTreeParser::NodeHelper::encodingForName(*it) == encoding) {
mSelectEncodingAction->setCurrentItem(i);
break;
@@ -1265,15 +1336,23 @@ bool ViewerPrivate::printingMode() const
void ViewerPrivate::printMessage(const Akonadi::Item &message)
{
- disconnect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintMessage);
- connect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintMessage);
+ disconnect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintMessage);
+ connect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintMessage);
setMessageItem(message, MimeTreeParser::Force);
}
void ViewerPrivate::printPreviewMessage(const Akonadi::Item &message)
{
- disconnect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintPreview);
- connect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintPreview);
+ disconnect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintPreview);
+ connect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintPreview);
setMessageItem(message, MimeTreeParser::Force);
}
@@ -1299,7 +1378,8 @@ void ViewerPrivate::resetStateForNewMessage()
if (mPrinting) {
if (MessageViewer::MessageViewerSettings::self()->respectExpandCollapseSettings()) {
if (MessageViewer::MessageViewerSettings::self()->showExpandQuotesMark()) {
- mLevelQuote = MessageViewer::MessageViewerSettings::self()->collapseQuoteLevelSpin() - 1;
+ mLevelQuote
+ = MessageViewer::MessageViewerSettings::self()->collapseQuoteLevelSpin() - 1;
} else {
mLevelQuote = -1;
}
@@ -1307,7 +1387,11 @@ void ViewerPrivate::resetStateForNewMessage()
mLevelQuote = -1;
}
} else {
- mDisplayFormatMessageOverwrite = (mDisplayFormatMessageOverwrite == MessageViewer::Viewer::UseGlobalSetting) ? MessageViewer::Viewer::UseGlobalSetting : MessageViewer::Viewer::Unknown;
+ mDisplayFormatMessageOverwrite
+ = (mDisplayFormatMessageOverwrite
+ == MessageViewer::Viewer::UseGlobalSetting) ? MessageViewer::Viewer::UseGlobalSetting
+ :
+ MessageViewer::Viewer::Unknown;
}
}
@@ -1324,7 +1408,6 @@ void ViewerPrivate::setMessageInternal(const KMime::Message::Ptr &message,
mMimePartTree->setRoot(mNodeHelper->messageWithExtraContent(message.data()));
update(updateMode);
#endif
-
}
void ViewerPrivate::setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMode updateMode)
@@ -1350,7 +1433,8 @@ void ViewerPrivate::setMessageItem(const Akonadi::Item &item, MimeTreeParser::Up
setMessageInternal(mMessageItem.payload<KMime::Message::Ptr>(), updateMode);
}
-void ViewerPrivate::setMessage(const KMime::Message::Ptr &aMsg, MimeTreeParser::UpdateMode updateMode)
+void ViewerPrivate::setMessage(const KMime::Message::Ptr &aMsg,
+ MimeTreeParser::UpdateMode updateMode)
{
resetStateForNewMessage();
@@ -1402,7 +1486,8 @@ void ViewerPrivate::showHideMimeTree()
return;
}
bool showMimeTree = false;
- if (MessageViewer::MessageViewerSettings::self()->mimeTreeMode() == MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always) {
+ if (MessageViewer::MessageViewerSettings::self()->mimeTreeMode()
+ == MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always) {
mMimePartTree->show();
showMimeTree = true;
} else {
@@ -1434,8 +1519,9 @@ void ViewerPrivate::adjustLayout()
mSplitter->addWidget(mMimePartTree);
mSplitter->setSizes(splitterSizes);
- if (MessageViewer::MessageViewerSettings::self()->mimeTreeMode() == MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always &&
- mMsgDisplay) {
+ if (MessageViewer::MessageViewerSettings::self()->mimeTreeMode()
+ == MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always
+ && mMsgDisplay) {
mMimePartTree->show();
} else {
mMimePartTree->hide();
@@ -1476,8 +1562,10 @@ void ViewerPrivate::createWidgets()
vlay->addWidget(mSplitter);
#ifndef QT_NO_TREEVIEW
mMimePartTree = new MimePartTreeView(mSplitter);
- connect(mMimePartTree, &QAbstractItemView::activated, this, &ViewerPrivate::slotMimePartSelected);
- connect(mMimePartTree, &QWidget::customContextMenuRequested, this, &ViewerPrivate::slotMimeTreeContextMenuRequested);
+ connect(mMimePartTree, &QAbstractItemView::activated, this,
+ &ViewerPrivate::slotMimePartSelected);
+ connect(mMimePartTree, &QWidget::customContextMenuRequested, this,
+ &ViewerPrivate::slotMimeTreeContextMenuRequested);
#endif
mBox = new QWidget(mSplitter);
@@ -1523,13 +1611,15 @@ void ViewerPrivate::createWidgets()
qCDebug(MESSAGEVIEWER_LOG) << " Impossible to initialize plugins";
}
mViewerPluginToolManager->createView();
- connect(mViewerPluginToolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this, &ViewerPrivate::slotActivatePlugin);
+ connect(mViewerPluginToolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this,
+ &ViewerPrivate::slotActivatePlugin);
mSliderContainer = new KPIMTextEdit::SlideContainer(readerBox);
mSliderContainer->setObjectName(QStringLiteral("slidercontainer"));
readerBoxVBoxLayout->addWidget(mSliderContainer);
mFindBar = new WebEngineViewer::FindBarWebEngineView(mViewer, q);
- connect(mFindBar, &WebEngineViewer::FindBarWebEngineView::hideFindBar, mSliderContainer, &KPIMTextEdit::SlideContainer::slideOut);
+ connect(mFindBar, &WebEngineViewer::FindBarWebEngineView::hideFindBar, mSliderContainer,
+ &KPIMTextEdit::SlideContainer::slideOut);
mSliderContainer->setContent(mFindBar);
#ifndef QT_NO_TREEVIEW
@@ -1552,60 +1642,67 @@ void ViewerPrivate::createActions()
{
KActionCollection *ac = mActionCollection;
mHeaderStyleMenuManager = new MessageViewer::HeaderStyleMenuManager(ac, this);
- connect(mHeaderStyleMenuManager, &MessageViewer::HeaderStyleMenuManager::styleChanged, this, &ViewerPrivate::slotStyleChanged);
- connect(mHeaderStyleMenuManager, &MessageViewer::HeaderStyleMenuManager::styleUpdated, this, &ViewerPrivate::slotStyleUpdated);
+ connect(mHeaderStyleMenuManager, &MessageViewer::HeaderStyleMenuManager::styleChanged, this,
+ &ViewerPrivate::slotStyleChanged);
+ connect(mHeaderStyleMenuManager, &MessageViewer::HeaderStyleMenuManager::styleUpdated, this,
+ &ViewerPrivate::slotStyleUpdated);
if (!ac) {
return;
}
mZoomActionMenu = new WebEngineViewer::ZoomActionMenu(this);
- connect(mZoomActionMenu, &WebEngineViewer::ZoomActionMenu::zoomChanged, mViewer, &MailWebEngineView::slotZoomChanged);
+ connect(mZoomActionMenu, &WebEngineViewer::ZoomActionMenu::zoomChanged, mViewer,
+ &MailWebEngineView::slotZoomChanged);
mZoomActionMenu->setActionCollection(ac);
mZoomActionMenu->createZoomActions();
// attachment style
- KActionMenu *attachmentMenu = new KActionMenu(i18nc("View->", "&Attachments"), this);
+ KActionMenu *attachmentMenu = new KActionMenu(i18nc("View->", "&Attachments"), this);
ac->addAction(QStringLiteral("view_attachments"), attachmentMenu);
addHelpTextAction(attachmentMenu, i18n("Choose display style of attachments"));
QActionGroup *group = new QActionGroup(this);
- KToggleAction *raction = new KToggleAction(i18nc("View->attachments->", "&As Icons"), this);
+ KToggleAction *raction = new KToggleAction(i18nc("View->attachments->", "&As Icons"), this);
ac->addAction(QStringLiteral("view_attachments_as_icons"), raction);
connect(raction, &QAction::triggered, this, &ViewerPrivate::slotIconicAttachments);
addHelpTextAction(raction, i18n("Show all attachments as icons. Click to see them."));
group->addAction(raction);
attachmentMenu->addAction(raction);
- raction = new KToggleAction(i18nc("View->attachments->", "&Smart"), this);
+ raction = new KToggleAction(i18nc("View->attachments->", "&Smart"), this);
ac->addAction(QStringLiteral("view_attachments_smart"), raction);
connect(raction, &QAction::triggered, this, &ViewerPrivate::slotSmartAttachments);
addHelpTextAction(raction, i18n("Show attachments as suggested by sender."));
group->addAction(raction);
attachmentMenu->addAction(raction);
- raction = new KToggleAction(i18nc("View->attachments->", "&Inline"), this);
+ raction = new KToggleAction(i18nc("View->attachments->", "&Inline"), this);
ac->addAction(QStringLiteral("view_attachments_inline"), raction);
connect(raction, &QAction::triggered, this, &ViewerPrivate::slotInlineAttachments);
addHelpTextAction(raction, i18n("Show all attachments inline (if possible)"));
group->addAction(raction);
attachmentMenu->addAction(raction);
- raction = new KToggleAction(i18nc("View->attachments->", "&Hide"), this);
+ raction = new KToggleAction(i18nc("View->attachments->", "&Hide"), this);
ac->addAction(QStringLiteral("view_attachments_hide"), raction);
connect(raction, &QAction::triggered, this, &ViewerPrivate::slotHideAttachments);
addHelpTextAction(raction, i18n("Do not show attachments in the message viewer"));
group->addAction(raction);
attachmentMenu->addAction(raction);
- mHeaderOnlyAttachmentsAction = new KToggleAction(i18nc("View->attachments->", "In Header Only"), this);
+ mHeaderOnlyAttachmentsAction = new KToggleAction(i18nc("View->attachments->",
+ "In Header Only"), this);
ac->addAction(QStringLiteral("view_attachments_headeronly"), mHeaderOnlyAttachmentsAction);
connect(mHeaderOnlyAttachmentsAction, &QAction::triggered,
this, &ViewerPrivate::slotHeaderOnlyAttachments);
- addHelpTextAction(mHeaderOnlyAttachmentsAction, i18n("Show Attachments only in the header of the mail"));
+ addHelpTextAction(mHeaderOnlyAttachmentsAction,
+ i18n("Show Attachments only in the header of the mail"));
group->addAction(mHeaderOnlyAttachmentsAction);
attachmentMenu->addAction(mHeaderOnlyAttachmentsAction);
// Set Encoding submenu
- mSelectEncodingAction = new KSelectAction(QIcon::fromTheme(QStringLiteral("character-set")), i18n("&Set Encoding"), this);
+ mSelectEncodingAction = new KSelectAction(QIcon::fromTheme(QStringLiteral(
+ "character-set")),
+ i18n("&Set Encoding"), this);
mSelectEncodingAction->setToolBarMode(KSelectAction::MenuMode);
ac->addAction(QStringLiteral("encoding"), mSelectEncodingAction);
connect(mSelectEncodingAction, SIGNAL(triggered(int)),
@@ -1627,7 +1724,7 @@ void ViewerPrivate::createActions()
viewerSelectionChanged();
// copy all text to clipboard
- mSelectAllAction = new QAction(i18n("Select All Text"), this);
+ mSelectAllAction = new QAction(i18n("Select All Text"), this);
ac->addAction(QStringLiteral("mark_all_text"), mSelectAllAction);
connect(mSelectAllAction, &QAction::triggered, this, &ViewerPrivate::selectAll);
ac->setDefaultShortcut(mSelectAllAction, QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_A));
@@ -1639,7 +1736,8 @@ void ViewerPrivate::createActions()
connect(mCopyURLAction, &QAction::triggered, this, &ViewerPrivate::slotUrlCopy);
// open URL
- mUrlOpenAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open")), i18n("Open URL"), this);
+ mUrlOpenAction = new QAction(QIcon::fromTheme(QStringLiteral("document-open")), i18n(
+ "Open URL"), this);
ac->addAction(QStringLiteral("open_url"), mUrlOpenAction);
connect(mUrlOpenAction, &QAction::triggered, this, &ViewerPrivate::slotOpenUrl);
@@ -1655,12 +1753,14 @@ void ViewerPrivate::createActions()
connect(mToggleMimePartTreeAction, &QAction::toggled,
this, &ViewerPrivate::slotToggleMimePartTree);
- mViewSourceAction = new QAction(i18n("&View Source"), this);
+ mViewSourceAction = new QAction(i18n("&View Source"), this);
ac->addAction(QStringLiteral("view_source"), mViewSourceAction);
connect(mViewSourceAction, &QAction::triggered, this, &ViewerPrivate::slotShowMessageSource);
ac->setDefaultShortcut(mViewSourceAction, QKeySequence(Qt::Key_V));
- mSaveMessageAction = new QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n("&Save message..."), this);
+ mSaveMessageAction
+ = new QAction(QIcon::fromTheme(QStringLiteral("document-save-as")), i18n(
+ "&Save message..."), this);
ac->addAction(QStringLiteral("save_message"), mSaveMessageAction);
connect(mSaveMessageAction, &QAction::triggered, this, &ViewerPrivate::slotSaveMessage);
//Laurent: conflict with kmail shortcut
@@ -1668,11 +1768,13 @@ void ViewerPrivate::createActions()
mSaveMessageDisplayFormat = new QAction(i18n("&Save Display Format"), this);
ac->addAction(QStringLiteral("save_message_display_format"), mSaveMessageDisplayFormat);
- connect(mSaveMessageDisplayFormat, &QAction::triggered, this, &ViewerPrivate::slotSaveMessageDisplayFormat);
+ connect(mSaveMessageDisplayFormat, &QAction::triggered, this,
+ &ViewerPrivate::slotSaveMessageDisplayFormat);
mResetMessageDisplayFormat = new QAction(i18n("&Reset Display Format"), this);
ac->addAction(QStringLiteral("reset_message_display_format"), mResetMessageDisplayFormat);
- connect(mResetMessageDisplayFormat, &QAction::triggered, this, &ViewerPrivate::slotResetMessageDisplayFormat);
+ connect(mResetMessageDisplayFormat, &QAction::triggered, this,
+ &ViewerPrivate::slotResetMessageDisplayFormat);
//
// Scroll actions
@@ -1711,15 +1813,18 @@ void ViewerPrivate::createActions()
ac->setDefaultShortcut(mToggleDisplayModeAction, QKeySequence(Qt::SHIFT + Qt::Key_H));
connect(mToggleDisplayModeAction, &QAction::triggered,
this, &ViewerPrivate::slotToggleHtmlMode);
- addHelpTextAction(mToggleDisplayModeAction, i18n("Toggle display mode between HTML and plain text"));
+ addHelpTextAction(mToggleDisplayModeAction,
+ i18n("Toggle display mode between HTML and plain text"));
// Load external reference
QAction *loadExternalReferenceAction = new QAction(i18n("Load external references"), this);
ac->addAction(QStringLiteral("load_external_reference"), loadExternalReferenceAction);
- ac->setDefaultShortcut(loadExternalReferenceAction, QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R));
+ ac->setDefaultShortcut(loadExternalReferenceAction,
+ QKeySequence(Qt::SHIFT + Qt::CTRL + Qt::Key_R));
connect(loadExternalReferenceAction, &QAction::triggered,
this, &ViewerPrivate::slotLoadExternalReference);
- addHelpTextAction(loadExternalReferenceAction, i18n("Load external references from the Internet for this message."));
+ addHelpTextAction(loadExternalReferenceAction,
+ i18n("Load external references from the Internet for this message."));
mSpeakTextAction = new QAction(i18n("Speak Text"), this);
mSpeakTextAction->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-text-to-speech")));
@@ -1734,14 +1839,17 @@ void ViewerPrivate::createActions()
connect(mCopyImageLocation, &QAction::triggered,
this, &ViewerPrivate::slotCopyImageLocation);
- mFindInMessageAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n("&Find in Message..."), this);
+ mFindInMessageAction
+ = new QAction(QIcon::fromTheme(QStringLiteral("edit-find")), i18n(
+ "&Find in Message..."), this);
ac->addAction(QStringLiteral("find_in_messages"), mFindInMessageAction);
connect(mFindInMessageAction, &QAction::triggered, this, &ViewerPrivate::slotFind);
ac->setDefaultShortcut(mFindInMessageAction, KStandardShortcut::find().first());
mShareServiceUrlMenu = mShareServiceManager->menu();
ac->addAction(QStringLiteral("shareservice_menu"), mShareServiceUrlMenu);
- connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this, &ViewerPrivate::slotServiceUrlSelected);
+ connect(mShareServiceManager, &PimCommon::ShareServiceUrlManager::serviceUrlSelected, this,
+ &ViewerPrivate::slotServiceUrlSelected);
mDisableEmoticonAction = new KToggleAction(i18n("Disable Emoticon"), this);
ac->addAction(QStringLiteral("disable_emoticon"), mDisableEmoticonAction);
@@ -1772,15 +1880,18 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
this, &ViewerPrivate::slotAttachmentSaveAs);
if (isAttachment) {
- popup.addAction(QIcon::fromTheme(QStringLiteral("document-open")), i18nc("to open", "Open"),
+ popup.addAction(QIcon::fromTheme(QStringLiteral("document-open")),
+ i18nc("to open", "Open"),
this, &ViewerPrivate::slotAttachmentOpen);
if (selectedContents().count() == 1) {
- createOpenWithMenu(&popup, QLatin1String(content->contentType()->mimeType()), false);
+ createOpenWithMenu(&popup, QLatin1String(content->contentType()->mimeType()),
+ false);
} else {
popup.addAction(i18n("Open With..."), this, &ViewerPrivate::slotAttachmentOpenWith);
}
- popup.addAction(i18nc("to view something", "View"), this, &ViewerPrivate::slotAttachmentView);
+ popup.addAction(i18nc("to view something",
+ "View"), this, &ViewerPrivate::slotAttachmentView);
}
}
@@ -1798,9 +1909,11 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
popup.addAction(QIcon::fromTheme("edit-delete"), i18n("Delete Attachment"),
this, SLOT(slotAttachmentDelete()));
#endif
- if (MessageViewer::MessageViewerSettings::self()->allowAttachmentEditing())
- popup.addAction(QIcon::fromTheme(QStringLiteral("document-properties")), i18n("Edit Attachment"),
+ if (MessageViewer::MessageViewerSettings::self()->allowAttachmentEditing()) {
+ popup.addAction(QIcon::fromTheme(QStringLiteral("document-properties")),
+ i18n("Edit Attachment"),
this, &ViewerPrivate::slotAttachmentEdit);
+ }
}
if (!content->isTopLevel()) {
@@ -1809,10 +1922,10 @@ void ViewerPrivate::showContextMenu(KMime::Content *content, const QPoint &pos)
}
popup.exec(mMimePartTree->viewport()->mapToGlobal(pos));
#endif
-
}
-KToggleAction *ViewerPrivate::actionForAttachmentStrategy(const MimeTreeParser::AttachmentStrategy *as)
+KToggleAction *ViewerPrivate::actionForAttachmentStrategy(
+ const MimeTreeParser::AttachmentStrategy *as)
{
if (!mActionCollection) {
return nullptr;
@@ -1840,12 +1953,14 @@ KToggleAction *ViewerPrivate::actionForAttachmentStrategy(const MimeTreeParser::
void ViewerPrivate::readGlobalOverrideCodec()
{
// if the global character encoding wasn't changed then there's nothing to do
- if (MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding() == mOldGlobalOverrideEncoding) {
+ if (MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding()
+ == mOldGlobalOverrideEncoding) {
return;
}
setOverrideEncoding(MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding());
- mOldGlobalOverrideEncoding = MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding();
+ mOldGlobalOverrideEncoding
+ = MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding();
}
const QTextCodec *ViewerPrivate::overrideCodec() const
@@ -1866,7 +1981,6 @@ static QColor nextColor(const QColor &c)
QString ViewerPrivate::renderAttachments(KMime::Content *node, const QColor &bgColor) const
{
-
if (!node) {
return QString();
}
@@ -1883,10 +1997,14 @@ QString ViewerPrivate::renderAttachments(KMime::Content *node, const QColor &bgC
}
QString align = headerStylePlugin()->alignment();
const QByteArray mediaTypeLower = node->contentType()->mediaType().toLower();
- const bool result = (mediaTypeLower == "message" || mediaTypeLower == "multipart" || node == mMessage.data());
- if (result)
+ const bool result
+ = (mediaTypeLower == "message" || mediaTypeLower == "multipart"
+ || node == mMessage.data());
+ if (result) {
html += QStringLiteral("<div style=\"background:%1; %2"
- "vertical-align:middle; float:%3;\">").arg(bgColor.name()).arg(margin).arg(align);
+ "vertical-align:middle; float:%3;\">").arg(bgColor.name()).
+ arg(margin).arg(align);
+ }
html += subHtml;
if (result) {
html += QLatin1String("</div>");
@@ -1896,11 +2014,13 @@ QString ViewerPrivate::renderAttachments(KMime::Content *node, const QColor &bgC
Util::AttachmentDisplayInfo info = Util::attachmentDisplayInfo(node);
if (info.displayInHeader) {
html += QLatin1String("<div style=\"float:left;\">");
- html += QStringLiteral("<span style=\"white-space:nowrap; border-width: 0px; border-left-width: 5px; border-color: %1; 2px; border-left-style: solid;\">").arg(bgColor.name());
+ html += QStringLiteral(
+ "<span style=\"white-space:nowrap; border-width: 0px; border-left-width: 5px; border-color: %1; 2px; border-left-style: solid;\">")
+ .arg(bgColor.name());
mNodeHelper->writeNodeToTempFile(node);
const QString href = mNodeHelper->asHREF(node, QStringLiteral("header"));
- html += QLatin1String("<a href=\"") + href +
- QLatin1String("\">");
+ html += QLatin1String("<a href=\"") + href
+ +QLatin1String("\">");
const QString imageMaxSize = QStringLiteral("width=\"16\" height=\"16\"");
#if 0
if (!info.icon.isEmpty()) {
@@ -1910,7 +2030,8 @@ QString ViewerPrivate::renderAttachments(KMime::Content *node, const QColor &bgC
}
}
#endif
- html += QStringLiteral("<img %1 style=\"vertical-align:middle;\" src=\"").arg(imageMaxSize) + info.icon + QLatin1String("\"/>&nbsp;");
+ html += QStringLiteral("<img %1 style=\"vertical-align:middle;\" src=\"").arg(
+ imageMaxSize) + info.icon + QLatin1String("\"/>&nbsp;");
const int elidedTextSize = headerStylePlugin()->elidedTextSize();
if (elidedTextSize == -1) {
html += info.label;
@@ -1927,7 +2048,7 @@ QString ViewerPrivate::renderAttachments(KMime::Content *node, const QColor &bgC
html += renderAttachments(extraNode, bgColor);
}
- KMime::Content *next = MessageCore::NodeHelper::nextSibling(node);
+ KMime::Content *next = MessageCore::NodeHelper::nextSibling(node);
if (next) {
html += renderAttachments(next, nextColor(bgColor));
}
@@ -1939,12 +2060,11 @@ KMime::Content *ViewerPrivate::findContentByType(KMime::Content *content, const
{
const auto list = content->contents();
for (KMime::Content *c : list) {
- if (c->contentType()->mimeType() == type) {
+ if (c->contentType()->mimeType() == type) {
return c;
}
}
return nullptr;
-
}
//-----------------------------------------------------------------------------
@@ -1995,7 +2115,9 @@ void ViewerPrivate::slotUrlOpen(const QUrl &url)
void ViewerPrivate::checkPhishingUrl()
{
- if (!PimCommon::NetworkUtil::self()->lowBandwidth() && MessageViewer::MessageViewerSettings::self()->checkPhishingUrl() && (mClickedUrl.scheme() != QLatin1String("mailto"))) {
+ if (!PimCommon::NetworkUtil::self()->lowBandwidth()
+ && MessageViewer::MessageViewerSettings::self()->checkPhishingUrl()
+ && (mClickedUrl.scheme() != QLatin1String("mailto"))) {
mPhishingDatabase->checkUrl(mClickedUrl);
} else {
executeRunner(mClickedUrl);
@@ -2010,14 +2132,16 @@ void ViewerPrivate::executeRunner(const QUrl &url)
}
}
-void ViewerPrivate::slotCheckedUrlFinished(const QUrl &url, WebEngineViewer::CheckPhishingUrlUtil::UrlStatus status)
+void ViewerPrivate::slotCheckedUrlFinished(const QUrl &url,
+ WebEngineViewer::CheckPhishingUrlUtil::UrlStatus status)
{
switch (status) {
case WebEngineViewer::CheckPhishingUrlUtil::BrokenNetwork:
KMessageBox::error(mMainWindow, i18n("The network is broken."), i18n("Check Phishing URL"));
break;
case WebEngineViewer::CheckPhishingUrlUtil::InvalidUrl:
- KMessageBox::error(mMainWindow, i18n("The URL %1 is not valid.", url.toString()), i18n("Check Phishing URL"));
+ KMessageBox::error(mMainWindow, i18n("The URL %1 is not valid.", url.toString()),
+ i18n("Check Phishing URL"));
break;
case WebEngineViewer::CheckPhishingUrlUtil::Ok:
break;
@@ -2035,7 +2159,11 @@ void ViewerPrivate::slotCheckedUrlFinished(const QUrl &url, WebEngineViewer::Che
bool ViewerPrivate::urlIsAMalwareButContinue()
{
- if (KMessageBox::No == KMessageBox::warningYesNo(mMainWindow, i18n("This web site is a malware, do you want to continue to show it?"), i18n("Malware"))) {
+ if (KMessageBox::No
+ == KMessageBox::warningYesNo(mMainWindow,
+ i18n(
+ "This web site is a malware, do you want to continue to show it?"),
+ i18n("Malware"))) {
return false;
}
return true;
@@ -2048,10 +2176,10 @@ void ViewerPrivate::slotUrlOn(const QString &link)
// to get the URL before WebKit managed to mangle it.
QUrl url(link);
const QString protocol = url.scheme();
- if (protocol == QLatin1String("kmail") ||
- protocol == QLatin1String("x-kmail") ||
- protocol == QLatin1String("attachment") ||
- (protocol.isEmpty() && url.path().isEmpty())) {
+ if (protocol == QLatin1String("kmail")
+ || protocol == QLatin1String("x-kmail")
+ || protocol == QLatin1String("attachment")
+ || (protocol.isEmpty() && url.path().isEmpty())) {
mViewer->setAcceptDrops(false);
} else {
mViewer->setAcceptDrops(true);
@@ -2157,9 +2285,11 @@ void ViewerPrivate::slotToggleFixedFont()
void ViewerPrivate::slotToggleMimePartTree()
{
if (mToggleMimePartTreeAction->isChecked()) {
- MessageViewer::MessageViewerSettings::self()->setMimeTreeMode(MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always);
+ MessageViewer::MessageViewerSettings::self()->setMimeTreeMode(
+ MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Always);
} else {
- MessageViewer::MessageViewerSettings::self()->setMimeTreeMode(MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Never);
+ MessageViewer::MessageViewerSettings::self()->setMimeTreeMode(
+ MessageViewer::MessageViewerSettings::EnumMimeTreeMode::Never);
}
showHideMimeTree();
}
@@ -2283,13 +2413,13 @@ void ViewerPrivate::slotHeaderOnlyAttachments()
void ViewerPrivate::attachmentView(KMime::Content *atmNode)
{
if (atmNode) {
-
const bool isEncapsulatedMessage = atmNode->parent() && atmNode->parent()->bodyIsMessage();
if (isEncapsulatedMessage) {
atmViewMsg(atmNode->parent()->bodyAsMessage());
- } else if ((qstricmp(atmNode->contentType()->mediaType().constData(), "text") == 0) &&
- ((qstricmp(atmNode->contentType()->subType().constData(), "x-vcard") == 0) ||
- (qstricmp(atmNode->contentType()->subType().constData(), "directory") == 0))) {
+ } else if ((qstricmp(atmNode->contentType()->mediaType().constData(), "text") == 0)
+ && ((qstricmp(atmNode->contentType()->subType().constData(), "x-vcard") == 0)
+ || (qstricmp(atmNode->contentType()->subType().constData(),
+ "directory") == 0))) {
setMessagePart(atmNode);
} else {
Q_EMIT showReader(atmNode, htmlMail(), overrideEncoding());
@@ -2304,12 +2434,17 @@ void ViewerPrivate::slotDelayedResize()
void ViewerPrivate::slotPrintPreview()
{
- disconnect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintPreview);
+ disconnect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintPreview);
if (!mMessage) {
return;
}
- QPointer<WebEngineViewer::WebEnginePrintMessageBox> dialog = new WebEngineViewer::WebEnginePrintMessageBox(q);
- connect(dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openInBrowser, this, &ViewerPrivate::slotOpenInBrowser);
+ QPointer<WebEngineViewer::WebEnginePrintMessageBox> dialog
+ = new WebEngineViewer::WebEnginePrintMessageBox(q);
+ connect(
+ dialog.data(), &WebEngineViewer::WebEnginePrintMessageBox::openInBrowser, this,
+ &ViewerPrivate::slotOpenInBrowser);
if (!dialog->exec()) {
Q_EMIT printingFinished();
}
@@ -2318,10 +2453,13 @@ void ViewerPrivate::slotPrintPreview()
void ViewerPrivate::slotOpenInBrowser()
{
- WebEngineViewer::WebEngineExportHtmlPageJob *job = new WebEngineViewer::WebEngineExportHtmlPageJob;
+ WebEngineViewer::WebEngineExportHtmlPageJob *job
+ = new WebEngineViewer::WebEngineExportHtmlPageJob;
job->setEngineView(mViewer);
- connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::failed, this, &ViewerPrivate::slotExportHtmlPageFailed);
- connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::success, this, &ViewerPrivate::slotExportHtmlPageSuccess);
+ connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::failed, this,
+ &ViewerPrivate::slotExportHtmlPageFailed);
+ connect(job, &WebEngineViewer::WebEngineExportHtmlPageJob::success, this,
+ &ViewerPrivate::slotExportHtmlPageSuccess);
job->start();
}
@@ -2343,7 +2481,9 @@ void ViewerPrivate::slotExportHtmlPageFailed()
void ViewerPrivate::slotPrintMessage()
{
- disconnect(mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this, &ViewerPrivate::slotPrintMessage);
+ disconnect(
+ mPartHtmlWriter.data(), &WebEnginePartHtmlWriter::finished, this,
+ &ViewerPrivate::slotPrintMessage);
if (!mMessage) {
return;
@@ -2381,7 +2521,8 @@ void ViewerPrivate::slotSetEncoding()
if (mSelectEncodingAction->currentItem() == 0) { // Auto
mOverrideEncoding.clear();
} else {
- mOverrideEncoding = MimeTreeParser::NodeHelper::encodingForName(mSelectEncodingAction->currentText());
+ mOverrideEncoding = MimeTreeParser::NodeHelper::encodingForName(
+ mSelectEncodingAction->currentText());
}
update(MimeTreeParser::Force);
}
@@ -2394,15 +2535,17 @@ HeaderStylePlugin *ViewerPrivate::headerStylePlugin() const
QString ViewerPrivate::attachmentInjectionHtml()
{
-
- const QColor background = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
+ const QColor background
+ = KColorScheme(QPalette::Active, KColorScheme::View).background().color();
QString html = renderAttachments(mMessage.data(), background);
if (html.isEmpty()) {
return QString();
}
- const QString listVisibility = !mShowAttachmentQuicklist ? QStringLiteral("style=\"display:none;\"") : QString();
- html = QStringLiteral("<div id=\"attachmentlist\" %1>").arg(listVisibility) + html + QStringLiteral("</div>");
+ const QString listVisibility = !mShowAttachmentQuicklist ? QStringLiteral(
+ "style=\"display:none;\"") : QString();
+ html = QStringLiteral("<div id=\"attachmentlist\" %1>").arg(listVisibility) + html
+ + QStringLiteral("</div>");
const QString urlHandleShow = QStringLiteral("kmail:showAttachmentQuicklist");
const QString imgSrcShow = QStringLiteral("quicklistClosed.png");
@@ -2419,26 +2562,36 @@ QString ViewerPrivate::attachmentInjectionHtml()
}
const QString visibility = QStringLiteral("style=\"display:none;\"");
- link += QStringLiteral("<div style=\"text-align: %1;\">").arg(textAlign) +
- QStringLiteral("<a id=\"kmailshowattachment\" href=\"%1\" %2>").arg(urlHandleShow).arg(mShowAttachmentQuicklist ? QString() : visibility) +
- QStringLiteral("<img src=\"%1\">").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcShow)).url()) +
- QStringLiteral("</a>") +
- QStringLiteral("<a id=\"kmailhideattachment\" href=\"%1\" %2>").arg(urlHandleHide).arg(mShowAttachmentQuicklist ? visibility : QString()) +
- QStringLiteral("<img src=\"%1\">").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcHide)).url()) +
- QStringLiteral("</a>") +
- QStringLiteral("</div>");
+ link += QStringLiteral("<div style=\"text-align: %1;\">").arg(textAlign)
+ +QStringLiteral("<a id=\"kmailshowattachment\" href=\"%1\" %2>").arg(urlHandleShow).arg(
+ mShowAttachmentQuicklist ? QString() : visibility)
+ +QStringLiteral("<img src=\"%1\">").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache
+ ::instance()->
+ iconPathFromLocal(
+ imgSrcShow)).url())
+ +QStringLiteral("</a>")
+ +QStringLiteral("<a id=\"kmailhideattachment\" href=\"%1\" %2>").arg(urlHandleHide).arg(
+ mShowAttachmentQuicklist ? visibility : QString())
+ +QStringLiteral("<img src=\"%1\">").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache
+ ::instance()->
+ iconPathFromLocal(
+ imgSrcHide)).url())
+ +QStringLiteral("</a>")
+ +QStringLiteral("</div>");
html.prepend(link);
if (isFancyTheme) {
- html.prepend(QStringLiteral("<div style=\"float:left;\">%1&nbsp;</div>").arg(i18n("Attachments:")));
+ html.prepend(QStringLiteral("<div style=\"float:left;\">%1&nbsp;</div>").arg(i18n(
+ "Attachments:")));
}
return html;
}
void ViewerPrivate::executeCustomScriptsAfterLoading()
{
- disconnect(mViewer, &MailWebEngineView::loadFinished, this, &ViewerPrivate::executeCustomScriptsAfterLoading);
+ disconnect(mViewer, &MailWebEngineView::loadFinished, this,
+ &ViewerPrivate::executeCustomScriptsAfterLoading);
// inject attachments in header view
// we have to do that after the otp has run so we also see encrypted parts
@@ -2498,7 +2651,7 @@ void ViewerPrivate::showOpenAttachmentFolderWidget(const QUrl &url)
bool ViewerPrivate::mimePartTreeIsEmpty() const
{
#ifndef QT_NO_TREEVIEW
- return (mMimePartTree->model()->rowCount() == 0);
+ return mMimePartTree->model()->rowCount() == 0;
#else
return false;
#endif
@@ -2509,7 +2662,8 @@ void ViewerPrivate::setPluginName(const QString &pluginName)
mHeaderStyleMenuManager->setPluginName(pluginName);
}
-QList<QAction *> ViewerPrivate::viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features)
+QList<QAction *> ViewerPrivate::viewerPluginActionList(
+ ViewerPluginInterface::SpecificFeatureTypes features)
{
if (mViewerPluginToolManager) {
return mViewerPluginToolManager->viewerPluginActionList(features);
@@ -2554,7 +2708,6 @@ void ViewerPrivate::slotAttachmentView()
for (KMime::Content *content : contents) {
attachmentView(content);
}
-
}
void ViewerPrivate::slotAttachmentProperties()
@@ -2572,7 +2725,8 @@ void ViewerPrivate::slotAttachmentProperties()
void ViewerPrivate::attachmentProperties(KMime::Content *content)
{
- MessageCore::AttachmentPropertiesDialog *dialog = new MessageCore::AttachmentPropertiesDialog(content, mMainWindow);
+ MessageCore::AttachmentPropertiesDialog *dialog = new MessageCore::AttachmentPropertiesDialog(
+ content, mMainWindow);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
@@ -2673,9 +2827,11 @@ void ViewerPrivate::slotHandleAttachment(int choice)
case Viewer::Properties:
attachmentProperties(mCurrentContent);
break;
- case Viewer::Save: {
+ case Viewer::Save:
+ {
QUrl currentUrl;
- if (Util::saveContents(mMainWindow, KMime::Content::List() << mCurrentContent, currentUrl)) {
+ if (Util::saveContents(mMainWindow, KMime::Content::List() << mCurrentContent,
+ currentUrl)) {
showOpenAttachmentFolderWidget(currentUrl);
}
break;
@@ -2761,7 +2917,8 @@ void ViewerPrivate::slotCopySelectedText()
void ViewerPrivate::viewerSelectionChanged()
{
- mActionCollection->action(QStringLiteral("kmail_copy"))->setEnabled(!mViewer->selectedText().isEmpty());
+ mActionCollection->action(QStringLiteral("kmail_copy"))->setEnabled(
+ !mViewer->selectedText().isEmpty());
}
void ViewerPrivate::selectAll()
@@ -2811,14 +2968,14 @@ bool ViewerPrivate::htmlMail() const
if (mDisplayFormatMessageOverwrite == Viewer::UseGlobalSetting) {
return mHtmlMailGlobalSetting;
} else {
- return (mDisplayFormatMessageOverwrite == Viewer::Html);
+ return mDisplayFormatMessageOverwrite == Viewer::Html;
}
}
bool ViewerPrivate::htmlLoadExternal() const
{
- return ((mHtmlLoadExternalGlobalSetting && !mHtmlLoadExtOverride) ||
- (!mHtmlLoadExternalGlobalSetting && mHtmlLoadExtOverride));
+ return (mHtmlLoadExternalGlobalSetting && !mHtmlLoadExtOverride)
+ || (!mHtmlLoadExternalGlobalSetting && mHtmlLoadExtOverride);
}
void ViewerPrivate::setDisplayFormatMessageOverwrite(Viewer::DisplayFormatMessage format)
@@ -2902,7 +3059,9 @@ void ViewerPrivate::scrollToAttachment(KMime::Content *node)
// Now, color the div of the attachment in yellow, so that the user sees what happened.
// We created a special marked div for this in writeAttachmentMarkHeader() in ObjectTreeParser,
// find and modify that now.
- mViewer->markAttachment(QLatin1String("attachmentDiv") + indexStr, QStringLiteral("border:2px solid %1").arg(cssHelper()->pgpWarnColor().name()));
+ mViewer->markAttachment(QLatin1String("attachmentDiv") + indexStr,
+ QStringLiteral("border:2px solid %1").arg(cssHelper()->pgpWarnColor().
+ name()));
}
void ViewerPrivate::setUseFixedFont(bool useFixedFont)
@@ -2921,26 +3080,39 @@ void ViewerPrivate::toggleFullAddressList()
QString ViewerPrivate::recipientsQuickListLinkHtml(const QString &field)
{
- const QString urlHandleShow = QLatin1String("kmail:hideFull") + field + QLatin1String("AddressList");
+ const QString urlHandleShow = QLatin1String("kmail:hideFull") + field + QLatin1String(
+ "AddressList");
const QString imgSrcShow = QStringLiteral("quicklistOpened.png");
- const QString urlHandleHide = QLatin1String("kmail:showFull") + field + QLatin1String("AddressList");
+ const QString urlHandleHide = QLatin1String("kmail:showFull") + field + QLatin1String(
+ "AddressList");
const QString imgSrcHide = QStringLiteral("quicklistClosed.png");
const QString visibility = QStringLiteral("style=\"display:none;\"");
- return QStringLiteral("<span style=\"text-align: right;\">") +
- QStringLiteral("<a id=\"kmail%2show\" href=\"%1\">").arg(urlHandleShow).arg(field) +
- QStringLiteral("<img src=\"%1\" alt=\"%2\" />").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcShow)).url(), /*altTextShow*/QString()) +
- QStringLiteral("</a>") +
- QStringLiteral("<a id=\"kmail%2hide\" href=\"%1\" %3>").arg(urlHandleHide).arg(field).arg(visibility) +
- QStringLiteral("<img src=\"%1\" alt=\"%2\" />").arg(QUrl::fromLocalFile(MessageViewer::IconNameCache::instance()->iconPathFromLocal(imgSrcHide)).url(), /*altTextHide*/QString()) +
- QStringLiteral("</a>") +
- QStringLiteral("</span>");
+ return QStringLiteral("<span style=\"text-align: right;\">")
+ +QStringLiteral("<a id=\"kmail%2show\" href=\"%1\">").arg(urlHandleShow).arg(field)
+ +QStringLiteral("<img src=\"%1\" alt=\"%2\" />").arg(QUrl::fromLocalFile(MessageViewer::
+ IconNameCache::
+ instance()->
+ iconPathFromLocal(
+ imgSrcShow)).url(), /*altTextShow*/ QString())
+ +QStringLiteral("</a>")
+ +QStringLiteral("<a id=\"kmail%2hide\" href=\"%1\" %3>").arg(urlHandleHide).arg(field).
+ arg(visibility)
+ +QStringLiteral("<img src=\"%1\" alt=\"%2\" />").arg(QUrl::fromLocalFile(MessageViewer::
+ IconNameCache::
+ instance()->
+ iconPathFromLocal(
+ imgSrcHide)).url(), /*altTextHide*/ QString())
+ +QStringLiteral("</a>")
+ +QStringLiteral("</span>");
}
void ViewerPrivate::toggleFullAddressList(const QString &field)
{
if (field == QLatin1String("To") || (field == QLatin1String("Cc"))) {
- mViewer->toggleFullAddressList(field, bind(&ViewerPrivate::recipientsQuickListLinkHtml, this, field));
+ mViewer->toggleFullAddressList(field,
+ bind(&ViewerPrivate::recipientsQuickListLinkHtml, this,
+ field));
}
}
@@ -3025,7 +3197,8 @@ void ViewerPrivate::goResourceOnline()
void ViewerPrivate::slotSaveMessageDisplayFormat()
{
if (mMessageItem.isValid()) {
- MessageViewer::ModifyMessageDisplayFormatJob *job = new MessageViewer::ModifyMessageDisplayFormatJob(this);
+ MessageViewer::ModifyMessageDisplayFormatJob *job
+ = new MessageViewer::ModifyMessageDisplayFormatJob(this);
job->setMessageFormat(displayFormatMessageOverwrite());
job->setMessageItem(mMessageItem);
job->setRemoteContent(htmlLoadExtOverride());
@@ -3037,7 +3210,8 @@ void ViewerPrivate::slotResetMessageDisplayFormat()
{
if (mMessageItem.isValid()) {
if (mMessageItem.hasAttribute<MessageViewer::MessageDisplayFormatAttribute>()) {
- MessageViewer::ModifyMessageDisplayFormatJob *job = new MessageViewer::ModifyMessageDisplayFormatJob(this);
+ MessageViewer::ModifyMessageDisplayFormatJob *job
+ = new MessageViewer::ModifyMessageDisplayFormatJob(this);
job->setMessageItem(mMessageItem);
job->setResetFormat(true);
job->start();
@@ -3049,15 +3223,19 @@ void ViewerPrivate::slotMessageMayBeAScam()
{
if (mMessageItem.isValid()) {
if (mMessageItem.hasAttribute<MessageViewer::ScamAttribute>()) {
- const MessageViewer::ScamAttribute *const attr = mMessageItem.attribute<MessageViewer::ScamAttribute>();
+ const MessageViewer::ScamAttribute *const attr
+ = mMessageItem.attribute<MessageViewer::ScamAttribute>();
if (attr && !attr->isAScam()) {
return;
}
}
if (mMessageItem.hasPayload<KMime::Message::Ptr>()) {
KMime::Message::Ptr message = mMessageItem.payload<KMime::Message::Ptr>();
- const QString email = QLatin1String(KEmailAddress::firstEmailAddress(message->from()->as7BitString(false)));
- const QStringList lst = MessageViewer::MessageViewerSettings::self()->scamDetectionWhiteList();
+ const QString email
+ = QLatin1String(KEmailAddress::firstEmailAddress(message->from()->as7BitString(
+ false)));
+ const QStringList lst
+ = MessageViewer::MessageViewerSettings::self()->scamDetectionWhiteList();
if (lst.contains(email)) {
return;
}
@@ -3069,7 +3247,8 @@ void ViewerPrivate::slotMessageMayBeAScam()
void ViewerPrivate::slotMessageIsNotAScam()
{
if (mMessageItem.isValid()) {
- MessageViewer::ScamAttribute *attr = mMessageItem.attribute<MessageViewer::ScamAttribute>(Akonadi::Item::AddIfMissing);
+ MessageViewer::ScamAttribute *attr = mMessageItem.attribute<MessageViewer::ScamAttribute>(
+ Akonadi::Item::AddIfMissing);
attr->setIsAScam(false);
Akonadi::ItemModifyJob *modify = new Akonadi::ItemModifyJob(mMessageItem);
modify->setIgnorePayload(true);
@@ -3100,8 +3279,11 @@ void ViewerPrivate::slotAddToWhiteList()
if (mMessageItem.isValid()) {
if (mMessageItem.hasPayload<KMime::Message::Ptr>()) {
KMime::Message::Ptr message = mMessageItem.payload<KMime::Message::Ptr>();
- const QString email = QLatin1String(KEmailAddress::firstEmailAddress(message->from()->as7BitString(false)));
- QStringList lst = MessageViewer::MessageViewerSettings::self()->scamDetectionWhiteList();
+ const QString email
+ = QLatin1String(KEmailAddress::firstEmailAddress(message->from()->as7BitString(
+ false)));
+ QStringList lst
+ = MessageViewer::MessageViewerSettings::self()->scamDetectionWhiteList();
if (lst.contains(email)) {
return;
}
@@ -3131,13 +3313,16 @@ void ViewerPrivate::slotRefreshMessage(const Akonadi::Item &item)
}
}
-void ViewerPrivate::slotServiceUrlSelected(PimCommon::ShareServiceUrlManager::ServiceType serviceType)
+void ViewerPrivate::slotServiceUrlSelected(
+ PimCommon::ShareServiceUrlManager::ServiceType serviceType)
{
- const QUrl url = mShareServiceManager->generateServiceUrl(mClickedUrl.toString(), QString(), serviceType);
+ const QUrl url = mShareServiceManager->generateServiceUrl(mClickedUrl.toString(),
+ QString(), serviceType);
mShareServiceManager->openUrl(url);
}
-QList<QAction *> ViewerPrivate::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const
+QList<QAction *> ViewerPrivate::interceptorUrlActions(
+ const WebEngineViewer::WebHitTestResult &result) const
{
return mViewer->interceptorUrlActions(result);
}
@@ -3149,6 +3334,6 @@ void ViewerPrivate::setPrintElementBackground(bool printElementBackground)
void ViewerPrivate::slotToggleEmoticons()
{
- mForceEmoticons = !mForceEmoticons;
- update(MimeTreeParser::Force);
+ mForceEmoticons = !mForceEmoticons;
+ update(MimeTreeParser::Force);
}
diff --git a/messageviewer/src/viewer/viewer_p.h b/messageviewer/src/viewer/viewer_p.h
index ac885ca..b38f974 100644
--- a/messageviewer/src/viewer/viewer_p.h
+++ b/messageviewer/src/viewer/viewer_p.h
@@ -40,8 +40,7 @@
#include <QObject>
#include <QTimer>
-namespace KIO
-{
+namespace KIO {
class Job;
}
@@ -57,32 +56,27 @@ class QSplitter;
class QModelIndex;
class QPrinter;
-namespace KPIMTextEdit
-{
+namespace KPIMTextEdit {
class SlideContainer;
class TextToSpeechWidget;
}
-namespace PimCommon
-{
+namespace PimCommon {
class ShareServiceUrlManager;
}
-namespace MimeTreeParser
-{
+namespace MimeTreeParser {
class AttachmentStrategy;
class HtmlWriter;
class ObjectTreeParser;
}
-namespace WebEngineViewer
-{
+namespace WebEngineViewer {
class WebHitTestResult;
class FindBarWebEngineView;
class ZoomActionMenu;
class LocalDataBaseManager;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class HeaderStylePlugin;
class CSSHelper;
class MailWebEngineView;
@@ -234,7 +228,8 @@ public:
*/
void prepareHandleAttachment(KMime::Content *node);
- void postProcessMessage(MimeTreeParser::ObjectTreeParser *otp, MimeTreeParser::KMMsgEncryptionState encryptionState);
+ void postProcessMessage(MimeTreeParser::ObjectTreeParser *otp,
+ MimeTreeParser::KMMsgEncryptionState encryptionState);
QString createAtmFileLink(const QString &atmFileName) const;
KService::Ptr getServiceOffer(KMime::Content *content);
@@ -261,7 +256,8 @@ public:
bool decryptMessage() const;
/** Display a generic HTML splash page instead of a message. */
- void displaySplashPage(const QString &templateName, const QVariantHash &data, const QByteArray &domain = QByteArray());
+ void displaySplashPage(const QString &templateName, const QVariantHash &data,
+ const QByteArray &domain = QByteArray());
void displaySplashPage(const QString &message);
@@ -320,20 +316,23 @@ public:
void resetStateForNewMessage();
- void setMessageInternal(const KMime::Message::Ptr &message, MimeTreeParser::UpdateMode updateMode);
+ void setMessageInternal(const KMime::Message::Ptr &message,
+ MimeTreeParser::UpdateMode updateMode);
/** Set the Akonadi item that will be displayed.
* @param item - the Akonadi item to be displayed. If it doesn't hold a mail (KMime::Message::Ptr as payload data),
* an empty page is shown.
* @param updateMode - update the display immediately or not. See MailViewer::UpdateMode.
*/
- void setMessageItem(const Akonadi::Item &item, MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
+ void setMessageItem(const Akonadi::Item &item,
+ MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
/** Set the message that shall be shown.
* @param msg - the message to be shown. If 0, an empty page is displayed.
* @param updateMode - update the display immediately or not. See MailViewer::UpdateMode.
*/
- void setMessage(const KMime::Message::Ptr &msg, MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
+ void setMessage(const KMime::Message::Ptr &msg,
+ MimeTreeParser::UpdateMode updateMode = MimeTreeParser::Delayed);
/** Instead of settings a message to be shown sets a message part
to be shown */
@@ -422,7 +421,8 @@ public:
void setPluginName(const QString &pluginName);
- QList<QAction *> viewerPluginActionList(MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
+ QList<QAction *> viewerPluginActionList(
+ MessageViewer::ViewerPluginInterface::SpecificFeatureTypes features);
QList<QAction *> interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const;
void setPrintElementBackground(bool printElementBackground);
@@ -445,7 +445,8 @@ private Q_SLOTS:
void itemFetchResult(KJob *job);
void slotItemChanged(const Akonadi::Item &item, const QSet<QByteArray> &partIdentifiers);
- void slotItemMoved(const Akonadi::Item &, const Akonadi::Collection &, const Akonadi::Collection &);
+ void slotItemMoved(const Akonadi::Item &, const Akonadi::Collection &,
+ const Akonadi::Collection &);
void itemModifiedResult(KJob *job);
@@ -570,8 +571,10 @@ public Q_SLOTS:
Q_SIGNALS:
void showStatusBarMessage(const QString &message);
void replaceMsgByUnencryptedVersion();
- void popupMenu(const Akonadi::Item &msg, const QUrl &url, const QUrl &imageUrl, const QPoint &mousePos);
- void displayPopupMenu(const Akonadi::Item &msg, const WebEngineViewer::WebHitTestResult &result, const QPoint &mousePos);
+ void popupMenu(const Akonadi::Item &msg, const QUrl &url, const QUrl &imageUrl,
+ const QPoint &mousePos);
+ void displayPopupMenu(const Akonadi::Item &msg, const WebEngineViewer::WebHitTestResult &result,
+ const QPoint &mousePos);
void urlClicked(const Akonadi::Item &msg, const QUrl &url);
void requestConfigSync();
@@ -598,7 +601,8 @@ private:
void replyMessageToAll(KMime::Content *atmNode);
bool urlIsAMalwareButContinue();
- void slotCheckedUrlFinished(const QUrl &url, WebEngineViewer::CheckPhishingUrlUtil::UrlStatus status);
+ void slotCheckedUrlFinished(const QUrl &url,
+ WebEngineViewer::CheckPhishingUrlUtil::UrlStatus status);
MimeTreeParser::NodeHelper *mNodeHelper;
public:
@@ -698,7 +702,6 @@ public:
QList<QPointer<MessageViewer::MailSourceWebEngineViewer> > mListMailSourceViewer;
WebEngineViewer::LocalDataBaseManager *mPhishingDatabase;
};
-
}
#endif
diff --git a/messageviewer/src/viewer/webengine/autotests/mailwebenginescripttest.cpp b/messageviewer/src/viewer/webengine/autotests/mailwebenginescripttest.cpp
index c078d18..ec2f7cd 100644
--- a/messageviewer/src/viewer/webengine/autotests/mailwebenginescripttest.cpp
+++ b/messageviewer/src/viewer/webengine/autotests/mailwebenginescripttest.cpp
@@ -25,18 +25,18 @@
MailWebEngineScriptTest::MailWebEngineScriptTest(QObject *parent)
: QObject(parent)
{
-
}
MailWebEngineScriptTest::~MailWebEngineScriptTest()
{
-
}
void MailWebEngineScriptTest::shouldInjectAttachment()
{
const QString expectedResult = QStringLiteral("qt.jQuery('#bla').append('foo')");
- QString script = MessageViewer::MailWebEngineScript::injectAttachments(QStringLiteral("foo"), QStringLiteral("bla"));
+ QString script = MessageViewer::MailWebEngineScript::injectAttachments(QStringLiteral(
+ "foo"),
+ QStringLiteral("bla"));
// skip the checks at the beginning of the script
script = script.mid(script.indexOf(QLatin1Char('\n')) + 1);
script = script.mid(script.indexOf(QLatin1Char('\n')) + 1);
@@ -45,8 +45,12 @@ void MailWebEngineScriptTest::shouldInjectAttachment()
void MailWebEngineScriptTest::shouldReplaceInnerHtml()
{
- const QString expectedResult = QStringLiteral("qt.jQuery('#iconFullGGAddressList').append('<a>hello word</a>')");
- QString script = MessageViewer::MailWebEngineScript::replaceInnerHtml(QStringLiteral("GG"), QStringLiteral("<a>hello word</a>"));
+ const QString expectedResult = QStringLiteral(
+ "qt.jQuery('#iconFullGGAddressList').append('<a>hello word</a>')");
+ QString script = MessageViewer::MailWebEngineScript::replaceInnerHtml(QStringLiteral(
+ "GG"),
+ QStringLiteral(
+ "<a>hello word</a>"));
// skip the checks at the beginning of the script
script = script.mid(script.indexOf(QLatin1Char('\n')) + 1);
QCOMPARE(script, expectedResult);
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
index 7a23f71..acff59d 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.cpp
@@ -26,7 +26,6 @@ using namespace MessageViewer;
BlockExternalResourcesUrlInterceptor::BlockExternalResourcesUrlInterceptor(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
{
-
}
BlockExternalResourcesUrlInterceptor::~BlockExternalResourcesUrlInterceptor()
@@ -37,28 +36,28 @@ bool BlockExternalResourcesUrlInterceptor::interceptRequest(QWebEngineUrlRequest
{
const QWebEngineUrlRequestInfo::ResourceType resourceType = info.resourceType();
const QWebEngineUrlRequestInfo::NavigationType navigationType = info.navigationType();
- if (resourceType == QWebEngineUrlRequestInfo::ResourceTypeMedia ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypePing ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypePrefetch ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeFavicon ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeXhr ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeObject ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeScript ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeServiceWorker ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeSharedWorker ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeWorker ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeSubResource ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypePluginResource ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeCspReport ||
- resourceType == QWebEngineUrlRequestInfo::ResourceTypeUnknown) {
+ if (resourceType == QWebEngineUrlRequestInfo::ResourceTypeMedia
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypePing
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypePrefetch
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeFavicon
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeXhr
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeObject
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeScript
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeServiceWorker
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeSharedWorker
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeWorker
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeSubResource
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypePluginResource
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeCspReport
+ || resourceType == QWebEngineUrlRequestInfo::ResourceTypeUnknown) {
return true;
} else if (navigationType == QWebEngineUrlRequestInfo::NavigationTypeFormSubmitted) {
Q_EMIT formSubmittedForbidden();
return true;
- } else if (navigationType == QWebEngineUrlRequestInfo::NavigationTypeReload ||
- navigationType == QWebEngineUrlRequestInfo::NavigationTypeTyped ||
- navigationType == QWebEngineUrlRequestInfo::NavigationTypeBackForward ||
- navigationType == QWebEngineUrlRequestInfo::NavigationTypeOther) {
+ } else if (navigationType == QWebEngineUrlRequestInfo::NavigationTypeReload
+ || navigationType == QWebEngineUrlRequestInfo::NavigationTypeTyped
+ || navigationType == QWebEngineUrlRequestInfo::NavigationTypeBackForward
+ || navigationType == QWebEngineUrlRequestInfo::NavigationTypeOther) {
return true;
}
return false;
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
index 179c202..237c1c4 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/blockexternalresourcesurlinterceptor.h
@@ -21,9 +21,9 @@
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
-namespace MessageViewer
-{
-class BlockExternalResourcesUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
+namespace MessageViewer {
+class BlockExternalResourcesUrlInterceptor : public WebEngineViewer::
+ NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
index 2757a8a..2ac7b0c 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
@@ -29,16 +29,15 @@ public:
LoadExternalReferencesUrlInterceptorPrivate()
: mAllowLoadExternalReference(false)
{
-
}
+
bool mAllowLoadExternalReference;
};
LoadExternalReferencesUrlInterceptor::LoadExternalReferencesUrlInterceptor(QObject *parent)
- : WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent),
- d(new LoadExternalReferencesUrlInterceptorPrivate)
+ : WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
+ , d(new LoadExternalReferencesUrlInterceptorPrivate)
{
-
}
LoadExternalReferencesUrlInterceptor::~LoadExternalReferencesUrlInterceptor()
@@ -52,8 +51,8 @@ bool LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequest
return false;
} else {
if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeImage
- && !info.requestUrl().isLocalFile()
- && (info.requestUrl().scheme() != QLatin1String("cid"))) {
+ && !info.requestUrl().isLocalFile()
+ && (info.requestUrl().scheme() != QLatin1String("cid"))) {
return true;
} else if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeMedia) {
return true;
diff --git a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.h b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.h
index 71fd210..27de272 100644
--- a/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.h
+++ b/messageviewer/src/viewer/webengine/blockexternalresourcesurlinterceptor/loadexternalreferencesurlinterceptor.h
@@ -21,10 +21,10 @@
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
-namespace MessageViewer
-{
+namespace MessageViewer {
class LoadExternalReferencesUrlInterceptorPrivate;
-class LoadExternalReferencesUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
+class LoadExternalReferencesUrlInterceptor : public WebEngineViewer::
+ NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
diff --git a/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp
index 61ad52f..56c1fca 100644
--- a/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.cpp
@@ -27,7 +27,6 @@ using namespace MessageViewer;
CidReferencesUrlInterceptor::CidReferencesUrlInterceptor(QObject *parent)
: WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
{
-
}
CidReferencesUrlInterceptor::~CidReferencesUrlInterceptor()
@@ -38,7 +37,8 @@ bool CidReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequestInfo &inf
{
const QUrl urlRequestUrl(info.requestUrl());
if (urlRequestUrl.scheme() == QLatin1String("cid")) {
- const QString newUrl = MessageViewer::WebEngineEmbedPart::self()->contentUrl(urlRequestUrl.path());
+ const QString newUrl = MessageViewer::WebEngineEmbedPart::self()->contentUrl(
+ urlRequestUrl.path());
if (!newUrl.isEmpty()) {
info.redirect(QUrl(newUrl));
}
diff --git a/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.h b/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.h
index 9de2ab3..89d056e 100644
--- a/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.h
+++ b/messageviewer/src/viewer/webengine/cidreferencesurlinterceptor/cidreferencesurlinterceptor.h
@@ -22,8 +22,7 @@
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
-namespace MessageViewer
-{
+namespace MessageViewer {
class CidReferencesUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
diff --git a/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp b/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
index 36d53d9..3a9d5ab 100644
--- a/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
+++ b/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.cpp
@@ -29,16 +29,15 @@ public:
LoadExternalReferencesUrlInterceptorPrivate()
: mAllowLoadExternalReference(false)
{
-
}
+
bool mAllowLoadExternalReference;
};
LoadExternalReferencesUrlInterceptor::LoadExternalReferencesUrlInterceptor(QObject *parent)
- : WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent),
- d(new LoadExternalReferencesUrlInterceptorPrivate)
+ : WebEngineViewer::NetworkPluginUrlInterceptorInterface(parent)
+ , d(new LoadExternalReferencesUrlInterceptorPrivate)
{
-
}
LoadExternalReferencesUrlInterceptor::~LoadExternalReferencesUrlInterceptor()
@@ -52,8 +51,8 @@ bool LoadExternalReferencesUrlInterceptor::interceptRequest(QWebEngineUrlRequest
return false;
} else {
if (info.resourceType() == QWebEngineUrlRequestInfo::ResourceTypeImage
- && !info.requestUrl().isLocalFile()
- && (info.requestUrl().scheme() != QLatin1String("cid"))) {
+ && !info.requestUrl().isLocalFile()
+ && (info.requestUrl().scheme() != QLatin1String("cid"))) {
return true;
}
}
diff --git a/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h b/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h
index 71fd210..27de272 100644
--- a/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h
+++ b/messageviewer/src/viewer/webengine/loadexternalreferencesurlinterceptor/loadexternalreferencesurlinterceptor.h
@@ -21,10 +21,10 @@
#include <WebEngineViewer/NetworkPluginUrlInterceptorInterface>
-namespace MessageViewer
-{
+namespace MessageViewer {
class LoadExternalReferencesUrlInterceptorPrivate;
-class LoadExternalReferencesUrlInterceptor : public WebEngineViewer::NetworkPluginUrlInterceptorInterface
+class LoadExternalReferencesUrlInterceptor : public WebEngineViewer::
+ NetworkPluginUrlInterceptorInterface
{
Q_OBJECT
public:
diff --git a/messageviewer/src/viewer/webengine/mailwebenginepage.cpp b/messageviewer/src/viewer/webengine/mailwebenginepage.cpp
index 859da5d..12c2681 100644
--- a/messageviewer/src/viewer/webengine/mailwebenginepage.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebenginepage.cpp
@@ -37,7 +37,6 @@ MailWebEnginePage::MailWebEnginePage(QWebEngineProfile *profile, QObject *parent
MailWebEnginePage::~MailWebEnginePage()
{
-
}
void MailWebEnginePage::initialize()
@@ -70,7 +69,6 @@ void MailWebEnginePage::initialize()
settings()->setFontSize(QWebEngineSettings::DefaultFontSize, font.pixelSize());
connect(this, &QWebEnginePage::featurePermissionRequested,
this, &MailWebEnginePage::slotFeaturePermissionRequested);
-
}
void MailWebEnginePage::setPrintElementBackground(bool printElementBackground)
@@ -82,7 +80,8 @@ void MailWebEnginePage::setPrintElementBackground(bool printElementBackground)
#endif
}
-void MailWebEnginePage::slotFeaturePermissionRequested(const QUrl &url, QWebEnginePage::Feature feature)
+void MailWebEnginePage::slotFeaturePermissionRequested(const QUrl &url,
+ QWebEnginePage::Feature feature)
{
//Denied all permissions.
setFeaturePermission(url, feature, QWebEnginePage::PermissionDeniedByUser);
diff --git a/messageviewer/src/viewer/webengine/mailwebenginepage.h b/messageviewer/src/viewer/webengine/mailwebenginepage.h
index 8b0df2d..d69d2c5 100644
--- a/messageviewer/src/viewer/webengine/mailwebenginepage.h
+++ b/messageviewer/src/viewer/webengine/mailwebenginepage.h
@@ -22,8 +22,7 @@
#include "messageviewer_export.h"
#include <WebEngineViewer/WebEnginePage>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MESSAGEVIEWER_EXPORT MailWebEnginePage : public WebEngineViewer::WebEnginePage
{
Q_OBJECT
diff --git a/messageviewer/src/viewer/webengine/mailwebenginescript.cpp b/messageviewer/src/viewer/webengine/mailwebenginescript.cpp
index d47e5a9..e4b8fe4 100644
--- a/messageviewer/src/viewer/webengine/mailwebenginescript.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebenginescript.cpp
@@ -24,7 +24,9 @@ using namespace MessageViewer;
static QString checkJQuery(const char *scriptName)
{
- return QStringLiteral("if (!qt) { console.warn(\"%1 executed too early, 'qt' variable unknown\"); };\n").arg(QString::fromLatin1(scriptName));
+ return QStringLiteral(
+ "if (!qt) { console.warn(\"%1 executed too early, 'qt' variable unknown\"); };\n").arg(QString::fromLatin1(
+ scriptName));
}
QString MailWebEngineScript::createShowHideAddressScript(const QString &field, bool hide)
@@ -32,14 +34,14 @@ QString MailWebEngineScript::createShowHideAddressScript(const QString &field, b
QString source = checkJQuery("createShowHideAddressScript");
if (hide) {
source += QString::fromLatin1("qt.jQuery(\"#kmail%1show\").hide();"
- "qt.jQuery(\"#kmail%1hide\").show();"
- "qt.jQuery(\"#dotsFull%1AddressList\").hide();"
- "qt.jQuery(\"#hiddenFull%1AddressList\").show();").arg(field);
+ "qt.jQuery(\"#kmail%1hide\").show();"
+ "qt.jQuery(\"#dotsFull%1AddressList\").hide();"
+ "qt.jQuery(\"#hiddenFull%1AddressList\").show();").arg(field);
} else {
source += QString::fromLatin1("qt.jQuery(\"#kmail%1hide\").hide();"
- "qt.jQuery(\"#kmail%1show\").show();"
- "qt.jQuery(\"#dotsFull%1AddressList\").show();"
- "qt.jQuery(\"#hiddenFull%1AddressList\").hide();").arg(field);
+ "qt.jQuery(\"#kmail%1show\").show();"
+ "qt.jQuery(\"#dotsFull%1AddressList\").show();"
+ "qt.jQuery(\"#hiddenFull%1AddressList\").hide();").arg(field);
}
return source;
}
@@ -59,28 +61,30 @@ QString MailWebEngineScript::manageShowHideAttachments(bool hide)
QString source = checkJQuery("manageShowHideAttachments");
if (hide) {
source += QString::fromLatin1("qt.jQuery(\"#kmailhideattachment\").hide();"
- "qt.jQuery(\"#kmailshowattachment\").show();"
- "if (!qt.jQuery(\"#attachmentlist\")) { console.warn('attachmentlist not found'); } else { qt.jQuery(\"#attachmentlist\").show(); }");
+ "qt.jQuery(\"#kmailshowattachment\").show();"
+ "if (!qt.jQuery(\"#attachmentlist\")) { console.warn('attachmentlist not found'); } else { qt.jQuery(\"#attachmentlist\").show(); }");
} else {
source += QString::fromLatin1("qt.jQuery('#kmailshowattachment').hide();"
- "qt.jQuery(\"#kmailhideattachment\").show();"
- "if (!qt.jQuery(\"#attachmentlist\")) { console.warn('attachmentlist not found'); } else { qt.jQuery(\"#attachmentlist\").hide(); }");
+ "qt.jQuery(\"#kmailhideattachment\").show();"
+ "if (!qt.jQuery(\"#attachmentlist\")) { console.warn('attachmentlist not found'); } else { qt.jQuery(\"#attachmentlist\").hide(); }");
}
return source;
}
-QString MailWebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr)
+QString MailWebEngineScript::injectAttachments(const QString &delayedHtml,
+ const QString &elementStr)
{
const QString source = checkJQuery("injectAttachments") + QString::fromLatin1(
- "if (!document.getElementById('%1')) { console.warn('NOT FOUND: %1'); };\n"
- "qt.jQuery('#%1').append('%2')").arg(elementStr, delayedHtml);
+ "if (!document.getElementById('%1')) { console.warn('NOT FOUND: %1'); };\n"
+ "qt.jQuery('#%1').append('%2')").arg(elementStr, delayedHtml);
return source;
}
QString MailWebEngineScript::replaceInnerHtml(const QString &field, const QString &html)
{
- const QString replaceInnerHtmlStr = QLatin1String("iconFull") + field + QLatin1String("AddressList");
- const QString source = checkJQuery("replaceInnerHtml") + QString::fromLatin1("qt.jQuery('#%1').append('%2')").arg(replaceInnerHtmlStr, html);
+ const QString replaceInnerHtmlStr = QLatin1String("iconFull") + field + QLatin1String(
+ "AddressList");
+ const QString source = checkJQuery("replaceInnerHtml") + QString::fromLatin1(
+ "qt.jQuery('#%1').append('%2')").arg(replaceInnerHtmlStr, html);
return source;
}
-
diff --git a/messageviewer/src/viewer/webengine/mailwebenginescript.h b/messageviewer/src/viewer/webengine/mailwebenginescript.h
index c74e230..c0c7818 100644
--- a/messageviewer/src/viewer/webengine/mailwebenginescript.h
+++ b/messageviewer/src/viewer/webengine/mailwebenginescript.h
@@ -23,10 +23,8 @@
#include <QString>
#include <QPoint>
-namespace MessageViewer
-{
-namespace MailWebEngineScript
-{
+namespace MessageViewer {
+namespace MailWebEngineScript {
MESSAGEVIEWER_EXPORT QString injectAttachments(const QString &delayedHtml, const QString &element);
MESSAGEVIEWER_EXPORT QString replaceInnerHtml(const QString &field, const QString &html);
MESSAGEVIEWER_EXPORT QString manageShowHideAttachments(bool hide);
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
index dd0761a..1aaace3 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp
@@ -63,16 +63,16 @@ class MessageViewer::MailWebEngineViewPrivate
{
public:
MailWebEngineViewPrivate()
- : mScamDetection(nullptr),
- mWebViewAccessKey(nullptr),
- mExternalReference(nullptr),
- mPageEngine(nullptr),
- mNetworkAccessManager(nullptr),
- mViewer(nullptr),
- mCanStartDrag(false)
+ : mScamDetection(nullptr)
+ , mWebViewAccessKey(nullptr)
+ , mExternalReference(nullptr)
+ , mPageEngine(nullptr)
+ , mNetworkAccessManager(nullptr)
+ , mViewer(nullptr)
+ , mCanStartDrag(false)
{
-
}
+
QUrl mHoveredUrl;
QPoint mLastClickPosition;
ScamDetectionWebEngine *mScamDetection;
@@ -85,31 +85,37 @@ public:
};
MailWebEngineView::MailWebEngineView(KActionCollection *ac, QWidget *parent)
- : WebEngineViewer::WebEngineView(parent),
- d(new MessageViewer::MailWebEngineViewPrivate)
-
+ : WebEngineViewer::WebEngineView(parent)
+ , d(new MessageViewer::MailWebEngineViewPrivate)
{
d->mPageEngine = new MailWebEnginePage(new QWebEngineProfile(this), this);
setPage(d->mPageEngine);
d->mWebViewAccessKey = new WebEngineViewer::WebEngineAccessKey(this, this);
d->mWebViewAccessKey->setActionCollection(ac);
d->mScamDetection = new ScamDetectionWebEngine(this);
- connect(d->mScamDetection, &ScamDetectionWebEngine::messageMayBeAScam, this, &MailWebEngineView::messageMayBeAScam);
- connect(d->mWebViewAccessKey, &WebEngineViewer::WebEngineAccessKey::openUrl, this, &MailWebEngineView::openUrl);
+ connect(d->mScamDetection, &ScamDetectionWebEngine::messageMayBeAScam, this,
+ &MailWebEngineView::messageMayBeAScam);
+ connect(d->mWebViewAccessKey, &WebEngineViewer::WebEngineAccessKey::openUrl, this,
+ &MailWebEngineView::openUrl);
connect(this, &MailWebEngineView::loadFinished, this, &MailWebEngineView::slotLoadFinished);
d->mNetworkAccessManager = new WebEngineViewer::InterceptorManager(this, ac, this);
d->mExternalReference = new MessageViewer::LoadExternalReferencesUrlInterceptor(this);
d->mNetworkAccessManager->addInterceptor(d->mExternalReference);
- MessageViewer::CidReferencesUrlInterceptor *cidReference = new MessageViewer::CidReferencesUrlInterceptor(this);
+ MessageViewer::CidReferencesUrlInterceptor *cidReference
+ = new MessageViewer::CidReferencesUrlInterceptor(this);
d->mNetworkAccessManager->addInterceptor(cidReference);
- MessageViewer::BlockExternalResourcesUrlInterceptor *blockExternalUrl = new MessageViewer::BlockExternalResourcesUrlInterceptor(this);
- connect(blockExternalUrl, &BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this, &MailWebEngineView::formSubmittedForbidden);
+ MessageViewer::BlockExternalResourcesUrlInterceptor *blockExternalUrl
+ = new MessageViewer::BlockExternalResourcesUrlInterceptor(this);
+ connect(blockExternalUrl, &BlockExternalResourcesUrlInterceptor::formSubmittedForbidden, this,
+ &MailWebEngineView::formSubmittedForbidden);
d->mNetworkAccessManager->addInterceptor(blockExternalUrl);
setFocusPolicy(Qt::WheelFocus);
connect(d->mPageEngine, &MailWebEnginePage::urlClicked, this, &MailWebEngineView::openUrl);
- connect(page(), &QWebEnginePage::scrollPositionChanged, d->mWebViewAccessKey, &WebEngineViewer::WebEngineAccessKey::hideAccessKeys);
+ connect(
+ page(), &QWebEnginePage::scrollPositionChanged, d->mWebViewAccessKey,
+ &WebEngineViewer::WebEngineAccessKey::hideAccessKeys);
initializeScripts();
}
@@ -142,7 +148,8 @@ void MailWebEngineView::initializeScripts()
void MailWebEngineView::contextMenuEvent(QContextMenuEvent *e)
{
WebEngineViewer::WebHitTest *webHit = d->mPageEngine->hitTestContent(e->pos());
- connect(webHit, &WebEngineViewer::WebHitTest::finished, this, &MailWebEngineView::slotWebHitFinished);
+ connect(webHit, &WebEngineViewer::WebHitTest::finished, this,
+ &MailWebEngineView::slotWebHitFinished);
}
void MailWebEngineView::slotWebHitFinished(const WebEngineViewer::WebHitTestResult &result)
@@ -197,7 +204,8 @@ void MailWebEngineView::forwardMousePressEvent(QMouseEvent *event)
return;
}
if (event->button() == Qt::LeftButton) {
- d->mCanStartDrag = URLHandlerManager::instance()->willHandleDrag(d->mHoveredUrl, d->mViewer);
+ d->mCanStartDrag = URLHandlerManager::instance()->willHandleDrag(d->mHoveredUrl,
+ d->mViewer);
d->mLastClickPosition = event->pos();
}
}
@@ -208,8 +216,8 @@ void MailWebEngineView::forwardMouseMoveEvent(QMouseEvent *event)
if (d->mViewer && !d->mHoveredUrl.isEmpty()) {
// If we are potentially handling a drag, deal with that.
if (d->mCanStartDrag && (event->buttons() & Qt::LeftButton)) {
-
- if ((d->mLastClickPosition - event->pos()).manhattanLength() > QApplication::startDragDistance()) {
+ if ((d->mLastClickPosition - event->pos()).manhattanLength()
+ > QApplication::startDragDistance()) {
if (URLHandlerManager::instance()->handleDrag(d->mHoveredUrl, d->mViewer)) {
// If the URL handler manager started a drag, don't handle this in the future
d->mCanStartDrag = false;
@@ -295,13 +303,15 @@ void MailWebEngineView::setElementByIdVisible(const QString &id, bool visible)
void MailWebEngineView::removeAttachmentMarking(const QString &id)
{
- runJavaScriptInWordId(WebEngineViewer::WebEngineScript::removeStyleToElement(QLatin1String("*#") + id));
+ runJavaScriptInWordId(WebEngineViewer::WebEngineScript::removeStyleToElement(QLatin1String("*#")
+ + id));
}
void MailWebEngineView::markAttachment(const QString &id, const QString &style)
{
//TODO verify "*#" + id
- runJavaScriptInWordId(WebEngineViewer::WebEngineScript::setStyleToElement(QLatin1String("*#") + id, style));
+ runJavaScriptInWordId(WebEngineViewer::WebEngineScript::setStyleToElement(QLatin1String("*#")
+ + id, style));
}
void MailWebEngineView::scrollToAnchor(const QString &anchor)
@@ -311,7 +321,8 @@ void MailWebEngineView::scrollToAnchor(const QString &anchor)
WebEngineViewer::WebEngineManageScript::scriptWordId(),
invoke(this, &MailWebEngineView::handleScrollToAnchor));
#else
- page()->runJavaScript(WebEngineViewer::WebEngineScript::searchElementPosition(anchor), invoke(this, &MailWebEngineView::handleScrollToAnchor));
+ page()->runJavaScript(WebEngineViewer::WebEngineScript::searchElementPosition(anchor),
+ invoke(this, &MailWebEngineView::handleScrollToAnchor));
#endif
}
@@ -363,7 +374,8 @@ void MailWebEngineView::executeHideShowAttachmentsScripts(bool hide)
runJavaScriptInWordId(source);
}
-void MailWebEngineView::toggleFullAddressList(const QString &field, const boost::function<QString()> &delayedHtml)
+void MailWebEngineView::toggleFullAddressList(const QString &field,
+ const boost::function<QString()> &delayedHtml)
{
const QString html = delayedHtml();
if (html.isEmpty()) {
@@ -385,7 +397,8 @@ void MailWebEngineView::setAllowExternalContent(bool b)
}
}
-QList<QAction *> MailWebEngineView::interceptorUrlActions(const WebEngineViewer::WebHitTestResult &result) const
+QList<QAction *> MailWebEngineView::interceptorUrlActions(
+ const WebEngineViewer::WebHitTestResult &result) const
{
return d->mNetworkAccessManager->interceptorUrlActions(result);
}
diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.h b/messageviewer/src/viewer/webengine/mailwebengineview.h
index 575fea3..e528715 100644
--- a/messageviewer/src/viewer/webengine/mailwebengineview.h
+++ b/messageviewer/src/viewer/webengine/mailwebengineview.h
@@ -23,12 +23,10 @@
#include <WebEngineViewer/WebEngineView>
#include <boost/function.hpp>
class KActionCollection;
-namespace WebEngineViewer
-{
+namespace WebEngineViewer {
class WebHitTestResult;
}
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPrivate;
class MailWebEngineViewPrivate;
class MESSAGEVIEWER_EXPORT MailWebEngineView : public WebEngineViewer::WebEngineView
diff --git a/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.cpp b/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.cpp
index 55680b4..bc1682b 100644
--- a/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.cpp
@@ -44,17 +44,18 @@ TestJQuerySupportMailWebEngine::TestJQuerySupportMailWebEngine(QWidget *parent)
mEditor = new QTextEdit(this);
mEditor->setAcceptRichText(false);
- mEditor->setPlainText(QStringLiteral("qt.jQuery('img').each( function () { qt.jQuery(this).css('-webkit-transition', '-webkit-transform 2s'); qt.jQuery(this).css('-webkit-transform', 'rotate(180deg)') } ); undefined"));
+ mEditor->setPlainText(QStringLiteral(
+ "qt.jQuery('img').each( function () { qt.jQuery(this).css('-webkit-transition', '-webkit-transform 2s'); qt.jQuery(this).css('-webkit-transform', 'rotate(180deg)') } ); undefined"));
vboxLayout->addWidget(mEditor);
QPushButton *executeQuery = new QPushButton(QStringLiteral("Execute Query"), this);
- connect(executeQuery, &QPushButton::clicked, this, &TestJQuerySupportMailWebEngine::slotExecuteQuery);
+ connect(executeQuery, &QPushButton::clicked, this,
+ &TestJQuerySupportMailWebEngine::slotExecuteQuery);
vboxLayout->addWidget(executeQuery);
}
TestJQuerySupportMailWebEngine::~TestJQuerySupportMailWebEngine()
{
-
}
KMime::Message::Ptr TestJQuerySupportMailWebEngine::readAndParseMail(const QString &mailFile)
diff --git a/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.h b/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.h
index 248cbc1..1d2639c 100644
--- a/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.h
+++ b/messageviewer/src/viewer/webengine/tests/testjquerysupportmailwebengine.h
@@ -22,8 +22,7 @@
#include <QWidget>
#include <KMime/Message>
-namespace MessageViewer
-{
+namespace MessageViewer {
class Viewer;
}
diff --git a/messageviewer/src/viewer/webengine/tests/testmaildndattachment.cpp b/messageviewer/src/viewer/webengine/tests/testmaildndattachment.cpp
index b1c9b7e..1c49b93 100644
--- a/messageviewer/src/viewer/webengine/tests/testmaildndattachment.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testmaildndattachment.cpp
@@ -34,15 +34,15 @@ TestMailDndAttachment::TestMailDndAttachment(QWidget *parent)
{
QVBoxLayout *vbox = new QVBoxLayout;
setLayout(vbox);
- MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(this));
+ MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(
+ this));
vbox->addWidget(viewer);
- viewer->setMessage(readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox"))/*KMime::Message::Ptr(msg)*/);
+ viewer->setMessage(readAndParseMail(QStringLiteral("encapsulated-with-attachment.mbox")) /*KMime::Message::Ptr(msg)*/);
viewer->setPluginName(QStringLiteral("longheaderstyleplugin"));
}
TestMailDndAttachment::~TestMailDndAttachment()
{
-
}
KMime::Message::Ptr TestMailDndAttachment::readAndParseMail(const QString &mailFile)
diff --git a/messageviewer/src/viewer/webengine/tests/testmailmboxwebengine.cpp b/messageviewer/src/viewer/webengine/tests/testmailmboxwebengine.cpp
index 9c061db..489b26a 100644
--- a/messageviewer/src/viewer/webengine/tests/testmailmboxwebengine.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testmailmboxwebengine.cpp
@@ -34,7 +34,8 @@ TestMailMBoxWebEngine::TestMailMBoxWebEngine(QWidget *parent)
{
QVBoxLayout *vbox = new QVBoxLayout;
setLayout(vbox);
- MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(this));
+ MessageViewer::Viewer *viewer = new MessageViewer::Viewer(nullptr, nullptr, new KActionCollection(
+ this));
vbox->addWidget(viewer);
viewer->setMessage(readAndParseMail(QStringLiteral("html.mbox")));
viewer->setPluginName(QStringLiteral("longheaderstyleplugin"));
@@ -42,7 +43,6 @@ TestMailMBoxWebEngine::TestMailMBoxWebEngine(QWidget *parent)
TestMailMBoxWebEngine::~TestMailMBoxWebEngine()
{
-
}
KMime::Message::Ptr TestMailMBoxWebEngine::readAndParseMail(const QString &mailFile)
diff --git a/messageviewer/src/viewer/webengine/tests/testmailwebengine.cpp b/messageviewer/src/viewer/webengine/tests/testmailwebengine.cpp
index 0467d4f..7e963eb 100644
--- a/messageviewer/src/viewer/webengine/tests/testmailwebengine.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testmailwebengine.cpp
@@ -35,9 +35,11 @@ TestMailWebEngine::TestMailWebEngine(QWidget *parent)
mZoom = 1.0;
QVBoxLayout *vbox = new QVBoxLayout(this);
mTestWebEngine = new MessageViewer::MailWebEngineView(new KActionCollection(this), this);
- connect(mTestWebEngine, &MessageViewer::MailWebEngineView::openUrl, this, &TestMailWebEngine::slotOpenUrl);
+ connect(mTestWebEngine, &MessageViewer::MailWebEngineView::openUrl, this,
+ &TestMailWebEngine::slotOpenUrl);
//mTestWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
- QString str = QStringLiteral("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, The Akregator Team </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n");
+ QString str = QStringLiteral(
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, The Akregator Team </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n");
mTestWebEngine->setHtml(str, QUrl(QStringLiteral("file:///")));
mTestWebEngine->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
vbox->addWidget(mTestWebEngine);
@@ -66,7 +68,6 @@ TestMailWebEngine::TestMailWebEngine(QWidget *parent)
TestMailWebEngine::~TestMailWebEngine()
{
-
}
void TestMailWebEngine::slotOpenUrl(const QUrl &url)
@@ -76,12 +77,16 @@ void TestMailWebEngine::slotOpenUrl(const QUrl &url)
void TestMailWebEngine::slotScrollDown()
{
- mTestWebEngine->page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollDown(10), WebEngineViewer::WebEngineManageScript::scriptWordId());
+ mTestWebEngine->page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollDown(
+ 10),
+ WebEngineViewer::WebEngineManageScript::scriptWordId());
}
void TestMailWebEngine::slotScrollUp()
{
- mTestWebEngine->page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollUp(10), WebEngineViewer::WebEngineManageScript::scriptWordId());
+ mTestWebEngine->page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollUp(
+ 10),
+ WebEngineViewer::WebEngineManageScript::scriptWordId());
}
void TestMailWebEngine::slotZoomDown()
diff --git a/messageviewer/src/viewer/webengine/tests/testmailwebengine.h b/messageviewer/src/viewer/webengine/tests/testmailwebengine.h
index 48b1ec5..661da3d 100644
--- a/messageviewer/src/viewer/webengine/tests/testmailwebengine.h
+++ b/messageviewer/src/viewer/webengine/tests/testmailwebengine.h
@@ -22,8 +22,7 @@
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MailWebEngineView;
}
diff --git a/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.cpp b/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.cpp
index dc01f4d..2a7b079 100644
--- a/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.cpp
@@ -28,13 +28,15 @@
#include <MessageViewer/MailWebEngineView>
TestMailWebEngineSelection::TestMailWebEngineSelection(QWidget *parent)
- : QWidget(parent),
- mNumber(0)
+ : QWidget(parent)
+ , mNumber(0)
{
QVBoxLayout *vbox = new QVBoxLayout(this);
mTestWebEngine = new MessageViewer::MailWebEngineView(new KActionCollection(this), this);
- connect(mTestWebEngine, &MessageViewer::MailWebEngineView::openUrl, this, &TestMailWebEngineSelection::slotOpenUrl);
- QString str = QStringLiteral("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, The Akregator Team </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n");
+ connect(mTestWebEngine, &MessageViewer::MailWebEngineView::openUrl, this,
+ &TestMailWebEngineSelection::slotOpenUrl);
+ QString str = QStringLiteral(
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, The Akregator Team </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n");
mTestWebEngine->setHtml(str, QUrl(QStringLiteral("file:///")));
mTestWebEngine->settings()->setAttribute(QWebEngineSettings::JavascriptEnabled, true);
vbox->addWidget(mTestWebEngine);
@@ -46,18 +48,20 @@ TestMailWebEngineSelection::TestMailWebEngineSelection(QWidget *parent)
hButtonBox->addWidget(changeHtml);
QPushButton *showSelection = new QPushButton(QStringLiteral("Show Selection"), this);
- connect(showSelection, &QPushButton::clicked, this, &TestMailWebEngineSelection::slotShowSelection);
+ connect(showSelection, &QPushButton::clicked, this,
+ &TestMailWebEngineSelection::slotShowSelection);
hButtonBox->addWidget(showSelection);
}
TestMailWebEngineSelection::~TestMailWebEngineSelection()
{
-
}
void TestMailWebEngineSelection::slotSwitchHtml()
{
- QString str = QStringLiteral("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, number %1 </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n").arg(mNumber);
+ QString str = QStringLiteral(
+ "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <style type=\"text/css\">\n /*<![CDATA[*/\n @import \"main.css\";\n /*]]>*/\n\n.links {\n margin: auto;\n}\n\n.links td {\n padding-top: 5px;\n padding-bottom: 5px;\n}\n\n </style>\n\n <title>Akregator</title>\n</head>\n\n<body>\n <div id=\"header\"><img src=\"file:///opt/kde5/share/icons/maia/apps/scalable/akregator.svg\" align=\"top\" height=\"128\" width=\"128\" alt=\"akregator\" title=\"\" />\n <div id=\"title\">\n <h1>Akregator</h1>Akregator est un agrégateur de flux pour KDE.\n </div>\n </div>\n\n <div id=\"box\">\n <div id=\"boxInner\">\n\n<div class=\"center\">\n <p>Feed readers provide a convenient way to browse different kinds of content, including news, blogs, and other content from online sites. Instead of checking all your favorite web sites manually for updates, Akregator collects the content for you.</p>\n <p> For more information about using Akregator, check the <a href='http://akregator.kde.org/'>Akregator website</a>. If you do not want to see this page anymore, <a href='config:/disable_introduction'>click here</a>.</p>\n <p>We hope that you will enjoy Akregator.</p>\n <p>Thank you, number %1 </p>\n</div>\n\n </div>\n </div>\n</body>\n</html>\n\n<!-- vim:set sw=2 et nocindent smartindent: -->\n")
+ .arg(mNumber);
mTestWebEngine->setHtml(str, QUrl(QStringLiteral("file:///")));
mNumber++;
}
diff --git a/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.h b/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.h
index f3e686b..498b839 100644
--- a/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.h
+++ b/messageviewer/src/viewer/webengine/tests/testmailwebengineselection.h
@@ -22,8 +22,7 @@
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MailWebEngineView;
}
diff --git a/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.cpp b/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.cpp
index 318a0bd..7f273eb 100644
--- a/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.cpp
@@ -44,7 +44,6 @@ TestWidget::TestWidget(QWidget *parent)
TestWidget::~TestWidget()
{
-
}
TestWebEngineAccesskey::TestWebEngineAccesskey(QWidget *parent)
@@ -60,12 +59,12 @@ TestWebEngineAccesskey::TestWebEngineAccesskey(QWidget *parent)
mTestWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
QPushButton *searchAccessKey = new QPushButton(QStringLiteral("AccessKey"), this);
vboxLayout->addWidget(searchAccessKey);
- connect(searchAccessKey, &QPushButton::clicked, this, &TestWebEngineAccesskey::slotShowAccessKey);
+ connect(searchAccessKey, &QPushButton::clicked, this,
+ &TestWebEngineAccesskey::slotShowAccessKey);
}
TestWebEngineAccesskey::~TestWebEngineAccesskey()
{
-
}
void TestWebEngineAccesskey::slotShowAccessKey()
@@ -83,4 +82,3 @@ int main(int argc, char *argv[])
const int ret = app.exec();
return ret;
}
-
diff --git a/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.h b/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.h
index c9156e1..839c80e 100644
--- a/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.h
+++ b/messageviewer/src/viewer/webengine/tests/testwebengineaccesskey.h
@@ -21,8 +21,7 @@
#include <QWebEngineView>
#include <QWidget>
-namespace WebEngineViewer
-{
+namespace WebEngineViewer {
class MailWebEngineView;
}
diff --git a/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.cpp b/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.cpp
index 18ed0ce..73faf4c 100644
--- a/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.cpp
+++ b/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.cpp
@@ -56,8 +56,8 @@ TestWebEngineScrollAddAttachment::TestWebEngineScrollAddAttachment(QWidget *pare
mTestWebEngine->load(QUrl(QStringLiteral("http://www.kde.org")));
QPushButton *scrollToButton = new QPushButton(QStringLiteral("Scroll to Attachment"), this);
vboxLayout->addWidget(scrollToButton);
- connect(scrollToButton, &QPushButton::clicked, this, &TestWebEngineScrollAddAttachment::slotScrollToAttachment);
-
+ connect(scrollToButton, &QPushButton::clicked, this,
+ &TestWebEngineScrollAddAttachment::slotScrollToAttachment);
}
void TestWebEngineScrollAddAttachment::slotScrollToAttachment()
diff --git a/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.h b/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.h
index 7316c53..c84d3dc 100644
--- a/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.h
+++ b/messageviewer/src/viewer/webengine/tests/testwebenginescrolladdattachment.h
@@ -21,8 +21,7 @@
#define TESTWEBENGINESCROLLADDATTACHMENT_H
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class MailWebEngineView;
}
class TestWebEngineScrollAddAttachment : public QWidget
diff --git a/messageviewer/src/viewerplugins/tests/viewerplugin_gui.cpp b/messageviewer/src/viewerplugins/tests/viewerplugin_gui.cpp
index 6e0269f..608c5ed 100644
--- a/messageviewer/src/viewerplugins/tests/viewerplugin_gui.cpp
+++ b/messageviewer/src/viewerplugins/tests/viewerplugin_gui.cpp
@@ -48,8 +48,10 @@ ViewerPluginTest::ViewerPluginTest(QWidget *parent)
vbox->setMargin(0);
vbox->setSpacing(0);
toolManagerWidget->setLayout(vbox);
- MessageViewer::ViewerPluginToolManager *toolManager = new MessageViewer::ViewerPluginToolManager(toolManagerWidget, this);
- connect(toolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this, &ViewerPluginTest::slotActivatePlugin);
+ MessageViewer::ViewerPluginToolManager *toolManager
+ = new MessageViewer::ViewerPluginToolManager(toolManagerWidget, this);
+ connect(toolManager, &MessageViewer::ViewerPluginToolManager::activatePlugin, this,
+ &ViewerPluginTest::slotActivatePlugin);
toolManager->setPluginName(QStringLiteral("messageviewer"));
toolManager->setServiceTypeName(QStringLiteral("MessageViewer/ViewerPlugin"));
@@ -65,12 +67,14 @@ ViewerPluginTest::ViewerPluginTest(QWidget *parent)
menu = new QMenu(this);
menu->setTitle(QStringLiteral("selected tools"));
- menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedSelection));
+ menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::
+ NeedSelection));
menuBar->addMenu(menu);
menu = new QMenu(this);
menu->setTitle(QStringLiteral("message tools"));
- menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::NeedMessage));
+ menu->addActions(toolManager->viewerPluginActionList(MessageViewer::ViewerPluginInterface::
+ NeedMessage));
menuBar->addMenu(menu);
menu = new QMenu(this);
@@ -85,7 +89,6 @@ ViewerPluginTest::ViewerPluginTest(QWidget *parent)
ViewerPluginTest::~ViewerPluginTest()
{
-
}
void ViewerPluginTest::slotActivatePlugin(MessageViewer::ViewerPluginInterface *interface)
@@ -97,7 +100,8 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);
QStandardPaths::setTestModeEnabled(true);
- KAboutData aboutData(QStringLiteral("viewerplugin_gui"), i18n("viewerplugin_Gui"), QStringLiteral("1.0"));
+ KAboutData aboutData(QStringLiteral("viewerplugin_gui"), i18n(
+ "viewerplugin_Gui"), QStringLiteral("1.0"));
aboutData.setShortDescription(i18n("Test for viewerplugin"));
QCommandLineParser parser;
KAboutData::setApplicationData(aboutData);
@@ -114,4 +118,3 @@ int main(int argc, char **argv)
delete w;
return 0;
}
-
diff --git a/messageviewer/src/viewerplugins/tests/viewerplugin_gui.h b/messageviewer/src/viewerplugins/tests/viewerplugin_gui.h
index b92cde5..b678991 100644
--- a/messageviewer/src/viewerplugins/tests/viewerplugin_gui.h
+++ b/messageviewer/src/viewerplugins/tests/viewerplugin_gui.h
@@ -21,8 +21,7 @@
#define TEST_VIEWVERPLUGIN_GUI_H
#include <QWidget>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPluginInterface;
}
diff --git a/messageviewer/src/viewerplugins/viewerplugin.cpp b/messageviewer/src/viewerplugins/viewerplugin.cpp
index e0319af..5f56de9 100644
--- a/messageviewer/src/viewerplugins/viewerplugin.cpp
+++ b/messageviewer/src/viewerplugins/viewerplugin.cpp
@@ -27,16 +27,15 @@ public:
ViewerPluginPrivate()
: mEnabled(false)
{
-
}
+
bool mEnabled;
};
ViewerPlugin::ViewerPlugin(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::ViewerPluginPrivate)
+ : QObject(parent)
+ , d(new MessageViewer::ViewerPluginPrivate)
{
-
}
ViewerPlugin::~ViewerPlugin()
@@ -63,4 +62,3 @@ bool ViewerPlugin::isEnabled() const
{
return d->mEnabled;
}
-
diff --git a/messageviewer/src/viewerplugins/viewerplugin.h b/messageviewer/src/viewerplugins/viewerplugin.h
index eeb27bc..bc60bc2 100644
--- a/messageviewer/src/viewerplugins/viewerplugin.h
+++ b/messageviewer/src/viewerplugins/viewerplugin.h
@@ -24,8 +24,7 @@
#include "messageviewer_export.h"
class KActionCollection;
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPluginPrivate;
class ViewerPluginInterface;
class MESSAGEVIEWER_EXPORT ViewerPlugin : public QObject
@@ -35,7 +34,8 @@ public:
explicit ViewerPlugin(QObject *parent = nullptr);
~ViewerPlugin();
- virtual MessageViewer::ViewerPluginInterface *createView(QWidget *parent, KActionCollection *ac) = 0;
+ virtual MessageViewer::ViewerPluginInterface *createView(QWidget *parent,
+ KActionCollection *ac) = 0;
virtual QString viewerPluginName() const = 0;
virtual void showConfigureDialog(QWidget *parent = nullptr);
virtual bool hasConfigureDialog() const;
diff --git a/messageviewer/src/viewerplugins/viewerplugininterface.cpp b/messageviewer/src/viewerplugins/viewerplugininterface.cpp
index 2db54fe..a4ceb94 100644
--- a/messageviewer/src/viewerplugins/viewerplugininterface.cpp
+++ b/messageviewer/src/viewerplugins/viewerplugininterface.cpp
@@ -26,15 +26,13 @@ class MessageViewer::ViewerPluginInterfacePrivate
public:
ViewerPluginInterfacePrivate()
{
-
}
};
ViewerPluginInterface::ViewerPluginInterface(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::ViewerPluginInterfacePrivate)
+ : QObject(parent)
+ , d(new MessageViewer::ViewerPluginInterfacePrivate)
{
-
}
ViewerPluginInterface::~ViewerPluginInterface()
diff --git a/messageviewer/src/viewerplugins/viewerplugininterface.h b/messageviewer/src/viewerplugins/viewerplugininterface.h
index 6d6a28e..010d1b3 100644
--- a/messageviewer/src/viewerplugins/viewerplugininterface.h
+++ b/messageviewer/src/viewerplugins/viewerplugininterface.h
@@ -27,8 +27,7 @@
class QAction;
class KActionCollection;
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPluginInterfacePrivate;
class MESSAGEVIEWER_EXPORT ViewerPluginInterface : public QObject
{
diff --git a/messageviewer/src/viewerplugins/viewerpluginmanager.cpp b/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
index e80be33..f3b585e 100644
--- a/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
+++ b/messageviewer/src/viewerplugins/viewerpluginmanager.cpp
@@ -53,10 +53,9 @@ class ViewerPluginInfo
{
public:
ViewerPluginInfo()
- : plugin(nullptr),
- isEnabled(false)
+ : plugin(nullptr)
+ , isEnabled(false)
{
-
}
QString metaDataFileNameBaseName;
@@ -72,8 +71,8 @@ public:
ViewerPluginManagerPrivate(ViewerPluginManager *qq)
: q(qq)
{
-
}
+
bool initializePluginList();
void loadPlugin(ViewerPluginInfo *item);
QVector<MessageViewer::ViewerPlugin *> pluginsList() const;
@@ -90,8 +89,7 @@ private:
ViewerPluginManager *q;
};
-namespace
-{
+namespace {
QString pluginVersion()
{
return QStringLiteral("2.0");
@@ -118,16 +116,20 @@ bool ViewerPluginManagerPrivate::initializePluginList()
}
static const QString s_serviceTypeName = serviceTypeName;
- QVector<KPluginMetaData> plugins = KPluginLoader::findPlugins(pluginName, [](const KPluginMetaData & md) {
+ QVector<KPluginMetaData> plugins
+ = KPluginLoader::findPlugins(pluginName, [](const KPluginMetaData &md) {
return md.serviceTypes().contains(s_serviceTypeName);
});
// We need common plugin to avoid to duplicate code between akregator/kmail
- plugins += KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](const KPluginMetaData & md) {
+ plugins
+ += KPluginLoader::findPlugins(QStringLiteral("messageviewer"), [](
+ const KPluginMetaData &md) {
return md.serviceTypes().contains(QStringLiteral("MessageViewer/ViewerCommonPlugin"));
});
- const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(configGroupName(), configPrefixSettingKey());
+ const QPair<QStringList, QStringList> pair = PimCommon::PluginUtil::loadPluginSetting(
+ configGroupName(), configPrefixSettingKey());
QVectorIterator<KPluginMetaData> i(plugins);
i.toBack();
QSet<QString> unique;
@@ -139,7 +141,10 @@ bool ViewerPluginManagerPrivate::initializePluginList()
//1) get plugin data => name/description etc.
info.pluginData = PimCommon::PluginUtil::createPluginMetaData(data);
//2) look at if plugin is activated
- const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first, pair.second, info.pluginData.mEnableByDefault, info.pluginData.mIdentifier);
+ const bool isPluginActivated = PimCommon::PluginUtil::isPluginActivated(pair.first,
+ pair.second,
+ info.pluginData.mEnableByDefault,
+ info.pluginData.mIdentifier);
info.isEnabled = isPluginActivated;
info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName();
info.metaDataFileName = data.fileName();
@@ -153,7 +158,8 @@ bool ViewerPluginManagerPrivate::initializePluginList()
mPluginList.push_back(info);
unique.insert(info.metaDataFileNameBaseName);
} else {
- qCWarning(MESSAGEVIEWER_LOG) << "Plugin name :" << data.name() << " doesn't have correct plugin version. Please update it";
+ qCWarning(MESSAGEVIEWER_LOG) << "Plugin name :" << data.name()
+ << " doesn't have correct plugin version. Please update it";
}
}
QVector<ViewerPluginInfo>::iterator end(mPluginList.end());
@@ -167,7 +173,9 @@ void ViewerPluginManagerPrivate::loadPlugin(ViewerPluginInfo *item)
{
KPluginLoader pluginLoader(item->metaDataFileName);
if (pluginLoader.factory()) {
- item->plugin = pluginLoader.factory()->create<MessageViewer::ViewerPlugin>(q, QVariantList() << item->metaDataFileNameBaseName);
+ item->plugin = pluginLoader.factory()->create<MessageViewer::ViewerPlugin>(q,
+ QVariantList()
+ << item->metaDataFileNameBaseName);
item->plugin->setIsEnabled(item->isEnabled);
item->pluginData.mHasConfigureDialog = item->plugin->hasConfigureDialog();
mPluginDataList.append(item->pluginData);
@@ -203,8 +211,8 @@ ViewerPlugin *ViewerPluginManagerPrivate::pluginFromIdentifier(const QString &id
}
ViewerPluginManager::ViewerPluginManager(QObject *parent)
- : QObject(parent),
- d(new MessageViewer::ViewerPluginManagerPrivate(this))
+ : QObject(parent)
+ , d(new MessageViewer::ViewerPluginManagerPrivate(this))
{
}
@@ -267,4 +275,3 @@ MessageViewer::ViewerPlugin *ViewerPluginManager::pluginFromIdentifier(const QSt
{
return d->pluginFromIdentifier(id);
}
-
diff --git a/messageviewer/src/viewerplugins/viewerpluginmanager.h b/messageviewer/src/viewerplugins/viewerpluginmanager.h
index 369cd7b..a2ed26d 100644
--- a/messageviewer/src/viewerplugins/viewerpluginmanager.h
+++ b/messageviewer/src/viewerplugins/viewerpluginmanager.h
@@ -23,8 +23,7 @@
#include <QObject>
#include "messageviewer_export.h"
#include <PimCommon/PluginUtil>
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPluginManagerPrivate;
class ViewerPlugin;
class MESSAGEVIEWER_EXPORT ViewerPluginManager : public QObject
diff --git a/messageviewer/src/viewerplugins/viewerplugintoolmanager.cpp b/messageviewer/src/viewerplugins/viewerplugintoolmanager.cpp
index 91ddaf8..39fb264 100644
--- a/messageviewer/src/viewerplugins/viewerplugintoolmanager.cpp
+++ b/messageviewer/src/viewerplugins/viewerplugintoolmanager.cpp
@@ -22,7 +22,6 @@
#include "viewerplugin.h"
#include "viewerplugininterface.h"
-
#include <QVector>
using namespace MessageViewer;
@@ -31,12 +30,12 @@ class MessageViewer::ViewerPluginToolManagerPrivate
{
public:
ViewerPluginToolManagerPrivate(ViewerPluginToolManager *qq, QWidget *parentWidget)
- : mActionCollection(nullptr),
- mParentWidget(parentWidget),
- q(qq)
+ : mActionCollection(nullptr)
+ , mParentWidget(parentWidget)
+ , q(qq)
{
-
}
+
void setServiceTypeName(const QString &serviceName);
QString serviceTypeName() const;
void setPluginName(const QString &pluginName);
@@ -82,12 +81,16 @@ void ViewerPluginToolManagerPrivate::refreshActionList()
void ViewerPluginToolManagerPrivate::createView()
{
- const QVector<MessageViewer::ViewerPlugin *> listPlugin = MessageViewer::ViewerPluginManager::self()->pluginsList();
+ const QVector<MessageViewer::ViewerPlugin *> listPlugin
+ = MessageViewer::ViewerPluginManager::self()->pluginsList();
for (MessageViewer::ViewerPlugin *plugin : listPlugin) {
if (plugin->isEnabled()) {
- MessageViewer::ViewerPluginInterface *interface = plugin->createView(mParentWidget, mActionCollection);
- q->connect(interface, &MessageViewer::ViewerPluginInterface::activatePlugin, q, &ViewerPluginToolManager::activatePlugin);
- q->connect(plugin, &ViewerPlugin::configChanged, q, &ViewerPluginToolManager::refreshActionList);
+ MessageViewer::ViewerPluginInterface *interface = plugin->createView(mParentWidget,
+ mActionCollection);
+ q->connect(interface, &MessageViewer::ViewerPluginInterface::activatePlugin, q,
+ &ViewerPluginToolManager::activatePlugin);
+ q->connect(plugin, &ViewerPlugin::configChanged, q,
+ &ViewerPluginToolManager::refreshActionList);
mListInterface.append(interface);
}
}
@@ -105,7 +108,8 @@ void ViewerPluginToolManagerPrivate::setActionCollection(KActionCollection *ac)
mActionCollection = ac;
}
-QList<QAction *> ViewerPluginToolManagerPrivate::actionList(ViewerPluginInterface::SpecificFeatureTypes features) const
+QList<QAction *> ViewerPluginToolManagerPrivate::actionList(
+ ViewerPluginInterface::SpecificFeatureTypes features) const
{
QList<QAction *> lstAction;
for (MessageViewer::ViewerPluginInterface *interface : qAsConst(mListInterface)) {
@@ -128,8 +132,8 @@ void ViewerPluginToolManagerPrivate::updateActions(const Akonadi::Item &messageI
}
ViewerPluginToolManager::ViewerPluginToolManager(QWidget *parentWidget, QObject *parent)
- : QObject(parent),
- d(new MessageViewer::ViewerPluginToolManagerPrivate(this, parentWidget))
+ : QObject(parent)
+ , d(new MessageViewer::ViewerPluginToolManagerPrivate(this, parentWidget))
{
}
@@ -183,7 +187,8 @@ bool ViewerPluginToolManager::initializePluginList()
return MessageViewer::ViewerPluginManager::self()->initializePluginList();
}
-QList<QAction *> ViewerPluginToolManager::viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features) const
+QList<QAction *> ViewerPluginToolManager::viewerPluginActionList(
+ ViewerPluginInterface::SpecificFeatureTypes features) const
{
return d->actionList(features);
}
diff --git a/messageviewer/src/viewerplugins/viewerplugintoolmanager.h b/messageviewer/src/viewerplugins/viewerplugintoolmanager.h
index 52ae219..860b2c4 100644
--- a/messageviewer/src/viewerplugins/viewerplugintoolmanager.h
+++ b/messageviewer/src/viewerplugins/viewerplugintoolmanager.h
@@ -26,8 +26,7 @@
#include "viewerplugininterface.h"
class KActionCollection;
class QAction;
-namespace MessageViewer
-{
+namespace MessageViewer {
class ViewerPluginToolManagerPrivate;
class ViewerPluginInterface;
class MESSAGEVIEWER_EXPORT ViewerPluginToolManager : public QObject
@@ -48,7 +47,8 @@ public:
void setPluginName(const QString &pluginName);
QString pluginName() const;
bool initializePluginList();
- QList<QAction *> viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features) const;
+ QList<QAction *> viewerPluginActionList(ViewerPluginInterface::SpecificFeatureTypes features)
+ const;
void updateActions(const Akonadi::Item &messageItem);
diff --git a/messageviewer/src/widgets/attachmentdialog.cpp b/messageviewer/src/widgets/attachmentdialog.cpp
index faf24dc..3c119a4 100644
--- a/messageviewer/src/widgets/attachmentdialog.cpp
+++ b/messageviewer/src/widgets/attachmentdialog.cpp
@@ -54,7 +54,6 @@ AttachmentDialog::AttachmentDialog(QWidget *parent, const QString &filenameText,
mButtonBox->addButton(user2Button, QDialogButtonBox::ActionRole);
user2Button->setText(i18n("&Open with '%1'", application));
connect(user2Button, &QPushButton::clicked, this, &AttachmentDialog::openClicked);
-
}
QPushButton *user3Button = new QPushButton;
@@ -78,8 +77,12 @@ int AttachmentDialog::exec()
}
bool again = false;
- const QDialogButtonBox::StandardButton ret = KMessageBox::createKMessageBox(dialog, mButtonBox, QMessageBox::Question, text, QStringList(),
- i18n("Do not ask again"), &again, nullptr);
+ const QDialogButtonBox::StandardButton ret = KMessageBox::createKMessageBox(dialog, mButtonBox,
+ QMessageBox::Question, text,
+ QStringList(),
+ i18n(
+ "Do not ask again"), &again,
+ nullptr);
if (ret == QDialogButtonBox::Cancel) {
return Cancel;
@@ -116,4 +119,3 @@ void AttachmentDialog::openWithClicked()
}
//---------------------------------------------------------------------
-
diff --git a/messageviewer/src/widgets/attachmentdialog.h b/messageviewer/src/widgets/attachmentdialog.h
index 8f51b70..23528bc 100644
--- a/messageviewer/src/widgets/attachmentdialog.h
+++ b/messageviewer/src/widgets/attachmentdialog.h
@@ -24,9 +24,7 @@
class QDialog;
class QDialogButtonBox;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* A class which handles the dialog used to present the user a choice what to do
* with an attachment.
@@ -46,8 +44,8 @@ public:
// if @application is non-empty, the "open with <application>" button will also be shown,
// otherwise only save, open with, cancel
- explicit AttachmentDialog(QWidget *parent, const QString &filenameText, const QString &application,
- const QString &dontAskAgainName);
+ explicit AttachmentDialog(QWidget *parent, const QString &filenameText,
+ const QString &application, const QString &dontAskAgainName);
// executes the modal dialog
int exec();
@@ -60,7 +58,6 @@ private:
QDialog *dialog;
QDialogButtonBox *mButtonBox;
};
-
}
#endif
diff --git a/messageviewer/src/widgets/configurewidget.cpp b/messageviewer/src/widgets/configurewidget.cpp
index a133674..ca40fa5 100644
--- a/messageviewer/src/widgets/configurewidget.cpp
+++ b/messageviewer/src/widgets/configurewidget.cpp
@@ -36,7 +36,6 @@ public:
ConfigureWidgetPrivate()
: mSettingsUi(nullptr)
{
-
}
~ConfigureWidgetPrivate()
@@ -49,8 +48,8 @@ public:
};
ConfigureWidget::ConfigureWidget(QWidget *parent)
- : QWidget(parent),
- d(new MessageViewer::ConfigureWidgetPrivate)
+ : QWidget(parent)
+ , d(new MessageViewer::ConfigureWidgetPrivate)
{
d->mSettingsUi = new Ui_Settings;
d->mSettingsUi->setupUi(this);
@@ -68,7 +67,10 @@ ConfigureWidget::ConfigureWidget(QWidget *parent)
d->mSettingsUi->kcfg_ShowExpandQuotesMark->setWhatsThis(
MessageViewer::MessageViewerSettings::self()->showExpandQuotesMarkItem()->whatsThis());
- connect(d->mSettingsUi->overrideCharacterEncoding, static_cast<void (KComboBox::*)(int)>(&KComboBox::currentIndexChanged), this, &ConfigureWidget::settingsChanged);
+ connect(d->mSettingsUi->overrideCharacterEncoding,
+ static_cast<void (KComboBox::*)(
+ int)>(&KComboBox::currentIndexChanged), this,
+ &ConfigureWidget::settingsChanged);
}
ConfigureWidget::~ConfigureWidget()
@@ -86,14 +88,16 @@ void ConfigureWidget::readConfig()
void ConfigureWidget::writeConfig()
{
MessageCore::MessageCoreSettings::self()->setOverrideCharacterEncoding(
- d->mSettingsUi->overrideCharacterEncoding->currentIndex() == 0 ?
- QString() :
- MimeTreeParser::NodeHelper::encodingForName(d->mSettingsUi->overrideCharacterEncoding->currentText()));
+ d->mSettingsUi->overrideCharacterEncoding->currentIndex() == 0
+ ? QString()
+ : MimeTreeParser::NodeHelper::encodingForName(d->mSettingsUi->overrideCharacterEncoding->
+ currentText()));
}
void ConfigureWidget::readCurrentOverrideCodec()
{
- const QString &currentOverrideEncoding = MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding();
+ const QString &currentOverrideEncoding
+ = MessageCore::MessageCoreSettings::self()->overrideCharacterEncoding();
if (currentOverrideEncoding.isEmpty()) {
d->mSettingsUi->overrideCharacterEncoding->setCurrentIndex(0);
return;
@@ -112,10 +116,10 @@ void ConfigureWidget::readCurrentOverrideCodec()
}
if (i == encodings.size()) {
// the current value of overrideCharacterEncoding is an unknown encoding => reset to Auto
- qCWarning(MESSAGEVIEWER_LOG) << "Unknown override character encoding" << currentOverrideEncoding
+ qCWarning(MESSAGEVIEWER_LOG) << "Unknown override character encoding"
+ << currentOverrideEncoding
<< ". Resetting to Auto.";
d->mSettingsUi->overrideCharacterEncoding->setCurrentIndex(0);
MessageCore::MessageCoreSettings::self()->setOverrideCharacterEncoding(QString());
}
}
-
diff --git a/messageviewer/src/widgets/configurewidget.h b/messageviewer/src/widgets/configurewidget.h
index b5d7551..66aecec 100644
--- a/messageviewer/src/widgets/configurewidget.h
+++ b/messageviewer/src/widgets/configurewidget.h
@@ -26,9 +26,7 @@
class KConfigDialogManager;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* Configure widget that can be used in a KConfigDialog.
*
@@ -66,7 +64,6 @@ private:
void readCurrentOverrideCodec();
ConfigureWidgetPrivate *const d;
};
-
}
#endif
diff --git a/messageviewer/src/widgets/htmlstatusbar.cpp b/messageviewer/src/widgets/htmlstatusbar.cpp
index 49d8cc4..c9c5acd 100644
--- a/messageviewer/src/widgets/htmlstatusbar.cpp
+++ b/messageviewer/src/widgets/htmlstatusbar.cpp
@@ -44,15 +44,17 @@
using namespace MessageViewer;
HtmlStatusBar::HtmlStatusBar(QWidget *parent)
- : QLabel(parent),
- mMode(MimeTreeParser::Util::Normal)
+ : QLabel(parent)
+ , mMode(MimeTreeParser::Util::Normal)
{
setAlignment(Qt::AlignHCenter | Qt::AlignTop);
setAutoFillBackground(true);
update();
}
-HtmlStatusBar::~HtmlStatusBar() {}
+HtmlStatusBar::~HtmlStatusBar()
+{
+}
MimeTreeParser::Util::HtmlMode HtmlStatusBar::mode() const
{
@@ -232,4 +234,3 @@ QColor HtmlStatusBar::bgColor() const
return Qt::white;
}
}
-
diff --git a/messageviewer/src/widgets/htmlstatusbar.h b/messageviewer/src/widgets/htmlstatusbar.h
index 1c24565..098b2cd 100644
--- a/messageviewer/src/widgets/htmlstatusbar.h
+++ b/messageviewer/src/widgets/htmlstatusbar.h
@@ -38,9 +38,7 @@
#include <QLabel>
class QMouseEvent;
-namespace MessageViewer
-{
-
+namespace MessageViewer {
/**
* @short The HTML statusbar widget for use with the reader.
*
@@ -114,7 +112,6 @@ private:
MimeTreeParser::Util::HtmlMode mMode;
QList<MimeTreeParser::Util::HtmlMode> mAvailableModes;
};
-
}
#endif // _KMAIL_HTMLSTATUSBAR_H_
diff --git a/messageviewer/src/widgets/invitationsettings.cpp b/messageviewer/src/widgets/invitationsettings.cpp
index bc60ee7..5f26852 100644
--- a/messageviewer/src/widgets/invitationsettings.cpp
+++ b/messageviewer/src/widgets/invitationsettings.cpp
@@ -42,7 +42,6 @@ public:
InvitationSettingsPrivate()
: mInvitationUi(new Ui_InvitationSettings)
{
-
}
~InvitationSettingsPrivate()
@@ -50,11 +49,13 @@ public:
delete mInvitationUi;
mInvitationUi = nullptr;
}
+
Ui_InvitationSettings *mInvitationUi;
};
InvitationSettings::InvitationSettings(QWidget *parent)
- : QWidget(parent), d(new MessageViewer::InvitationSettingsPrivate)
+ : QWidget(parent)
+ , d(new MessageViewer::InvitationSettingsPrivate)
{
d->mInvitationUi->setupUi(this);
@@ -64,26 +65,36 @@ InvitationSettings::InvitationSettings(QWidget *parent)
d->mInvitationUi->mDeleteInvitations->setWhatsThis(
i18n(MessageViewer::MessageViewerSettings::self()->
deleteInvitationEmailsAfterSendingReplyItem()->whatsThis().toUtf8().constData()));
- connect(d->mInvitationUi->mDeleteInvitations, &QCheckBox::toggled, this, &InvitationSettings::changed);
+ connect(d->mInvitationUi->mDeleteInvitations, &QCheckBox::toggled, this,
+ &InvitationSettings::changed);
d->mInvitationUi->mLegacyMangleFromTo->setWhatsThis(
- i18n(MessageViewer::MessageViewerSettings::self()->legacyMangleFromToHeadersItem()->whatsThis().toUtf8().constData()));
- connect(d->mInvitationUi->mLegacyMangleFromTo, &QCheckBox::stateChanged, this, &InvitationSettings::changed);
+ i18n(MessageViewer::MessageViewerSettings::self()->legacyMangleFromToHeadersItem()->
+ whatsThis().toUtf8().constData()));
+ connect(d->mInvitationUi->mLegacyMangleFromTo, &QCheckBox::stateChanged, this,
+ &InvitationSettings::changed);
d->mInvitationUi->mLegacyBodyInvites->setWhatsThis(
- i18n(MessageViewer::MessageViewerSettings::self()->legacyBodyInvitesItem()->whatsThis().toUtf8().constData()));
- connect(d->mInvitationUi->mLegacyBodyInvites, &QCheckBox::toggled, this, &InvitationSettings::slotLegacyBodyInvitesToggled);
- connect(d->mInvitationUi->mLegacyBodyInvites, &QCheckBox::stateChanged, this, &InvitationSettings::changed);
+ i18n(MessageViewer::MessageViewerSettings::self()->legacyBodyInvitesItem()->whatsThis().
+ toUtf8().constData()));
+ connect(d->mInvitationUi->mLegacyBodyInvites, &QCheckBox::toggled, this,
+ &InvitationSettings::slotLegacyBodyInvitesToggled);
+ connect(d->mInvitationUi->mLegacyBodyInvites, &QCheckBox::stateChanged, this,
+ &InvitationSettings::changed);
d->mInvitationUi->mExchangeCompatibleInvitations->setWhatsThis(
- i18n(MessageViewer::MessageViewerSettings::self()->exchangeCompatibl