Commit 0d388049 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Astyle kdelibs

parent 911391a2
......@@ -63,7 +63,6 @@ void initLocale()
Q_CONSTRUCTOR_FUNCTION(initLocale)
#endif
namespace
{
template <typename String>
......
......@@ -37,9 +37,8 @@ public:
{
}
KPIM::MultiplyingLine *newLine(QWidget *parent) Q_DECL_OVERRIDE
{
auto line = qobject_cast<MessageComposer::RecipientLineNG*>(
KPIM::MultiplyingLine *newLine(QWidget *parent) Q_DECL_OVERRIDE {
auto line = qobject_cast<MessageComposer::RecipientLineNG *>(
MessageComposer::RecipientLineFactory::newLine(parent));
line->setEnableAkonadiSearch(false);
line->setEnableIndexSearch(false);
......@@ -47,8 +46,6 @@ public:
}
};
class RecipientsEditorTest : public QObject
{
Q_OBJECT
......@@ -59,7 +56,6 @@ private Q_SLOTS:
void test_splitPastedListToLines();
};
void RecipientsEditorTest::test_addLineOnCommaPress()
{
MessageComposer::RecipientsEditor editor(new RecipientsLineTestFactory());
......@@ -68,7 +64,7 @@ void RecipientsEditorTest::test_addLineOnCommaPress()
QCOMPARE(editor.recipients().size(), 0);
auto lineEdit = editor.lines().first()->findChild<MessageComposer::RecipientLineEdit*>();
auto lineEdit = editor.lines().first()->findChild<MessageComposer::RecipientLineEdit *>();
lineEdit->setFocus();
// Simulate typing email address
......@@ -79,7 +75,7 @@ void RecipientsEditorTest::test_addLineOnCommaPress()
QTest::keyClick(lineEdit, Qt::Key_Comma, Qt::NoModifier, 0);
lineEdit = editor.lines().at(1)->findChild<MessageComposer::RecipientLineEdit*>();
lineEdit = editor.lines().at(1)->findChild<MessageComposer::RecipientLineEdit *>();
QVERIFY(lineEdit->hasFocus());
QTest::keyClicks(lineEdit, QStringLiteral("test@example.test"), Qt::NoModifier, 10);
......@@ -113,8 +109,7 @@ void RecipientsEditorTest::test_splitPastedListToLines()
clipboard->setText(QStringLiteral("test@example.com, \"Vrátil, Daniel\" <dvratil@kde.org>"));
auto lineEdit = editor.lines().at(0)->findChild<MessageComposer::RecipientLineEdit*>();
auto lineEdit = editor.lines().at(0)->findChild<MessageComposer::RecipientLineEdit *>();
// paste() is protected in KPIM::AddresseeLineEdit
QMetaObject::invokeMethod(lineEdit, "paste");
......
......@@ -608,7 +608,6 @@ QList< MessageComposer::Composer * > MessageComposer::ComposerViewBase::generate
encryptChainCertNearExpiryWarningThresholdInDays(),
signingChainCertNearExpiryWarningThresholdInDays());
QStringList encryptToSelfKeys;
QStringList signKeys;
......
......@@ -49,7 +49,6 @@ public:
void setIdentityManagement(KIdentityManagement::IdentityManager *identityManagement);
KIdentityManagement::IdentityManager *identityManagement() const;
void setParameters(const MessageComposer::PluginEditorCheckBeforeSendParams &params);
MessageComposer::PluginEditorCheckBeforeSendParams parameters() const;
......
......@@ -304,14 +304,14 @@ void RecipientsEditor::slotLineDeleted(int pos)
bool RecipientsEditor::eventFilter(QObject *object, QEvent *event)
{
if (event->type() == QEvent::KeyPress && qobject_cast<RecipientLineEdit*>(object)) {
auto ke = static_cast<QKeyEvent*>(event);
if (event->type() == QEvent::KeyPress && qobject_cast<RecipientLineEdit *>(object)) {
auto ke = static_cast<QKeyEvent *>(event);
// Treats comma or semicolon as email separator, will automatically move focus
// to a new line, basically preventing user from inputting more than one
// email address per line, which breaks our opportunistic crypto in composer
if (ke->key() == Qt::Key_Comma || (
ke->key() == Qt::Key_Semicolon && MessageComposerSettings::self()->allowSemicolonAsAddressSeparator())) {
auto line = qobject_cast<RecipientLineNG*>(object->parent());
ke->key() == Qt::Key_Semicolon && MessageComposerSettings::self()->allowSemicolonAsAddressSeparator())) {
auto line = qobject_cast<RecipientLineNG *>(object->parent());
const auto split = KEmailAddress::splitAddressList(line->rawData() + QLatin1String(", "));
if (split.size() > 1) {
addRecipient(QString(), line->recipientType());
......
......@@ -396,7 +396,7 @@ void AttachmentPropertiesDialog::accept()
void AttachmentPropertiesDialog::slotHelp()
{
PimCommon::Util::invokeHelp(QStringLiteral("kmail/the-composer-window.html"),QStringLiteral("attachments"));
PimCommon::Util::invokeHelp(QStringLiteral("kmail/the-composer-window.html"), QStringLiteral("attachments"));
}
#include "moc_attachmentpropertiesdialog.cpp"
......@@ -72,7 +72,7 @@ void ViewerTest::shouldHaveDefaultValuesOnCreation()
void ViewerTest::shouldDisplayMessage()
{
QByteArray data =
QByteArray data =
"From: Konqui <konqui@kde.org>\n"
"To: Friends <friends@kde.org>\n"
"Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST)\n"
......
......@@ -165,7 +165,6 @@ QString GrantleeHeaderFormatter::format(const QString &absolutePath, const Grant
headerObject.insert(QStringLiteral("listid"), message->headerByType("List-Id")->asUnicodeString());
}
const QString spamHtml = d->headerStyleUtil.spamStatus(message);
if (!spamHtml.isEmpty()) {
headerObject.insert(QStringLiteral("spamstatusi18n"), i18n("Spam Status:"));
......
......@@ -129,11 +129,13 @@ public:
Q_UNUSED(availableModes);
}
MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE {
MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE
{
return mPreferredMode;
}
void setPreferredMode(MimeTreeParser::Util::HtmlMode mode) {
void setPreferredMode(MimeTreeParser::Util::HtmlMode mode)
{
mPreferredMode = mode;
}
......
......@@ -1220,7 +1220,7 @@ public:
}
return htmlWriter->html;
}
QString render(const EncryptedMessagePart::Ptr &mp)
{
auto htmlWriter = QSharedPointer<CacheHtmlWriter>(new CacheHtmlWriter(mOldWriter));
......@@ -1263,7 +1263,7 @@ public:
auto mode = mp->preferredMode();
if (mode == MimeTreeParser::Util::MultipartPlain && mp->text().trimmed().isEmpty()) {
foreach(const auto m, mp->availableModes()) {
foreach (const auto m, mp->availableModes()) {
if (m != MimeTreeParser::Util::MultipartPlain) {
mode = m;
break;
......
......@@ -63,15 +63,15 @@ void MailViewerSource::setHtmlMode(MimeTreeParser::Util::HtmlMode mode, const QL
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;
case MessageViewer::Viewer::Html:
return MimeTreeParser::Util::MultipartHtml;
case MessageViewer::Viewer::Text:
return MimeTreeParser::Util::MultipartPlain;
case MessageViewer::Viewer::ICal:
return MimeTreeParser::Util::MultipartIcal;
case MessageViewer::Viewer::UseGlobalSetting:
case MessageViewer::Viewer::Unknown:
return mViewer->htmlMailGlobalSetting() ? MimeTreeParser::Util::Html : MimeTreeParser::Util::Normal;
case MessageViewer::Viewer::Html:
return MimeTreeParser::Util::MultipartHtml;
case MessageViewer::Viewer::Text:
return MimeTreeParser::Util::MultipartPlain;
case MessageViewer::Viewer::ICal:
return MimeTreeParser::Util::MultipartIcal;
}
Q_ASSERT(true);
return MimeTreeParser::Util::Html;
......
......@@ -2015,17 +2015,17 @@ void ViewerPrivate::slotLoadExternalReference()
Viewer::DisplayFormatMessage translateToDisplayFormat(MimeTreeParser::Util::HtmlMode mode)
{
switch(mode) {
case MimeTreeParser::Util::Normal:
return Viewer::Unknown;
case MimeTreeParser::Util::Html:
return Viewer::Html;
case MimeTreeParser::Util::MultipartPlain:
return Viewer::Text;
case MimeTreeParser::Util::MultipartHtml:
return Viewer::Html;
case MimeTreeParser::Util::MultipartIcal:
return Viewer::ICal;
switch (mode) {
case MimeTreeParser::Util::Normal:
return Viewer::Unknown;
case MimeTreeParser::Util::Html:
return Viewer::Html;
case MimeTreeParser::Util::MultipartPlain:
return Viewer::Text;
case MimeTreeParser::Util::MultipartHtml:
return Viewer::Html;
case MimeTreeParser::Util::MultipartIcal:
return Viewer::ICal;
}
return Viewer::Unknown;
}
......
......@@ -48,15 +48,15 @@ void MailWebEngineScriptTest::shouldReplaceInnerHtml()
void MailWebEngineScriptTest::shouldManageShowHideAttachments()
{
const QString result = QString::fromLatin1("qt.jQuery('#kmailshowattachment').click(function(){"
"qt.jQuery('#kmailshowattachment').hide();"
"qt.jQuery(\"#kmailhideattachment\").show();"
"qt.jQuery(\"#attachmentid\").hide()}"
");"
"qt.jQuery('#kmailhideattachment').click(function(){"
"qt.jQuery(\"#kmailhideattachment\").hide();"
"qt.jQuery(\"#kmailshowattachment\").show();"
"qt.jQuery(\"#attachmentid\").show()}"
");");
"qt.jQuery('#kmailshowattachment').hide();"
"qt.jQuery(\"#kmailhideattachment\").show();"
"qt.jQuery(\"#attachmentid\").hide()}"
");"
"qt.jQuery('#kmailhideattachment').click(function(){"
"qt.jQuery(\"#kmailhideattachment\").hide();"
"qt.jQuery(\"#kmailshowattachment\").show();"
"qt.jQuery(\"#attachmentid\").show()}"
");");
QCOMPARE(MessageViewer::MailWebEngineScript::manageShowHideAttachments(), result);
}
......
......@@ -107,7 +107,6 @@ MailWebEngineView::~MailWebEngineView()
delete d;
}
void MailWebEngineView::initializeScripts()
{
initializeJQueryScript();
......
......@@ -114,7 +114,7 @@ void HtmlStatusBar::setAvailableModes(const QList<MimeTreeParser::Util::HtmlMode
mAvailableModes = availableModes;
}
const QList< MimeTreeParser::Util::HtmlMode >& HtmlStatusBar::availableModes()
const QList< MimeTreeParser::Util::HtmlMode > &HtmlStatusBar::availableModes()
{
return mAvailableModes;
}
......
......@@ -50,7 +50,6 @@ MailSourceWebEngineViewer::MailSourceWebEngineViewer(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose);
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mRawBrowser = new MailSourceViewTextBrowserWidget(this);
#ifndef NDEBUG
......
......@@ -122,11 +122,13 @@ public:
Q_UNUSED(availableModes);
}
MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE {
MimeTreeParser::Util::HtmlMode preferredMode() const Q_DECL_OVERRIDE
{
return mPreferredMode;
}
void setPreferredMode( MimeTreeParser::Util::HtmlMode mode) {
void setPreferredMode(MimeTreeParser::Util::HtmlMode mode)
{
mPreferredMode = mode;
}
......
......@@ -75,8 +75,8 @@ Interface::MessagePart::Ptr ApplicationPGPEncryptedBodyPartFormatter::process(In
part.nodeHelper()->setEncryptionState(node, KMMsgFullyEncrypted);
EncryptedMessagePart::Ptr mp(new EncryptedMessagePart(part.objectTreeParser(),
data->decodedText(), Kleo::CryptoBackendFactory::instance()->openpgp(),
NodeHelper::fromAsString(data), node));
data->decodedText(), Kleo::CryptoBackendFactory::instance()->openpgp(),
NodeHelper::fromAsString(data), node));
mp->setIsEncrypted(true);
mp->setDecryptMessage(part.source()->decryptMessage());
PartMetaData *messagePart(mp->partMetaData());
......
......@@ -98,8 +98,8 @@ Interface::MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Inter
}
auto _mp = EncryptedMessagePart::Ptr(new EncryptedMessagePart(part.objectTreeParser(),
node->decodedText(), smimeCrypto,
NodeHelper::fromAsString(node), node));
node->decodedText(), smimeCrypto,
NodeHelper::fromAsString(node), node));
mp = _mp;
_mp->setIsEncrypted(true);
_mp->setDecryptMessage(part.source()->decryptMessage());
......@@ -149,8 +149,8 @@ Interface::MessagePart::Ptr ApplicationPkcs7MimeBodyPartFormatter::process(Inter
const QTextCodec *aCodec(part.objectTreeParser()->codecFor(signTestNode));
const QByteArray signaturetext = signTestNode->decodedContent();
auto _mp = SignedMessagePart::Ptr(new SignedMessagePart(part.objectTreeParser(),
aCodec->toUnicode(signaturetext), smimeCrypto,
NodeHelper::fromAsString(node), signTestNode));
aCodec->toUnicode(signaturetext), smimeCrypto,
NodeHelper::fromAsString(node), signTestNode));
mp = _mp;
//mp->setDecryptMessage(part.source()->decryptMessage());
PartMetaData *messagePart(mp->partMetaData());
......
......@@ -79,7 +79,7 @@ Interface::MessagePart::Ptr MultiPartAlternativeBodyPartFormatter::process(Inter
}
preferredMode = Util::MultipartIcal;
} else if ((dataHtml && (preferredMode == Util::MultipartHtml || preferredMode == Util::Html)) ||
(dataHtml && dataPlain && dataPlain->body().isEmpty())) {
(dataHtml && dataPlain && dataPlain->body().isEmpty())) {
if (dataPlain) {
part.nodeHelper()->setNodeProcessed(dataPlain, false);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment