diff --git a/akonadi-import-wizard/evolutionv1/evolutionv1importdata.cpp b/akonadi-import-wizard/evolutionv1/evolutionv1importdata.cpp index 5973ed06..9dbb9cb5 100644 --- a/akonadi-import-wizard/evolutionv1/evolutionv1importdata.cpp +++ b/akonadi-import-wizard/evolutionv1/evolutionv1importdata.cpp @@ -1,78 +1,78 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "evolutionv1importdata.h" #include "mailimporter/filterevolution.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(Evolutionv1ImportData, "evolutionv1importer.json") Evolutionv1ImportData::Evolutionv1ImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = MailImporter::FilterEvolution::defaultSettingsPath(); } Evolutionv1ImportData::~Evolutionv1ImportData() { } bool Evolutionv1ImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString Evolutionv1ImportData::name() const { return QStringLiteral("Evolution 1.x"); } bool Evolutionv1ImportData::importMails() { MailImporter::FilterEvolution evolution; initializeFilter(evolution); evolution.filterInfo()->setStatusMessage(i18n("Import in progress")); const QString mailsPath = mPath; QDir directory(mailsPath); if (directory.exists()) { evolution.importMails(mailsPath); } else { evolution.import(); } evolution.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions Evolutionv1ImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; return options; } #include "evolutionv1importdata.moc" diff --git a/akonadi-import-wizard/evolutionv2/evolutionv2importdata.cpp b/akonadi-import-wizard/evolutionv2/evolutionv2importdata.cpp index 995bcf8c..c6ac967e 100644 --- a/akonadi-import-wizard/evolutionv2/evolutionv2importdata.cpp +++ b/akonadi-import-wizard/evolutionv2/evolutionv2importdata.cpp @@ -1,78 +1,78 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "evolutionv2importdata.h" #include "mailimporter/filterevolution_v2.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(Evolutionv2ImportData, "evolutionv2importer.json") Evolutionv2ImportData::Evolutionv2ImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = MailImporter::FilterEvolution_v2::defaultSettingsPath(); } Evolutionv2ImportData::~Evolutionv2ImportData() { } bool Evolutionv2ImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString Evolutionv2ImportData::name() const { return QStringLiteral("Evolution 2.x"); } bool Evolutionv2ImportData::importMails() { MailImporter::FilterEvolution_v2 evolution; initializeFilter(evolution); evolution.filterInfo()->setStatusMessage(i18n("Import in progress")); const QString mailsPath = mPath; QDir directory(mailsPath); if (directory.exists()) { evolution.importMails(mailsPath); } else { evolution.import(); } evolution.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions Evolutionv2ImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; return options; } #include "evolutionv2importdata.moc" diff --git a/akonadi-import-wizard/geary/gearyimportdata.cpp b/akonadi-import-wizard/geary/gearyimportdata.cpp index a77935b0..e530ebc2 100644 --- a/akonadi-import-wizard/geary/gearyimportdata.cpp +++ b/akonadi-import-wizard/geary/gearyimportdata.cpp @@ -1,92 +1,92 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "gearyimportdata.h" #include "gearysettings.h" #include "gearyaddressbook.h" #include "mailimporter/filterinfo.h" #include "mailimporter/othermailerutil.h" #include "gearyplugin_debug.h" -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(GearyImportData, "gearyimporter.json") GearyImportData::GearyImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = MailImporter::OtherMailerUtil::gearyDefaultPath(); } GearyImportData::~GearyImportData() { } bool GearyImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString GearyImportData::name() const { return QStringLiteral("Geary"); } bool GearyImportData::importMails() { return false; } bool GearyImportData::importSettings() { QDir directory(mPath); const QStringList lstDir = directory.entryList(QDir::AllDirs); qCDebug(GEARYPLUGIN_LOG) << "Number of directory " << lstDir.count(); const QString configName = QStringLiteral("geary.ini"); for (int i = 0; i < lstDir.count(); ++i) { const QString fullPath = lstDir.at(i) + QDir::separator() + configName; if (QFileInfo::exists(fullPath)) { GearySettings setting(fullPath); setting.setAbstractDisplayInfo(mAbstractDisplayInfo); setting.importSettings(); } } return true; } bool GearyImportData::importAddressBook() { return false; } LibImportWizard::AbstractImporter::TypeSupportedOptions GearyImportData::supportedOption() { TypeSupportedOptions options; //options |=LibImportWizard::AbstractImporter::Mails; options |= LibImportWizard::AbstractImporter::Settings; //options |= LibImportWizard::AbstractImporter::AddressBooks; return options; } #include "gearyimportdata.moc" diff --git a/akonadi-import-wizard/mailapp/mailappimportdata.cpp b/akonadi-import-wizard/mailapp/mailappimportdata.cpp index 09c02bf1..12437b8f 100644 --- a/akonadi-import-wizard/mailapp/mailappimportdata.cpp +++ b/akonadi-import-wizard/mailapp/mailappimportdata.cpp @@ -1,80 +1,80 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mailappimportdata.h" #include "mailimporter/filtermailapp.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_FACTORY_WITH_JSON(MailAppImporterFactory, "mailappimporter.json", registerPlugin(); ) MailAppImportData::MailAppImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = QDir::homePath(); } MailAppImportData::~MailAppImportData() { } bool MailAppImportData::foundMailer() const { #ifdef Q_OS_MAC //TODO find a method to search it. Perhaps look at binary. QDir directory(mPath); if (directory.exists()) { return true; } #endif return false; } QString MailAppImportData::name() const { return QStringLiteral("Mail App"); } bool MailAppImportData::importMails() { MailImporter::FilterMailApp mailapp; initializeFilter(mailapp); mailapp.filterInfo()->setStatusMessage(i18n("Import in progress")); QDir directory(mPath); if (directory.exists()) { mailapp.importMails(mPath); } else { mailapp.import(); } mailapp.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions MailAppImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; return options; } #include "mailappimportdata.moc" diff --git a/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp b/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp index 5ceb4196..4a8483c5 100644 --- a/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp +++ b/akonadi-import-wizard/nylas-mail/nylasmaildata.cpp @@ -1,94 +1,94 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nylasmaildata.h" #include "nylasmailsettings.h" #include "mailimporter/filterinfo.h" #include "mailimporter/othermailerutil.h" #include "nylasmailplugin_debug.h" -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(NylasMailImportData, "nylasmailimporter.json") NylasMailImportData::NylasMailImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = MailImporter::OtherMailerUtil::nylasMailDefaultPath(); } NylasMailImportData::~NylasMailImportData() { } bool NylasMailImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString NylasMailImportData::name() const { return QStringLiteral("NylasMail"); } bool NylasMailImportData::importMails() { return false; } bool NylasMailImportData::importSettings() { QDir directory(mPath); const QStringList lstDir = directory.entryList(QDir::AllDirs); qCDebug(NYLASMAILPLUGIN_LOG) << "Number of directory " << lstDir.count(); /* const QString configName = QStringLiteral("NylasMail.ini"); for (int i = 0; i < lstDir.count(); ++i) { const QString fullPath = lstDir.at(i) + QDir::separator() + configName; if (QFileInfo::exists(fullPath)) { NylasMailSettings setting(fullPath); setting.setAbstractDisplayInfo(mAbstractDisplayInfo); setting.importSettings(); } } */ return true; } bool NylasMailImportData::importAddressBook() { return false; } LibImportWizard::AbstractImporter::TypeSupportedOptions NylasMailImportData::supportedOption() { TypeSupportedOptions options; //options |=LibImportWizard::AbstractImporter::Mails; //Disable it for the moment //options |= LibImportWizard::AbstractImporter::Settings; //options |= LibImportWizard::AbstractImporter::AddressBooks; return options; } #include "nylasmaildata.moc" diff --git a/akonadi-import-wizard/oe/oeimportdata.cpp b/akonadi-import-wizard/oe/oeimportdata.cpp index 41af10a9..31892985 100644 --- a/akonadi-import-wizard/oe/oeimportdata.cpp +++ b/akonadi-import-wizard/oe/oeimportdata.cpp @@ -1,81 +1,81 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "oeimportdata.h" #include "mailimporter/filteroe.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_FACTORY_WITH_JSON(OEImporterFactory, "oeimporter.json", registerPlugin(); ) OeImportData::OeImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = QDir::homePath(); } OeImportData::~OeImportData() { } bool OeImportData::foundMailer() const { #ifdef Q_OS_WIN //TODO find a method to search it. Perhaps look at binary. QDir directory(mPath); if (directory.exists()) { return true; } #endif return false; } QString OeImportData::name() const { return QStringLiteral("Outlook Express"); } bool OeImportData::importMails() { MailImporter::FilterOE opera; initializeFilter(opera); opera.filterInfo()->setStatusMessage(i18n("Import in progress")); QDir directory(mPath); if (directory.exists()) { opera.importMails(mPath); } else { opera.import(); } opera.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions OeImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; return options; } #include "oeimportdata.moc" diff --git a/akonadi-import-wizard/opera/operaimportdata.cpp b/akonadi-import-wizard/opera/operaimportdata.cpp index af1903e8..756bb937 100644 --- a/akonadi-import-wizard/opera/operaimportdata.cpp +++ b/akonadi-import-wizard/opera/operaimportdata.cpp @@ -1,99 +1,99 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "operaimportdata.h" #include "operaaddressbook.h" #include "operasettings.h" #include "mailimporter/filteropera.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(OperaImportData, "operaimporter.json") OperaImportData::OperaImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = MailImporter::FilterOpera::defaultSettingsPath(); } OperaImportData::~OperaImportData() { } bool OperaImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString OperaImportData::name() const { return QStringLiteral("Opera"); } bool OperaImportData::importMails() { MailImporter::FilterOpera opera; initializeFilter(opera); opera.filterInfo()->setStatusMessage(i18n("Import in progress")); const QString mailPath(mPath + QStringLiteral("mail/store/")); QDir directory(mailPath); if (directory.exists()) { opera.importMails(mailPath); } else { opera.import(); } opera.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } bool OperaImportData::importAddressBook() { const QString addressbookFile(mPath + QStringLiteral("bookmarks.adr")); OperaAddressBook addressbook(addressbookFile); addressbook.setAbstractDisplayInfo(mAbstractDisplayInfo); addressbook.importAddressBook(); return true; } bool OperaImportData::importSettings() { const QString settingFile(mPath + QStringLiteral("mail/accounts.ini")); OperaSettings settings(settingFile); settings.setAbstractDisplayInfo(mAbstractDisplayInfo); settings.importSettings(); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions OperaImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; options |= LibImportWizard::AbstractImporter::AddressBooks; options |= LibImportWizard::AbstractImporter::Settings; return options; } #include "operaimportdata.moc" diff --git a/akonadi-import-wizard/pmail/pmailimportdata.cpp b/akonadi-import-wizard/pmail/pmailimportdata.cpp index 5efc5f79..2736f1f2 100644 --- a/akonadi-import-wizard/pmail/pmailimportdata.cpp +++ b/akonadi-import-wizard/pmail/pmailimportdata.cpp @@ -1,91 +1,91 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "pmailimportdata.h" #include "pmailsettings.h" #include "mailimporter/filterpmail.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_FACTORY_WITH_JSON(PMailImporterFactory, "pmailimporter.json", registerPlugin(); ) PMailImportData::PMailImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { mPath = QDir::homePath(); } PMailImportData::~PMailImportData() { } bool PMailImportData::foundMailer() const { #ifdef Q_OS_WIN //TODO find a method to search it. Perhaps look at binary. QDir directory(mPath); if (directory.exists()) { return true; } #endif return false; } QString PMailImportData::name() const { return QStringLiteral("Pegasus Mail"); } bool PMailImportData::importMails() { MailImporter::FilterPMail pmail; initializeFilter(pmail); pmail.filterInfo()->setStatusMessage(i18n("Import in progress")); QDir directory(mPath); if (directory.exists()) { pmail.importMails(mPath); } else { pmail.import(); } pmail.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } bool PMailImportData::importSettings() { //TODO verify path const QString settingFile(mPath + QLatin1String("pmail.ini")); PMailSettings settings(settingFile); settings.setAbstractDisplayInfo(mAbstractDisplayInfo); settings.importSettings(); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions PMailImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; //options |=LibImportWizard::AbstractImporter::Settings; return options; } #include "pmailimportdata.moc" diff --git a/akonadi-import-wizard/thebat/thebatimportdata.cpp b/akonadi-import-wizard/thebat/thebatimportdata.cpp index 0527a4a2..9db1ab5e 100644 --- a/akonadi-import-wizard/thebat/thebatimportdata.cpp +++ b/akonadi-import-wizard/thebat/thebatimportdata.cpp @@ -1,79 +1,79 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "thebatimportdata.h" #include "mailimporter/filterthebat.h" #include "mailimporter/filterinfo.h" #include -#include +#include #include K_PLUGIN_FACTORY_WITH_JSON(TheBatImporterFactory, "thebatimporter.json", registerPlugin(); ) TheBatImportData::TheBatImportData(QObject *parent, const QList &) : LibImportWizard::AbstractImporter(parent) { //TODO fix it mPath = QDir::homePath(); } TheBatImportData::~TheBatImportData() { } bool TheBatImportData::foundMailer() const { QDir directory(mPath); if (directory.exists()) { return true; } return false; } QString TheBatImportData::name() const { return QStringLiteral("TheBat"); } bool TheBatImportData::importMails() { MailImporter::FilterTheBat thebat; initializeFilter(thebat); thebat.filterInfo()->setStatusMessage(i18n("Import in progress")); QDir directory(mPath); if (directory.exists()) { thebat.importMails(mPath); } else { thebat.import(); } thebat.filterInfo()->setStatusMessage(i18n("Import finished")); return true; } LibImportWizard::AbstractImporter::TypeSupportedOptions TheBatImportData::supportedOption() { TypeSupportedOptions options; options |= LibImportWizard::AbstractImporter::Mails; return options; } #include "thebatimportdata.moc" diff --git a/kaddressbook/editorpages/cryptopageplugin.cpp b/kaddressbook/editorpages/cryptopageplugin.cpp index 315d3814..9825b456 100644 --- a/kaddressbook/editorpages/cryptopageplugin.cpp +++ b/kaddressbook/editorpages/cryptopageplugin.cpp @@ -1,211 +1,211 @@ /* Copyright (c) 2004 Klar�vdalens Datakonsult AB 2009 Tobias Koenig This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "cryptopageplugin.h" #include #include #include #include #include #include #include #include #include #include -#include +#include #include #include "gpgme++/data.h" #include "gpgme++/key.h" #include "Libkleo/KeyRequester" #include "Libkleo/Enum" CryptoPagePlugin::CryptoPagePlugin() : mReadOnly(false) { KIconLoader::global()->addAppDir(QStringLiteral("libkleopatra")); QGridLayout *topLayout = new QGridLayout(this); topLayout->setColumnStretch(1, 1); topLayout->setRowStretch(4, 1); QGroupBox *protGB = new QGroupBox(i18n("Allowed Protocols"), this); QLayout *protGBLayout = new QVBoxLayout; topLayout->addWidget(protGB, 0, 0, 1, 2); uint msgFormat = 1; for (uint i = 0; i < NumberOfProtocols; ++i) { Kleo::CryptoMessageFormat f = static_cast(msgFormat); mProtocolCB[ i ] = new QCheckBox(Kleo::cryptoMessageFormatToLabel(f), protGB); protGBLayout->addWidget(mProtocolCB[i]); // Iterating over a bitfield means *2 every time msgFormat *= 2; } protGB->setLayout(protGBLayout); QLabel *l = new QLabel(i18n("Preferred OpenPGP encryption key:"), this); topLayout->addWidget(l, 1, 0); mPgpKey = new Kleo::EncryptionKeyRequester(true, Kleo::EncryptionKeyRequester::OpenPGP, this); topLayout->addWidget(mPgpKey, 1, 1); l = new QLabel(i18n("Preferred S/MIME encryption certificate:"), this); topLayout->addWidget(l, 2, 0); mSmimeCert = new Kleo::EncryptionKeyRequester(true, Kleo::EncryptionKeyRequester::SMIME, this); topLayout->addWidget(mSmimeCert, 2, 1); QGroupBox *box = new QGroupBox(i18n("Message Preference"), this); QLayout *boxLayout = new QVBoxLayout; topLayout->addWidget(box, 3, 0, 1, 2); // Send preferences/sign (see kleo/kleo/enum.h) QWidget *hbox = new QWidget(box); QHBoxLayout *hboxHBoxLayout = new QHBoxLayout(hbox); hboxHBoxLayout->setContentsMargins(0, 0, 0, 0); l = new QLabel(i18n("Sign:"), hbox); hboxHBoxLayout->addWidget(l); mSignPref = new QComboBox(hbox); hboxHBoxLayout->addWidget(mSignPref); l->setBuddy(mSignPref); mSignPref->setEditable(false); for (unsigned int i = Kleo::UnknownSigningPreference; i < Kleo::MaxSigningPreference; ++i) { mSignPref->addItem(Kleo::signingPreferenceToLabel( static_cast(i))); } boxLayout->addWidget(hbox); // Send preferences/encrypt (see kleo/kleo/enum.h) hbox = new QWidget(box); hboxHBoxLayout = new QHBoxLayout(hbox); hboxHBoxLayout->setContentsMargins(0, 0, 0, 0); l = new QLabel(i18n("Encrypt:"), hbox); hboxHBoxLayout->addWidget(l); mCryptPref = new QComboBox(hbox); hboxHBoxLayout->addWidget(mCryptPref); l->setBuddy(mCryptPref); mCryptPref->setEditable(false); for (unsigned int i = Kleo::UnknownPreference; i < Kleo::MaxEncryptionPreference; ++i) { mCryptPref->addItem(Kleo::encryptionPreferenceToLabel( static_cast(i))); } boxLayout->addWidget(hbox); box->setLayout(boxLayout); } CryptoPagePlugin::~CryptoPagePlugin() { } QString CryptoPagePlugin::title() const { return i18n("Crypto Settings"); } void CryptoPagePlugin::loadContact(const KContacts::Addressee &contact) { const QStringList protocolPrefs = contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOPROTOPREF")).split(QLatin1Char(','), QString::SkipEmptyParts); const uint cryptoFormats = Kleo::stringListToCryptoMessageFormats(protocolPrefs); uint msgFormat = 1; for (uint i = 0; i < NumberOfProtocols; ++i, msgFormat *= 2) { mProtocolCB[i]->setChecked(cryptoFormats & msgFormat); } mSignPref->setCurrentIndex(Kleo::stringToSigningPreference(contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOSIGNPREF")))); mCryptPref->setCurrentIndex(Kleo::stringToEncryptionPreference(contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOENCRYPTPREF")))); // We don't use the contents of addr->key(...) because we want just a ref. // to the key/cert. stored elsewhere. mPgpKey->setFingerprints(contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("OPENPGPFP")).split(QLatin1Char(','), QString::SkipEmptyParts)); mSmimeCert->setFingerprints(contact.custom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("SMIMEFP")).split(QLatin1Char(','), QString::SkipEmptyParts)); } void CryptoPagePlugin::storeContact(KContacts::Addressee &contact) const { uint cryptoFormats = 0; uint msgFormat = 1; for (uint i = 0; i < NumberOfProtocols; ++i, msgFormat *= 2) { if (mProtocolCB[ i ]->isChecked()) { cryptoFormats |= msgFormat; } } const QStringList protocolPref = Kleo::cryptoMessageFormatsToStringList(cryptoFormats); if (!protocolPref.isEmpty()) { contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOPROTOPREF"), protocolPref.join(QLatin1Char(','))); } else { contact.removeCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOPROTOPREF")); } const Kleo::SigningPreference signPref = static_cast(mSignPref->currentIndex()); if (signPref != Kleo::UnknownSigningPreference) { contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOSIGNPREF"), QLatin1String(Kleo::signingPreferenceToString(signPref))); } else { contact.removeCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOSIGNPREF")); } const Kleo::EncryptionPreference encryptPref = static_cast(mCryptPref->currentIndex()); if (encryptPref != Kleo::UnknownPreference) { contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOENCRYPTPREF"), QLatin1String(Kleo::encryptionPreferenceToString(encryptPref))); } else { contact.removeCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("CRYPTOENCRYPTPREF")); } const QStringList pfp = mPgpKey->fingerprints(); const QStringList sfp = mSmimeCert->fingerprints(); if (!pfp.isEmpty()) { contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("OPENPGPFP"), pfp.join(QLatin1Char(','))); } else { contact.removeCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("OPENPGPFP")); } if (!sfp.isEmpty()) { contact.insertCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("SMIMEFP"), sfp.join(QLatin1Char(','))); } else { contact.removeCustom(QStringLiteral("KADDRESSBOOK"), QStringLiteral("SMIMEFP")); } } void CryptoPagePlugin::setReadOnly(bool readOnly) { mReadOnly = readOnly; for (uint i = 0; i < NumberOfProtocols; ++i) { mProtocolCB[ i ]->setEnabled(!readOnly); } mSignPref->setEnabled(!readOnly); mCryptPref->setEnabled(!readOnly); mPgpKey->setEnabled(!readOnly); mSmimeCert->setEnabled(!readOnly); } diff --git a/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp b/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp index 4524667d..1b8b8c71 100644 --- a/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp +++ b/kaddressbook/importexportplugins/csv/csvimportexportplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "csvimportexportplugin.h" #include "csvimportexportplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(CSVImportExportPlugin, "kaddressbook_importexportcsvplugin.json") CSVImportExportPlugin::CSVImportExportPlugin(QObject *parent, const QList &) : KAddressBookImportExport::KAddressBookImportExportPlugin(parent) { } CSVImportExportPlugin::~CSVImportExportPlugin() { } PimCommon::AbstractGenericPluginInterface *CSVImportExportPlugin::createInterface(QObject *parent) { CSVImportExportPluginInterface *interface = new CSVImportExportPluginInterface(parent); return interface; } bool CSVImportExportPlugin::hasPopupMenuSupport() const { return true; } #include "csvimportexportplugin.moc" diff --git a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp index 08299992..62d7639a 100644 --- a/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp +++ b/kaddressbook/importexportplugins/gmx/gmximportexportplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "gmximportexportplugin.h" #include "gmximportexportplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(GMXImportExportPlugin, "kaddressbook_importexportgmxplugin.json") GMXImportExportPlugin::GMXImportExportPlugin(QObject *parent, const QList &) : KAddressBookImportExport::KAddressBookImportExportPlugin(parent) { } GMXImportExportPlugin::~GMXImportExportPlugin() { } PimCommon::AbstractGenericPluginInterface *GMXImportExportPlugin::createInterface(QObject *parent) { GMXImportExportPluginInterface *interface = new GMXImportExportPluginInterface(parent); return interface; } bool GMXImportExportPlugin::hasPopupMenuSupport() const { return true; } #include "gmximportexportplugin.moc" diff --git a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp index ab95d057..1083e9f6 100644 --- a/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp +++ b/kaddressbook/importexportplugins/ldap/ldapimportexportplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ldapimportexportplugin.h" #include "ldapimportexportplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(LDapImportExportPlugin, "kaddressbook_importexportldapplugin.json") LDapImportExportPlugin::LDapImportExportPlugin(QObject *parent, const QList &) : KAddressBookImportExport::KAddressBookImportExportPlugin(parent) { } LDapImportExportPlugin::~LDapImportExportPlugin() { } PimCommon::AbstractGenericPluginInterface *LDapImportExportPlugin::createInterface(QObject *parent) { LDapImportExportPluginInterface *interface = new LDapImportExportPluginInterface(parent); return interface; } bool LDapImportExportPlugin::hasPopupMenuSupport() const { return true; } #include "ldapimportexportplugin.moc" diff --git a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp index 27a865e6..9f738dd4 100644 --- a/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp +++ b/kaddressbook/importexportplugins/ldif/ldifimportexportplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ldifimportexportplugin.h" #include "ldifimportexportplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(LDifImportExportPlugin, "kaddressbook_importexportldifplugin.json") LDifImportExportPlugin::LDifImportExportPlugin(QObject *parent, const QList &) : KAddressBookImportExport::KAddressBookImportExportPlugin(parent) { } LDifImportExportPlugin::~LDifImportExportPlugin() { } PimCommon::AbstractGenericPluginInterface *LDifImportExportPlugin::createInterface(QObject *parent) { LDifImportExportPluginInterface *interface = new LDifImportExportPluginInterface(parent); return interface; } bool LDifImportExportPlugin::hasPopupMenuSupport() const { return true; } #include "ldifimportexportplugin.moc" diff --git a/kaddressbook/importexportplugins/vcards/engine/vcardexportselectionwidget.cpp b/kaddressbook/importexportplugins/vcards/engine/vcardexportselectionwidget.cpp index fd2d6301..186a419f 100644 --- a/kaddressbook/importexportplugins/vcards/engine/vcardexportselectionwidget.cpp +++ b/kaddressbook/importexportplugins/vcards/engine/vcardexportselectionwidget.cpp @@ -1,161 +1,161 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "vcardexportselectionwidget.h" #include -#include +#include #include #include #include #include VCardExportSelectionWidget::VCardExportSelectionWidget(QWidget *parent) : QWidget(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(this); mainLayout->setContentsMargins(0, 0, 0, 0); QGroupBox *gbox = new QGroupBox( i18nc("@title:group", "Fields to be exported"), this); mainLayout->addWidget(gbox); QGridLayout *layout = new QGridLayout; gbox->setLayout(layout); gbox->setFlat(true); layout->addWidget(gbox, 0, 0, 1, 2); mPrivateBox = new QCheckBox(i18nc("@option:check", "Private fields"), this); mPrivateBox->setToolTip( i18nc("@info:tooltip", "Export private fields")); mPrivateBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "private fields to the vCard output file.")); layout->addWidget(mPrivateBox, 1, 0); mBusinessBox = new QCheckBox(i18nc("@option:check", "Business fields"), this); mBusinessBox->setToolTip( i18nc("@info:tooltip", "Export business fields")); mBusinessBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "business fields to the vCard output file.")); layout->addWidget(mBusinessBox, 2, 0); mOtherBox = new QCheckBox(i18nc("@option:check", "Other fields"), this); mOtherBox->setToolTip( i18nc("@info:tooltip", "Export other fields")); mOtherBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "other fields to the vCard output file.")); layout->addWidget(mOtherBox, 3, 0); mEncryptionKeys = new QCheckBox(i18nc("@option:check", "Encryption keys"), this); mEncryptionKeys->setToolTip( i18nc("@info:tooltip", "Export encryption keys")); mEncryptionKeys->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "encryption keys to the vCard output file.")); layout->addWidget(mEncryptionKeys, 1, 1); mPictureBox = new QCheckBox(i18nc("@option:check", "Pictures"), this); mPictureBox->setToolTip( i18nc("@info:tooltip", "Export pictures")); mPictureBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's " "picture to the vCard output file.")); layout->addWidget(mPictureBox, 2, 1); gbox = new QGroupBox( i18nc("@title:group", "Export options"), this); gbox->setFlat(true); mainLayout->addWidget(gbox); QHBoxLayout *gbLayout = new QHBoxLayout; gbox->setLayout(gbLayout); mDisplayNameBox = new QCheckBox(i18nc("@option:check", "Display name as full name"), this); mDisplayNameBox->setToolTip( i18nc("@info:tooltip", "Export display name as full name")); mDisplayNameBox->setWhatsThis( i18nc("@info:whatsthis", "Check this box if you want to export the contact's display name " "in the vCard's full name field. This may be required to get the " "name shown correctly in GMail or Android.")); gbLayout->addWidget(mDisplayNameBox); readSettings(); } VCardExportSelectionWidget::~VCardExportSelectionWidget() { writeSettings(); } void VCardExportSelectionWidget::readSettings() { KConfig config(QStringLiteral("kaddressbookrc")); const KConfigGroup group(&config, "XXPortVCard"); mPrivateBox->setChecked(group.readEntry("ExportPrivateFields", true)); mBusinessBox->setChecked(group.readEntry("ExportBusinessFields", true)); mOtherBox->setChecked(group.readEntry("ExportOtherFields", true)); mEncryptionKeys->setChecked(group.readEntry("ExportEncryptionKeys", true)); mPictureBox->setChecked(group.readEntry("ExportPictureFields", true)); mDisplayNameBox->setChecked(group.readEntry("ExportDisplayName", false)); } void VCardExportSelectionWidget::writeSettings() { KConfig config(QStringLiteral("kaddressbookrc")); KConfigGroup group(&config, "XXPortVCard"); group.writeEntry("ExportPrivateFields", mPrivateBox->isChecked()); group.writeEntry("ExportBusinessFields", mBusinessBox->isChecked()); group.writeEntry("ExportOtherFields", mOtherBox->isChecked()); group.writeEntry("ExportEncryptionKeys", mEncryptionKeys->isChecked()); group.writeEntry("ExportPictureFields", mPictureBox->isChecked()); group.writeEntry("ExportDisplayName", mDisplayNameBox->isChecked()); } VCardExportSelectionWidget::ExportFields VCardExportSelectionWidget::exportType() const { ExportFields type = None; if (mPrivateBox->isChecked()) { type |= Private; } if (mBusinessBox->isChecked()) { type |= Business; } if (mOtherBox->isChecked()) { type |= Other; } if (mEncryptionKeys->isChecked()) { type |= Encryption; } if (mPictureBox->isChecked()) { type |= Picture; } if (mDisplayNameBox->isChecked()) { type |= DiplayName; } return type; } diff --git a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp index 111f695f..37fec011 100644 --- a/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp +++ b/kaddressbook/importexportplugins/vcards/vcardimportexportplugin.cpp @@ -1,45 +1,45 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "vcardimportexportplugin.h" #include "vcardimportexportplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(VCardImportExportPlugin, "kaddressbook_importexportvcardplugin.json") VCardImportExportPlugin::VCardImportExportPlugin(QObject *parent, const QList &) : KAddressBookImportExport::KAddressBookImportExportPlugin(parent) { } VCardImportExportPlugin::~VCardImportExportPlugin() { } PimCommon::AbstractGenericPluginInterface *VCardImportExportPlugin::createInterface(QObject *parent) { VCardImportExportPluginInterface *interface = new VCardImportExportPluginInterface(parent); return interface; } bool VCardImportExportPlugin::hasPopupMenuSupport() const { return true; } #include "vcardimportexportplugin.moc" diff --git a/kaddressbook/plugins/checkgravatar/checkgravatarplugin.cpp b/kaddressbook/plugins/checkgravatar/checkgravatarplugin.cpp index 8db156d3..25ed6156 100644 --- a/kaddressbook/plugins/checkgravatar/checkgravatarplugin.cpp +++ b/kaddressbook/plugins/checkgravatar/checkgravatarplugin.cpp @@ -1,47 +1,47 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "checkgravatarplugin.h" #include "checkgravatarplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(CheckGravatarPlugin, "kaddressbook_checkgravatarplugin.json" ) CheckGravatarPlugin::CheckGravatarPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } CheckGravatarPlugin::~CheckGravatarPlugin() { } PimCommon::GenericPluginInterface *CheckGravatarPlugin::createInterface(QObject *parent) { CheckGravatarPluginInterface *interface = new CheckGravatarPluginInterface(parent); return interface; } bool CheckGravatarPlugin::hasPopupMenuSupport() const { return true; } #include "checkgravatarplugin.moc" diff --git a/kaddressbook/plugins/mergecontacts/mergecontactsplugin.cpp b/kaddressbook/plugins/mergecontacts/mergecontactsplugin.cpp index 52a13ae8..3a6bddb8 100644 --- a/kaddressbook/plugins/mergecontacts/mergecontactsplugin.cpp +++ b/kaddressbook/plugins/mergecontacts/mergecontactsplugin.cpp @@ -1,42 +1,42 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "mergecontactsplugin.h" #include "mergecontactsplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(MergeContactsPlugin, "kaddressbook_mergecontactsplugin.json" ) MergeContactsPlugin::MergeContactsPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } MergeContactsPlugin::~MergeContactsPlugin() { } PimCommon::GenericPluginInterface *MergeContactsPlugin::createInterface(QObject *parent) { MergeContactsPluginInterface *interface = new MergeContactsPluginInterface(parent); return interface; } #include "mergecontactsplugin.moc" diff --git a/kaddressbook/plugins/searchduplicates/searchduplicatesplugin.cpp b/kaddressbook/plugins/searchduplicates/searchduplicatesplugin.cpp index 84979702..794c1bcb 100644 --- a/kaddressbook/plugins/searchduplicates/searchduplicatesplugin.cpp +++ b/kaddressbook/plugins/searchduplicates/searchduplicatesplugin.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "searchduplicatesplugin.h" #include "searchduplicatesplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(SearchDuplicatesPlugin, "kaddressbook_searchduplicatesplugin.json") SearchDuplicatesPlugin::SearchDuplicatesPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } SearchDuplicatesPlugin::~SearchDuplicatesPlugin() { } PimCommon::GenericPluginInterface *SearchDuplicatesPlugin::createInterface(QObject *parent) { SearchDuplicatesPluginInterface *interface = new SearchDuplicatesPluginInterface(parent); return interface; } #include "searchduplicatesplugin.moc" diff --git a/kaddressbook/plugins/sendmail/sendmailplugin.cpp b/kaddressbook/plugins/sendmail/sendmailplugin.cpp index e0ea2997..bec4757e 100644 --- a/kaddressbook/plugins/sendmail/sendmailplugin.cpp +++ b/kaddressbook/plugins/sendmail/sendmailplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sendmailplugin.h" #include "sendmailplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(SendMailPlugin, "kaddressbook_sendmailplugin.json") SendMailPlugin::SendMailPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } SendMailPlugin::~SendMailPlugin() { } PimCommon::GenericPluginInterface *SendMailPlugin::createInterface(QObject *parent) { SendMailPluginInterface *interface = new SendMailPluginInterface(parent); return interface; } bool SendMailPlugin::hasPopupMenuSupport() const { return true; } #include "sendmailplugin.moc" diff --git a/kaddressbook/plugins/sendvcards/sendvcardsplugin.cpp b/kaddressbook/plugins/sendvcards/sendvcardsplugin.cpp index c5878fc6..bba427ed 100644 --- a/kaddressbook/plugins/sendvcards/sendvcardsplugin.cpp +++ b/kaddressbook/plugins/sendvcards/sendvcardsplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sendvcardsplugin.h" #include "sendvcardsplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(SendVcardsPlugin, "kaddressbook_sendvcardsplugin.json") SendVcardsPlugin::SendVcardsPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } SendVcardsPlugin::~SendVcardsPlugin() { } PimCommon::GenericPluginInterface *SendVcardsPlugin::createInterface(QObject *parent) { SendVcardsPluginInterface *interface = new SendVcardsPluginInterface(parent); return interface; } bool SendVcardsPlugin::hasPopupMenuSupport() const { return true; } #include "sendvcardsplugin.moc" diff --git a/kmail/editorconvertertextplugins/markdown/plugin/markdownplugin.cpp b/kmail/editorconvertertextplugins/markdown/plugin/markdownplugin.cpp index dc6d08d6..bff10d06 100644 --- a/kmail/editorconvertertextplugins/markdown/plugin/markdownplugin.cpp +++ b/kmail/editorconvertertextplugins/markdown/plugin/markdownplugin.cpp @@ -1,86 +1,86 @@ /* Copyright (C) 2018-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "markdownplugin.h" #include "markdowninterface.h" #include "markdownconfiguredialog.h" #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(MarkdownPlugin, "kmail_markdownplugin.json") MarkdownPlugin::MarkdownPlugin(QObject *parent, const QList &) : MessageComposer::PluginEditorConvertText(parent) { } MarkdownPlugin::~MarkdownPlugin() { } MessageComposer::PluginEditorConvertTextInterface *MarkdownPlugin::createInterface(QObject *parent) { MarkdownInterface *interface = new MarkdownInterface(parent); connect(this, &MarkdownPlugin::configChanged, interface, &MarkdownInterface::reloadConfig); return interface; } bool MarkdownPlugin::hasConfigureDialog() const { return true; } void MarkdownPlugin::showConfigureDialog(QWidget *parent) { Q_UNUSED(parent); QPointer dlg = new MarkdownConfigureDialog(parent); if (dlg->exec()) { Q_EMIT configChanged(); } delete dlg; } QString MarkdownPlugin::description() const { return i18n("Generate HTML from markdown language."); } bool MarkdownPlugin::canWorkOnHtml() const { return false; } bool MarkdownPlugin::hasStatusBarSupport() const { return true; } bool MarkdownPlugin::hasPopupMenuSupport() const { return true; } bool MarkdownPlugin::hasToolBarSupport() const { return false; } #include "markdownplugin.moc" diff --git a/kmail/editorconvertertextplugins/qtcreator-template/kmaileditorconvertertextplugins/plugineditor.cpp b/kmail/editorconvertertextplugins/qtcreator-template/kmaileditorconvertertextplugins/plugineditor.cpp index ee4d9dbf..c4586e55 100644 --- a/kmail/editorconvertertextplugins/qtcreator-template/kmaileditorconvertertextplugins/plugineditor.cpp +++ b/kmail/editorconvertertextplugins/qtcreator-template/kmaileditorconvertertextplugins/plugineditor.cpp @@ -1,25 +1,25 @@ %{Cpp:LicenseTemplate}\ #include "%{ProjectNameLower}plugineditor.h" #include "%{ProjectNameLower}plugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(%{CN}PluginEditor, "%{ProjectNameLower}editorplugin.json") %{CN}PluginEditor::%{CN}PluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditorConvertText(parent) { } %{CN}PluginEditor::~%{CN}PluginEditor() { } MessageComposer::PluginEditorConvertTextInterface *%{CN}PluginEditor::createInterface(KActionCollection *ac, QObject *parent) { %{CN}PluginEditorInterface *interface = new %{CN}PluginEditorInterface(parent); interface->createAction(ac); return interface; } #include "%{ProjectNameLower}plugineditor.moc" diff --git a/kmail/editorinitplugins/externalcomposer/externalcomposerplugineditor.cpp b/kmail/editorinitplugins/externalcomposer/externalcomposerplugineditor.cpp index 855d24e0..263e2493 100644 --- a/kmail/editorinitplugins/externalcomposer/externalcomposerplugineditor.cpp +++ b/kmail/editorinitplugins/externalcomposer/externalcomposerplugineditor.cpp @@ -1,54 +1,54 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "externalcomposerplugineditor.h" #include "externalcomposerplugineditorinterface.h" #include "externalcomposerconfiguredialog.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(ExternalComposerPluginEditor, "kmail_externalcomposereditorplugin.json") ExternalComposerPluginEditor::ExternalComposerPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditorInit(parent) { } ExternalComposerPluginEditor::~ExternalComposerPluginEditor() { } MessageComposer::PluginEditorInitInterface *ExternalComposerPluginEditor::createInterface(QObject *parent) { ExternalComposerPluginEditorInterface *interface = new ExternalComposerPluginEditorInterface(parent); return interface; } bool ExternalComposerPluginEditor::hasConfigureDialog() const { return true; } void ExternalComposerPluginEditor::showConfigureDialog(QWidget *parent) { QPointer dlg = new ExternalComposerConfigureDialog(parent); dlg->exec(); delete dlg; } #include "externalcomposerplugineditor.moc" diff --git a/kmail/editorplugins/autocorrection/autocorrectionplugineditor.cpp b/kmail/editorplugins/autocorrection/autocorrectionplugineditor.cpp index 99cae2ec..f250456b 100644 --- a/kmail/editorplugins/autocorrection/autocorrectionplugineditor.cpp +++ b/kmail/editorplugins/autocorrection/autocorrectionplugineditor.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "autocorrectionplugineditor.h" #include "autocorrectionplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(AutoCorrectionPluginEditor, "kmail_autocorrectioneditorplugin.json") AutoCorrectionPluginEditor::AutoCorrectionPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } AutoCorrectionPluginEditor::~AutoCorrectionPluginEditor() { } MessageComposer::PluginEditorInterface *AutoCorrectionPluginEditor::createInterface(QObject *parent) { AutoCorrectionPluginEditorInterface *interface = new AutoCorrectionPluginEditorInterface(parent); return interface; } #include "autocorrectionplugineditor.moc" diff --git a/kmail/editorplugins/changecase/changecaseplugineditor.cpp b/kmail/editorplugins/changecase/changecaseplugineditor.cpp index e3ca6eee..6c8cf324 100644 --- a/kmail/editorplugins/changecase/changecaseplugineditor.cpp +++ b/kmail/editorplugins/changecase/changecaseplugineditor.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "changecaseplugineditor.h" #include "changecaseplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(ChangeCasePluginEditor, "kmail_changecaseeditorplugin.json") ChangeCasePluginEditor::ChangeCasePluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } ChangeCasePluginEditor::~ChangeCasePluginEditor() { } bool ChangeCasePluginEditor::hasPopupMenuSupport() const { return true; } MessageComposer::PluginEditorInterface *ChangeCasePluginEditor::createInterface(QObject *parent) { ChangeCasePluginEditorInterface *interface = new ChangeCasePluginEditorInterface(parent); return interface; } #include "changecaseplugineditor.moc" diff --git a/kmail/editorplugins/insertemail/insertemailplugineditor.cpp b/kmail/editorplugins/insertemail/insertemailplugineditor.cpp index 256998ab..dfbbb359 100644 --- a/kmail/editorplugins/insertemail/insertemailplugineditor.cpp +++ b/kmail/editorplugins/insertemail/insertemailplugineditor.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "insertemailplugineditor.h" #include "insertemailplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(InsertEmailPluginEditor, "kmail_insertemaileditorplugin.json") InsertEmailPluginEditor::InsertEmailPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } InsertEmailPluginEditor::~InsertEmailPluginEditor() { } MessageComposer::PluginEditorInterface *InsertEmailPluginEditor::createInterface(QObject *parent) { InsertEmailPluginEditorInterface *interface = new InsertEmailPluginEditorInterface(parent); return interface; } #include "insertemailplugineditor.moc" diff --git a/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp b/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp index 23f9aec1..aeabfded 100644 --- a/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp +++ b/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp @@ -1,63 +1,63 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "insertshorturlplugineditor.h" #include "insertshorturlplugineditorinterface.h" #include "insertshorturlconfiguredialog.h" -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(InsertShorturlPluginEditor, "kmail_insertshorturleditorplugin.json") InsertShorturlPluginEditor::InsertShorturlPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } InsertShorturlPluginEditor::~InsertShorturlPluginEditor() { } MessageComposer::PluginEditorInterface *InsertShorturlPluginEditor::createInterface(QObject *parent) { InsertShorturlPluginEditorInterface *interface = new InsertShorturlPluginEditorInterface(parent); connect(this, &InsertShorturlPluginEditor::configChanged, interface, &InsertShorturlPluginEditorInterface::loadEngine); return interface; } bool InsertShorturlPluginEditor::hasPopupMenuSupport() const { return true; } bool InsertShorturlPluginEditor::hasConfigureDialog() const { return true; } void InsertShorturlPluginEditor::showConfigureDialog(QWidget *parent) { QPointer dlg = new InsertShorturlConfigureDialog(parent); if (dlg->exec()) { Q_EMIT configChanged(); } delete dlg; } #include "insertshorturlplugineditor.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/googleshorturlengineplugin/googleshorturlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/googleshorturlengineplugin/googleshorturlengineplugin.cpp index f4f6a630..87328973 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/googleshorturlengineplugin/googleshorturlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/googleshorturlengineplugin/googleshorturlengineplugin.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2015-2019 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "googleshorturlengineplugin.h" #include "googleshorturlengineinterface.h" -#include +#include K_PLUGIN_FACTORY_WITH_JSON(GoogleShortUrlEnginePluginFactory, "pimcommon_googleshorturlengineplugin.json", registerPlugin(); ) GoogleShortUrlEnginePlugin::GoogleShortUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } GoogleShortUrlEnginePlugin::~GoogleShortUrlEnginePlugin() { } ShortUrlEngineInterface *GoogleShortUrlEnginePlugin::createInterface(QObject *parent) { return new GoogleShortUrlEngineInterface(parent); } #include "googleshorturlengineplugin.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/isgdshorturlengineplugin/isgdshorturlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/isgdshorturlengineplugin/isgdshorturlengineplugin.cpp index 7bcbe52f..88f3c3f9 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/isgdshorturlengineplugin/isgdshorturlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/isgdshorturlengineplugin/isgdshorturlengineplugin.cpp @@ -1,45 +1,45 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "isgdshorturlengineplugin.h" #include "isgdshorturlengineinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(IsgdShortUrlEnginePlugin, "pimcommon_isgdshorturlengineplugin.json") IsgdShortUrlEnginePlugin::IsgdShortUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } IsgdShortUrlEnginePlugin::~IsgdShortUrlEnginePlugin() { } ShortUrlEngineInterface *IsgdShortUrlEnginePlugin::createInterface(QObject *parent) { return new IsgdShortUrlEngineInterface(this, parent); } QString IsgdShortUrlEnginePlugin::engineName() const { return QStringLiteral("isdgshorturl"); } #include "isgdshorturlengineplugin.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp index 14d39e63..fcffba25 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/shorturlenginepluginmanager.cpp @@ -1,131 +1,131 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "shorturlengineplugin.h" #include "shorturlenginepluginmanager.h" #include #include -#include +#include #include #include #include class ShortUrlEnginePluginInfo { public: ShortUrlEnginePluginInfo() : plugin(nullptr) { } QString metaDataFileNameBaseName; QString metaDataFileName; QString pluginName; ShortUrlEnginePlugin *plugin = nullptr; }; class ShortUrlEnginePluginManagerPrivate { public: ShortUrlEnginePluginManagerPrivate(ShortUrlEnginePluginManager *qq) : q(qq) { } void initializePlugins(); void loadPlugin(ShortUrlEnginePluginInfo *item); QVector pluginsList() const; QVector mPluginList; ShortUrlEnginePluginManager *q; }; void ShortUrlEnginePluginManagerPrivate::initializePlugins() { const QVector plugins = KPluginLoader::findPlugins(QStringLiteral("pimcommon"), [](const KPluginMetaData &md) { return md.serviceTypes().contains(QLatin1String("PimCommonShortUrlEngine/Plugin")); }); QVectorIterator i(plugins); i.toBack(); QSet unique; while (i.hasPrevious()) { ShortUrlEnginePluginInfo info; const KPluginMetaData data = i.previous(); info.metaDataFileNameBaseName = QFileInfo(data.fileName()).baseName(); info.metaDataFileName = data.fileName(); info.pluginName = data.name(); // only load plugins once, even if found multiple times! if (unique.contains(info.metaDataFileNameBaseName)) { continue; } info.plugin = nullptr; mPluginList.push_back(info); unique.insert(info.metaDataFileNameBaseName); } QVector::iterator end(mPluginList.end()); for (QVector::iterator it = mPluginList.begin(); it != end; ++it) { loadPlugin(&(*it)); } } void ShortUrlEnginePluginManagerPrivate::loadPlugin(ShortUrlEnginePluginInfo *item) { KPluginLoader pluginLoader(item->metaDataFileName); if (pluginLoader.factory()) { item->plugin = pluginLoader.factory()->create(q, QVariantList() << item->metaDataFileNameBaseName); item->plugin->setPluginName(item->pluginName); } } QVector ShortUrlEnginePluginManagerPrivate::pluginsList() const { QVector lst; QVector::ConstIterator end(mPluginList.constEnd()); for (QVector::ConstIterator it = mPluginList.constBegin(); it != end; ++it) { if ((*it).plugin) { lst << (*it).plugin; } } return lst; } ShortUrlEnginePluginManager::ShortUrlEnginePluginManager(QObject *parent) : QObject(parent) , d(new ShortUrlEnginePluginManagerPrivate(this)) { d->initializePlugins(); } ShortUrlEnginePluginManager::~ShortUrlEnginePluginManager() { delete d; } ShortUrlEnginePluginManager *ShortUrlEnginePluginManager::self() { static ShortUrlEnginePluginManager s_self; return &s_self; } QVector ShortUrlEnginePluginManager::pluginsList() const { return d->pluginsList(); } diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/tinyurlengineplugin/tinyurlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/tinyurlengineplugin/tinyurlengineplugin.cpp index 8b8e4b31..5aec7db6 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/tinyurlengineplugin/tinyurlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/tinyurlengineplugin/tinyurlengineplugin.cpp @@ -1,45 +1,45 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "tinyurlengineplugin.h" #include "tinyurlengineinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(TinyUrlEnginePlugin, "pimcommon_tinyurlengineplugin.json") TinyUrlEnginePlugin::TinyUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } TinyUrlEnginePlugin::~TinyUrlEnginePlugin() { } ShortUrlEngineInterface *TinyUrlEnginePlugin::createInterface(QObject *parent) { return new TinyUrlEngineInterface(this, parent); } QString TinyUrlEnginePlugin::engineName() const { return QStringLiteral("tinyurl"); } #include "tinyurlengineplugin.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/triopabshorturlengineplugin/triopabshorturlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/triopabshorturlengineplugin/triopabshorturlengineplugin.cpp index bd123b61..245de98f 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/triopabshorturlengineplugin/triopabshorturlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/triopabshorturlengineplugin/triopabshorturlengineplugin.cpp @@ -1,45 +1,45 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "triopabshorturlengineplugin.h" #include "triopabshorturlengineinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(TriopAbShortUrlEnginePlugin, "pimcommon_triopabshorturlengineplugin.json") TriopAbShortUrlEnginePlugin::TriopAbShortUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } TriopAbShortUrlEnginePlugin::~TriopAbShortUrlEnginePlugin() { } ShortUrlEngineInterface *TriopAbShortUrlEnginePlugin::createInterface(QObject *parent) { return new TripAbShortUrlEngineInterface(this, parent); } QString TriopAbShortUrlEnginePlugin::engineName() const { return QStringLiteral("triopabshorturl"); } #include "triopabshorturlengineplugin.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/triopabshorturlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/triopabshorturlengineplugin.cpp index b9a186a2..4cb18403 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/triopabshorturlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/triopabshorturlengineplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2015-2019 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "triopabshorturlengineplugin.h" #include "triopabshorturlengineinterface.h" -#include +#include K_PLUGIN_FACTORY_WITH_JSON(TriopAbShortUrlEnginePluginFactory, "pimcommon_triopabshorturlengineplugin.json", registerPlugin(); ) TriopAbShortUrlEnginePlugin::TriopAbShortUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } TriopAbShortUrlEnginePlugin::~TriopAbShortUrlEnginePlugin() { } ShortUrlEngineInterface *TriopAbShortUrlEnginePlugin::createInterface(QObject *parent) { return new TripAbShortUrlEngineInterface(this, parent); } QString TriopAbShortUrlEnginePlugin::engineName() const { return QStringLiteral("triopabshorturl"); } #include "triopabshorturlengineplugin.moc" diff --git a/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/ur1cashorturlengineplugin.cpp b/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/ur1cashorturlengineplugin.cpp index 7a857ae6..19cf15df 100644 --- a/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/ur1cashorturlengineplugin.cpp +++ b/kmail/editorplugins/insertshorturl/shorturlengineplugin/ur1cashorturlengineplugin/ur1cashorturlengineplugin.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "ur1cashorturlengineplugin.h" #include "ur1cashorturlengineinterface.h" -#include +#include K_PLUGIN_FACTORY_WITH_JSON(Ur1CaShortUrlEnginePluginFactory, "pimcommon_ur1cashorturlengineplugin.json", registerPlugin(); ) Ur1CaShortUrlEnginePlugin::Ur1CaShortUrlEnginePlugin(QObject *parent, const QList &) : ShortUrlEnginePlugin(parent) { } Ur1CaShortUrlEnginePlugin::~Ur1CaShortUrlEnginePlugin() { } ShortUrlEngineInterface *Ur1CaShortUrlEnginePlugin::createInterface(QObject *parent) { return new Ur1CaShortUrlEngineInterface(this, parent); } QString Ur1CaShortUrlEnginePlugin::engineName() const { return QStringLiteral("urlcashorturl"); } #include "ur1cashorturlengineplugin.moc" diff --git a/kmail/editorplugins/insertspecialcharacter/insertspecialcharacterplugineditor.cpp b/kmail/editorplugins/insertspecialcharacter/insertspecialcharacterplugineditor.cpp index a4bbad47..58cd210a 100644 --- a/kmail/editorplugins/insertspecialcharacter/insertspecialcharacterplugineditor.cpp +++ b/kmail/editorplugins/insertspecialcharacter/insertspecialcharacterplugineditor.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "insertspecialcharacterplugineditor.h" #include "insertspecialcharacterplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(InsertSpecialCharacterPluginEditor, "kmail_insertspecialcharactereditorplugin.json") InsertSpecialCharacterPluginEditor::InsertSpecialCharacterPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } InsertSpecialCharacterPluginEditor::~InsertSpecialCharacterPluginEditor() { } MessageComposer::PluginEditorInterface *InsertSpecialCharacterPluginEditor::createInterface(QObject *parent) { InsertSpecialCharacterPluginEditorInterface *interface = new InsertSpecialCharacterPluginEditorInterface(parent); return interface; } #include "insertspecialcharacterplugineditor.moc" diff --git a/kmail/editorplugins/nonbreakingspace/nonbreakingspaceplugineditor.cpp b/kmail/editorplugins/nonbreakingspace/nonbreakingspaceplugineditor.cpp index dcea165c..229689da 100644 --- a/kmail/editorplugins/nonbreakingspace/nonbreakingspaceplugineditor.cpp +++ b/kmail/editorplugins/nonbreakingspace/nonbreakingspaceplugineditor.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "nonbreakingspaceplugineditor.h" #include "nonbreakingspaceplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(NonBreakingSpacePluginEditor, "kmail_nonbreakingspaceeditorplugin.json") NonBreakingSpacePluginEditor::NonBreakingSpacePluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } NonBreakingSpacePluginEditor::~NonBreakingSpacePluginEditor() { } MessageComposer::PluginEditorInterface *NonBreakingSpacePluginEditor::createInterface(QObject *parent) { NonBreakingSpacePluginEditorInterface *interface = new NonBreakingSpacePluginEditorInterface(parent); return interface; } #include "nonbreakingspaceplugineditor.moc" diff --git a/kmail/editorplugins/qtcreator-template/kmaileditorplugins/plugineditor.cpp b/kmail/editorplugins/qtcreator-template/kmaileditorplugins/plugineditor.cpp index 56d75cb3..0bd12881 100644 --- a/kmail/editorplugins/qtcreator-template/kmaileditorplugins/plugineditor.cpp +++ b/kmail/editorplugins/qtcreator-template/kmaileditorplugins/plugineditor.cpp @@ -1,29 +1,29 @@ %{Cpp:LicenseTemplate}\ #include "%{ProjectNameLower}plugineditor.h" #include "%{ProjectNameLower}plugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(%{CN}PluginEditor, "%{ProjectNameLower}editorplugin.json") %{CN}PluginEditor::%{CN}PluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } %{CN}PluginEditor::~%{CN}PluginEditor() { } bool %{CN}PluginEditor::hasPopupMenuSupport() const { return false; } MessageComposer::PluginEditorInterface *%{CN}PluginEditor::createInterface(QObject *parent) { %{CN}PluginEditorInterface *interface = new %{CN}PluginEditorInterface(parent); return interface; } #include "%{ProjectNameLower}plugineditor.moc" diff --git a/kmail/editorplugins/quicktext/quicktextplugineditor.cpp b/kmail/editorplugins/quicktext/quicktextplugineditor.cpp index 9c29624d..cd0a9852 100644 --- a/kmail/editorplugins/quicktext/quicktextplugineditor.cpp +++ b/kmail/editorplugins/quicktext/quicktextplugineditor.cpp @@ -1,67 +1,67 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "quicktextplugineditor.h" #include "quicktextplugineditorinterface.h" -#include +#include #include "quicktextconfiguredialog.h" K_PLUGIN_CLASS_WITH_JSON(QuickTextPluginEditor, "kmail_quicktextplugin.json") QuickTextPluginEditor::QuickTextPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } QuickTextPluginEditor::~QuickTextPluginEditor() { } MessageComposer::PluginEditorInterface *QuickTextPluginEditor::createInterface(QObject *parent) { QuickTextPluginEditorInterface *interface = new QuickTextPluginEditorInterface(parent); connect(this, &QuickTextPluginEditor::configChanged, interface, &QuickTextPluginEditorInterface::reloadConfig); return interface; } bool QuickTextPluginEditor::hasStatusBarSupport() const { return true; } bool QuickTextPluginEditor::hasConfigureDialog() const { return true; } void QuickTextPluginEditor::showConfigureDialog(QWidget *parent) { QPointer dlg = new QuickTextConfigureDialog(parent); if (dlg->exec()) { Q_EMIT configChanged(); } delete dlg; } bool QuickTextPluginEditor::canProcessKeyEvent() const { return true; } #include "quicktextplugineditor.moc" diff --git a/kmail/editorplugins/quicktext/quicktexttreewidget.cpp b/kmail/editorplugins/quicktext/quicktexttreewidget.cpp index ffa4f18f..a2f216ad 100644 --- a/kmail/editorplugins/quicktext/quicktexttreewidget.cpp +++ b/kmail/editorplugins/quicktext/quicktexttreewidget.cpp @@ -1,219 +1,219 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "quicktexttreewidget.h" #include "quicktextmanager.h" -#include +#include #include #include #include #include #include #include QuicktextTreeWidget::QuicktextTreeWidget(QuicktextManager *manager, QWidget *parent) : QTreeView(parent) , mSnippetsManager(manager) { header()->hide(); setAcceptDrops(true); setDragEnabled(true); setRootIsDecorated(true); setAlternatingRowColors(true); connect(mSnippetsManager, &QuicktextManager::insertPlainText, this, &QuicktextTreeWidget::insertSnippetText); setModel(mSnippetsManager->model()); setSelectionModel(mSnippetsManager->selectionModel()); connect(mSnippetsManager->selectionModel(), &QItemSelectionModel::selectionChanged, this, [this]() { selectionWasChanged(); }); connect(mSnippetsManager->model(), &QAbstractItemModel::rowsInserted, this, &QTreeView::expandAll); connect(mSnippetsManager->model(), &QAbstractItemModel::rowsRemoved, this, &QTreeView::expandAll); mAddSnippetAction = new QAction(i18n("Add Snippet..."), this); mAddSnippetAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); mEditSnippetAction = new QAction(i18n("Edit Snippet..."), this); mEditSnippetAction->setIcon(QIcon::fromTheme(QStringLiteral("document-properties"))); mDeleteSnippetAction = new QAction(i18n("Remove Snippet"), this); mDeleteSnippetAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); mAddSnippetGroupAction = new QAction(i18n("Add Group..."), this); mAddSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); mEditSnippetGroupAction = new QAction(i18n("Rename Group..."), this); mEditSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-rename"))); mDeleteSnippetGroupAction = new QAction(i18n("Remove Group"), this); mDeleteSnippetGroupAction->setIcon(QIcon::fromTheme(QStringLiteral("edit-delete"))); connect(mAddSnippetAction, &QAction::triggered, this, [this]() { Q_EMIT addSnippet(); }); connect(mEditSnippetAction, &QAction::triggered, this, [this]() { Q_EMIT editSnippet(); }); connect(mAddSnippetGroupAction, &QAction::triggered, this, [this]() { Q_EMIT addSnippetGroup(); }); connect(mEditSnippetGroupAction, &QAction::triggered, this, [this]() { Q_EMIT editSnippetGroup(); }); connect(mDeleteSnippetGroupAction, &QAction::triggered, this, [this]() { deleteSnippetGroup(); }); connect(mDeleteSnippetAction, &QAction::triggered, this, [this]() { deleteSnippet(); }); expandAll(); selectionWasChanged(); } QuicktextTreeWidget::~QuicktextTreeWidget() { } void QuicktextTreeWidget::contextMenuEvent(QContextMenuEvent *event) { QMenu popup; const bool itemSelected = mSnippetsManager->selectionModel()->hasSelection(); bool canAddSnippet = true; if (itemSelected) { popup.setTitle(mSnippetsManager->selectedName()); if (mSnippetsManager->snippetGroupSelected()) { popup.addAction(mEditSnippetGroupAction); popup.addAction(mDeleteSnippetGroupAction); } else { canAddSnippet = false; // subsnippets are not permitted popup.addAction(mAddSnippetAction); popup.addAction(mEditSnippetAction); popup.addAction(mDeleteSnippetAction); } popup.addSeparator(); } else { popup.setTitle(i18n("Text Snippets")); } if (canAddSnippet) { popup.addAction(mAddSnippetAction); } popup.addAction(mAddSnippetGroupAction); popup.exec(event->globalPos()); } void QuicktextTreeWidget::dropEvent(QDropEvent *event) { if (event->source() == this) { event->setDropAction(Qt::MoveAction); } QTreeView::dropEvent(event); } QuicktextManager *QuicktextTreeWidget::snippetsManager() const { return mSnippetsManager; } void QuicktextTreeWidget::selectionWasChanged() { const bool itemSelected = !mSnippetsManager->selectionModel()->selectedIndexes().isEmpty(); if (itemSelected) { const QModelIndex index = mSnippetsManager->selectionModel()->selectedIndexes().first(); const bool isGroup = index.data(MailCommon::SnippetsModel::IsGroupRole).toBool(); if (isGroup) { mEditSnippetAction->setEnabled(false); mDeleteSnippetAction->setEnabled(false); mEditSnippetGroupAction->setEnabled(true); mDeleteSnippetGroupAction->setEnabled(true); } else { mEditSnippetAction->setEnabled(true); mDeleteSnippetAction->setEnabled(true); mEditSnippetGroupAction->setEnabled(false); mDeleteSnippetGroupAction->setEnabled(false); } } else { mEditSnippetAction->setEnabled(false); mDeleteSnippetAction->setEnabled(false); mEditSnippetGroupAction->setEnabled(false); mDeleteSnippetGroupAction->setEnabled(false); } } void QuicktextTreeWidget::deleteSnippet() { const QModelIndex index = mSnippetsManager->selectionModel()->selectedIndexes().first(); const QString snippetName = index.data(MailCommon::SnippetsModel::NameRole).toString(); if (KMessageBox::warningContinueCancel( this, xi18nc("@info", "Do you really want to remove snippet \"%1\"?" "There is no way to undo the removal.", snippetName), QString(), KStandardGuiItem::remove()) == KMessageBox::Cancel) { return; } mSnippetsManager->model()->removeRow(index.row(), mSnippetsManager->currentGroupIndex()); mSnippetsManager->save(); } void QuicktextTreeWidget::deleteSnippetGroup() { const QModelIndex groupIndex = mSnippetsManager->currentGroupIndex(); if (!groupIndex.isValid()) { return; } const QString groupName = groupIndex.data(MailCommon::SnippetsModel::NameRole).toString(); if (mSnippetsManager->model()->rowCount(groupIndex) > 0) { if (KMessageBox::warningContinueCancel( this, xi18nc("@info", "Do you really want to remove group \"%1\" along with all its snippets?" "There is no way to undo the removal.", groupName), QString(), KStandardGuiItem::remove()) == KMessageBox::Cancel) { return; } } else { if (KMessageBox::warningContinueCancel( nullptr, i18nc("@info", "Do you really want to remove group \"%1\"?", groupName), QString(), KStandardGuiItem::remove()) == KMessageBox::Cancel) { return; } } mSnippetsManager->model()->removeRow(groupIndex.row(), QModelIndex()); mSnippetsManager->save(); } diff --git a/kmail/editorplugins/sharetext/sharetextplugineditor.cpp b/kmail/editorplugins/sharetext/sharetextplugineditor.cpp index ac5173b0..44e54272 100644 --- a/kmail/editorplugins/sharetext/sharetextplugineditor.cpp +++ b/kmail/editorplugins/sharetext/sharetextplugineditor.cpp @@ -1,46 +1,46 @@ /* Copyright (C) 2018-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sharetextplugineditor.h" #include "sharetextplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(ShareTextPluginEditor, "kmail_sharetexteditorplugin.json") ShareTextPluginEditor::ShareTextPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } ShareTextPluginEditor::~ShareTextPluginEditor() { } bool ShareTextPluginEditor::hasPopupMenuSupport() const { return false; } MessageComposer::PluginEditorInterface *ShareTextPluginEditor::createInterface(QObject *parent) { ShareTextPluginEditorInterface *interface = new ShareTextPluginEditorInterface(parent); return interface; } #include "sharetextplugineditor.moc" diff --git a/kmail/editorplugins/zoomtext/zoomtextplugineditor.cpp b/kmail/editorplugins/zoomtext/zoomtextplugineditor.cpp index 6aa600cf..6c7aba7f 100644 --- a/kmail/editorplugins/zoomtext/zoomtextplugineditor.cpp +++ b/kmail/editorplugins/zoomtext/zoomtextplugineditor.cpp @@ -1,51 +1,51 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "zoomtextplugineditor.h" #include "zoomtextplugineditorinterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(ZoomTextPluginEditor, "kmail_zoomtexteditorplugin.json") ZoomTextPluginEditor::ZoomTextPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { } ZoomTextPluginEditor::~ZoomTextPluginEditor() { } MessageComposer::PluginEditorInterface *ZoomTextPluginEditor::createInterface(QObject *parent) { ZoomTextPluginEditorInterface *interface = new ZoomTextPluginEditorInterface(parent); return interface; } bool ZoomTextPluginEditor::hasPopupMenuSupport() const { return false; } bool ZoomTextPluginEditor::hasStatusBarSupport() const { return true; } #include "zoomtextplugineditor.moc" diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsplugin.cpp b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsplugin.cpp index 378bea45..f91685e5 100644 --- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsplugin.cpp +++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsplugin.cpp @@ -1,57 +1,57 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "automaticaddcontactsplugin.h" #include "automaticaddcontactsinterface.h" #include "automaticaddcontactsconfigurewidget.h" #include "automaticaddcontactsconfiguredialog.h" #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(AutomaticAddContactsPlugin, "kmail_automaticaddcontactsplugin.json") AutomaticAddContactsPlugin::AutomaticAddContactsPlugin(QObject *parent, const QList &) : MessageComposer::PluginEditorCheckBeforeSend(parent) { } AutomaticAddContactsPlugin::~AutomaticAddContactsPlugin() { } MessageComposer::PluginEditorCheckBeforeSendInterface *AutomaticAddContactsPlugin::createInterface(QObject *parent) { AutomaticAddContactsInterface *interface = new AutomaticAddContactsInterface(parent); connect(this, &AutomaticAddContactsPlugin::configChanged, interface, &AutomaticAddContactsInterface::reloadConfig); return interface; } bool AutomaticAddContactsPlugin::hasConfigureDialog() const { return true; } void AutomaticAddContactsPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new AutomaticAddContactsConfigureDialog(parent); dlg->exec(); delete dlg; } #include "automaticaddcontactsplugin.moc" diff --git a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendplugin.cpp b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendplugin.cpp index c9eb41b9..d4f5bbea 100644 --- a/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendplugin.cpp +++ b/kmail/editorsendcheckplugins/checkbeforesend/checkbeforesendplugin.cpp @@ -1,58 +1,58 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "checkbeforesendplugin.h" #include "checkbeforesendinterface.h" #include "configurewidget/checkbeforesendconfigurewidget.h" #include "configurewidget/checkbeforesendconfiguredialog.h" #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(CheckBeforeSendPlugin, "kmail_checkbeforesendplugin.json") CheckBeforeSendPlugin::CheckBeforeSendPlugin(QObject *parent, const QList &) : MessageComposer::PluginEditorCheckBeforeSend(parent) { } CheckBeforeSendPlugin::~CheckBeforeSendPlugin() { } MessageComposer::PluginEditorCheckBeforeSendInterface *CheckBeforeSendPlugin::createInterface(QObject *parent) { CheckBeforeSendInterface *interface = new CheckBeforeSendInterface(parent); connect(this, &CheckBeforeSendPlugin::configChanged, interface, &CheckBeforeSendInterface::reloadConfig); return interface; } bool CheckBeforeSendPlugin::hasConfigureDialog() const { return true; } void CheckBeforeSendPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new CheckBeforeSendConfigureDialog(parent); dlg->exec(); delete dlg; } #include "checkbeforesendplugin.moc" diff --git a/kmail/editorsendcheckplugins/confirm-address/confirmaddressplugin.cpp b/kmail/editorsendcheckplugins/confirm-address/confirmaddressplugin.cpp index 1a5f9855..fb20bbc0 100644 --- a/kmail/editorsendcheckplugins/confirm-address/confirmaddressplugin.cpp +++ b/kmail/editorsendcheckplugins/confirm-address/confirmaddressplugin.cpp @@ -1,59 +1,59 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "confirmaddressplugin.h" #include "confirmaddressinterface.h" #include "confirmaddressconfigurewidget.h" #include "confirmaddressconfiguredialog.h" #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(ConfirmAddressPlugin, "kmail_confirmaddressplugin.json") ConfirmAddressPlugin::ConfirmAddressPlugin(QObject *parent, const QList &) : MessageComposer::PluginEditorCheckBeforeSend(parent) { } ConfirmAddressPlugin::~ConfirmAddressPlugin() { } MessageComposer::PluginEditorCheckBeforeSendInterface *ConfirmAddressPlugin::createInterface(QObject *parent) { ConfirmAddressInterface *interface = new ConfirmAddressInterface(parent); connect(this, &ConfirmAddressPlugin::configChanged, interface, &ConfirmAddressInterface::reloadConfig); connect(interface, &ConfirmAddressInterface::forceReloadConfig, this, &ConfirmAddressPlugin::configChanged); return interface; } bool ConfirmAddressPlugin::hasConfigureDialog() const { return true; } void ConfirmAddressPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new ConfirmAddressConfigureDialog(parent); dlg->exec(); delete dlg; } #include "confirmaddressplugin.moc" diff --git a/kmail/grammarplugins/grammalecte/plugin/grammalecteplugin.cpp b/kmail/grammarplugins/grammalecte/plugin/grammalecteplugin.cpp index e9531016..3ce19df6 100644 --- a/kmail/grammarplugins/grammalecte/plugin/grammalecteplugin.cpp +++ b/kmail/grammarplugins/grammalecte/plugin/grammalecteplugin.cpp @@ -1,69 +1,69 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "grammalecteplugin.h" #include "grammalecteinterface.h" #include "grammalecteconfigdialog.h" #include "grammalectemanager.h" #include #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(GrammalectePlugin, "kmail_grammalecteplugin.json") GrammalectePlugin::GrammalectePlugin(QObject *parent, const QList &) : PimCommon::CustomToolsPlugin(parent) { } GrammalectePlugin::~GrammalectePlugin() { } PimCommon::CustomToolsViewInterface *GrammalectePlugin::createView(KActionCollection *ac, PimCommon::CustomToolsWidgetNg *parent) { GrammalecteInterface *view = new GrammalecteInterface(ac, parent); connect(view, &GrammalecteInterface::toolsWasClosed, parent, &PimCommon::CustomToolsWidgetNg::slotToolsWasClosed); connect(view, &GrammalecteInterface::insertText, parent, &PimCommon::CustomToolsWidgetNg::insertText); connect(view, &GrammalecteInterface::activateView, parent, &PimCommon::CustomToolsWidgetNg::slotActivateView); return view; } QString GrammalectePlugin::customToolName() const { return i18n("Grammalecte Plugin"); } bool GrammalectePlugin::hasConfigureDialog() const { return true; } void GrammalectePlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new GrammalecteConfigDialog(parent); if (dlg->exec()) { GrammalecteManager::self()->loadSettings(); } delete dlg; } #include "grammalecteplugin.moc" diff --git a/kmail/grammarplugins/languagetool/plugin/languagetoolplugin.cpp b/kmail/grammarplugins/languagetool/plugin/languagetoolplugin.cpp index 9e6d5435..e5b90df7 100644 --- a/kmail/grammarplugins/languagetool/plugin/languagetoolplugin.cpp +++ b/kmail/grammarplugins/languagetool/plugin/languagetoolplugin.cpp @@ -1,69 +1,69 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "languagetoolplugin.h" #include "languagetoolinterface.h" #include "languagetoolconfigdialog.h" #include "languagetoolmanager.h" #include #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(LanguageToolPlugin, "kmail_languagetoolplugin.json") LanguageToolPlugin::LanguageToolPlugin(QObject *parent, const QList &) : PimCommon::CustomToolsPlugin(parent) { } LanguageToolPlugin::~LanguageToolPlugin() { } PimCommon::CustomToolsViewInterface *LanguageToolPlugin::createView(KActionCollection *ac, PimCommon::CustomToolsWidgetNg *parent) { LanguageToolInterface *view = new LanguageToolInterface(ac, parent); connect(view, &LanguageToolInterface::toolsWasClosed, parent, &PimCommon::CustomToolsWidgetNg::slotToolsWasClosed); connect(view, &LanguageToolInterface::insertText, parent, &PimCommon::CustomToolsWidgetNg::insertText); connect(view, &LanguageToolInterface::activateView, parent, &PimCommon::CustomToolsWidgetNg::slotActivateView); return view; } QString LanguageToolPlugin::customToolName() const { return i18n("LanguageTool Plugin"); } bool LanguageToolPlugin::hasConfigureDialog() const { return true; } void LanguageToolPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new LanguageToolConfigDialog(parent); if (dlg->exec()) { LanguageToolManager::self()->loadSettings(); } delete dlg; } #include "languagetoolplugin.moc" diff --git a/kmail/plugins/antispamplugin/antispamplugin.cpp b/kmail/plugins/antispamplugin/antispamplugin.cpp index eb8f8b93..238e7e5a 100644 --- a/kmail/plugins/antispamplugin/antispamplugin.cpp +++ b/kmail/plugins/antispamplugin/antispamplugin.cpp @@ -1,40 +1,40 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "antispamplugin.h" #include "antispamplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(AntiSpamPlugin, "kmail_antispamplugin.json") AntiSpamPlugin::AntiSpamPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } AntiSpamPlugin::~AntiSpamPlugin() { } PimCommon::GenericPluginInterface *AntiSpamPlugin::createInterface(QObject *parent) { AntiSpamPluginInterface *interface = new AntiSpamPluginInterface(parent); return interface; } #include "antispamplugin.moc" diff --git a/kmail/plugins/antivirusplugin/antivirusplugin.cpp b/kmail/plugins/antivirusplugin/antivirusplugin.cpp index 830d784f..653aff62 100644 --- a/kmail/plugins/antivirusplugin/antivirusplugin.cpp +++ b/kmail/plugins/antivirusplugin/antivirusplugin.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "antivirusplugin.h" #include "antivirusplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(AntiVirusPlugin, "kmail_antivirusplugin.json") AntiVirusPlugin::AntiVirusPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } AntiVirusPlugin::~AntiVirusPlugin() { } PimCommon::GenericPluginInterface *AntiVirusPlugin::createInterface(QObject *parent) { AntiVirusPluginInterface *interface = new AntiVirusPluginInterface(parent); return interface; } #include "antivirusplugin.moc" diff --git a/kmail/plugins/common/antispamwizard.cpp b/kmail/plugins/common/antispamwizard.cpp index 2812d1ac..1bb7339c 100644 --- a/kmail/plugins/common/antispamwizard.cpp +++ b/kmail/plugins/common/antispamwizard.cpp @@ -1,1328 +1,1328 @@ /* This file is part of KMail. Copyright (c) 2003 Andreas Gungl KMail is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. KMail is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ #include "antispamwizard.h" #ifndef QT_NO_CURSOR #include "Libkdepim/KCursorSaver" #endif #include "MailCommon/FolderRequester" #include "MailCommon/FolderTreeWidget" #include "MailCommon/FolderTreeView" #include "MailCommon/FolderTreeWidgetProxyModel" #include "MailCommon/MailUtil" #include "MailCommon/MailKernel" #include "MailCommon/MailFilter" #include "MailCommon/FilterAction" #include "MailCommon/FilterActionDict" #include "MailCommon/FilterManager" #include "PimCommon/PimUtil" #include #include #include #include -#include -#include +#include +#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace KMail; using namespace MailCommon; AntiSpamWizard::AntiSpamWizard(WizardMode mode, QWidget *parent) : KAssistantDialog(parent) , mInfoPage(nullptr) , mSpamRulesPage(nullptr) , mVirusRulesPage(nullptr) , mSummaryPage(nullptr) , mSpamToolsUsed(false) , mVirusToolsUsed(false) , mMode(mode) { // read the configuration for the anti-spam tools ConfigReader reader(mMode, mToolList); reader.readAndMergeConfig(); mToolList = reader.getToolList(); #ifndef NDEBUG if (mMode == AntiSpam) { qDebug() << endl << "Considered anti-spam tools:"; } else { qDebug() << endl << "Considered anti-virus tools:"; } QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { qDebug() << "Predefined tool:" << (*it).getId(); qDebug() << "Config version:" << (*it).getVersion(); qDebug() << "Selection priority:" << (*it).getPrio(); qDebug() << "Displayed name:" << (*it).getVisibleName(); qDebug() << "Executable:" << (*it).getExecutable(); qDebug() << "WhatsThis URL:" << (*it).getWhatsThisText(); qDebug() << "Filter name:" << (*it).getFilterName(); qDebug() << "Detection command:" << (*it).getDetectCmd(); qDebug() << "Learn spam command:" << (*it).getSpamCmd(); qDebug() << "Learn ham command:" << (*it).getHamCmd(); qDebug() << "Detection header:" << (*it).getDetectionHeader(); qDebug() << "Detection pattern:" << (*it).getDetectionPattern(); qDebug() << "Use as RegExp:" << (*it).isUseRegExp(); qDebug() << "Supports Bayes Filter:" << (*it).useBayesFilter(); qDebug() << "Type:" << (*it).getType(); } #endif const bool isAntiSpam = (mMode == AntiSpam); setWindowTitle(isAntiSpam ? i18n("Anti-Spam Wizard") : i18n("Anti-Virus Wizard")); mInfoPage = new ASWizInfoPage(mMode, nullptr, QString()); mInfoPageItem = addPage(mInfoPage, isAntiSpam ? i18n("Welcome to the KMail Anti-Spam Wizard") : i18n("Welcome to the KMail Anti-Virus Wizard")); connect(mInfoPage, &ASWizInfoPage::selectionChanged, this, &AntiSpamWizard::checkProgramsSelections); if (isAntiSpam) { mSpamRulesPage = new ASWizSpamRulesPage(nullptr, QString()); mSpamRulesPageItem = addPage(mSpamRulesPage, i18n("Options to fine-tune the handling of spam messages")); connect(mSpamRulesPage, &ASWizSpamRulesPage::selectionChanged, this, &AntiSpamWizard::slotBuildSummary); mSummaryPage = new ASWizSummaryPage(nullptr, QString()); mSummaryPageItem = addPage(mSummaryPage, i18n("Summary of changes to be made by this wizard")); } else { mVirusRulesPage = new ASWizVirusRulesPage(nullptr, QString()); mVirusRulesPageItem = addPage(mVirusRulesPage, i18n("Options to fine-tune the handling of virus messages")); connect(mVirusRulesPage, &ASWizVirusRulesPage::selectionChanged, this, &AntiSpamWizard::checkVirusRulesSelections); } connect(button(QDialogButtonBox::Help), &QPushButton::clicked, this, &AntiSpamWizard::slotHelpClicked); QTimer::singleShot(0, this, &AntiSpamWizard::checkToolAvailability); } void AntiSpamWizard::accept() { if (mSpamRulesPage) { qDebug() << "Folder name for messages classified as spam is" << mSpamRulesPage->selectedSpamCollectionId(); qDebug() << "Folder name for messages classified as unsure is" << mSpamRulesPage->selectedUnsureCollectionId(); } if (mVirusRulesPage) { qDebug() << "Folder name for viruses is" << mVirusRulesPage->selectedFolderName(); } FilterActionDict dict; QVector filterList; bool replaceExistingFilters = false; // Let's start with virus detection and handling, // so we can avoid spam checks for viral messages if (mMode == AntiVirus) { if (!mVirusToolsUsed) { QDialog::accept(); return; } QVector::const_iterator end(mToolList.constEnd()); for (QVector::const_iterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (mVirusRulesPage->pipeRulesSelected() && (*it).isVirusTool())) { // pipe messages through the anti-virus tools, // one single filter for each tool // (could get combined but so it's easier to understand for the user) MailFilter *pipeFilter = new MailFilter(); QVector *pipeFilterActions = pipeFilter->actions(); FilterAction *pipeFilterAction = dict.value(QStringLiteral("filter app"))->create(); pipeFilterAction->argsFromString((*it).getDetectCmd()); pipeFilterActions->append(pipeFilterAction); SearchPattern *pipeFilterPattern = pipeFilter->pattern(); pipeFilterPattern->setName(uniqueNameFor((*it).getFilterName())); pipeFilterPattern->append(SearchRule::createInstance("", SearchRule::FuncIsGreaterOrEqual, QStringLiteral("0"))); pipeFilter->setApplyOnOutbound(false); pipeFilter->setApplyOnInbound(true); pipeFilter->setApplyOnExplicit(true); pipeFilter->setStopProcessingHere(false); pipeFilter->setConfigureShortcut(false); filterList.append(pipeFilter); } } if (mVirusRulesPage->moveRulesSelected()) { // Sort out viruses depending on header fields set by the tools MailFilter *virusFilter = new MailFilter(); QVector *virusFilterActions = virusFilter->actions(); FilterAction *virusFilterAction1 = dict.value(QStringLiteral("transfer"))->create(); virusFilterAction1->argsFromString(mVirusRulesPage->selectedFolderName()); virusFilterActions->append(virusFilterAction1); if (mVirusRulesPage->markReadRulesSelected()) { FilterAction *virusFilterAction2 = dict.value(QStringLiteral("set status"))->create(); virusFilterAction2->argsFromString(QStringLiteral("R")); // Read virusFilterActions->append(virusFilterAction2); } SearchPattern *virusFilterPattern = virusFilter->pattern(); virusFilterPattern->setName(uniqueNameFor(i18n("Virus handling"))); virusFilterPattern->setOp(SearchPattern::OpOr); QVector::ConstIterator endSpamTool(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != endSpamTool; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName())) { if ((*it).isVirusTool()) { const QByteArray header = (*it).getDetectionHeader().toLatin1(); const QString &pattern = (*it).getDetectionPattern(); if ((*it).isUseRegExp()) { virusFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncRegExp, pattern)); } else { virusFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncContains, pattern)); } } } } virusFilter->setApplyOnOutbound(false); virusFilter->setApplyOnInbound(true); virusFilter->setApplyOnExplicit(true); virusFilter->setStopProcessingHere(true); virusFilter->setConfigureShortcut(false); filterList.append(virusFilter); } } else { // AntiSpam mode if (!mSpamToolsUsed) { QDialog::accept(); return; } // TODO Existing filters with same name are replaced. This is hardcoded // ATM and needs to be replaced with a value from a (still missing) // checkbox in the GUI. At least, the replacement is announced in the GUI. replaceExistingFilters = true; QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (*it).isSpamTool() && !(*it).isDetectionOnly()) { // pipe messages through the anti-spam tools, // one single filter for each tool // (could get combined but so it's easier to understand for the user) MailFilter *pipeFilter = new MailFilter(); QVector *pipeFilterActions = pipeFilter->actions(); FilterAction *pipeFilterAction = dict.value(QStringLiteral("filter app"))->create(); pipeFilterAction->argsFromString((*it).getDetectCmd()); pipeFilterActions->append(pipeFilterAction); SearchPattern *pipeFilterPattern = pipeFilter->pattern(); if (replaceExistingFilters) { pipeFilterPattern->setName((*it).getFilterName()); } else { pipeFilterPattern->setName(uniqueNameFor((*it).getFilterName())); } pipeFilterPattern->append(SearchRule::createInstance("", SearchRule::FuncIsLessOrEqual, QStringLiteral("256000"))); pipeFilter->setApplyOnOutbound(false); pipeFilter->setApplyOnInbound(true); pipeFilter->setApplyOnExplicit(true); pipeFilter->setStopProcessingHere(false); pipeFilter->setConfigureShortcut(false); filterList.append(pipeFilter); } } // Sort out spam depending on header fields set by the tools MailFilter *spamFilter = new MailFilter(); QVector *spamFilterActions = spamFilter->actions(); if (mSpamRulesPage->moveSpamSelected()) { FilterAction *spamFilterAction1 = dict.value(QStringLiteral("transfer"))->create(); spamFilterAction1->argsFromString(mSpamRulesPage->selectedSpamCollectionId()); spamFilterActions->append(spamFilterAction1); } FilterAction *spamFilterAction2 = dict.value(QStringLiteral("set status"))->create(); spamFilterAction2->argsFromString(QStringLiteral("P")); // Spam spamFilterActions->append(spamFilterAction2); if (mSpamRulesPage->markAsReadSelected()) { FilterAction *spamFilterAction3 = dict.value(QStringLiteral("set status"))->create(); spamFilterAction3->argsFromString(QStringLiteral("R")); // Read spamFilterActions->append(spamFilterAction3); } SearchPattern *spamFilterPattern = spamFilter->pattern(); if (replaceExistingFilters) { spamFilterPattern->setName(i18n("Spam Handling")); } else { spamFilterPattern->setName(uniqueNameFor(i18n("Spam Handling"))); } spamFilterPattern->setOp(SearchPattern::OpOr); QVector::ConstIterator endToolList(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != endToolList; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName())) { if ((*it).isSpamTool()) { const QByteArray header = (*it).getDetectionHeader().toLatin1(); const QString &pattern = (*it).getDetectionPattern(); if ((*it).isUseRegExp()) { spamFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncRegExp, pattern)); } else { spamFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncContains, pattern)); } } } } spamFilter->setApplyOnOutbound(false); spamFilter->setApplyOnInbound(true); spamFilter->setApplyOnExplicit(true); spamFilter->setStopProcessingHere(true); spamFilter->setConfigureShortcut(false); filterList.append(spamFilter); if (mSpamRulesPage->moveUnsureSelected()) { // Sort out messages classified as unsure bool atLeastOneUnsurePattern = false; MailFilter *unsureFilter = new MailFilter(); QVector *unsureFilterActions = unsureFilter->actions(); FilterAction *unsureFilterAction1 = dict.value(QStringLiteral("transfer"))->create(); unsureFilterAction1->argsFromString(mSpamRulesPage->selectedUnsureCollectionId()); unsureFilterActions->append(unsureFilterAction1); SearchPattern *unsureFilterPattern = unsureFilter->pattern(); if (replaceExistingFilters) { unsureFilterPattern->setName(i18n("Semi spam (unsure) handling")); } else { unsureFilterPattern->setName(uniqueNameFor(i18n("Semi spam (unsure) handling"))); } unsureFilterPattern->setOp(SearchPattern::OpOr); QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName())) { if ((*it).isSpamTool() && (*it).hasTristateDetection()) { atLeastOneUnsurePattern = true; const QByteArray header = (*it).getDetectionHeader().toLatin1(); const QString &pattern = (*it).getDetectionPattern2(); if ((*it).isUseRegExp()) { unsureFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncRegExp, pattern)); } else { unsureFilterPattern->append( SearchRule::createInstance(header, SearchRule::FuncContains, pattern)); } } } } unsureFilter->setApplyOnOutbound(false); unsureFilter->setApplyOnInbound(true); unsureFilter->setApplyOnExplicit(true); unsureFilter->setStopProcessingHere(true); unsureFilter->setConfigureShortcut(false); if (atLeastOneUnsurePattern) { filterList.append(unsureFilter); } else { delete unsureFilter; } } // Classify messages manually as Spam MailFilter *classSpamFilter = new MailFilter(); classSpamFilter->setIcon(QStringLiteral("mail-mark-junk")); QVector *classSpamFilterActions = classSpamFilter->actions(); FilterAction *classSpamFilterActionFirst = dict.value(QStringLiteral("set status"))->create(); classSpamFilterActionFirst->argsFromString(QStringLiteral("P")); classSpamFilterActions->append(classSpamFilterActionFirst); QVector::ConstIterator endToolList2(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != endToolList2; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (*it).useBayesFilter() && !(*it).isDetectionOnly()) { FilterAction *classSpamFilterAction = dict.value(QStringLiteral("execute"))->create(); classSpamFilterAction->argsFromString((*it).getSpamCmd()); classSpamFilterActions->append(classSpamFilterAction); } } if (mSpamRulesPage->moveSpamSelected()) { FilterAction *classSpamFilterActionLast = dict.value(QStringLiteral("transfer"))->create(); classSpamFilterActionLast->argsFromString(mSpamRulesPage->selectedSpamCollectionId()); classSpamFilterActions->append(classSpamFilterActionLast); } SearchPattern *classSpamFilterPattern = classSpamFilter->pattern(); if (replaceExistingFilters) { classSpamFilterPattern->setName(i18n("Classify as Spam")); } else { classSpamFilterPattern->setName(uniqueNameFor(i18n("Classify as Spam"))); } classSpamFilterPattern->append(SearchRule::createInstance("", SearchRule::FuncIsGreaterOrEqual, QStringLiteral("0"))); classSpamFilter->setApplyOnOutbound(false); classSpamFilter->setApplyOnInbound(false); classSpamFilter->setApplyOnExplicit(false); classSpamFilter->setStopProcessingHere(true); classSpamFilter->setConfigureShortcut(true); classSpamFilter->setConfigureToolbar(true); classSpamFilter->setToolbarName(i18n("Spam")); filterList.append(classSpamFilter); // Classify messages manually as not Spam / as Ham MailFilter *classHamFilter = new MailFilter(); classHamFilter->setIcon(QStringLiteral("mail-mark-notjunk")); QVector *classHamFilterActions = classHamFilter->actions(); FilterAction *classHamFilterActionFirst = dict.value(QStringLiteral("set status"))->create(); classHamFilterActionFirst->argsFromString(QStringLiteral("H")); classHamFilterActions->append(classHamFilterActionFirst); end = mToolList.constEnd(); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (*it).useBayesFilter() && !(*it).isDetectionOnly()) { FilterAction *classHamFilterAction = dict.value(QStringLiteral("execute"))->create(); classHamFilterAction->argsFromString((*it).getHamCmd()); classHamFilterActions->append(classHamFilterAction); } } end = mToolList.constEnd(); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (*it).useBayesFilter() && !(*it).isDetectionOnly()) { FilterAction *classHamFilterAction = dict.value(QStringLiteral("filter app"))->create(); classHamFilterAction->argsFromString((*it).getNoSpamCmd()); classHamFilterActions->append(classHamFilterAction); } } SearchPattern *classHamFilterPattern = classHamFilter->pattern(); if (replaceExistingFilters) { classHamFilterPattern->setName(i18n("Classify as NOT Spam")); } else { classHamFilterPattern->setName(uniqueNameFor(i18n("Classify as NOT Spam"))); } classHamFilterPattern->append(SearchRule::createInstance("", SearchRule::FuncIsGreaterOrEqual, QStringLiteral("0"))); classHamFilter->setApplyOnOutbound(false); classHamFilter->setApplyOnInbound(false); classHamFilter->setApplyOnExplicit(false); classHamFilter->setStopProcessingHere(true); classHamFilter->setConfigureShortcut(true); classHamFilter->setConfigureToolbar(true); classHamFilter->setToolbarName(i18n("Ham")); filterList.append(classHamFilter); } /* Now that all the filters have been added to the list, tell * the filter manager about it. That will Q_EMIT filterListUpdate * which will result in the filter list in kmmainwidget being * initialized. This should happened only once. */ if (!filterList.isEmpty()) { MailCommon::FilterManager::instance()->appendFilters(filterList, replaceExistingFilters); } QDialog::accept(); } void AntiSpamWizard::checkProgramsSelections() { bool supportUnsure = false; mSpamToolsUsed = false; mVirusToolsUsed = false; QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName())) { if ((*it).isSpamTool()) { mSpamToolsUsed = true; if ((*it).hasTristateDetection()) { supportUnsure = true; } } if ((*it).isVirusTool()) { mVirusToolsUsed = true; } if (mSpamToolsUsed && mVirusToolsUsed && supportUnsure) { break; } } } if (mMode == AntiSpam) { mSpamRulesPage->allowUnsureFolderSelection(supportUnsure); mSpamRulesPage->allowMoveSpam(mSpamToolsUsed); slotBuildSummary(); setAppropriate(mSpamRulesPageItem, mSpamToolsUsed); setAppropriate(mSummaryPageItem, mSpamToolsUsed); } else if (mMode == AntiVirus) { if (mVirusToolsUsed) { checkVirusRulesSelections(); } setAppropriate(mVirusRulesPageItem, mVirusToolsUsed); } } void AntiSpamWizard::checkVirusRulesSelections() { //setFinishEnabled( mVirusRulesPage, anyVirusOptionChecked() ); } void AntiSpamWizard::checkToolAvailability() { // this can take some time to find the tools #ifndef QT_NO_CURSOR KPIM::KCursorSaver busy(KPIM::KBusyPtr::busy()); #endif bool found = false; QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { const QString text(i18n("Scanning for %1...", (*it).getId())); mInfoPage->setScanProgressText(text); if ((*it).isSpamTool() && (*it).isServerBased()) { // check the configured account for pattern in const QString pattern = (*it).getServerPattern(); qDebug() << "Testing for server pattern:" << pattern; const Akonadi::AgentInstance::List lst = MailCommon::Util::agentInstances(); for (const Akonadi::AgentInstance &type : lst) { if (type.status() == Akonadi::AgentInstance::Broken) { continue; } const QString typeIdentifier(type.identifier()); if (PimCommon::Util::isImapResource(typeIdentifier)) { MailCommon::ResourceReadConfigFile resourceFile(typeIdentifier); const KConfigGroup grp = resourceFile.group(QStringLiteral("network")); if (grp.isValid()) { const QString host = grp.readEntry(QStringLiteral("ImapServer")); if (host.contains(pattern.toLower(), Qt::CaseInsensitive)) { mInfoPage->addAvailableTool((*it).getVisibleName()); found = true; } } } else if (type.identifier().contains(POP3_RESOURCE_IDENTIFIER)) { MailCommon::ResourceReadConfigFile resourceFile(typeIdentifier); const KConfigGroup grp = resourceFile.group(QStringLiteral("General")); if (grp.isValid()) { const QString host = grp.readEntry(QStringLiteral("host")); if (host.contains(pattern.toLower(), Qt::CaseInsensitive)) { mInfoPage->addAvailableTool((*it).getVisibleName()); found = true; } } } } } else { // check the availability of the application qApp->processEvents(QEventLoop::ExcludeUserInputEvents, 200); if (!checkForProgram((*it).getExecutable())) { mInfoPage->addAvailableTool((*it).getVisibleName()); found = true; } } } if (found) { mInfoPage->setScanProgressText((mMode == AntiSpam) ? i18n("Scanning for anti-spam tools finished.") : i18n("Scanning for anti-virus tools finished.")); } else { mInfoPage->setScanProgressText((mMode == AntiSpam) ? i18n("

