diff --git a/CMakeLists.txt b/CMakeLists.txt index 58e2e21f..66a1efa8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,133 +1,133 @@ cmake_minimum_required(VERSION 3.5) set(PIM_VERSION "5.12.42") if (POLICY CMP0053) cmake_policy(SET CMP0053 NEW) endif() project(Messagelib VERSION ${PIM_VERSION}) option(MIMETREEPARSER_ONLY_BUILD "Build only mimetreeparser" FALSE) option(KDEPIM_ENTERPRISE_BUILD "Enable features specific to the enterprise branch, which are normally disabled. Also, it disables many components not needed for Kontact such as the Kolab client." FALSE) option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) option(DKIM_CHECKER_BUILD "DKIM CHECKER (experimental)" FALSE) set(KF5_MIN_VERSION "5.60.0") set(MESSAGELIB_LIB_VERSION ${PIM_VERSION}) set(AKONADIMIME_LIB_VERSION "5.12.40") set(QT_REQUIRED_VERSION "5.11.0") set(AKONADI_VERSION "5.12.40") set(GRANTLEETHEME_LIB_VERSION "5.12.40") set(GRAVATAR_LIB_VERSION "5.12.40") set(IDENTITYMANAGEMENT_LIB_VERSION "5.12.40") set(KCONTACTS_LIB_VERSION "5.12.40") set(KDEPIM_APPS_LIB_VERSION "5.12.40") set(KLDAP_LIB_VERSION "5.12.40") set(KMAILTRANSPORT_LIB_VERSION "5.12.40") set(KMBOX_LIB_VERSION "5.12.40") set(KMIME_LIB_VERSION "5.12.40") set(KPIMTEXTEDIT_LIB_VERSION "5.12.40") set(LIBKDEPIM_LIB_VERSION "5.12.40") set(LIBKLEO_LIB_VERSION "5.12.40") set(PIMCOMMON_LIB_VERSION "5.12.40") set(GPGME_LIB_VERSION "1.11.1") -set(AKONADI_CONTACT_VERSION "5.12.40") +set(AKONADI_CONTACT_VERSION "5.12.41") if (${MIMETREEPARSER_ONLY_BUILD}) set(ECM_VERSION "5.26.0") set(KMIME_LIB_VERSION "5.1.40") else() set(ECM_VERSION ${KF5_MIN_VERSION}) endif() find_package(ECM ${ECM_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${Messagelib_SOURCE_DIR}/cmake/modules ${ECM_MODULE_PATH}) set(LIBRARY_NAMELINK) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Gui Test) find_package(KF5Codecs ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5NewStuff ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(QGpgme ${GPGME_LIB_VERSION} CONFIG REQUIRED) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Network PrintSupport WebEngine WebEngineWidgets) find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Completion ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Config ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ConfigWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5JobWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Service ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Sonnet ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5TextWidgets ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WidgetsAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5WindowSystem ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(Grantlee5 "5.1" CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Contacts ${KCONTACTS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADI_CONTACT_VERSION} CONFIG REQUIRED) find_package(KF5FollowupReminder ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${IDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5KaddressbookGrantlee ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Ldap ${KLDAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mbox ${KMBOX_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5SendLater ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiSearch "5.12.40" CONFIG REQUIRED) set_package_properties(KF5AkonadiSearch PROPERTIES DESCRIPTION "The Akonadi Search libraries" URL "https://kde.org/" TYPE REQUIRED PURPOSE "Provides search capabilities in KMail and Akonadi") endif() set(CMAKE_CXX_STANDARD 14) #add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) if(BUILD_TESTING) add_definitions(-DBUILD_TESTING) endif() add_subdirectory(mimetreeparser) if (NOT ${MIMETREEPARSER_ONLY_BUILD}) add_subdirectory(messageviewer) add_subdirectory(templateparser) add_subdirectory(messagecomposer) add_subdirectory(messagecore) add_subdirectory(messagelist) add_subdirectory(webengineviewer) endif() install(FILES messagelib.renamecategories messagelib.categories DESTINATION ${KDE_INSTALL_LOGGINGCATEGORIESDIR}) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/messagecomposer/src/CMakeLists.txt b/messagecomposer/src/CMakeLists.txt index 01f183ba..7b53f393 100644 --- a/messagecomposer/src/CMakeLists.txt +++ b/messagecomposer/src/CMakeLists.txt @@ -1,476 +1,474 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libmessagecomposer\") if(BUILD_TESTING) add_subdirectory( imagescaling/autotests ) add_subdirectory( imagescaling/tests ) add_subdirectory( composer-ng/autotests ) add_subdirectory( statusbarwidget/autotests ) endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/part) set( messagecomposer_job_src job/jobbase.cpp job/contentjobbase.cpp job/attachmentjob.cpp job/singlepartjob.cpp job/multipartjob.cpp job/maintextjob.cpp job/signjob.cpp job/encryptjob.cpp job/signencryptjob.cpp job/transparentjob.cpp job/inserttextfilejob.cpp job/skeletonmessagejob.cpp job/aliasesexpandjob.cpp job/emailaddressresolvejob.cpp job/attachmentfrompublickeyjob.cpp job/distributionlistexpandjob.cpp job/savecontactpreferencejob.cpp job/attachmentvcardfromaddressbookjob.cpp job/attachmentclipboardjob.cpp ) set( messagecomposer_statusbarwidget_src statusbarwidget/statusbarlabeltoggledstate.cpp ) set( messagecomposer_composer_src composer/composer.cpp composer/signaturecontroller.cpp composer/composerlineedit.cpp composer/composerviewbase.cpp composer/keyresolver.cpp ) set( messagecomposer_recipient_src recipient/recipientspicker.cpp recipient/recipient.cpp recipient/recipientline.cpp recipient/recipientseditor.cpp recipient/recipientseditorsidewidget.cpp recipient/kwindowpositioner.cpp recipient/distributionlistdialog.cpp - recipient/recipientseditormanager.cpp - recipient/recipientspickerwidget.cpp ) set( messagecomposer_imagescaling_src imagescaling/imagescaling.cpp imagescaling/imagescalingwidget.cpp imagescaling/imagescalingutils.cpp imagescaling/imagescalingselectformat.cpp ) set( messagecomposer_part_src part/messagepart.cpp part/globalpart.cpp part/infopart.cpp part/textpart.cpp ) set( messagecomposer_attachment_src attachment/attachmentcontrollerbase.cpp attachment/attachmentmodel.cpp ) set( messagecomposer_helper_src helper/messagehelper.cpp helper/messagefactoryng.cpp helper/messagefactoryforwardjob.cpp helper/messagefactoryreplyjob.cpp ) set( messagecomposer_sender_src sender/akonadisender.cpp ) set(messagecomposer_followupreminder_SRCS followupreminder/followupreminderselectdatedialog.cpp followupreminder/followupremindercreatejob.cpp ) set(messagecomposer_richtextcomposerng_SRCS composer-ng/richtextcomposerng.cpp composer-ng/richtextcomposersignatures.cpp ) set(messagecomposer_plugineditor_SRCS plugineditor/plugineditormanager.cpp plugineditor/plugineditor.cpp plugineditor/plugineditorinterface.cpp plugineditor/pluginactiontype.cpp ) set(messagecomposer_plugineditorcheckbeforesend_SRCS plugineditorcheckbeforesend/plugineditorcheckbeforesend.cpp plugineditorcheckbeforesend/plugineditorcheckbeforesendinterface.cpp plugineditorcheckbeforesend/plugineditorcheckbeforesendmanager.cpp plugineditorcheckbeforesend/plugineditorcheckbeforesendconfigurewidget.cpp plugineditorcheckbeforesend/plugineditorcheckbeforesendparams.cpp ) set(messagecomposer_plugineditorinit_SRCS plugineditorinit/plugineditorinitconfigurewidget.cpp plugineditorinit/plugineditorinit.cpp plugineditorinit/plugineditorinitmanager.cpp plugineditorinit/plugineditorinitinterface.cpp ) set(messagecomposer_plugineditorconverttext_SRCS plugineditorconverttext/plugineditorconverttextconfigurewidget.cpp plugineditorconverttext/plugineditorconverttext.cpp plugineditorconverttext/plugineditorconverttextmanager.cpp plugineditorconverttext/plugineditorconverttextinterface.cpp plugineditorconverttext/plugineditorconverterinitialdata.cpp plugineditorconverttext/plugineditorconverterbeforeconvertingdata.cpp ) set(messagecomposer_plugineditorgrammar_SRCS plugineditorgrammar/plugineditorgrammarmanager.cpp plugineditorgrammar/plugineditorgrammarcustomtoolsviewinterface.cpp ) set( messagecomposer_src ${messagecomposer_statusbarwidget_src} ${messagecomposer_plugineditorconverttext_SRCS} ${messagecomposer_plugineditorinit_SRCS} ${messagecomposer_plugineditor_SRCS} ${messagecomposer_richtextcomposerng_SRCS} ${messagecomposer_part_src} ${messagecomposer_imagescaling_src} ${messagecomposer_job_src} ${messagecomposer_composer_src} ${messagecomposer_recipient_src} ${messagecomposer_attachment_src} ${messagecomposer_helper_src} ${messagecomposer_sender_src} ${messagecomposer_followupreminder_SRCS} ${messagecomposer_plugineditorcheckbeforesend_SRCS} ${messagecomposer_plugineditorgrammar_SRCS} utils/util.cpp settings/messagecomposersettings.cpp ) ki18n_wrap_ui(messagecomposer_src imagescaling/ui/imagescalingwidget.ui ) ecm_qt_declare_logging_category(messagecomposer_src HEADER messagecomposer_debug.h IDENTIFIER MESSAGECOMPOSER_LOG CATEGORY_NAME org.kde.pim.messagecomposer) if(KDEPIM_ENTERPRISE_BUILD) set(WARN_TOOMANY_RECIPIENTS_DEFAULT true) set(ALLOW_SEMICOLON_AS_ADDRESS_SEPARATOR_DEFAULT true) else() set(WARN_TOOMANY_RECIPIENTS_DEFAULT false) set(ALLOW_SEMICOLON_AS_ADDRESS_SEPARATOR_DEFAULT false) endif() configure_file(settings/messagecomposer.kcfg.cmake ${CMAKE_CURRENT_BINARY_DIR}/messagecomposer.kcfg) kconfig_add_kcfg_files(messagecomposer_src settings/messagecomposersettings_base.kcfgc ) add_library( KF5MessageComposer ${messagecomposer_src} ) generate_export_header(KF5MessageComposer BASE_NAME messagecomposer) add_library(KF5::MessageComposer ALIAS KF5MessageComposer) target_link_libraries(KF5MessageComposer PUBLIC KF5::Mime KF5::MessageCore KF5::PimCommon KF5::AkonadiCore KF5::IdentityManagement KF5::AkonadiMime KF5::Libkleo KF5::MessageViewer PRIVATE KF5::MailTransportAkonadi KF5::PimTextEdit KF5::TemplateParser KF5::AkonadiWidgets KF5::LibkdepimAkonadi KF5::KIOCore KF5::I18n KF5::Completion # for KComboBox KF5::KIOWidgets # for KIO::JobUiDelegate KF5::KIOFileWidgets # for KEncodingDialog KF5::XmlGui # for KActionCollection KF5::SonnetUi Grantlee5::TextDocument KF5::CalendarCore # for KCalendarCore/Todo KF5::SendLater KF5::FollowupReminder KF5::Archive KF5::Contacts KF5::SonnetCore ) target_include_directories(KF5MessageComposer INTERFACE "$") set_target_properties(KF5MessageComposer PROPERTIES VERSION ${MESSAGECOMPOSER_VERSION_STRING} SOVERSION ${MESSAGECOMPOSER_SOVERSION} EXPORT_NAME MessageComposer ) install(TARGETS KF5MessageComposer EXPORT KF5MessageComposerTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) ecm_generate_headers(MessageComposer_Camelstatusbarwidget_HEADERS HEADER_NAMES StatusBarLabelToggledState REQUIRED_HEADERS MessageComposer_statusbarwidget_HEADERS PREFIX MessageComposer RELATIVE statusbarwidget ) ecm_generate_headers(MessageComposer_Camelplugineditor_HEADERS HEADER_NAMES PluginEditor PluginActionType PluginEditorInterface PluginEditorManager REQUIRED_HEADERS MessageComposer_plugineditor_HEADERS PREFIX MessageComposer RELATIVE plugineditor ) ecm_generate_headers(MessageComposer_Camelplugineditorinit_HEADERS HEADER_NAMES PluginEditorInitConfigureWidget PluginEditorInit PluginEditorInitManager PluginEditorInitInterface REQUIRED_HEADERS MessageComposer_plugineditorinit_HEADERS PREFIX MessageComposer RELATIVE plugineditorinit ) ecm_generate_headers(MessageComposer_Camelplugineditorconverttext_HEADERS HEADER_NAMES PluginEditorConvertTextConfigureWidget PluginEditorConvertText PluginEditorConvertTextManager PluginEditorConvertTextInterface PluginEditorConverterInitialData PluginEditorConverterBeforeConvertingData REQUIRED_HEADERS MessageComposer_plugineditorconverttext_HEADERS PREFIX MessageComposer RELATIVE plugineditorconverttext ) ecm_generate_headers(MessageComposer_Camelplugineditorgrammar_HEADERS HEADER_NAMES PluginEditorGrammarManager PluginEditorGrammarCustomToolsViewInterface REQUIRED_HEADERS MessageComposer_plugineditorgrammar_HEADERS PREFIX MessageComposer RELATIVE plugineditorgrammar ) ecm_generate_headers(MessageComposer_Camelplugineditorcheckbeforesend_HEADERS HEADER_NAMES PluginEditorCheckBeforeSend PluginEditorCheckBeforeSendInterface PluginEditorCheckBeforeSendManager PluginEditorCheckBeforeSendConfigureWidget PluginEditorCheckBeforeSendParams REQUIRED_HEADERS MessageComposer_plugineditorcheckbeforesend_HEADERS PREFIX MessageComposer RELATIVE plugineditorcheckbeforesend ) ecm_generate_headers(MessageComposer_Camelcaseattachement_HEADERS HEADER_NAMES AttachmentModel AttachmentControllerBase REQUIRED_HEADERS MessageComposer_attachement_HEADERS PREFIX MessageComposer RELATIVE attachment ) ecm_generate_headers(MessageComposer_Camelcasecomposer_HEADERS HEADER_NAMES Composer ComposerLineEdit ComposerViewBase SignatureController REQUIRED_HEADERS MessageComposer_composer_HEADERS PREFIX MessageComposer RELATIVE composer ) ecm_generate_headers(MessageComposer_Camelcasecomposerng_HEADERS HEADER_NAMES RichTextComposerNg RichTextComposerSignatures REQUIRED_HEADERS MessageComposer_composerng_HEADERS PREFIX MessageComposer RELATIVE composer-ng ) ecm_generate_headers(MessageComposer_Camelcasesender_HEADERS HEADER_NAMES AkonadiSender MessageSender REQUIRED_HEADERS MessageComposer_sender_HEADERS PREFIX MessageComposer RELATIVE sender ) ecm_generate_headers(MessageComposer_Camelcaseutils_HEADERS HEADER_NAMES Util Kleo_Util REQUIRED_HEADERS MessageComposer_utils_HEADERS PREFIX MessageComposer RELATIVE utils ) ecm_generate_headers(MessageComposer_Camelcasehelper_HEADERS HEADER_NAMES MessageHelper MessageFactoryNG REQUIRED_HEADERS MessageComposer_helper_HEADERS PREFIX MessageComposer RELATIVE helper ) ecm_generate_headers(MessageComposer_Camelcasesettings_HEADERS HEADER_NAMES MessageComposerSettings REQUIRED_HEADERS MessageComposer_settings_HEADERS PREFIX MessageComposer RELATIVE settings ) ecm_generate_headers(MessageComposer_Camelcasepart_HEADERS HEADER_NAMES TextPart GlobalPart InfoPart MessagePart REQUIRED_HEADERS MessageComposer_part_HEADERS PREFIX MessageComposer RELATIVE part ) ecm_generate_headers(MessageComposer_Camelcasefollowupreminder_HEADERS HEADER_NAMES FollowupReminderCreateJob FollowUpReminderSelectDateDialog REQUIRED_HEADERS MessageComposer_followupreminder_HEADERS PREFIX MessageComposer RELATIVE followupreminder ) ecm_generate_headers(MessageComposer_Camelcaserecipient_HEADERS HEADER_NAMES Recipient RecipientsEditor RecipientLine REQUIRED_HEADERS MessageComposer_recipient_HEADERS PREFIX MessageComposer RELATIVE recipient ) ecm_generate_headers(MessageComposer_Camelcaseimagescaling_HEADERS HEADER_NAMES ImageScalingWidget REQUIRED_HEADERS MessageComposer_imagescaling_HEADERS PREFIX MessageComposer RELATIVE imagescaling ) ecm_generate_headers(MessageComposer_Camelcasejob_HEADERS HEADER_NAMES JobBase AbstractEncryptJob ContentJobBase InsertTextFileJob AttachmentJob SinglepartJob MainTextJob AttachmentFromPublicKeyJob MultipartJob EncryptJob AttachmentVcardFromAddressBookJob SignJob TransparentJob JobBase AliasesExpandJob SkeletonMessageJob AttachmentClipBoardJob REQUIRED_HEADERS MessageComposer_job_HEADERS PREFIX MessageComposer RELATIVE job ) ecm_generate_pri_file(BASE_NAME MessageComposer LIB_NAME KF5MessageComposer DEPS "Mime MessageCore PimCommon Akonadi IdentityManagement AkonadiMime Libkleo" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageComposer ) install(FILES ${MessageComposer_Camelplugineditorconverttext_HEADERS} ${MessageComposer_Camelplugineditorinit_HEADERS} ${MessageComposer_Camelplugineditorcheckbeforesend_HEADERS} ${MessageComposer_Camelcasecomposer_HEADERS} ${MessageComposer_Camelcasecomposerng_HEADERS} ${MessageComposer_Camelcasesender_HEADERS} ${MessageComposer_Camelcaseutils_HEADERS} ${MessageComposer_Camelcasehelper_HEADERS} ${MessageComposer_Camelcasesettings_HEADERS} ${MessageComposer_Camelcasepart_HEADERS} ${MessageComposer_Camelcasefollowupreminder_HEADERS} ${MessageComposer_Camelcaserecipient_HEADERS} ${MessageComposer_Camelcaseimagescaling_HEADERS} ${MessageComposer_Camelcasejob_HEADERS} ${MessageComposer_Camelcaseattachement_HEADERS} ${MessageComposer_Camelplugineditor_HEADERS} ${MessageComposer_Camelplugineditorgrammar_HEADERS} ${MessageComposer_Camelstatusbarwidget_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MessageComposer COMPONENT Devel ) install(FILES ${MessageComposer_HEADERS} ${MessageComposer_plugineditorconverttext_HEADERS} ${MessageComposer_plugineditorinit_HEADERS} ${MessageComposer_statusbarwidget_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/messagecomposer_export.h ${CMAKE_CURRENT_BINARY_DIR}/messagecomposersettings_base.h ${CMAKE_CURRENT_BINARY_DIR}/messagecomposer_debug.h ${MessageComposer_composer_HEADERS} ${MessageComposer_composerng_HEADERS} ${MessageComposer_sender_HEADERS} ${MessageComposer_utils_HEADERS} ${MessageComposer_helper_HEADERS} ${MessageComposer_settings_HEADERS} ${MessageComposer_part_HEADERS} ${MessageComposer_followupreminder_HEADERS} ${MessageComposer_recipient_HEADERS} ${MessageComposer_imagescaling_HEADERS} ${MessageComposer_attachement_HEADERS} ${MessageComposer_job_HEADERS} ${MessageComposer_plugineditor_HEADERS} ${MessageComposer_plugineditorcheckbeforesend_HEADERS} ${MessageComposer_plugineditorgrammar_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/messagecomposer COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff --git a/messagecomposer/src/recipient/recipientseditormanager.cpp b/messagecomposer/src/recipient/recipientseditormanager.cpp deleted file mode 100644 index 620b8b3f..00000000 --- a/messagecomposer/src/recipient/recipientseditormanager.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* - 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 "recipientseditormanager.h" -#include -#include - -using namespace MessageComposer; - -RecipientsEditorManager::RecipientsEditorManager(QObject *parent) - : QObject(parent) -{ -} - -RecipientsEditorManager::~RecipientsEditorManager() -{ -} - -RecipientsEditorManager *RecipientsEditorManager::self() -{ - static RecipientsEditorManager s_self; - return &s_self; -} - -Akonadi::EmailAddressSelectionModel *RecipientsEditorManager::model() -{ - if (!mModel) { - mModel = new Akonadi::EmailAddressSelectionModel(this); - } - return mModel; -} diff --git a/messagecomposer/src/recipient/recipientseditormanager.h b/messagecomposer/src/recipient/recipientseditormanager.h deleted file mode 100644 index 4d1dbbb9..00000000 --- a/messagecomposer/src/recipient/recipientseditormanager.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - 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. -*/ - -#ifndef RECIPIENTSEDITORMANAGER_H -#define RECIPIENTSEDITORMANAGER_H - -#include -#include "messagecomposer_export.h" - -namespace Akonadi { -class EmailAddressSelectionModel; -} - -namespace MessageComposer { -class MESSAGECOMPOSER_EXPORT RecipientsEditorManager : public QObject -{ - Q_OBJECT -public: - explicit RecipientsEditorManager(QObject *parent = nullptr); - ~RecipientsEditorManager(); - - static RecipientsEditorManager *self(); - Q_REQUIRED_RESULT Akonadi::EmailAddressSelectionModel *model(); - -private: - Akonadi::EmailAddressSelectionModel *mModel = nullptr; -}; -} - -#endif // RECIPIENTSEDITORMANAGER_H diff --git a/messagecomposer/src/recipient/recipientspicker.cpp b/messagecomposer/src/recipient/recipientspicker.cpp index 11860cbe..fa361d41 100644 --- a/messagecomposer/src/recipient/recipientspicker.cpp +++ b/messagecomposer/src/recipient/recipientspicker.cpp @@ -1,237 +1,237 @@ /* Copyright (c) 2010 Volker Krause This file was part of KMail. Copyright (c) 2005 Cornelius Schumacher 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 "recipientspicker.h" -#include "recipientspickerwidget.h" #include "settings/messagecomposersettings.h" #include +#include #include #include #include #include #include #include #include #include "messagecomposer_debug.h" #include #include #include #include #include #include using namespace MessageComposer; RecipientsPicker::RecipientsPicker(QWidget *parent) : QDialog(parent) , mLdapSearchDialog(nullptr) { setObjectName(QStringLiteral("RecipientsPicker")); setWindowTitle(i18n("Select Recipient")); QVBoxLayout *mainLayout = new QVBoxLayout(this); - mView = new RecipientsPickerWidget(this); + mView = new Akonadi::RecipientsPickerWidget(false, this); mainLayout->addWidget(mView); mainLayout->setStretchFactor(mView, 1); connect(mView->view()->selectionModel(), &QItemSelectionModel::selectionChanged, this, &RecipientsPicker::slotSelectionChanged); connect(mView->view(), &QAbstractItemView::doubleClicked, this, &RecipientsPicker::slotPicked); QPushButton *searchLDAPButton = new QPushButton(i18n("Search &Directory Service"), this); connect(searchLDAPButton, &QPushButton::clicked, this, &RecipientsPicker::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::Close, this); mUser1Button = new QPushButton; buttonBox->addButton(mUser1Button, QDialogButtonBox::ActionRole); mUser2Button = new QPushButton; buttonBox->addButton(mUser2Button, QDialogButtonBox::ActionRole); mUser3Button = new QPushButton; buttonBox->addButton(mUser3Button, QDialogButtonBox::ActionRole); mUser4Button = new QPushButton; buttonBox->addButton(mUser4Button, QDialogButtonBox::ActionRole); connect(buttonBox, &QDialogButtonBox::rejected, this, &RecipientsPicker::reject); mainLayout->addWidget(buttonBox); mUser4Button->setText(i18n("Add as &Reply-To")); mUser3Button->setText(i18n("Add as &To")); mUser2Button->setText(i18n("Add as CC")); mUser1Button->setText(i18n("Add as &BCC")); connect(mUser1Button, &QPushButton::clicked, this, &RecipientsPicker::slotBccClicked); connect(mUser2Button, &QPushButton::clicked, this, &RecipientsPicker::slotCcClicked); connect(mUser3Button, &QPushButton::clicked, this, &RecipientsPicker::slotToClicked); connect(mUser4Button, &QPushButton::clicked, this, &RecipientsPicker::slotReplyToClicked); mView->emailAddressSelectionWidget()->searchLineEdit()->setFocus(); readConfig(); slotSelectionChanged(); } RecipientsPicker::~RecipientsPicker() { writeConfig(); } void RecipientsPicker::slotSelectionChanged() { const bool hasSelection = !mView->emailAddressSelectionWidget()->selectedAddresses().isEmpty(); mUser1Button->setEnabled(hasSelection); mUser2Button->setEnabled(hasSelection); mUser3Button->setEnabled(hasSelection); mUser4Button->setEnabled(hasSelection); } void RecipientsPicker::setRecipients(const Recipient::List &) { mView->view()->selectionModel()->clear(); } void RecipientsPicker::setDefaultType(Recipient::Type type) { mDefaultType = type; mUser1Button->setDefault(type == Recipient::To); mUser2Button->setDefault(type == Recipient::Cc); mUser3Button->setDefault(type == Recipient::Bcc); mUser4Button->setDefault(type == Recipient::ReplyTo); } void RecipientsPicker::slotToClicked() { pick(Recipient::To); } void RecipientsPicker::slotReplyToClicked() { pick(Recipient::ReplyTo); } void RecipientsPicker::slotCcClicked() { pick(Recipient::Cc); } void RecipientsPicker::slotBccClicked() { pick(Recipient::Bcc); } void RecipientsPicker::slotPicked() { pick(mDefaultType); } void RecipientsPicker::pick(Recipient::Type type) { qCDebug(MESSAGECOMPOSER_LOG) << int(type); const Akonadi::EmailAddressSelection::List selections = mView->emailAddressSelectionWidget()->selectedAddresses(); const int count = selections.count(); if (count == 0) { return; } if (count > MessageComposerSettings::self()->maximumRecipients()) { KMessageBox::sorry(this, i18np("You selected 1 recipient. The maximum supported number of " "recipients is %2. Please adapt the selection.", "You selected %1 recipients. The maximum supported number of " "recipients is %2. Please adapt the selection.", count, MessageComposerSettings::self()->maximumRecipients())); return; } bool tooManyAddress = false; for (const Akonadi::EmailAddressSelection &selection : selections) { Recipient recipient; recipient.setType(type); recipient.setEmail(selection.quotedEmail()); Q_EMIT pickedRecipient(recipient, tooManyAddress); if (tooManyAddress) { break; } } } void RecipientsPicker::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape) { close(); } QDialog::keyPressEvent(event); } void RecipientsPicker::readConfig() { KSharedConfig::Ptr cfg = KSharedConfig::openConfig(); KConfigGroup group(cfg, "RecipientsPicker"); QSize size = group.readEntry("Size", QSize()); if (!size.isEmpty()) { resize(size); } } void RecipientsPicker::writeConfig() { KSharedConfig::Ptr cfg = KSharedConfig::openConfig(); KConfigGroup group(cfg, "RecipientsPicker"); group.writeEntry("Size", size()); } void RecipientsPicker::slotSearchLDAP() { if (!mLdapSearchDialog) { mLdapSearchDialog = new KLDAP::LdapSearchDialog(this); connect(mLdapSearchDialog, &KLDAP::LdapSearchDialog::contactsAdded, this, &RecipientsPicker::ldapSearchResult); } mLdapSearchDialog->setSearchText(mView->emailAddressSelectionWidget()->searchLineEdit()->text()); mLdapSearchDialog->show(); } void RecipientsPicker::ldapSearchResult() { const KContacts::Addressee::List contacts = mLdapSearchDialog->selectedContacts(); for (const KContacts::Addressee &contact : contacts) { bool tooManyAddress = false; Q_EMIT pickedRecipient(Recipient(contact.fullEmail(), Recipient::Undefined), tooManyAddress); if (tooManyAddress) { break; } } } diff --git a/messagecomposer/src/recipient/recipientspicker.h b/messagecomposer/src/recipient/recipientspicker.h index 2749073d..61598524 100644 --- a/messagecomposer/src/recipient/recipientspicker.h +++ b/messagecomposer/src/recipient/recipientspicker.h @@ -1,83 +1,86 @@ /* Copyright (c) 2010 Volker Krause This file was part of KMail. Copyright (c) 2005 Cornelius Schumacher This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MESSAGECOMPOSER_RECIPIENTSPICKER_H #define MESSAGECOMPOSER_RECIPIENTSPICKER_H #include #include #include class QPushButton; namespace KLDAP { class LdapSearchDialog; } -namespace MessageComposer { +namespace Akonadi { class RecipientsPickerWidget; +} + +namespace MessageComposer { class RecipientsPicker : public QDialog { Q_OBJECT public: explicit RecipientsPicker(QWidget *parent); ~RecipientsPicker() override; void setRecipients(const Recipient::List &); void setDefaultType(Recipient::Type); Q_SIGNALS: void pickedRecipient(const Recipient &, bool &); protected: void readConfig(); void writeConfig(); void pick(Recipient::Type); void keyPressEvent(QKeyEvent *) override; protected Q_SLOTS: void slotToClicked(); void slotCcClicked(); void slotBccClicked(); void slotReplyToClicked(); void slotPicked(); void slotSearchLDAP(); void ldapSearchResult(); void slotSelectionChanged(); private: - MessageComposer::RecipientsPickerWidget *mView = nullptr; + Akonadi::RecipientsPickerWidget *mView = nullptr; KLDAP::LdapSearchDialog *mLdapSearchDialog = nullptr; Recipient::Type mDefaultType; QPushButton *mUser4Button = nullptr; QPushButton *mUser3Button = nullptr; QPushButton *mUser2Button = nullptr; QPushButton *mUser1Button = nullptr; }; } #endif diff --git a/messagecomposer/src/recipient/recipientspickerwidget.cpp b/messagecomposer/src/recipient/recipientspickerwidget.cpp deleted file mode 100644 index 0eb17116..00000000 --- a/messagecomposer/src/recipient/recipientspickerwidget.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - 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 "recipientspickerwidget.h" -#include "recipientseditormanager.h" -#include -#include -#include -#include -#include -#include -using namespace MessageComposer; -RecipientsPickerWidget::RecipientsPickerWidget(QWidget *parent) - : QWidget(parent) -{ - QHBoxLayout *layout = new QHBoxLayout(this); - layout->setContentsMargins(0, 0, 0, 0); - - mView = new Akonadi::EmailAddressSelectionWidget(false, MessageComposer::RecipientsEditorManager::self()->model()->model(), this); - layout->addWidget(mView); - mView->view()->setSelectionMode(QAbstractItemView::ExtendedSelection); - mView->view()->setAlternatingRowColors(true); - mView->view()->setSortingEnabled(true); - mView->view()->sortByColumn(0, Qt::AscendingOrder); -} - -RecipientsPickerWidget::~RecipientsPickerWidget() -{ -} - -QTreeView *RecipientsPickerWidget::view() const -{ - return mView->view(); -} - -Akonadi::EmailAddressSelectionWidget *RecipientsPickerWidget::emailAddressSelectionWidget() const -{ - return mView; -} diff --git a/messagecomposer/src/recipient/recipientspickerwidget.h b/messagecomposer/src/recipient/recipientspickerwidget.h deleted file mode 100644 index 6bfa9a40..00000000 --- a/messagecomposer/src/recipient/recipientspickerwidget.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - 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. -*/ - -#ifndef RECIPIENTSPICKERWIDGET_H -#define RECIPIENTSPICKERWIDGET_H - -#include -class QTreeView; -namespace Akonadi { -class EmailAddressSelectionWidget; -} - -namespace MessageComposer { -class RecipientsPickerWidget : public QWidget -{ - Q_OBJECT -public: - explicit RecipientsPickerWidget(QWidget *parent = nullptr); - ~RecipientsPickerWidget(); - Q_REQUIRED_RESULT QTreeView *view() const; - - Q_REQUIRED_RESULT Akonadi::EmailAddressSelectionWidget *emailAddressSelectionWidget() const; -private: - Akonadi::EmailAddressSelectionWidget *mView = nullptr; -}; -} - -#endif // RECIPIENTSPICKERWIDGET_H