Commit f946d8ab authored by Laurent Montel's avatar Laurent Montel
Browse files

Coding style

parent 6ccbb3e2
......@@ -46,7 +46,6 @@ private:
void writeConfig();
void updateView();
KContacts::Addressee::List mContacts;
KContacts::Addressee::List::Iterator mIt;
QPushButton *mApplyButton = nullptr;
......
......@@ -23,7 +23,6 @@
CheckGravatarPluginTest::CheckGravatarPluginTest(QObject *parent)
: QObject(parent)
{
}
QTEST_MAIN(CheckGravatarPluginTest)
......@@ -17,7 +17,6 @@
Boston, MA 02110-1301, USA.
*/
#ifndef CHECKGRAVATARPLUGINTEST_H
#define CHECKGRAVATARPLUGINTEST_H
......
......@@ -83,7 +83,6 @@ void ExternalComposerConfigureWidgetTest::shouldEnableDisableElements()
QVERIFY(urlrequesterlabel->isEnabled());
QVERIFY(explanationlabel->isEnabled());
mExternalEditorCheck->toggle();
QVERIFY(!mExternalEditorCheck->isChecked());
QVERIFY(!mEditorRequester->isEnabled());
......
......@@ -24,7 +24,6 @@
ExternalComposerPluginEditorTest::ExternalComposerPluginEditorTest(QObject *parent)
: QObject(parent)
{
}
void ExternalComposerPluginEditorTest::shouldHaveDefaultValue()
......
......@@ -31,7 +31,6 @@ public:
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // EXTERNALCOMPOSERPLUGINEDITORTEST_H
......@@ -48,8 +48,8 @@ ExternalComposerConfigureWidget::ExternalComposerConfigureWidget(QWidget *parent
hbox->addWidget(mEditorRequester);
mEditorRequester->setMimeTypeFilters({QStringLiteral("application/x-executable"),
QStringLiteral("application/x-shellscript"),
QStringLiteral("application/x-desktop")});
QStringLiteral("application/x-shellscript"),
QStringLiteral("application/x-desktop")});
mEditorRequester->setMode(KFile::File | KFile::ExistingOnly | KFile::LocalOnly);
mEditorRequester->setEnabled(false); // !mExternalEditorCheck->isChecked()
......
......@@ -103,7 +103,7 @@ void AutomaticAddContactsJob::slotFetchAllCollections(KJob *job)
Akonadi::Collection::List canCreateItemCollections;
const Akonadi::Collection::List addressBookCollections = addressBookJob->collections();
for (const Akonadi::Collection &collection : addressBookCollections) {
if (Akonadi::Collection::CanCreateItem & collection.rights()) {
if (Akonadi::Collection::CanCreateItem &collection.rights()) {
canCreateItemCollections.append(collection);
}
}
......
......@@ -47,17 +47,29 @@ void CheckAttachmentJobTest::shouldAssignEmails_data()
QTest::addColumn<QStringList>("originalEmails");
QTest::addColumn<QStringList>("result");
QTest::newRow("emptylist") << QStringList() << QStringList();
QStringList emails{ QStringLiteral("foo@kde.org"), QStringLiteral("bla@kde.org")};
QStringList createdList{ QStringLiteral("foo@kde.org"), QStringLiteral("bla@kde.org")};
QStringList emails{
QStringLiteral("foo@kde.org"), QStringLiteral("bla@kde.org")
};
QStringList createdList{
QStringLiteral("foo@kde.org"), QStringLiteral("bla@kde.org")
};
QTest::newRow("nonempty") << emails << createdList;
emails = QStringList{ QStringLiteral("\"bla\" <foo@kde.org>"), QStringLiteral("bla@kde.org")};
emails = QStringList{
QStringLiteral("\"bla\" <foo@kde.org>"), QStringLiteral("bla@kde.org")
};
QTest::newRow("potentialerrors") << emails << emails;
emails = QStringList{ QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org")};
emails = QStringList{
QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org")
};
QTest::newRow("emailswithquote") << emails << emails;
emails = QStringList{ QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org"), QStringLiteral(" ")};
createdList = QStringList{ QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org")};
emails = QStringList{
QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org"), QStringLiteral(" ")
};
createdList = QStringList{
QStringLiteral("\"bla, foo\" <foo@kde.org>"), QStringLiteral("bla@kde.org")
};
QTest::newRow("emailswithemptystr") << emails << createdList;
}
......@@ -71,7 +83,6 @@ void CheckAttachmentJobTest::shouldAssignEmails()
QCOMPARE(job.originalEmails(), result);
}
void CheckAttachmentJobTest::shouldRemoveDuplicatedEmails()
{
QFETCH(QStringList, originalEmails);
......
......@@ -29,7 +29,6 @@ QTEST_MAIN(CheckBeforeSendUpdateSmtpDialogTest)
CheckBeforeSendUpdateSmtpDialogTest::CheckBeforeSendUpdateSmtpDialogTest(QObject *parent)
: QObject(parent)
{
}
void CheckBeforeSendUpdateSmtpDialogTest::shouldHaveDefaultValue()
......
......@@ -17,7 +17,6 @@
Boston, MA 02110-1301, USA.
*/
#include "checkbeforesendupdatesmtpdialog.h"
#include <KLocalizedString>
#include <QVBoxLayout>
......@@ -51,7 +50,6 @@ CheckBeforeSendUpdateSmtpDialog::CheckBeforeSendUpdateSmtpDialog(QWidget *parent
CheckBeforeSendUpdateSmtpDialog::~CheckBeforeSendUpdateSmtpDialog()
{
}
bool CheckBeforeSendUpdateSmtpDialog::changeSmtp() const
......
......@@ -31,7 +31,6 @@ QTEST_MAIN(ConfirmAddressEmailEntryDialogTest)
ConfirmAddressEmailEntryDialogTest::ConfirmAddressEmailEntryDialogTest(QObject *parent)
: QObject(parent)
{
}
void ConfirmAddressEmailEntryDialogTest::shouldHaveDefaultValue()
......@@ -44,7 +43,6 @@ void ConfirmAddressEmailEntryDialogTest::shouldHaveDefaultValue()
QVERIFY(label);
QVERIFY(!label->text().isEmpty());
QLineEdit *mLineEdit = dlg.findChild<QLineEdit *>(QStringLiteral("lineedit"));
QVERIFY(mLineEdit);
QVERIFY(mLineEdit->text().isEmpty());
......
......@@ -56,9 +56,9 @@ ConfirmAddressConfigureTabWidget::ConfirmAddressConfigureTabWidget(QWidget *pare
= static_cast<PimCommon::SimpleStringListEditor::ButtonCode>(PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify);
mDomainNameListEditor
= new ConfirmAddressSimpleStringListEditor(groupBoxDomainName, buttonCode,
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new domain name:"));
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new domain name:"));
mDomainNameListEditor->setObjectName(QStringLiteral("domainnamelisteditor"));
connect(mDomainNameListEditor, &ConfirmAddressSimpleStringListEditor::changed,
this, &ConfirmAddressConfigureTabWidget::configureChanged);
......@@ -74,9 +74,9 @@ ConfirmAddressConfigureTabWidget::ConfirmAddressConfigureTabWidget(QWidget *pare
= static_cast<PimCommon::SimpleStringListEditor::ButtonCode>(PimCommon::SimpleStringListEditor::Add | PimCommon::SimpleStringListEditor::Remove | PimCommon::SimpleStringListEditor::Modify);
mWhiteListEditor
= new ConfirmAddressSimpleStringListEditor(groupBoxWhiteList, buttonCode,
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new email address:"));
i18n("A&dd..."), i18n("Re&move"),
i18n("Mod&ify..."),
i18n("Enter new email address:"));
mWhiteListEditor->setObjectName(QStringLiteral("whitelisteditor"));
layoutWhiteList->addWidget(mWhiteListEditor);
connect(mWhiteListEditor, &ConfirmAddressSimpleStringListEditor::changed,
......
......@@ -17,7 +17,6 @@
Boston, MA 02110-1301, USA.
*/
#include "confirmaddressemailentrydialog.h"
#include <KLocalizedString>
#include <QHBoxLayout>
......@@ -42,7 +41,6 @@ ConfirmAddressEmailEntryDialog::ConfirmAddressEmailEntryDialog(QWidget *parent)
KPIM::EmailValidator *emailValidator = new KPIM::EmailValidator(this);
mLineEdit->setValidator(emailValidator);
QDialogButtonBox *buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
buttons->setObjectName(QStringLiteral("buttons"));
mainLayout->addWidget(buttons);
......
......@@ -17,7 +17,6 @@
Boston, MA 02110-1301, USA.
*/
#ifndef CONFIRMADDRESSEMAILENTRYDIALOG_H
#define CONFIRMADDRESSEMAILENTRYDIALOG_H
......
......@@ -17,21 +17,18 @@
Boston, MA 02110-1301, USA.
*/
#include "confirmaddresssimplestringlisteditor.h"
#include "confirmaddressemailentrydialog.h"
#include <KLocalizedString>
#include <QPointer>
ConfirmAddressSimpleStringListEditor::ConfirmAddressSimpleStringListEditor(QWidget *parent, ButtonCode buttons, const QString &addLabel,
const QString &removeLabel, const QString &modifyLabel, const QString &addDialogLabel)
ConfirmAddressSimpleStringListEditor::ConfirmAddressSimpleStringListEditor(QWidget *parent, ButtonCode buttons, const QString &addLabel, const QString &removeLabel, const QString &modifyLabel,
const QString &addDialogLabel)
: PimCommon::SimpleStringListEditor(parent, buttons, addLabel, removeLabel, modifyLabel, addDialogLabel)
{
}
void ConfirmAddressSimpleStringListEditor::addNewEntry()
{
QPointer<ConfirmAddressEmailEntryDialog> dlg = new ConfirmAddressEmailEntryDialog(this);
......@@ -42,11 +39,10 @@ void ConfirmAddressSimpleStringListEditor::addNewEntry()
delete dlg;
}
QString ConfirmAddressSimpleStringListEditor::modifyEntry(const QString &text)
{
QString newText;
QPointer<ConfirmAddressEmailEntryDialog> dlg = new ConfirmAddressEmailEntryDialog(this);
QPointer<ConfirmAddressEmailEntryDialog> dlg = new ConfirmAddressEmailEntryDialog(this);
dlg->setWindowTitle(i18n("Change Value"));
dlg->setValue(text);
if (dlg->exec()) {
......
......@@ -64,5 +64,3 @@ MailTransport::TransportJob *SendMailTransportPlugin::createTransportJob(MailTra
}
#include "sendmailtransportplugin.moc"
......@@ -26,7 +26,6 @@
DiffHighlighterTest::DiffHighlighterTest(QObject *parent)
: QObject(parent)
{
}
QString readDiffFile(const QString &diffFile)
......@@ -67,17 +66,15 @@ void DiffHighlighterTest::shouldGenerateDiff()
// compare to reference file
QStringList args = QStringList()
<< QStringLiteral("-u")
<< refFile
<< generatedFile;
<< QStringLiteral("-u")
<< refFile
<< generatedFile;
QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels);
proc.start(QStringLiteral("diff"), args);
QVERIFY(proc.waitForFinished());
QCOMPARE(proc.exitCode(), 0);
}
QTEST_MAIN(DiffHighlighterTest)
......@@ -847,8 +847,8 @@ public:
}
if (KMessageBox::warningYesNo(
nullptr,
i18n("%1\n%2", warnStr, queryStr)) == KMessageBox::No) {
nullptr,
i18n("%1\n%2", warnStr, queryStr)) == KMessageBox::No) {
return true;
}
}
......@@ -1023,7 +1023,9 @@ public:
QDesktopServices::openUrl(QUrl(attachment->uri()));
} else {
// put the attachment in a temporary file and launch it
QTemporaryFile *file{nullptr};
QTemporaryFile *file{
nullptr
};
QMimeDatabase db;
QStringList patterns = db.mimeTypeForName(attachment->mimeType()).globPatterns();
if (!patterns.empty()) {
......@@ -1068,7 +1070,9 @@ public:
stat = job->exec();
} else {
// put the attachment in a temporary file and save it
QTemporaryFile *file{nullptr};
QTemporaryFile *file{
nullptr
};
QMimeDatabase db;
QStringList patterns = db.mimeTypeForName(a->mimeType()).globPatterns();
if (!patterns.empty()) {
......@@ -1087,7 +1091,6 @@ public:
auto job = KIO::file_copy(QUrl::fromLocalFile(filename), QUrl::fromLocalFile(saveAsFile));
stat = job->exec();
}
return stat;
}
......@@ -1172,9 +1175,9 @@ public:
}
delete kontact;
OrgKdeKorganizerCalendarInterface *iface =
new OrgKdeKorganizerCalendarInterface(QStringLiteral("org.kde.korganizer"), QStringLiteral("/Calendar"),
QDBusConnection::sessionBus(), nullptr);
OrgKdeKorganizerCalendarInterface *iface
= new OrgKdeKorganizerCalendarInterface(QStringLiteral("org.kde.korganizer"), QStringLiteral("/Calendar"),
QDBusConnection::sessionBus(), nullptr);
if (!iface->isValid()) {
qCDebug(TEXT_CALENDAR_LOG) << "Calendar interface is not valid! " << iface->lastError().message();
delete iface;
......
......@@ -30,12 +30,11 @@ DiffHighlighter::DiffHighlighter()
setTheme(/*(palette().color(QPalette::Base).lightness() < 128)
? mRepo.defaultTheme(KSyntaxHighlighting::Repository::DarkTheme)*/
/*:*/ mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
/*:*/ mRepo.defaultTheme(KSyntaxHighlighting::Repository::LightTheme));
}
DiffHighlighter::~DiffHighlighter()
{
}
void DiffHighlighter::highlightDiff(const QString &str)
......@@ -70,18 +69,24 @@ void DiffHighlighter::applyFormat(int offset, int length, const KSyntaxHighlight
{
if (!format.isDefaultTextStyle(theme())) {
mOutputDiff += QStringLiteral("<span style=\"");
if (format.hasTextColor(theme()))
if (format.hasTextColor(theme())) {
mOutputDiff += QStringLiteral("color:") + format.textColor(theme()).name() + QStringLiteral(";");
if (format.hasBackgroundColor(theme()))
}
if (format.hasBackgroundColor(theme())) {
mOutputDiff += QStringLiteral("background-color:") + format.backgroundColor(theme()).name() + QStringLiteral(";");
if (format.isBold(theme()))
}
if (format.isBold(theme())) {
mOutputDiff += QStringLiteral("font-weight:bold;");
if (format.isItalic(theme()))
}
if (format.isItalic(theme())) {
mOutputDiff += QStringLiteral("font-style:italic;");
if (format.isUnderline(theme()))
}
if (format.isUnderline(theme())) {
mOutputDiff += QStringLiteral("text-decoration:underline;");
if (format.isStrikeThrough(theme()))
}
if (format.isStrikeThrough(theme())) {
mOutputDiff += QStringLiteral("text-decoration:line-through;");
}
mOutputDiff += QStringLiteral("\">");
}
......
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