Sorry, no spam detection tools have been found. " "Install your spam detection software and " "re-run this wizard.

") : i18n("Scanning complete. No anti-virus tools found.")); } checkProgramsSelections(); } void AntiSpamWizard::slotHelpClicked() { PimCommon::Util::invokeHelp((mMode == AntiSpam) ? QStringLiteral("kmail2/the-anti-spam-wizard.html") : QStringLiteral("kmail2/the-anti-virus-wizard.html")); } void AntiSpamWizard::slotBuildSummary() { QString text; QString newFilters; QString replaceFilters; if (mMode == AntiVirus) { text.clear(); // TODO add summary for the virus part } else { // AntiSpam mode if (mSpamRulesPage->markAsReadSelected()) { if (mSpamRulesPage->moveSpamSelected()) { text = i18n("

Messages classified as spam are marked as read." "
Spam messages are moved into the folder named %1.

", mSpamRulesPage->selectedSpamCollectionName()); } else { text = i18n("

Messages classified as spam are marked as read." "
Spam messages are not moved into a certain folder.

"); } } else { if (mSpamRulesPage->moveSpamSelected()) { text = i18n("

Messages classified as spam are not marked as read." "
Spam messages are moved into the folder named %1.

", mSpamRulesPage->selectedSpamCollectionName()); } else { text = i18n("

Messages classified as spam are not marked as read." "
Spam messages are not moved into a certain folder.

"); } } QVector::ConstIterator end(mToolList.constEnd()); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName()) && (*it).isSpamTool() && !(*it).isDetectionOnly()) { sortFilterOnExistance((*it).getFilterName(), newFilters, replaceFilters); } } sortFilterOnExistance(i18n("Spam Handling"), newFilters, replaceFilters); // The need for a handling of status "probably spam" depends on the tools chosen if (mSpamRulesPage->moveUnsureSelected()) { bool atLeastOneUnsurePattern = false; end = mToolList.constEnd(); for (QVector::ConstIterator it = mToolList.constBegin(); it != end; ++it) { if (mInfoPage->isProgramSelected((*it).getVisibleName())) { if ((*it).isSpamTool() && (*it).hasTristateDetection()) { atLeastOneUnsurePattern = true; break; } } } if (atLeastOneUnsurePattern) { sortFilterOnExistance(i18n("Semi spam (unsure) handling"), newFilters, replaceFilters); text += i18n("

The folder for messages classified as unsure (probably spam) is %1.

", mSpamRulesPage->selectedUnsureCollectionName()); } } // Manual classification via toolbar icon / manually applied filter action sortFilterOnExistance(i18n("Classify as Spam"), newFilters, replaceFilters); sortFilterOnExistance(i18n("Classify as NOT Spam"), newFilters, replaceFilters); // Show the filters in the summary if (!newFilters.isEmpty()) { text += i18n("

The wizard will create the following filters:

    %1

", newFilters); } if (!replaceFilters.isEmpty()) { text += i18n("

The wizard will replace the following filters:

    %1

", replaceFilters); } } mSummaryPage->setSummaryText(text); } int AntiSpamWizard::checkForProgram(const QString &executable) const { qDebug() << "Testing for executable:" << executable; KProcess process; process.setShellCommand(executable); return process.execute(); } bool AntiSpamWizard::anyVirusOptionChecked() const { return mVirusRulesPage->moveRulesSelected() || mVirusRulesPage->pipeRulesSelected(); } const QString AntiSpamWizard::uniqueNameFor(const QString &name) { return MailCommon::FilterManager::instance()->createUniqueFilterName(name); } void AntiSpamWizard::sortFilterOnExistance( const QString &intendedFilterName, QString &newFilters, QString &replaceFilters) { if (uniqueNameFor(intendedFilterName) == intendedFilterName) { newFilters += QLatin1String("
  • ") + intendedFilterName + QLatin1String("
  • "); } else { replaceFilters += QLatin1String("
  • ") + intendedFilterName + QLatin1String("
  • "); } } //--------------------------------------------------------------------------- AntiSpamWizard::SpamToolConfig::SpamToolConfig(const QString &toolId, int configVersion, int prio, const QString &name, const QString &exec, const QString &url, const QString &filter, const QString &detection, const QString &spam, const QString &ham, const QString &noSpam, const QString &header, const QString &pattern, const QString &pattern2, const QString &serverPattern, bool detectionOnly, bool regExp, bool bayesFilter, bool tristateDetection, WizardMode type) : mId(toolId) , mVersion(configVersion) , mPrio(prio) , mVisibleName(name) , mExecutable(exec) , mWhatsThisText(url) , mFilterName(filter) , mDetectCmd(detection) , mSpamCmd(spam) , mHamCmd(ham) , mNoSpamCmd(noSpam) , mDetectionHeader(header) , mDetectionPattern(pattern) , mDetectionPattern2(pattern2) , mServerPattern(serverPattern) , mDetectionOnly(detectionOnly) , mUseRegExp(regExp) , mSupportsBayesFilter(bayesFilter) , mSupportsUnsure(tristateDetection) , mType(type) { } int AntiSpamWizard::SpamToolConfig::getVersion() const { return mVersion; } int AntiSpamWizard::SpamToolConfig::getPrio() const { return mPrio; } QString AntiSpamWizard::SpamToolConfig::getId() const { return mId; } QString AntiSpamWizard::SpamToolConfig::getVisibleName() const { return mVisibleName; } QString AntiSpamWizard::SpamToolConfig::getExecutable() const { return mExecutable; } QString AntiSpamWizard::SpamToolConfig::getWhatsThisText() const { return mWhatsThisText; } QString AntiSpamWizard::SpamToolConfig::getFilterName() const { return mFilterName; } QString AntiSpamWizard::SpamToolConfig::getDetectCmd() const { return mDetectCmd; } QString AntiSpamWizard::SpamToolConfig::getSpamCmd() const { return mSpamCmd; } QString AntiSpamWizard::SpamToolConfig::getHamCmd() const { return mHamCmd; } QString AntiSpamWizard::SpamToolConfig::getNoSpamCmd() const { return mNoSpamCmd; } QString AntiSpamWizard::SpamToolConfig::getDetectionHeader() const { return mDetectionHeader; } QString AntiSpamWizard::SpamToolConfig::getDetectionPattern() const { return mDetectionPattern; } QString AntiSpamWizard::SpamToolConfig::getDetectionPattern2() const { return mDetectionPattern2; } QString AntiSpamWizard::SpamToolConfig::getServerPattern() const { return mServerPattern; } bool AntiSpamWizard::SpamToolConfig::isServerBased() const { return !mServerPattern.isEmpty(); } bool AntiSpamWizard::SpamToolConfig::isDetectionOnly() const { return mDetectionOnly; } bool AntiSpamWizard::SpamToolConfig::isUseRegExp() const { return mUseRegExp; } bool AntiSpamWizard::SpamToolConfig::useBayesFilter() const { return mSupportsBayesFilter; } bool AntiSpamWizard::SpamToolConfig::hasTristateDetection() const { return mSupportsUnsure; } AntiSpamWizard::WizardMode AntiSpamWizard::SpamToolConfig::getType() const { return mType; } bool AntiSpamWizard::SpamToolConfig::isSpamTool() const { return mType == AntiSpam; } bool AntiSpamWizard::SpamToolConfig::isVirusTool() const { return mType == AntiVirus; } //--------------------------------------------------------------------------- AntiSpamWizard::ConfigReader::ConfigReader(WizardMode mode, QVector &configList) : mToolList(configList) , mMode(mode) { if (mMode == AntiSpam) { mConfig = KSharedConfig::openConfig(QStringLiteral("kmail.antispamrc")); } else { mConfig = KSharedConfig::openConfig(QStringLiteral("kmail.antivirusrc")); } } AntiSpamWizard::ConfigReader::~ConfigReader() { } void AntiSpamWizard::ConfigReader::readAndMergeConfig() { QString groupName = (mMode == AntiSpam) ? QStringLiteral("Spamtool #%1") : QStringLiteral("Virustool #%1"); // read the configuration from the global config file mConfig->setReadDefaults(true); KConfigGroup general(mConfig, "General"); const int registeredTools = general.readEntry("tools", 0); for (int i = 1; i <= registeredTools; ++i) { KConfigGroup toolConfig(mConfig, groupName.arg(i)); if (!toolConfig.readEntry("HeadersOnly", false)) { mToolList.append(readToolConfig(toolConfig)); } } // read the configuration from the user config file // and merge newer config data mConfig->setReadDefaults(false); KConfigGroup user_general(mConfig, "General"); const int user_registeredTools = user_general.readEntry("tools", 0); for (int i = 1; i <= user_registeredTools; ++i) { KConfigGroup toolConfig(mConfig, groupName.arg(i)); if (!toolConfig.readEntry("HeadersOnly", false)) { mergeToolConfig(readToolConfig(toolConfig)); } } // Make sure to have add least one tool listed even when the // config file was not found or whatever went wrong // Currently only works for spam tools if (mMode == AntiSpam) { if (registeredTools < 1 && user_registeredTools < 1) { mToolList.append(createDummyConfig()); } sortToolList(); } } AntiSpamWizard::SpamToolConfig AntiSpamWizard::ConfigReader::readToolConfig(KConfigGroup &configGroup) { const QString id = configGroup.readEntry("Ident"); const int version = configGroup.readEntry("Version", 0); #ifndef NDEBUG qDebug() << "Found predefined tool:" << id; qDebug() << "With config version :" << version; #endif const int prio = configGroup.readEntry("Priority", 1); const QString name = configGroup.readEntry("VisibleName"); const QString executable = configGroup.readEntry("Executable"); const QString url = configGroup.readEntry("URL"); const QString filterName = configGroup.readEntry("PipeFilterName"); const QString detectCmd = configGroup.readEntry("PipeCmdDetect"); const QString spamCmd = configGroup.readEntry("ExecCmdSpam"); const QString hamCmd = configGroup.readEntry("ExecCmdHam"); const QString noSpamCmd = configGroup.readEntry("PipeCmdNoSpam"); const QString header = configGroup.readEntry("DetectionHeader"); const QString pattern = configGroup.readEntry("DetectionPattern"); const QString pattern2 = configGroup.readEntry("DetectionPattern2"); const QString serverPattern = configGroup.readEntry("ServerPattern"); const bool detectionOnly = configGroup.readEntry("DetectionOnly", false); const bool useRegExp = configGroup.readEntry("UseRegExp", false); const bool supportsBayes = configGroup.readEntry("SupportsBayes", false); const bool supportsUnsure = configGroup.readEntry("SupportsUnsure", false); return SpamToolConfig(id, version, prio, name, executable, url, filterName, detectCmd, spamCmd, hamCmd, noSpamCmd, header, pattern, pattern2, serverPattern, detectionOnly, useRegExp, supportsBayes, supportsUnsure, mMode); } AntiSpamWizard::SpamToolConfig AntiSpamWizard::ConfigReader::createDummyConfig() { return SpamToolConfig(QStringLiteral("spamassassin"), 0, 1, QStringLiteral("SpamAssassin"), QStringLiteral("spamassassin -V"), QStringLiteral("https://spamassassin.apache.org/"), QStringLiteral("SpamAssassin Check"), QStringLiteral("spamassassin -L"), QStringLiteral("sa-learn -L --spam --no-sync --single"), QStringLiteral("sa-learn -L --ham --no-sync --single"), QStringLiteral("spamassassin -d"), QStringLiteral("X-Spam-Status"), QStringLiteral("yes"), QString(), QString(), false, false, true, false, AntiSpam); } void AntiSpamWizard::ConfigReader::mergeToolConfig(const AntiSpamWizard::SpamToolConfig &config) { bool found = false; QVector::Iterator end(mToolList.end()); for (QVector::Iterator it = mToolList.begin(); it != end; ++it) { #ifndef NDEBUG qDebug() << "Check against tool:" << (*it).getId(); qDebug() << "Against version :" << (*it).getVersion(); #endif if ((*it).getId() == config.getId()) { found = true; if ((*it).getVersion() < config.getVersion()) { #ifndef NDEBUG qDebug() << "Replacing config ..."; #endif mToolList.erase(it); mToolList.append(config); } break; } } if (!found) { mToolList.append(config); } } void AntiSpamWizard::ConfigReader::sortToolList() { QVector tmpList; SpamToolConfig config; while (!mToolList.isEmpty()) { QVector::Iterator highest; int priority = 0; // ascending QVector::Iterator end(mToolList.end()); for (QVector::Iterator it = mToolList.begin(); it != end; ++it) { if ((*it).getPrio() > priority) { priority = (*it).getPrio(); highest = it; } } config = (*highest); tmpList.append(config); mToolList.erase(highest); } QVector::ConstIterator end(tmpList.constEnd()); for (QVector::ConstIterator it = tmpList.constBegin(); it != end; ++it) { mToolList.append((*it)); } } //--------------------------------------------------------------------------- ASWizPage::ASWizPage(QWidget *parent, const QString &name) : QWidget(parent) { setObjectName(name); mLayout = new QHBoxLayout(this); QVBoxLayout *sideLayout = new QVBoxLayout(); mLayout->addItem(sideLayout); mLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding)); QPixmap banner; banner.load(QStringLiteral(":/org/kde/kmail/pics/kmwizard.png")); QLabel *bannerLabel = new QLabel(this); bannerLabel->setPixmap(banner); bannerLabel->setScaledContents(false); bannerLabel->setFrameShape(QFrame::StyledPanel); bannerLabel->setFrameShadow(QFrame::Sunken); bannerLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); sideLayout->addWidget(bannerLabel); sideLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Minimum, QSizePolicy::Expanding)); } //--------------------------------------------------------------------------- ASWizInfoPage::ASWizInfoPage(AntiSpamWizard::WizardMode mode, QWidget *parent, const QString &name) : ASWizPage(parent, name) { QBoxLayout *layout = new QVBoxLayout(); mLayout->addItem(layout); QTextEdit *introText = new QTextEdit(this); introText->setText( (mode == AntiSpamWizard::AntiSpam) ? i18n( "The wizard will search for any tools to do spam detection\n" "and setup KMail to work with them." ) : i18n( "

    Here you can get some assistance in setting up KMail's filter " "rules to use some commonly-known anti-virus tools.

    " "

    The wizard can detect those tools on your computer as " "well as create filter rules to classify messages using these " "tools and to separate messages containing viruses. " "The wizard will not take any existing filter " "rules into consideration: it will always append the new rules.

    " "

    Warning: As KMail appears to be frozen during the scan of the " "messages for viruses, you may encounter problems with " "the responsiveness of KMail because anti-virus tool " "operations are usually time consuming; please consider " "deleting the filter rules created by the wizard to get " "back to the former behavior.

    " )); introText->setReadOnly(true); introText->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); layout->addWidget(introText); mScanProgressText = new QLabel(this); mScanProgressText->clear(); mScanProgressText->setWordWrap(true); layout->addWidget(mScanProgressText); mToolsList = new QListWidget(this); mToolsList->hide(); mToolsList->setSelectionMode(QAbstractItemView::MultiSelection); mToolsList->setLayoutMode(QListView::Batched); mToolsList->setBatchSize(10); mToolsList->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum)); layout->addWidget(mToolsList); connect(mToolsList->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ASWizInfoPage::processSelectionChange); mSelectionHint = new QLabel(this); mSelectionHint->clear(); mSelectionHint->setWordWrap(true); layout->addWidget(mSelectionHint); } void ASWizInfoPage::setScanProgressText(const QString &toolName) { mScanProgressText->setText(toolName); } void ASWizInfoPage::addAvailableTool(const QString &visibleName) { mToolsList->addItem(visibleName); if (!mToolsList->isVisible()) { mToolsList->show(); mToolsList->selectionModel()->clearSelection(); mToolsList->setCurrentRow(0); mSelectionHint->setText(i18n("

    Please select the tools to be used " "for the detection and go " "to the next page.

    ")); } } bool ASWizInfoPage::isProgramSelected(const QString &visibleName) const { const QList foundItems = mToolsList->findItems(visibleName, Qt::MatchFixedString); return !foundItems.isEmpty() && foundItems[0]->isSelected(); } void ASWizInfoPage::processSelectionChange() { Q_EMIT selectionChanged(); } //--------------------------------------------------------------------------- ASWizSpamRulesPage::ASWizSpamRulesPage(QWidget *parent, const QString &name) : ASWizPage(parent, name) { QVBoxLayout *layout = new QVBoxLayout(); mLayout->addItem(layout); mMarkRules = new QCheckBox(i18n("&Mark detected spam messages as read"), this); mMarkRules->setWhatsThis( i18n("Mark messages which have been classified as spam as read.")); layout->addWidget(mMarkRules); mMoveSpamRules = new QCheckBox(i18n("Move &known spam to:"), this); mMoveSpamRules->setWhatsThis( i18n("The default folder for spam messages is the trash folder, " "but you may change that in the folder view below.")); layout->addWidget(mMoveSpamRules); mFolderReqForSpamFolder = new FolderRequester(this); mFolderReqForSpamFolder->setCollection(CommonKernel->trashCollectionFolder()); mFolderReqForSpamFolder->setMustBeReadWrite(true); mFolderReqForSpamFolder->setShowOutbox(false); QHBoxLayout *hLayout1 = new QHBoxLayout(); layout->addItem(hLayout1); hLayout1->addWidget(mFolderReqForSpamFolder); mMoveUnsureRules = new QCheckBox(i18n("Move &probable spam to:"), this); mMoveUnsureRules->setWhatsThis( i18n("The default folder is the inbox folder, but you may change that " "in the folder view below.

    " "Not all tools support a classification as unsure. If you have not " "selected a capable tool, you cannot select a folder as well.

    ")); layout->addWidget(mMoveUnsureRules); mFolderReqForUnsureFolder = new FolderRequester(this); mFolderReqForUnsureFolder->setCollection(CommonKernel->inboxCollectionFolder()); mFolderReqForUnsureFolder->setMustBeReadWrite(true); mFolderReqForUnsureFolder->setShowOutbox(false); QHBoxLayout *hLayout2 = new QHBoxLayout(); layout->addItem(hLayout2); hLayout2->addWidget(mFolderReqForUnsureFolder); layout->addStretch(); connect(mMarkRules, &QAbstractButton::clicked, this, &ASWizSpamRulesPage::processSelectionChange); connect(mMoveSpamRules, &QAbstractButton::clicked, this, &ASWizSpamRulesPage::processSelectionChange); connect(mMoveUnsureRules, &QAbstractButton::clicked, this, &ASWizSpamRulesPage::processSelectionChange); connect(mFolderReqForSpamFolder, &FolderRequester::folderChanged, this, &ASWizSpamRulesPage::processSelectionChange); connect(mFolderReqForUnsureFolder, &FolderRequester::folderChanged, this, &ASWizSpamRulesPage::processSelectionChange); mMarkRules->setChecked(true); mMoveSpamRules->setChecked(true); } bool ASWizSpamRulesPage::markAsReadSelected() const { return mMarkRules->isChecked(); } bool ASWizSpamRulesPage::moveSpamSelected() const { return mMoveSpamRules->isChecked(); } bool ASWizSpamRulesPage::moveUnsureSelected() const { return mMoveUnsureRules->isChecked(); } QString ASWizSpamRulesPage::selectedSpamCollectionId() const { return QString::number(selectedSpamCollection().id()); } QString ASWizSpamRulesPage::selectedSpamCollectionName() const { return selectedSpamCollection().name(); } Akonadi::Collection ASWizSpamRulesPage::selectedSpamCollection() const { if (mFolderReqForSpamFolder->hasCollection()) { return mFolderReqForSpamFolder->collection(); } else { return CommonKernel->trashCollectionFolder(); } } Akonadi::Collection ASWizSpamRulesPage::selectedUnsureCollection() const { if (mFolderReqForUnsureFolder->hasCollection()) { return mFolderReqForUnsureFolder->collection(); } else { return CommonKernel->inboxCollectionFolder(); } } QString ASWizSpamRulesPage::selectedUnsureCollectionName() const { return selectedUnsureCollection().name(); } QString ASWizSpamRulesPage::selectedUnsureCollectionId() const { return QString::number(selectedUnsureCollection().id()); } void ASWizSpamRulesPage::processSelectionChange() { mFolderReqForSpamFolder->setEnabled(mMoveSpamRules->isChecked()); mFolderReqForUnsureFolder->setEnabled(mMoveUnsureRules->isChecked()); Q_EMIT selectionChanged(); } void ASWizSpamRulesPage::allowUnsureFolderSelection(bool enabled) { mMoveUnsureRules->setEnabled(enabled); mMoveUnsureRules->setVisible(enabled); mFolderReqForUnsureFolder->setEnabled(enabled); mFolderReqForUnsureFolder->setVisible(enabled); } void ASWizSpamRulesPage::allowMoveSpam(bool enabled) { mMarkRules->setEnabled(enabled); mMarkRules->setChecked(enabled); mMoveSpamRules->setEnabled(enabled); mMoveSpamRules->setChecked(enabled); } //--------------------------------------------------------------------------- ASWizVirusRulesPage::ASWizVirusRulesPage(QWidget *parent, const QString &name) : ASWizPage(parent, name) { QGridLayout *grid = new QGridLayout(); mLayout->addItem(grid); mPipeRules = new QCheckBox(i18n("Check messages using the anti-virus tools"), this); mPipeRules->setWhatsThis( i18n("Let the anti-virus tools check your messages. The wizard " "will create appropriate filters. The messages are usually " "marked by the tools so that following filters can react " "on this and, for example, move virus messages to a special folder.")); grid->addWidget(mPipeRules, 0, 0); mMoveRules = new QCheckBox(i18n("Move detected viral messages to the selected folder"), this); mMoveRules->setWhatsThis( i18n("A filter to detect messages classified as virus-infected and to move " "those messages into a predefined folder is created. The " "default folder is the trash folder, but you may change that " "in the folder view.")); grid->addWidget(mMoveRules, 1, 0); mMarkRules = new QCheckBox(i18n("Additionally, mark detected viral messages as read"), this); mMarkRules->setEnabled(false); mMarkRules->setWhatsThis( i18n("Mark messages which have been classified as " "virus-infected as read, as well as moving them " "to the selected folder.")); grid->addWidget(mMarkRules, 2, 0); FolderTreeWidget::TreeViewOptions opt = FolderTreeWidget::None; opt |= FolderTreeWidget::UseDistinctSelectionModel; FolderTreeWidgetProxyModel::FolderTreeWidgetProxyModelOptions optReadableProxy = FolderTreeWidgetProxyModel::None; optReadableProxy |= FolderTreeWidgetProxyModel::HideVirtualFolder; optReadableProxy |= FolderTreeWidgetProxyModel::HideOutboxFolder; mFolderTree = new FolderTreeWidget(this, nullptr, opt, optReadableProxy); mFolderTree->readConfig(); mFolderTree->folderTreeView()->expandAll(); mFolderTree->folderTreeWidgetProxyModel()->setAccessRights(Akonadi::Collection::CanCreateCollection); mFolderTree->selectCollectionFolder(CommonKernel->trashCollectionFolder()); mFolderTree->folderTreeView()->setDragDropMode(QAbstractItemView::NoDragDrop); mFolderTree->disableContextMenuAndExtraColumn(); grid->addWidget(mFolderTree, 3, 0); connect(mPipeRules, &QCheckBox::clicked, this, &ASWizVirusRulesPage::processSelectionChange); connect(mMoveRules, &QCheckBox::clicked, this, &ASWizVirusRulesPage::processSelectionChange); connect(mMarkRules, &QCheckBox::clicked, this, &ASWizVirusRulesPage::processSelectionChange); connect(mMoveRules, &QCheckBox::toggled, mMarkRules, &QCheckBox::setEnabled); } bool ASWizVirusRulesPage::pipeRulesSelected() const { return mPipeRules->isChecked(); } bool ASWizVirusRulesPage::moveRulesSelected() const { return mMoveRules->isChecked(); } bool ASWizVirusRulesPage::markReadRulesSelected() const { return mMarkRules->isChecked(); } QString ASWizVirusRulesPage::selectedFolderName() const { if (mFolderTree->selectedCollection().isValid()) { return QString::number(mFolderTree->selectedCollection().id()); } else { return QString::number(CommonKernel->trashCollectionFolder().id()); } } void ASWizVirusRulesPage::processSelectionChange() { Q_EMIT selectionChanged(); } //--------------------------------------------------------------------------- ASWizSummaryPage::ASWizSummaryPage(QWidget *parent, const QString &name) : ASWizPage(parent, name) { QBoxLayout *layout = new QVBoxLayout(); mLayout->addItem(layout); mSummaryText = new QLabel(this); layout->addWidget(mSummaryText); layout->addStretch(); } void ASWizSummaryPage::setSummaryText(const QString &text) { mSummaryText->setText(text); } diff --git a/kmail/plugins/expertplugin/expertplugin.cpp b/kmail/plugins/expertplugin/expertplugin.cpp index 56ccb364..4817705f 100644 --- a/kmail/plugins/expertplugin/expertplugin.cpp +++ b/kmail/plugins/expertplugin/expertplugin.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "expertplugin.h" #include "expertplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(ExpertPlugin, "kmail_expertplugin.json") ExpertPlugin::ExpertPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } ExpertPlugin::~ExpertPlugin() { } PimCommon::GenericPluginInterface *ExpertPlugin::createInterface(QObject *parent) { ExpertPluginInterface *interface = new ExpertPluginInterface(parent); return interface; } #include "expertplugin.moc" diff --git a/kmail/plugins/logactivitiesplugin/logactivitiesplugin.cpp b/kmail/plugins/logactivitiesplugin/logactivitiesplugin.cpp index 0849689e..9eb5e855 100644 --- a/kmail/plugins/logactivitiesplugin/logactivitiesplugin.cpp +++ b/kmail/plugins/logactivitiesplugin/logactivitiesplugin.cpp @@ -1,41 +1,41 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "logactivitiesplugin.h" #include "logactivitiesplugininterface.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(LogActivitiesPlugin, "kmail_logactivitiesplugin.json") LogActivitiesPlugin::LogActivitiesPlugin(QObject *parent, const QList &) : PimCommon::GenericPlugin(parent) { } LogActivitiesPlugin::~LogActivitiesPlugin() { } PimCommon::GenericPluginInterface *LogActivitiesPlugin::createInterface(QObject *parent) { LogActivitiesPluginInterface *interface = new LogActivitiesPluginInterface(parent); return interface; } #include "logactivitiesplugin.moc" diff --git a/kmailtransport/sendmail/sendmailtransportplugin.cpp b/kmailtransport/sendmail/sendmailtransportplugin.cpp index dce185da..2bc241a4 100644 --- a/kmailtransport/sendmail/sendmailtransportplugin.cpp +++ b/kmailtransport/sendmail/sendmailtransportplugin.cpp @@ -1,65 +1,65 @@ /* Copyright (C) 2017-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sendmailtransportplugin.h" #include "sendmailconfigdialog.h" #include "sendmailjob.h" -#include +#include #include #include K_PLUGIN_CLASS_WITH_JSON(SendMailTransportPlugin, "sendmailtransport.json") SendMailTransportPlugin::SendMailTransportPlugin(QObject *parent, const QList &) : MailTransport::TransportAbstractPlugin(parent) { } SendMailTransportPlugin::~SendMailTransportPlugin() { } QVector SendMailTransportPlugin::names() const { MailTransport::TransportAbstractPluginInfo info; info.name = i18nc("@option sendmail transport", "Sendmail"); info.identifier = QStringLiteral("sendmail"); info.description = i18n("A local sendmail installation"); info.isAkonadi = false; return QVector() << info; } bool SendMailTransportPlugin::configureTransport(const QString &identifier, MailTransport::Transport *transport, QWidget *parent) { Q_UNUSED(identifier); QPointer transportConfigDialog = new SendMailConfigDialog(transport, parent); transportConfigDialog->setWindowTitle(i18n("Configure account")); bool okClicked = (transportConfigDialog->exec() == QDialog::Accepted); delete transportConfigDialog; return okClicked; } MailTransport::TransportJob *SendMailTransportPlugin::createTransportJob(MailTransport::Transport *t, const QString &identifier) { Q_UNUSED(identifier); return new MailTransport::SendmailJob(t, this); } #include "sendmailtransportplugin.moc" diff --git a/korganizer/emailaddressselectionldapdialog/emailaddressselectionldapdialog.cpp b/korganizer/emailaddressselectionldapdialog/emailaddressselectionldapdialog.cpp index 4978abb2..66bea026 100644 --- a/korganizer/emailaddressselectionldapdialog/emailaddressselectionldapdialog.cpp +++ b/korganizer/emailaddressselectionldapdialog/emailaddressselectionldapdialog.cpp @@ -1,114 +1,114 @@ /* Copyright (C) 2019 Laurent Montel This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "emailaddressselectionldapdialog.h" #include #include #include #include #include #include #include #include #include #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(EmailAddressSelectionLdapDialog, "emailaddressselectionldapdialog.json") EmailAddressSelectionLdapDialog::EmailAddressSelectionLdapDialog(QWidget *parent, const QList &) : Akonadi::AbstractEmailAddressSelectionDialog(parent) { QVBoxLayout *mainLayout = new QVBoxLayout(this); mView = new Akonadi::RecipientsPickerWidget(true, nullptr, this); mainLayout->addWidget(mView); connect(mView->emailAddressSelectionWidget()->view(), &QTreeView::doubleClicked, this, &QDialog::accept); QPushButton *searchLDAPButton = new QPushButton(i18n("Search &Directory Service"), this); connect(searchLDAPButton, &QPushButton::clicked, this, &EmailAddressSelectionLdapDialog::slotSearchLDAP); mainLayout->addWidget(searchLDAPButton); KConfig config(QStringLiteral("kabldaprc")); KConfigGroup group = config.group("LDAP"); int numHosts = group.readEntry("NumSelectedHosts", 0); if (!numHosts) { searchLDAPButton->setVisible(false); } QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setDefault(true); okButton->setShortcut(Qt::CTRL | Qt::Key_Return); connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); mainLayout->addWidget(buttonBox); readConfig(); } void EmailAddressSelectionLdapDialog::readConfig() { KConfigGroup group(KSharedConfig::openConfig(), QStringLiteral("EmailAddressSelectionLdapDialog")); const QSize size = group.readEntry("Size", QSize()); if (size.isValid()) { resize(size); } else { resize(sizeHint().width(), sizeHint().height()); } } void EmailAddressSelectionLdapDialog::writeConfig() { KConfigGroup group(KSharedConfig::openConfig(), QStringLiteral("EmailAddressSelectionLdapDialog")); group.writeEntry("Size", size()); } EmailAddressSelectionLdapDialog::~EmailAddressSelectionLdapDialog() { writeConfig(); } Akonadi::EmailAddressSelection::List EmailAddressSelectionLdapDialog::selectedAddresses() const { return mView->emailAddressSelectionWidget()->selectedAddresses(); } Akonadi::EmailAddressSelectionWidget *EmailAddressSelectionLdapDialog::view() const { return mView->emailAddressSelectionWidget(); } void EmailAddressSelectionLdapDialog::slotSearchLDAP() { if (!mLdapSearchDialog) { mLdapSearchDialog = new KLDAP::LdapSearchDialog(this); connect(mLdapSearchDialog, &KLDAP::LdapSearchDialog::contactsAdded, this, &EmailAddressSelectionLdapDialog::ldapSearchResult); } mLdapSearchDialog->setSearchText(mView->emailAddressSelectionWidget()->searchLineEdit()->text()); mLdapSearchDialog->show(); } void EmailAddressSelectionLdapDialog::ldapSearchResult() { const KContacts::Addressee::List contacts = mLdapSearchDialog->selectedContacts(); Q_EMIT insertAddresses(contacts); } #include "emailaddressselectionldapdialog.moc" diff --git a/plugins/customtoolsplugins/translatorplugin/translatorplugin.cpp b/plugins/customtoolsplugins/translatorplugin/translatorplugin.cpp index 1671902a..ab5b1173 100644 --- a/plugins/customtoolsplugins/translatorplugin/translatorplugin.cpp +++ b/plugins/customtoolsplugins/translatorplugin/translatorplugin.cpp @@ -1,51 +1,51 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "translatorplugin.h" #include "translatorview.h" #include -#include +#include #include K_PLUGIN_CLASS_WITH_JSON(TranslatorPlugin, "pimcommon_translatorplugin.json") TranslatorPlugin::TranslatorPlugin(QObject *parent, const QList &) : PimCommon::CustomToolsPlugin(parent) { } TranslatorPlugin::~TranslatorPlugin() { } PimCommon::CustomToolsViewInterface *TranslatorPlugin::createView(KActionCollection *ac, PimCommon::CustomToolsWidgetNg *parent) { TranslatorView *view = new TranslatorView(ac, parent); connect(view, &TranslatorView::toolsWasClosed, parent, &PimCommon::CustomToolsWidgetNg::slotToolsWasClosed); connect(view, &TranslatorView::insertText, parent, &PimCommon::CustomToolsWidgetNg::insertText); connect(view, &TranslatorView::activateView, parent, &PimCommon::CustomToolsWidgetNg::slotActivateView); return view; } QString TranslatorPlugin::customToolName() const { return i18n("Translator"); } #include "translatorplugin.moc" diff --git a/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.cpp b/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.cpp index f9bc7eef..f7025765 100644 --- a/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.cpp +++ b/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.cpp @@ -1,106 +1,106 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "updatecontactjob.h" #include #include #include #include -#include +#include UpdateContactJob::UpdateContactJob(const QString &email, const KContacts::Addressee &contact, QWidget *parentWidget, QObject *parent) : KJob(parent) , mEmail(email) , mContact(contact) , mParentWidget(parentWidget) { } UpdateContactJob::~UpdateContactJob() { } void UpdateContactJob::slotSearchDone(KJob *job) { if (job->error()) { setError(job->error()); setErrorText(job->errorText()); emitResult(); return; } const Akonadi::ContactSearchJob *searchJob = qobject_cast(job); const KContacts::Addressee::List contacts = searchJob->contacts(); if (contacts.isEmpty()) { const QString text = i18n("The vCard's primary email address is not in addressbook."); KMessageBox::information(mParentWidget, text); setError(UserDefinedError); emitResult(); return; } else if (contacts.count() > 1) { const QString text = i18n("There are two or more contacts with same email stored in addressbook."); KMessageBox::information(mParentWidget, text); setError(UserDefinedError); emitResult(); return; } Akonadi::Item item = searchJob->items().at(0); item.setPayload(mContact); Akonadi::ItemModifyJob *modifyJob = new Akonadi::ItemModifyJob(item); connect(modifyJob, &Akonadi::ItemModifyJob::result, this, &UpdateContactJob::slotUpdateContactDone); } void UpdateContactJob::slotUpdateContactDone(KJob *job) { if (job->error()) { setError(job->error()); setErrorText(job->errorText()); emitResult(); return; } const QString text = i18n("The vCard was updated to your address book; " "you can add more information to this " "entry by opening the address book."); KMessageBox::information(mParentWidget, text, QString(), QStringLiteral("updatedtokabc")); emitResult(); } void UpdateContactJob::start() { if (mEmail.isEmpty()) { const QString text = i18n("Email not specified"); KMessageBox::information(mParentWidget, text); setError(UserDefinedError); emitResult(); return; } // first check whether a contact with the same email exists already Akonadi::ContactSearchJob *searchJob = new Akonadi::ContactSearchJob(this); searchJob->setLimit(1); searchJob->setQuery(Akonadi::ContactSearchJob::Email, mEmail.toLower(), Akonadi::ContactSearchJob::ExactMatch); connect(searchJob, &Akonadi::ContactSearchJob::result, this, &UpdateContactJob::slotSearchDone); } #include "moc_updatecontactjob.cpp" diff --git a/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.h b/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.h index 96c0b205..6bdcdcde 100644 --- a/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.h +++ b/plugins/messageviewer/bodypartformatter/vcard/updatecontactjob.h @@ -1,45 +1,45 @@ /* Copyright (C) 2012-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef UPDATECONTACTJOB_H #define UPDATECONTACTJOB_H -#include +#include #include class UpdateContactJob : public KJob { Q_OBJECT public: explicit UpdateContactJob(const QString &email, const KContacts::Addressee &contact, QWidget *parentWidget, QObject *parent = nullptr); ~UpdateContactJob() override; void start() override; private: void slotSearchDone(KJob *); void slotUpdateContactDone(KJob *); QString mEmail; KContacts::Addressee mContact; QWidget *mParentWidget = nullptr; }; #endif // UPDATECONTACTJOB_H diff --git a/plugins/messageviewerconfigureplugins/dkim-verify/dkimconfiguresettingsplugin.cpp b/plugins/messageviewerconfigureplugins/dkim-verify/dkimconfiguresettingsplugin.cpp index 45e4d386..52eb004d 100644 --- a/plugins/messageviewerconfigureplugins/dkim-verify/dkimconfiguresettingsplugin.cpp +++ b/plugins/messageviewerconfigureplugins/dkim-verify/dkimconfiguresettingsplugin.cpp @@ -1,42 +1,42 @@ /* Copyright (C) 2018-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "dkimconfiguresettingsplugin.h" #include "dkimconfiguredialog.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(DkimConfigureSettingsPlugin, "messageviewer_dkimconfigplugin.json") DkimConfigureSettingsPlugin::DkimConfigureSettingsPlugin(QObject *parent, const QList &) : MessageViewer::MessageViewerConfigureSettingsPlugin(parent) { } DkimConfigureSettingsPlugin::~DkimConfigureSettingsPlugin() { } void DkimConfigureSettingsPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new DKIMConfigureDialog(parent); dlg->exec(); delete dlg; } #include "dkimconfiguresettingsplugin.moc" diff --git a/plugins/messageviewerconfigureplugins/gravatar/gravatarconfiguresettingsplugin.cpp b/plugins/messageviewerconfigureplugins/gravatar/gravatarconfiguresettingsplugin.cpp index 70de8c7a..5253b767 100644 --- a/plugins/messageviewerconfigureplugins/gravatar/gravatarconfiguresettingsplugin.cpp +++ b/plugins/messageviewerconfigureplugins/gravatar/gravatarconfiguresettingsplugin.cpp @@ -1,42 +1,42 @@ /* Copyright (C) 2018-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "gravatarconfiguresettingsplugin.h" #include "gravatarconfiguresettingsplugindialog.h" -#include +#include K_PLUGIN_CLASS_WITH_JSON(GravatarConfigureSettingsPlugin, "messageviewer_gravatarconfigplugin.json") GravatarConfigureSettingsPlugin::GravatarConfigureSettingsPlugin(QObject *parent, const QList &) : MessageViewer::MessageViewerConfigureSettingsPlugin(parent) { } GravatarConfigureSettingsPlugin::~GravatarConfigureSettingsPlugin() { } void GravatarConfigureSettingsPlugin::showConfigureDialog(QWidget *parent) { QPointer dlg = new GravatarConfigureSettingsPluginDialog(parent); dlg->exec(); delete dlg; } #include "gravatarconfiguresettingsplugin.moc" diff --git a/plugins/messageviewerheaderplugins/briefheaderstyleplugin/briefheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/briefheaderstyleplugin/briefheaderstyleplugin.cpp index 4b1012e9..3353513c 100644 --- a/plugins/messageviewerheaderplugins/briefheaderstyleplugin/briefheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/briefheaderstyleplugin/briefheaderstyleplugin.cpp @@ -1,67 +1,67 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "briefheaderstyleplugin.h" #include "briefheaderstyleinterface.h" #include "briefheaderstyle.h" #include "briefheaderstrategy.h" -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(BriefHeaderStylePlugin, "messageviewer_briefheaderstyleplugin.json") BriefHeaderStylePlugin::BriefHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new BriefHeaderStyle) , mHeaderStrategy(new BriefHeaderStrategy) { } BriefHeaderStylePlugin::~BriefHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *BriefHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *BriefHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } MessageViewer::HeaderStyleInterface *BriefHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::BriefHeaderStyleInterface *view = new MessageViewer::BriefHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString BriefHeaderStylePlugin::name() const { return QStringLiteral("brief"); } #include "briefheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyleplugin.cpp index 2c1edb9a..549607d4 100644 --- a/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/enterpriseheaderstyleplugin/enterpriseheaderstyleplugin.cpp @@ -1,83 +1,83 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "enterpriseheaderstyleplugin.h" #include "enterpriseheaderstyle.h" #include "enterpriseheaderstyleinterface.h" #include "messageviewer/richheaderstrategy.h" -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(EnterpriseHeaderStylePlugin, "messageviewer_enterpriseheaderstyleplugin.json") EnterpriseHeaderStylePlugin::EnterpriseHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new EnterpriseHeaderStyle) , mHeaderStrategy(new RichHeaderStrategy) { } EnterpriseHeaderStylePlugin::~EnterpriseHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *EnterpriseHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *EnterpriseHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } HeaderStyleInterface *EnterpriseHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::HeaderStyleInterface *view = new MessageViewer::EnterpriseHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString EnterpriseHeaderStylePlugin::name() const { return QStringLiteral("enterprise"); } bool EnterpriseHeaderStylePlugin::hasMargin() const { return false; } QString EnterpriseHeaderStylePlugin::alignment() const { return QStringLiteral("right"); } int EnterpriseHeaderStylePlugin::elidedTextSize() const { return 180; } #include "enterpriseheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/fancyheaderstyleplugin/fancyheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/fancyheaderstyleplugin/fancyheaderstyleplugin.cpp index 15ce601a..545a2da0 100644 --- a/plugins/messageviewerheaderplugins/fancyheaderstyleplugin/fancyheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/fancyheaderstyleplugin/fancyheaderstyleplugin.cpp @@ -1,200 +1,200 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "fancyheaderstyleinterface.h" #include "fancyheaderstyleplugin.h" #include "fancyheaderstyle.h" #include "messageviewer/richheaderstrategy.h" -#include +#include #include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(FancyHeaderStylePlugin, "messageviewer_fancyheaderstyleplugin.json") FancyHeaderStylePlugin::FancyHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new FancyHeaderStyle) , mHeaderStrategy(new RichHeaderStrategy) { } FancyHeaderStylePlugin::~FancyHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *FancyHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *FancyHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } HeaderStyleInterface *FancyHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::HeaderStyleInterface *view = new MessageViewer::FancyHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString FancyHeaderStylePlugin::name() const { return QStringLiteral("fancy"); } int FancyHeaderStylePlugin::elidedTextSize() const { return 1000; } QString FancyHeaderStylePlugin::extraScreenCss(const QString &headerFont) const { Q_UNUSED(headerFont); const QPalette &pal = QApplication::palette(); const QString val = QStringLiteral("div.fancy.header > div {\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border: solid %3 1px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div a[href] { color: %2 ! important; }\n\n" "div.fancy.header > div a[href]:hover { text-decoration: underline ! important; }\n\n" "div.fancy.header > div.spamheader {\n" " background-color: #cdcdcd ! important;\n" " border-top: 0px ! important;\n" " padding: 3px ! important;\n" " color: black ! important;\n" " font-weight: bold ! important;\n" " font-size: smaller ! important;\n" "}\n\n" "div.fancy.header > table.outer {\n" " all: inherit;\n" " width: auto ! important;\n" " border-spacing: 0;\n" " background-color: %4 ! important;\n" " color: %3 ! important;\n" " border-bottom: solid %3 1px ! important;\n" " border-left: solid %3 1px ! important;\n" " border-right: solid %3 1px ! important;\n" "}\n\n" ).arg(pal.color(QPalette::Highlight).name(), pal.color(QPalette::HighlightedText).name(), pal.color(QPalette::WindowText).name(), pal.color(QPalette::Window).name()); return val; } QString FancyHeaderStylePlugin::extraPrintCss(const QString &headerFont) const { Q_UNUSED(headerFont); const QPalette &pal = QApplication::palette(); const QString val = QStringLiteral("div.fancy.header > div {\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " padding: 4px ! important;\n" " border: solid %2 1px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div a[href] { color: %2 ! important; }\n\n" "div.fancy.header > table.outer{\n" " all: inherit;\n" " width: auto ! important;\n" " border-spacing: 0;\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border-bottom: solid %2 1px ! important;\n" " border-left: solid %2 1px ! important;\n" " border-right: solid %2 1px ! important;\n" "}\n\n" ).arg(pal.color(QPalette::Window).name(), pal.color(QPalette::WindowText).name()); return val; } QString FancyHeaderStylePlugin::extraCommonCss(const QString &headerFont) const { const QPalette &pal = QApplication::palette(); const QString val = QStringLiteral( "div.fancy.header table {\n" " width: 100% ! important;\n" " table-layout: auto;\n" " border-width: 0px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header > div {\n" " font-weight: bold ! important;\n" " padding: 4px ! important;\n" " line-height: normal;\n" "}\n\n" "div.fancy.header table {\n" " padding: 2px ! important;\n" " text-align: left ! important;\n" " border-collapse: separate ! important;\n" "}\n\n" "div.fancy.header table th {\n" " %3\n" " padding: 0px ! important;\n" " white-space: nowrap ! important;\n" " border-spacing: 0px ! important;\n" " text-align: left ! important;\n" " vertical-align: top ! important;\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border: 1px ! important;\n" "}\n\n" "div.fancy.header table td {\n" " %3\n" " padding: 0px ! important;\n" " border-spacing: 0px ! important;\n" " text-align: left ! important;\n" " vertical-align: top ! important;\n" " width: 100% ! important;\n" " background-color: %1 ! important;\n" " color: %2 ! important;\n" " border: 1px ! important;\n" "}\n\n" "div.fancy.header table a:hover {\n" " background-color: transparent ! important;\n" "}\n\n") .arg(pal.color(QPalette::Window).name()) .arg(pal.color(QPalette::WindowText).name()) .arg(headerFont); return val; } #include "fancyheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/grantleeheaderstyleplugin/grantleeheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/grantleeheaderstyleplugin/grantleeheaderstyleplugin.cpp index 15baefd0..1737b388 100644 --- a/plugins/messageviewerheaderplugins/grantleeheaderstyleplugin/grantleeheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/grantleeheaderstyleplugin/grantleeheaderstyleplugin.cpp @@ -1,67 +1,67 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "grantleeheaderstyleinterface.h" #include "grantleeheaderstyleplugin.h" #include #include "grantleeheaderstrategy.h" -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(GrantleeHeaderStylePlugin, "messageviewer_grantleeheaderstyleplugin.json") GrantleeHeaderStylePlugin::GrantleeHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new GrantleeHeaderStyle) , mHeaderStrategy(new GrantleeHeaderStrategy) { } GrantleeHeaderStylePlugin::~GrantleeHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *GrantleeHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *GrantleeHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } HeaderStyleInterface *GrantleeHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::HeaderStyleInterface *view = new MessageViewer::GrantleeHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString GrantleeHeaderStylePlugin::name() const { return QStringLiteral("grantlee"); } #include "grantleeheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/longheaderstyleplugin/longheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/longheaderstyleplugin/longheaderstyleplugin.cpp index 623f8696..851bfd4e 100644 --- a/plugins/messageviewerheaderplugins/longheaderstyleplugin/longheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/longheaderstyleplugin/longheaderstyleplugin.cpp @@ -1,68 +1,68 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "longheaderstyleinterface.h" #include "longheaderstyleplugin.h" #include "messageviewer/plainheaderstyle.h" #include "messageviewer/richheaderstrategy.h" -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(LongHeaderStylePlugin, "messageviewer_longheaderstyleplugin.json") LongHeaderStylePlugin::LongHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new PlainHeaderStyle) , mHeaderStrategy(new RichHeaderStrategy) { } LongHeaderStylePlugin::~LongHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *LongHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *LongHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } HeaderStyleInterface *LongHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::HeaderStyleInterface *view = new MessageViewer::LongHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString LongHeaderStylePlugin::name() const { return QStringLiteral("long-header"); } #include "longheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/standardsheaderstyleplugin/standardsheaderstyleplugin.cpp b/plugins/messageviewerheaderplugins/standardsheaderstyleplugin/standardsheaderstyleplugin.cpp index 00983792..642616b3 100644 --- a/plugins/messageviewerheaderplugins/standardsheaderstyleplugin/standardsheaderstyleplugin.cpp +++ b/plugins/messageviewerheaderplugins/standardsheaderstyleplugin/standardsheaderstyleplugin.cpp @@ -1,67 +1,67 @@ /* Copyright (C) 2015-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "standardsheaderstyleplugin.h" #include "standardsheaderstyleinterface.h" #include "standardheaderstrategy.h" #include "messageviewer/plainheaderstyle.h" -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(StandardsHeaderStylePlugin, "messageviewer_standardsheaderstyleplugin.json") StandardsHeaderStylePlugin::StandardsHeaderStylePlugin(QObject *parent, const QList &) : MessageViewer::HeaderStylePlugin(parent) , mHeaderStyle(new PlainHeaderStyle) , mHeaderStrategy(new StandardHeaderStrategy) { } StandardsHeaderStylePlugin::~StandardsHeaderStylePlugin() { delete mHeaderStyle; delete mHeaderStrategy; } HeaderStyle *StandardsHeaderStylePlugin::headerStyle() const { return mHeaderStyle; } HeaderStrategy *StandardsHeaderStylePlugin::headerStrategy() const { return mHeaderStrategy; } HeaderStyleInterface *StandardsHeaderStylePlugin::createView(KActionMenu *menu, QActionGroup *actionGroup, KActionCollection *ac, QObject *parent) { MessageViewer::HeaderStyleInterface *view = new MessageViewer::StandardsHeaderStyleInterface(this, parent); if (ac) { view->createAction(menu, actionGroup, ac); } return view; } QString StandardsHeaderStylePlugin::name() const { return QStringLiteral("standards-header"); } #include "standardsheaderstyleplugin.moc" diff --git a/plugins/messageviewerheaderplugins/tests/headerstylemenu_gui.cpp b/plugins/messageviewerheaderplugins/tests/headerstylemenu_gui.cpp index 3eb75f8a..63f3bbf7 100644 --- a/plugins/messageviewerheaderplugins/tests/headerstylemenu_gui.cpp +++ b/plugins/messageviewerheaderplugins/tests/headerstylemenu_gui.cpp @@ -1,77 +1,77 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "headerstylemenu_gui.h" #include "messageviewer/headerstylemenumanager.h" #include #include #include #include #include #include -#include +#include #include #include #include #include #include HeaderStyleMenuTest::HeaderStyleMenuTest(QWidget *parent) : QWidget(parent) { QMenuBar *menu = new QMenuBar(this); QVBoxLayout *hbox = new QVBoxLayout(this); hbox->addWidget(menu); MessageViewer::HeaderStyleMenuManager *manager = new MessageViewer::HeaderStyleMenuManager(new KActionCollection(this), this); menu->addAction(manager->menu()); mTextEdit = new QTextEdit(this); mTextEdit->setReadOnly(true); hbox->addWidget(mTextEdit); connect(manager, &MessageViewer::HeaderStyleMenuManager::styleChanged, this, &HeaderStyleMenuTest::styleChanged); manager->readConfig(); } HeaderStyleMenuTest::~HeaderStyleMenuTest() { } void HeaderStyleMenuTest::styleChanged(MessageViewer::HeaderStylePlugin *plugin) { mTextEdit->append(QStringLiteral("strategy: %1, headerstyle: %2").arg(QLatin1String(plugin->headerStrategy()->name())) .arg(QLatin1String(plugin->headerStyle()->name()))); } int main(int argc, char **argv) { QApplication app(argc, argv); QStandardPaths::setTestModeEnabled(true); QCommandLineParser parser; parser.addVersionOption(); parser.addHelpOption(); parser.process(app); HeaderStyleMenuTest *w = new HeaderStyleMenuTest(); w->resize(800, 200); w->show(); app.exec(); delete w; return 0; } diff --git a/plugins/messageviewerplugins/common/expandurlplugin/viewerpluginexpandurl.cpp b/plugins/messageviewerplugins/common/expandurlplugin/viewerpluginexpandurl.cpp index ed15824d..bcf878f8 100644 --- a/plugins/messageviewerplugins/common/expandurlplugin/viewerpluginexpandurl.cpp +++ b/plugins/messageviewerplugins/common/expandurlplugin/viewerpluginexpandurl.cpp @@ -1,44 +1,44 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerpluginexpandurl.h" #include "viewerpluginexpandurlinterface.h" #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginExpandurl, "messageviewer_expandurlplugin.json") ViewerPluginExpandurl::ViewerPluginExpandurl(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginExpandurl::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginExpandurlInterface(ac, parent); return view; } QString ViewerPluginExpandurl::viewerPluginName() const { return QStringLiteral("expandurl"); } #include "viewerpluginexpandurl.moc" diff --git a/plugins/messageviewerplugins/common/translatorplugin/viewerplugintranslator.cpp b/plugins/messageviewerplugins/common/translatorplugin/viewerplugintranslator.cpp index a5998f03..4afc2b73 100644 --- a/plugins/messageviewerplugins/common/translatorplugin/viewerplugintranslator.cpp +++ b/plugins/messageviewerplugins/common/translatorplugin/viewerplugintranslator.cpp @@ -1,44 +1,44 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerplugintranslator.h" #include "viewerplugintranslatorinterface.h" #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginTranslator, "messageviewer_translatorplugin.json") ViewerPluginTranslator::ViewerPluginTranslator(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginTranslator::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginTranslatorInterface(ac, parent); return view; } QString ViewerPluginTranslator::viewerPluginName() const { return QStringLiteral("translator"); } #include "viewerplugintranslator.moc" diff --git a/plugins/messageviewerplugins/createeventplugin/viewerplugincreateevent.cpp b/plugins/messageviewerplugins/createeventplugin/viewerplugincreateevent.cpp index 50c97c1f..34c66a72 100644 --- a/plugins/messageviewerplugins/createeventplugin/viewerplugincreateevent.cpp +++ b/plugins/messageviewerplugins/createeventplugin/viewerplugincreateevent.cpp @@ -1,44 +1,44 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerplugincreateevent.h" #include "viewerplugincreateeventinterface.h" #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginCreateevent, "messageviewer_createeventplugin.json") ViewerPluginCreateevent::ViewerPluginCreateevent(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginCreateevent::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginCreateEventInterface(ac, parent); return view; } QString ViewerPluginCreateevent::viewerPluginName() const { return QStringLiteral("create-task"); } #include "viewerplugincreateevent.moc" diff --git a/plugins/messageviewerplugins/createnoteplugin/viewerplugincreatenote.cpp b/plugins/messageviewerplugins/createnoteplugin/viewerplugincreatenote.cpp index ce7fc997..07611022 100644 --- a/plugins/messageviewerplugins/createnoteplugin/viewerplugincreatenote.cpp +++ b/plugins/messageviewerplugins/createnoteplugin/viewerplugincreatenote.cpp @@ -1,44 +1,44 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerplugincreatenote.h" #include "viewerplugincreatenoteinterface.h" #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginCreatenote, "messageviewer_createnoteplugin.json") ViewerPluginCreatenote::ViewerPluginCreatenote(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginCreatenote::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginCreatenoteInterface(ac, parent); return view; } QString ViewerPluginCreatenote::viewerPluginName() const { return QStringLiteral("create-task"); } #include "viewerplugincreatenote.moc" diff --git a/plugins/messageviewerplugins/createtodoplugin/viewerplugincreatetodo.cpp b/plugins/messageviewerplugins/createtodoplugin/viewerplugincreatetodo.cpp index 25b6272f..9f21e27b 100644 --- a/plugins/messageviewerplugins/createtodoplugin/viewerplugincreatetodo.cpp +++ b/plugins/messageviewerplugins/createtodoplugin/viewerplugincreatetodo.cpp @@ -1,44 +1,44 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerplugincreatetodo.h" #include "viewerplugincreatetodointerface.h" #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginCreatetodo, "messageviewer_createtodoplugin.json") ViewerPluginCreatetodo::ViewerPluginCreatetodo(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginCreatetodo::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginCreateTodoInterface(ac, parent); return view; } QString ViewerPluginCreatetodo::viewerPluginName() const { return QStringLiteral("create-todo"); } #include "viewerplugincreatetodo.moc" diff --git a/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscript.cpp b/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscript.cpp index 075819af..b676f9b6 100644 --- a/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscript.cpp +++ b/plugins/messageviewerplugins/externalscriptplugin/viewerpluginexternalscript.cpp @@ -1,60 +1,60 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "viewerpluginexternalscript.h" #include "viewerpluginexternalscriptinterface.h" #include "configuredialog/viewerpluginexternalconfiguredialog.h" #include #include -#include +#include using namespace MessageViewer; K_PLUGIN_CLASS_WITH_JSON(ViewerPluginExternalscript, "messageviewer_externalscriptplugin.json") ViewerPluginExternalscript::ViewerPluginExternalscript(QObject *parent, const QList &) : MessageViewer::ViewerPlugin(parent) { } ViewerPluginInterface *ViewerPluginExternalscript::createView(QWidget *parent, KActionCollection *ac) { MessageViewer::ViewerPluginInterface *view = new MessageViewer::ViewerPluginExternalscriptInterface(ac, parent); return view; } QString ViewerPluginExternalscript::viewerPluginName() const { return QStringLiteral("external script"); } void MessageViewer::ViewerPluginExternalscript::showConfigureDialog(QWidget *parent) { QPointer dlg = new ViewerPluginExternalConfigureDialog(parent); if (dlg->exec()) { Q_EMIT configChanged(); } delete dlg; } bool MessageViewer::ViewerPluginExternalscript::hasConfigureDialog() const { return true; } #include "viewerpluginexternalscript.moc" diff --git a/plugins/templateparser/templateparseremailaddressrequesterakonadi.cpp b/plugins/templateparser/templateparseremailaddressrequesterakonadi.cpp index 19e65e25..f945b6b3 100644 --- a/plugins/templateparser/templateparseremailaddressrequesterakonadi.cpp +++ b/plugins/templateparser/templateparseremailaddressrequesterakonadi.cpp @@ -1,60 +1,60 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "templateparseremailaddressrequesterakonadi.h" #include #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(TemplateParserEmailAddressRequesterAkonadi, "templateparseremailaddressrequesterakonadi.json") TemplateParserEmailAddressRequesterAkonadi::TemplateParserEmailAddressRequesterAkonadi(QWidget *parent, const QList &) : TemplateParser::TemplateParserEmailAddressRequesterBase(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setObjectName(QStringLiteral("mainLayout")); mainLayout->setContentsMargins(0, 0, 0, 0); mEmailAddressRequester = new Akonadi::EmailAddressRequester(this); mEmailAddressRequester->setObjectName(QStringLiteral("EmailAddressRequester")); mainLayout->addWidget(mEmailAddressRequester); connect(mEmailAddressRequester, &Akonadi::EmailAddressRequester::textChanged, this, &TemplateParser::TemplateParserEmailAddressRequesterBase::textChanged); } TemplateParserEmailAddressRequesterAkonadi::~TemplateParserEmailAddressRequesterAkonadi() { disconnect(mEmailAddressRequester, &Akonadi::EmailAddressRequester::textChanged, this, &TemplateParser::TemplateParserEmailAddressRequesterBase::textChanged); } QString TemplateParserEmailAddressRequesterAkonadi::text() const { return mEmailAddressRequester->text(); } void TemplateParserEmailAddressRequesterAkonadi::setText(const QString &str) { mEmailAddressRequester->setText(str); } void TemplateParserEmailAddressRequesterAkonadi::clear() { mEmailAddressRequester->clear(); } #include "templateparseremailaddressrequesterakonadi.moc" diff --git a/plugins/webengineurlinterceptor/adblock/adblockpluginurlinterceptor.cpp b/plugins/webengineurlinterceptor/adblock/adblockpluginurlinterceptor.cpp index 80780c2f..4b16721d 100644 --- a/plugins/webengineurlinterceptor/adblock/adblockpluginurlinterceptor.cpp +++ b/plugins/webengineurlinterceptor/adblock/adblockpluginurlinterceptor.cpp @@ -1,57 +1,57 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "adblockpluginurlinterceptor.h" #include "adblockinterceptorinterface.h" #include "../lib/widgets/adblockpluginurlinterceptorconfigurewidget.h" #include "lib/adblockmanager.h" #include "../lib/widgets/adblockpluginurlinterceptorconfiguredialog.h" #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(AdblockPluginUrlInterceptor, "messageviewer_adblockurlinterceptor.json") AdblockPluginUrlInterceptor::AdblockPluginUrlInterceptor(QObject *parent, const QList &) : WebEngineViewer::NetworkPluginUrlInterceptor(parent) { } AdblockPluginUrlInterceptor::~AdblockPluginUrlInterceptor() { } WebEngineViewer::NetworkPluginUrlInterceptorInterface *AdblockPluginUrlInterceptor::createInterface(QWebEngineView *webEngine, QObject *parent) { AdblockInterceptorInterface *adblockInterface = new AdblockInterceptorInterface(parent); adblockInterface->setWebEngineView(webEngine); return adblockInterface; } bool AdblockPluginUrlInterceptor::hasConfigureDialog() const { return true; } void AdblockPluginUrlInterceptor::showConfigureDialog(QWidget *parent) { QPointer dlg = new AdBlock::AdblockPluginUrlInterceptorConfigureDialog(parent); dlg->exec(); delete dlg; } #include "adblockpluginurlinterceptor.moc" diff --git a/plugins/webengineurlinterceptor/donottrack/donottrackpluginurlinterceptor.cpp b/plugins/webengineurlinterceptor/donottrack/donottrackpluginurlinterceptor.cpp index 1b8e012b..d4ca9ffb 100644 --- a/plugins/webengineurlinterceptor/donottrack/donottrackpluginurlinterceptor.cpp +++ b/plugins/webengineurlinterceptor/donottrack/donottrackpluginurlinterceptor.cpp @@ -1,41 +1,41 @@ /* Copyright (c) 2016-2019 Montel Laurent This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "donottrackpluginurlinterceptor.h" #include "donottrackinterceptorinterface.h" #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(DoNotTrackPluginUrlInterceptor, "messageviewer_donottrackurlinterceptor.json") DoNotTrackPluginUrlInterceptor::DoNotTrackPluginUrlInterceptor(QObject *parent, const QList &) : WebEngineViewer::NetworkPluginUrlInterceptor(parent) { } DoNotTrackPluginUrlInterceptor::~DoNotTrackPluginUrlInterceptor() { } WebEngineViewer::NetworkPluginUrlInterceptorInterface *DoNotTrackPluginUrlInterceptor::createInterface(QWebEngineView *webEngine, QObject *parent) { Q_UNUSED(webEngine); return new DoNotTrackInterceptorInterface(parent); } #include "donottrackpluginurlinterceptor.moc" diff --git a/sieveeditor/emaillineedit/emaillineedit.cpp b/sieveeditor/emaillineedit/emaillineedit.cpp index fe951d0a..cbe6146d 100644 --- a/sieveeditor/emaillineedit/emaillineedit.cpp +++ b/sieveeditor/emaillineedit/emaillineedit.cpp @@ -1,161 +1,161 @@ /* Copyright (C) 2018-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "emaillineedit.h" #include "sieveeditoremaillineditplugin_debug.h" -#include +#include #include #include #include #include #include #include #include #include #include K_PLUGIN_CLASS_WITH_JSON(EmailLineEdit, "emaillineedit.json") EmailLineEdit::EmailLineEdit(QWidget *parent, const QList &) : KSieveUi::AbstractSelectEmailLineEdit(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setObjectName(QStringLiteral("mainlayout")); mainLayout->setContentsMargins(0, 0, 0, 0); mLineEdit = new QLineEdit(this); mLineEdit->setObjectName(QStringLiteral("lineedit")); mLineEdit->setClearButtonEnabled(true); mLineEdit->setPlaceholderText(i18n("Click on button for selecting contacts...")); connect(mLineEdit, &QLineEdit::textChanged, this, &EmailLineEdit::slotTextChanged); mainLayout->addWidget(mLineEdit); mEmailButton = new QToolButton(this); mEmailButton->setText(i18n("...")); mEmailButton->setObjectName(QStringLiteral("emailbutton")); mEmailButton->setToolTip(i18n("Select Emails")); mainLayout->addWidget(mEmailButton); connect(mEmailButton, &QToolButton::clicked, this, &EmailLineEdit::slotSelectEmail); verifyAkonadiStatus(); connect(Akonadi::ServerManager::self(), &Akonadi::ServerManager::stateChanged, this, &EmailLineEdit::akonadiStateChanged); verifyAddress(); } EmailLineEdit::~EmailLineEdit() { } void EmailLineEdit::akonadiStateChanged(Akonadi::ServerManager::State state) { mEmailButton->setVisible(state == Akonadi::ServerManager::Running); } void EmailLineEdit::verifyAkonadiStatus() { Akonadi::ServerManager::State state = Akonadi::ServerManager::self()->state(); mEmailButton->setVisible(state == Akonadi::ServerManager::Running); } void EmailLineEdit::insertAddresses(const KContacts::Addressee::List &list) { QString currentText = mLineEdit->text(); bool firstElement = currentText.isEmpty(); for (const KContacts::Addressee &contact : list) { if (!firstElement) { currentText.append(QLatin1Char(';')); } else { firstElement = false; } currentText.append(contact.preferredEmail()); } mLineEdit->setText(currentText); } void EmailLineEdit::slotSelectEmail() { std::unique_ptr dlg; KPluginLoader loader(QStringLiteral("akonadi/emailaddressselectionldapdialogplugin")); KPluginFactory *factory = loader.factory(); if (factory) { dlg.reset(factory->create(this)); } else { dlg.reset(new Akonadi::EmailAddressSelectionDialog(this)); } dlg->setWindowTitle(i18n("Select Emails")); dlg->view()->view()->setSelectionMode(multiSelection() ? QAbstractItemView::MultiSelection : QAbstractItemView::SingleSelection); connect(dlg.get(), &Akonadi::AbstractEmailAddressSelectionDialog::insertAddresses, this, &EmailLineEdit::insertAddresses); if (dlg->exec()) { QStringList addresses; const Akonadi::EmailAddressSelection::List lstAddress = dlg->selectedAddresses(); if (!lstAddress.isEmpty()) { bool firstElement = true; QString result; for (const Akonadi::EmailAddressSelection &value : lstAddress) { if (!firstElement) { result.append(QLatin1Char(';')); } else { firstElement = false; } result.append(value.email()); } mLineEdit->setText(result); } } } void EmailLineEdit::setText(const QString &str) { mLineEdit->setText(str); } QString EmailLineEdit::text() const { return mLineEdit->text(); } bool EmailLineEdit::isValid() const { return mEmailIsValid; } void EmailLineEdit::slotTextChanged() { verifyAddress(); Q_EMIT valueChanged(); } void EmailLineEdit::verifyAddress() { #ifndef QT_NO_STYLE_STYLESHEET QString styleSheet; const QString lineEditText = text(); mEmailIsValid = lineEditText.contains(QLatin1Char('@')); if (mNegativeBackground.isEmpty()) { KStatefulBrush bgBrush = KStatefulBrush(KColorScheme::View, KColorScheme::NegativeText); mNegativeBackground = QStringLiteral("QLineEdit{ background-color:%1 }").arg(bgBrush.brush(this).color().name()); } if (!mEmailIsValid) { styleSheet = mNegativeBackground; } mLineEdit->setStyleSheet(styleSheet); #endif } #include "emaillineedit.moc" diff --git a/sieveeditor/imapfoldercompletion/selectimapwidget.cpp b/sieveeditor/imapfoldercompletion/selectimapwidget.cpp index 33f85882..7af8ee3e 100644 --- a/sieveeditor/imapfoldercompletion/selectimapwidget.cpp +++ b/sieveeditor/imapfoldercompletion/selectimapwidget.cpp @@ -1,95 +1,95 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "selectimapwidget.h" #include "selectimapfolderdialog.h" #include "selectimaplineedit.h" #include "imapfoldercompletionplugin_debug.h" #include #include #include #include -#include +#include K_PLUGIN_CLASS_WITH_JSON(SelectImapWidget, "imapfoldercompletion.json") SelectImapWidget::SelectImapWidget(QWidget *parent, const QList &) : KSieveUi::AbstractMoveImapFolderWidget(parent) { QHBoxLayout *layout = new QHBoxLayout(this); layout->setObjectName(QStringLiteral("mainlayout")); layout->setContentsMargins(0, 0, 0, 0); mLineEdit = new SelectImapLineEdit(this); mLineEdit->setObjectName(QStringLiteral("lineedit")); layout->addWidget(mLineEdit); mToolButton = new QToolButton(this); mToolButton->setText(QStringLiteral("...")); mToolButton->setObjectName(QStringLiteral("toolbutton")); mToolButton->setToolTip(i18n("Select IMAP folder")); mToolButton->hide(); layout->addWidget(mToolButton); connect(mToolButton, &QToolButton::clicked, this, &SelectImapWidget::slotOpenSelectImapFolder); } SelectImapWidget::~SelectImapWidget() { delete mSelectImapFolderDialog; } void SelectImapWidget::setText(const QString &str) { mLineEdit->setText(str); } QString SelectImapWidget::text() const { return mLineEdit->text(); } void SelectImapWidget::setSieveImapAccountSettings(const KSieveUi::SieveImapAccountSettings &account) { mAccount = account; if (mAccount.isValid()) { mToolButton->show(); mLineEdit->setSieveImapAccountSettings(account); mLineEdit->setPlaceholderText(i18n("Click on button for selecting folder...")); } else { qCDebug(IMAPFOLDERCOMPLETIONPLUGIN_LOG) << "Account is not defined"; } } SelectImapFolderDialog *SelectImapWidget::selectFolderDialog() { if (mSelectImapFolderDialog.isNull()) { mSelectImapFolderDialog = new SelectImapFolderDialog(mAccount, this); mSelectImapFolderDialog->setModal(true); } return mSelectImapFolderDialog; } void SelectImapWidget::slotOpenSelectImapFolder() { QPointer dlg(selectFolderDialog()); if (dlg->exec()) { mLineEdit->setText(dlg->selectedFolderName()); } } #include "selectimapwidget.moc" diff --git a/sieveeditor/imapfoldercompletion/tests/selectimapwidgettest.cpp b/sieveeditor/imapfoldercompletion/tests/selectimapwidgettest.cpp index ce1e1583..17ce9152 100644 --- a/sieveeditor/imapfoldercompletion/tests/selectimapwidgettest.cpp +++ b/sieveeditor/imapfoldercompletion/tests/selectimapwidgettest.cpp @@ -1,70 +1,70 @@ /* Copyright (C) 2016-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "selectimapwidgettest.h" #include #include -#include +#include #include #include SelectImapWidgetTest::SelectImapWidgetTest(QWidget *parent) : QWidget(parent) { setWindowTitle(QStringLiteral("Test AbstractMoveImapFolderWidget plugin")); QHBoxLayout *mainLayout = new QHBoxLayout(this); KSieveUi::AbstractMoveImapFolderWidget *lineEdit = nullptr; KPluginLoader loader(QStringLiteral("libksieve/imapfoldercompletionplugin")); KPluginFactory *factory = loader.factory(); if (factory) { lineEdit = factory->create(); } else { lineEdit = new DefaultMoveImapFolderWidget(this); qDebug() << " error during load : " << loader.errorString(); } mainLayout->addWidget(lineEdit); } SelectImapWidgetTest::~SelectImapWidgetTest() { } DefaultMoveImapFolderWidget::DefaultMoveImapFolderWidget(QWidget *parent) : KSieveUi::AbstractMoveImapFolderWidget(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); QLabel *label = new QLabel(QStringLiteral("Problem during loading plugin! Please verify your installation.")); mainLayout->addWidget(label); } void DefaultMoveImapFolderWidget::setText(const QString &str) { Q_UNUSED(str); } QString DefaultMoveImapFolderWidget::text() const { return {}; } void DefaultMoveImapFolderWidget::setSieveImapAccountSettings(const KSieveUi::SieveImapAccountSettings &account) { Q_UNUSED(account); } diff --git a/sieveeditor/regexeditorlineedit/regexpeditorlineedit.cpp b/sieveeditor/regexeditorlineedit/regexpeditorlineedit.cpp index e7b99ba4..0697a7f0 100644 --- a/sieveeditor/regexeditorlineedit/regexpeditorlineedit.cpp +++ b/sieveeditor/regexeditorlineedit/regexpeditorlineedit.cpp @@ -1,145 +1,145 @@ /* Copyright (C) 2017-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "regexpeditorlineedit.h" #include "regexpeditorlineeditplugin_debug.h" -#include +#include #include #include #include #include #include #include #include K_PLUGIN_CLASS_WITH_JSON(RegexpEditorLineEdit, "regexepeditorlineedit.json") struct InfoRegExp { InfoRegExp() : status(Unknown) , mEditorDialog(nullptr) { } enum RegexpEditorStatus { Unknown = 0, Installed, NotInstalled }; RegexpEditorStatus status; QDialog *mEditorDialog = nullptr; }; Q_GLOBAL_STATIC(InfoRegExp, s_regexpeditorinstalled) RegexpEditorLineEdit::RegexpEditorLineEdit(QWidget *parent, const QList &) : KSieveUi::AbstractRegexpEditorLineEdit(parent) { QHBoxLayout *mainLayout = new QHBoxLayout(this); mainLayout->setObjectName(QStringLiteral("mainlayout")); mainLayout->setContentsMargins(0, 0, 0, 0); mLineEdit = new QLineEdit(this); connect(mLineEdit, &QLineEdit::textChanged, this, &RegexpEditorLineEdit::textChanged); mLineEdit->setObjectName(QStringLiteral("lineedit")); mainLayout->addWidget(mLineEdit); mRegExpEditorButton = new QToolButton(this); mRegExpEditorButton->setText(i18n("...")); mRegExpEditorButton->setObjectName(QStringLiteral("regexpbutton")); mRegExpEditorButton->setToolTip(i18n("Create Regular Expression")); mainLayout->addWidget(mRegExpEditorButton); //Disable for the moment until we fix kregexeditor s_regexpeditorinstalled->status = InfoRegExp::NotInstalled; if (s_regexpeditorinstalled->status == InfoRegExp::Unknown) { if (KServiceTypeTrader::self()->query(QStringLiteral("KRegExpEditor/KRegExpEditor")).isEmpty()) { s_regexpeditorinstalled->status = InfoRegExp::NotInstalled; } else { s_regexpeditorinstalled->status = InfoRegExp::Installed; } } if (s_regexpeditorinstalled->status == InfoRegExp::Installed) { connect(mRegExpEditorButton, &QToolButton::clicked, this, &RegexpEditorLineEdit::slotOpenRegexpEditor); } else { qCWarning(REGEXPEDITORLINEEDITPLUGIN_LOG) << "KRegExpEditor is not installed on system."; } //Hidden by default mRegExpEditorButton->setVisible(false); } RegexpEditorLineEdit::~RegexpEditorLineEdit() { } void RegexpEditorLineEdit::slotOpenRegexpEditor() { if (!s_regexpeditorinstalled->mEditorDialog) { QString error; s_regexpeditorinstalled->mEditorDialog = KServiceTypeTrader::createInstanceFromQuery(QStringLiteral("KRegExpEditor/KRegExpEditor"), this, this, {}, {}, &error); if (!s_regexpeditorinstalled->mEditorDialog) { qCWarning(REGEXPEDITORLINEEDITPLUGIN_LOG) << " Impossible to create regexpeditor " << error; return; } } #if 0 KRegExpEditorInterface *iface = qobject_cast(s_regexpeditorinstalled->mEditorDialog); Q_ASSERT(iface); // This should not fail! // now use the editor. iface->setRegExp(mLineEdit->text()); if (s_regexpeditorinstalled->mEditorDialog->exec() == QDialog::Accepted) { mLineEdit->setText(iface->regExp()); } #else qCWarning(REGEXPEDITORLINEEDITPLUGIN_LOG) << "KRegExpEditorInterface is deprecated. Need to adapt KRegExpEditor first "; #endif } void RegexpEditorLineEdit::switchToRegexpEditorLineEdit(bool regexpEditor) { if (s_regexpeditorinstalled->status == InfoRegExp::Installed) { mRegExpEditorButton->setVisible(regexpEditor); } } void RegexpEditorLineEdit::setCode(const QString &str) { mLineEdit->setText(str); } QString RegexpEditorLineEdit::code() const { return mLineEdit->text(); } void RegexpEditorLineEdit::setClearButtonEnabled(bool b) { mLineEdit->setClearButtonEnabled(b); } void RegexpEditorLineEdit::setPlaceholderText(const QString &str) { mLineEdit->setPlaceholderText(str); } #include "regexpeditorlineedit.moc"