diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4819c..4f536e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,121 +1,131 @@ cmake_minimum_required(VERSION 3.5) set(PIM_VERSION "5.11.40") project(mailcommon VERSION ${PIM_VERSION}) set(KF5_MIN_VERSION "5.58.0") find_package(ECM ${KF5_MIN_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${mailcommon_SOURCE_DIR}/cmake/modules/ ${ECM_MODULE_PATH}) if (POLICY CMP0053) cmake_policy(SET CMP0053 NEW) endif() set(LIBRARY_NAMELINK) include(GenerateExportHeader) include(ECMGenerateHeaders) include(ECMGeneratePriFile) include(ECMSetupVersion) include(FeatureSummary) include(KDEInstallDirs) include(KDECMakeSettings) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(ECMQtDeclareLoggingCategory) include(ECMAddTests) set(QT_REQUIRED_VERSION "5.10.0") set(MAILCOMMON_LIB_VERSION ${PIM_VERSION}) set(AKONADIMIME_LIB_VERSION "5.11.40") set(MESSAGELIB_LIB_VERSION "5.11.40") set(KMIME_LIB_VERSION "5.11.40") set(KMAILTRANSPORT_LIB_VERSION "5.11.40") set(MAILIMPORTER_LIB_VERSION "5.11.40") set(LIBKDEPIM_LIB_VERSION "5.11.40") set(PIMCOMMON_LIB_VERSION "5.11.40") set(AKONADI_VERSION "5.11.40") +set(AKONADIMIME_LIB_VERSION "5.11.1") +set(MESSAGELIB_LIB_VERSION "5.11.1") +set(KMIME_LIB_VERSION "5.11.1") +set(KMAILTRANSPORT_LIB_VERSION "5.11.1") +set(MAILIMPORTER_LIB_VERSION "5.11.1") +set(LIBKDEPIM_LIB_VERSION "5.11.1") +set(PIMCOMMON_LIB_VERSION "5.11.1") + +set(AKONADI_VERSION "5.11.1") find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets DBus Test Xml) find_package(KF5Archive ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Codecs ${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(KF5I18n ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemModels ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5ItemViews ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${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(KF5DBusAddons ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5SyntaxHighlighting ${KF5_MIN_VERSION} CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiMime ${AKONADIMIME_LIB_VERSION} CONFIG REQUIRED) +find_package(KF5Libkdepim ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailImporter ${MAILIMPORTER_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransport ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageComposer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageCore ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Mime ${KMIME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(Phonon4Qt5 CONFIG REQUIRED) find_package(KF5DesignerPlugin ${KF5_MIN_VERSION} CONFIG) set_package_properties(KF5DesignerPlugin PROPERTIES DESCRIPTION "KF5 designer plugin" TYPE OPTIONAL) ecm_setup_version(PROJECT VARIABLE_PREFIX MAILCOMMON VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/mailcommon_version.h" PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfigVersion.cmake" SOVERSION 5 ) find_package(Xsltproc) set_package_properties(Xsltproc PROPERTIES DESCRIPTION "XSLT processor from libxslt" TYPE REQUIRED PURPOSE "Required to generate D-Bus interfaces for all Akonadi resources.") ########### Targets ########### remove_definitions( -DQT_NO_CAST_FROM_ASCII ) option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE) # workaround for https://bugreports.qt.io/browse/QTBUG-74665 (bug in qt5.13 reevaluate it) if (${Qt5Widgets_VERSION} STREQUAL "5.13.0") MESSAGE(STATUS "Qt version: ${Qt5Widgets_VERSION} DISABLE compile without deprecated methods. bug QTBUG-74665") else() add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x060000) endif() ########### CMake Config Files ########### set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/KF5MailCommon") configure_package_config_file( "${CMAKE_CURRENT_SOURCE_DIR}/KF5MailCommonConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfig.cmake" INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} ) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/KF5MailCommonConfigVersion.cmake" DESTINATION "${CMAKECONFIG_INSTALL_DIR}" COMPONENT Devel ) install(EXPORT KF5MailCommonTargets DESTINATION "${CMAKECONFIG_INSTALL_DIR}" FILE KF5MailCommonTargets.cmake NAMESPACE KF5::) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mailcommon_version.h DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5} COMPONENT Devel ) add_subdirectory(src) if(BUILD_TESTING) add_subdirectory(autotests) endif() install( FILES mailcommon.renamecategories mailcommon.categories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/KF5MailCommonConfig.cmake.in b/KF5MailCommonConfig.cmake.in index 00c998c..3ff3d78 100644 --- a/KF5MailCommonConfig.cmake.in +++ b/KF5MailCommonConfig.cmake.in @@ -1,9 +1,10 @@ @PACKAGE_INIT@ include(CMakeFindDependencyMacro) find_dependency(KF5Akonadi "@AKONADI_VERSION@") find_dependency(KF5AkonadiMime "@AKONADIMIME_LIB_VERSION@") +find_dependency(KF5Libkdepim "@LIBKDEPIM_LIB_VERSION@") find_dependency(KF5MessageComposer "@MESSAGELIB_LIB_VERSION@") find_dependency(KF5PimCommon "@MESSAGELIB_LIB_VERSION@") find_dependency(KF5Completion "@KF5_MIN_VERSION@") include("${CMAKE_CURRENT_LIST_DIR}/KF5MailCommonTargets.cmake") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 07bbed5..c528c09 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,496 +1,497 @@ add_definitions(-DTRANSLATION_DOMAIN=\"libmailcommon\") #add_definitions( -DQT_NO_CAST_FROM_ASCII ) #add_definitions( -DQT_NO_CAST_TO_ASCII ) if(BUILD_TESTING) add_definitions(-DBUILD_TESTING) endif() set(libmailcommon_filter_SRCS filter/kmfilteraccountlist.cpp filter/kmfilterlistbox.cpp filter/filterselectiondialog.cpp filter/filterconverter/filterconverttosieve.cpp filter/filterconverter/filterconverttosieveresultdialog.cpp filter/filterconverter/filterconverttosievepurposemenuwidget.cpp filter/filteractions/filteraction.cpp filter/filteractions/filteractionaddheader.cpp filter/filteractions/filteractionaddtag.cpp filter/filteractions/filteractionaddtoaddressbook.cpp filter/filteractions/filteractioncopy.cpp filter/filteractions/filteractiondecrypt.cpp filter/filteractions/filteractiondelete.cpp filter/filteractions/filteractiondict.cpp filter/filteractions/filteractionencrypt.cpp filter/filteractions/filteractionexec.cpp filter/filteractions/filteractionforward.cpp filter/filteractions/filteractionmove.cpp filter/filteractions/filteractionpipethrough.cpp filter/filteractions/filteractionplaysound.cpp filter/filteractions/filteractionredirect.cpp filter/filteractions/filteractionremoveheader.cpp filter/filteractions/filteractionreplyto.cpp filter/filteractions/filteractionrewriteheader.cpp filter/filteractions/filteractionsendfakedisposition.cpp filter/filteractions/filteractionsendreceipt.cpp filter/filteractions/filteractionsetidentity.cpp filter/filteractions/filteractionsetstatus.cpp filter/filteractions/filteractionstatus.cpp filter/filteractions/filteractionunsetstatus.cpp filter/filteractions/filteractionsettransport.cpp filter/filteractions/filteractionwidget.cpp filter/filteractions/filteractionwithaddress.cpp filter/filteractions/filteractionwithcommand.cpp filter/filteractions/filteractionwithcrypto.cpp filter/filteractions/filteractionwithfolder.cpp filter/filteractions/filteractionwithnone.cpp filter/filteractions/filteractionwithstring.cpp filter/filteractions/filteractionwithstringlist.cpp filter/filteractions/filteractionwithtest.cpp filter/filteractions/filteractionwithuoid.cpp filter/filteractions/filteractionwithurl.cpp filter/filterimporterexporter.cpp filter/filterimporter/filterimporterabstract.cpp filter/filterimporter/filterimporterevolution.cpp filter/filterimporter/filterimportersylpheed.cpp filter/filterimporter/filterimporterthunderbird.cpp filter/filterimporter/filterimporterprocmail.cpp filter/filterimporter/filterimporterbalsa.cpp filter/filterimporter/filterimporterclawsmail.cpp filter/filterimporter/filterimportergmail.cpp filter/filterlog.cpp filter/filtermanager.cpp filter/itemcontext.cpp filter/kmfilterdialog.cpp filter/mailfilter.cpp filter/mdnadvicedialog.cpp filter/filterimporterpathcache.cpp ) set(libmailcommon_filter_dialog filter/dialog/selectthunderbirdfilterfilesdialog.cpp filter/dialog/selectthunderbirdfilterfileswidget.cpp filter/dialog/filteractionmissingfolderdialog.cpp filter/dialog/filteractionmissingsoundurldialog.cpp filter/dialog/filteractionmissingtagdialog.cpp filter/dialog/filteractionmissingaccountdialog.cpp filter/dialog/filteractionmissingtemplatedialog.cpp filter/dialog/filteractionmissingtransportdialog.cpp filter/dialog/filteractionmissingidentitydialog.cpp ) set(libmailcommon_invalidfilters filter/invalidfilters/invalidfilterdialog.cpp filter/invalidfilters/invalidfilterlistview.cpp filter/invalidfilters/invalidfilterwidget.cpp filter/invalidfilters/invalidfilterinfo.cpp filter/invalidfilters/invalidfilterlistitemdelegate.cpp filter/invalidfilters/invalidfilterlistmodel.cpp filter/invalidfilters/invalidfilterinfowidget.cpp ) set(libmailcommon_collection_SRCS collectionpage/attributeregistrar.cpp collectionpage/collectiongeneralpage.cpp collectionpage/collectionexpirypage.cpp collectionpage/attributes/expirecollectionattribute.cpp ) set(libmailcommon_folder_SRCS folder/foldersettings.cpp folder/foldercollectionmonitor.cpp folder/folderrequester.cpp folder/folderselectiondialog.cpp folder/foldertreeview.cpp folder/foldertreewidget.cpp folder/foldertreewidgetproxymodel.cpp folder/entitycollectionorderproxymodel.cpp folder/accountconfigorderdialog.cpp folder/favoritecollectionorderproxymodel.cpp ) set(libmailcommon_job_SRCS job/jobscheduler.cpp job/folderjob.cpp job/expirejob.cpp job/backupjob.cpp ) set(libmailcommon_search_SRCS search/widgethandler/rulewidgethandlermanager.cpp search/searchpattern.cpp search/searchpatternedit.cpp search/widgethandler/encryptionwidgethandler.cpp search/widgethandler/textrulerwidgethandler.cpp search/widgethandler/statusrulewidgethandler.cpp search/widgethandler/messagerulewidgethandler.cpp search/widgethandler/tagrulewidgethandler.cpp search/widgethandler/numericrulewidgethandler.cpp search/widgethandler/daterulewidgethandler.cpp search/widgethandler/numericdoublerulewidgethandler.cpp search/widgethandler/headersrulerwidgethandler.cpp search/searchrule/searchrulenumerical.cpp search/searchrule/searchruledate.cpp search/searchrule/searchrulestring.cpp search/searchrule/searchrulestatus.cpp search/searchrule/searchruleencryption.cpp search/searchrule/searchrule.cpp ) set(libmailcommon_snippets_SRCS snippets/snippetdialog.cpp snippets/snippetsmanager.cpp snippets/snippetsmodel.cpp snippets/snippetvariabledialog.cpp ) set(libmailcommon_tag_SRCS tag/tagwidget.cpp tag/tag.cpp tag/addtagdialog.cpp ) set(libmailcommon_widget_SRCS widgets/redirectdialog.cpp widgets/redirectwidget.cpp widgets/favoritecollectionwidget.cpp ) set(libmailcommon_mdn_SRCS mdn/sendmdnhandler.cpp mdn/mdnstateattribute.cpp ) set(libmailcommon_util_SRCS util/cryptoutils.cpp util/mailutil.cpp util/resourcereadconfigfile.cpp ) set(libmailcommon_SRCS kernel/mailkernel.cpp ${libmailcommon_filter_dialog} ${libmailcommon_util_SRCS} ${libmailcommon_mdn_SRCS} ${libmailcommon_invalidfilters} ${libmailcommon_widget_SRCS} ${libmailcommon_tag_SRCS} ${libmailcommon_snippets_SRCS} ${libmailcommon_search_SRCS} ${libmailcommon_job_SRCS} ${libmailcommon_collection_SRCS} ${libmailcommon_folder_SRCS} ${libmailcommon_filter_SRCS} ) kconfig_add_kcfg_files(libmailcommon_SRCS settings/mailcommonsettings_base.kcfgc ) ecm_qt_declare_logging_category(libmailcommon_SRCS HEADER mailcommon_debug.h IDENTIFIER MAILCOMMON_LOG CATEGORY_NAME org.kde.pim.mailcommon) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/dbusinterfaces/org.freedesktop.Akonadi.MailFilterAgent.xml PROPERTIES INCLUDE "dbusoperators.h") qt5_add_dbus_interfaces(libmailcommon_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/dbusinterfaces/org.freedesktop.Akonadi.MailFilterAgent.xml ) ki18n_wrap_ui(libmailcommon_SRCS filter/ui/filterconfigwidget.ui snippets/ui/snippetdialog.ui filter/ui/selectthunderbirdfilterfileswidget.ui) set(libmailcommon_SRCS ${libmailcommon_SRCS} filter/soundtestwidget.cpp) macro(add_resource_iface _kcfgFile _ifaceName _className) kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${_ifaceName}) string(TOLOWER ${_className} _codeFile) qt5_add_dbus_interface(libmailcommon_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${_ifaceName}.xml ${_codeFile} ${_className} ) endmacro() add_resource_iface(settings.kcfg org.kde.Akonadi.POP3.Settings Pop3Settings) qt5_add_dbus_interfaces(libmailcommon_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/dbusinterfaces/org.kde.Korganizer.Calendar.xml ) add_library(KF5MailCommon ${libmailcommon_SRCS}) generate_export_header(KF5MailCommon BASE_NAME mailcommon) add_library(KF5::MailCommon ALIAS KF5MailCommon) target_link_libraries(KF5MailCommon PUBLIC KF5::AkonadiCore KF5::AkonadiMime + KF5::Libkdepim KF5::MessageComposer KF5::PimCommonAkonadi KF5::Completion PRIVATE KF5::TextWidgets KF5::I18n KF5::LibkdepimAkonadi KF5::MessageViewer KF5::MailImporter KF5::MessageCore KF5::TemplateParser KF5::Mime KF5::Codecs KF5::MailTransport Phonon::phonon4qt5 KF5::XmlGui KF5::KIOWidgets KF5::WindowSystem KF5::IconThemes KF5::Archive KF5::ItemViews KF5::SyntaxHighlighting ) target_include_directories(KF5MailCommon INTERFACE "$") target_include_directories(KF5MailCommon PUBLIC "$") set_target_properties(KF5MailCommon PROPERTIES VERSION ${MAILCOMMON_VERSION_STRING} SOVERSION ${MAILCOMMON_SOVERSION} EXPORT_NAME MailCommon ) install(TARGETS KF5MailCommon EXPORT KF5MailCommonTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) if (BUILD_TESTING) add_subdirectory(filter/filterimporter/autotests) add_subdirectory(collectionpage/autotests) add_subdirectory(filter/autotests) add_subdirectory(snippets/autotests) add_subdirectory(filter/tests) add_subdirectory(search/autotests) add_subdirectory(mdn/autotests/) endif() ecm_generate_headers(MailCommon_CamelCase_HEADERS HEADER_NAMES CryptoUtils MailUtil ResourceReadConfigFile REQUIRED_HEADERS MailCommon_HEADERS PREFIX MailCommon RELATIVE util ) ecm_generate_headers(MailCommon_Camelcasetop_HEADERS HEADER_NAMES DBusOperators REQUIRED_HEADERS MailCommon_top_HEADERS PREFIX MailCommon ) ecm_generate_headers(MailCommon_Camelcasetag_HEADERS HEADER_NAMES TagWidget Tag AddTagDialog REQUIRED_HEADERS MailCommon_tag_HEADERS PREFIX MailCommon RELATIVE tag ) ecm_generate_headers(MailCommon_Camelcasefolder_HEADERS HEADER_NAMES FolderSettings FolderRequester FolderCollectionMonitor AccountConfigOrderDialog FolderTreeView FolderTreeWidget FolderSelectionDialog FolderTreeWidgetProxyModel FavoriteCollectionOrderProxyModel REQUIRED_HEADERS MailCommon_folder_HEADERS PREFIX MailCommon RELATIVE folder ) ecm_generate_headers(MailCommon_Camelcasekernel_HEADERS HEADER_NAMES MailKernel REQUIRED_HEADERS MailCommon_kernel_HEADERS PREFIX MailCommon RELATIVE kernel ) ecm_generate_headers(MailCommon_Camelcaseinterfaces_HEADERS HEADER_NAMES MailInterfaces REQUIRED_HEADERS MailCommon_interfaces_HEADERS PREFIX MailCommon RELATIVE interfaces ) ecm_generate_headers(MailCommon_Camelcasefilter_HEADERS HEADER_NAMES FilterLog MailFilter FilterImporterExporter FilterManager KMFilterDialog FilterImporterPathCache ItemContext REQUIRED_HEADERS MailCommon_filter_HEADERS PREFIX MailCommon RELATIVE filter ) ecm_generate_headers(MailCommon_Camelcasejob_HEADERS HEADER_NAMES BackupJob JobScheduler FolderJob REQUIRED_HEADERS MailCommon_job_HEADERS PREFIX MailCommon RELATIVE job ) ecm_generate_headers(MailCommon_Camelcasefilteraction_HEADERS HEADER_NAMES FilterAction FilterActionDict REQUIRED_HEADERS MailCommon_filteraction_HEADERS PREFIX MailCommon RELATIVE filter/filteractions/ ) ecm_generate_headers(MailCommon_Camelcasemdn_HEADERS HEADER_NAMES SendMdnHandler MDNStateAttribute REQUIRED_HEADERS MailCommon_mdn_HEADERS PREFIX MailCommon RELATIVE mdn ) ecm_generate_headers(MailCommon_Camelcasecollectionpage_HEADERS HEADER_NAMES CollectionGeneralPage CollectionExpiryPage REQUIRED_HEADERS MailCommon_collectionpage_HEADERS PREFIX MailCommon RELATIVE collectionpage ) ecm_generate_headers(MailCommon_Camelcasecollectionpageattributes_HEADERS HEADER_NAMES ExpireCollectionAttribute REQUIRED_HEADERS MailCommon_collectionpageattributes_HEADERS PREFIX MailCommon RELATIVE collectionpage/attributes ) ecm_generate_headers(MailCommon_Camelcasefilterimporter_HEADERS HEADER_NAMES FilterImporterBalsa FilterImporterClawsMail FilterImporterAbstract REQUIRED_HEADERS MailCommon_filterimporter_HEADERS PREFIX MailCommon RELATIVE filter/filterimporter/ ) ecm_generate_headers(MailCommon_Camelcasesnippets_HEADERS HEADER_NAMES SnippetsManager REQUIRED_HEADERS MailCommon_snippets_HEADERS PREFIX MailCommon RELATIVE snippets ) ecm_generate_headers(MailCommon_Camelcasekernel_HEADERS HEADER_NAMES SearchPattern SearchPatternEdit REQUIRED_HEADERS MailCommon_kernel_HEADERS PREFIX MailCommon RELATIVE search ) ecm_generate_headers(MailCommon_Camelcasewidgets_HEADERS HEADER_NAMES RedirectDialog FavoriteCollectionWidget REQUIRED_HEADERS MailCommon_widgets_HEADERS PREFIX MailCommon RELATIVE widgets ) ecm_generate_headers(MailCommon_Camelcasesearchrule_HEADERS HEADER_NAMES SearchRule SearchRuleStatus REQUIRED_HEADERS MailCommon_searchrule_HEADERS PREFIX MailCommon RELATIVE search/searchrule ) ecm_generate_pri_file(BASE_NAME MailCommon LIB_NAME KF5MailCommon DEPS "AkonadiCore AkonadiMime MessageComposer PimCommon" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/MailCommon ) install(FILES ${MailCommon_Camelcasesearchrule_HEADERS} ${MailCommon_CamelCase_HEADERS} ${MailCommon_Camelcasetop_HEADERS} ${MailCommon_Camelcasetag_HEADERS} ${MailCommon_Camelcasefolder_HEADERS} ${MailCommon_Camelcasekernel_HEADERS} ${MailCommon_Camelcaseinterfaces_HEADERS} ${MailCommon_Camelcasefilter_HEADERS} ${MailCommon_Camelcasejob_HEADERS} ${MailCommon_Camelcasefilteraction_HEADERS} ${MailCommon_Camelcasemdn_HEADERS} ${MailCommon_Camelcasecollectionpage_HEADERS} ${MailCommon_Camelcasecollectionpageattributes_HEADERS} ${MailCommon_Camelcasefilterimporter_HEADERS} ${MailCommon_Camelcasesnippets_HEADERS} ${MailCommon_Camelcasewidgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/MailCommon COMPONENT Devel ) install(FILES ${MailCommon_searchrule_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/mailcommon_export.h ${CMAKE_CURRENT_BINARY_DIR}/pop3settings.h ${CMAKE_CURRENT_BINARY_DIR}/mailcommonsettings_base.h ${MailCommon_HEADERS} ${MailCommon_top_HEADERS} ${MailCommon_tag_HEADERS} ${MailCommon_folder_HEADERS} ${MailCommon_kernel_HEADERS} ${MailCommon_interfaces_HEADERS} ${MailCommon_filter_HEADERS} ${MailCommon_job_HEADERS} ${MailCommon_filteraction_HEADERS} ${MailCommon_mdn_HEADERS} ${MailCommon_collectionpage_HEADERS} ${MailCommon_collectionpageattributes_HEADERS} ${MailCommon_filterimporter_HEADERS} ${MailCommon_snippets_HEADERS} ${MailCommon_widgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/mailcommon COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) add_subdirectory(designer) diff --git a/src/job/backupjob.h b/src/job/backupjob.h index ed4d0bd..c803dcc 100644 --- a/src/job/backupjob.h +++ b/src/job/backupjob.h @@ -1,126 +1,127 @@ /* Copyright (c) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company 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) version 3 or any later version accepted by the membership of KDE e.V. (or its successor approved by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of version 3 of the license. 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, see . */ #ifndef MAILCOMMON_BACKUPJOB_H #define MAILCOMMON_BACKUPJOB_H #include "mailcommon_export.h" -#include "libkdepim/progressmanager.h" + +#include #include #include #include #include #include #include class KArchive; class KJob; class QWidget; namespace Akonadi { class ItemFetchJob; } namespace MailCommon { /** * Writes an entire folder structure to an archive file. The archive is * structured like a hierarchy of maildir folders. However, every type of * folder works as the source, i.e. also online IMAP folders. * * The job deletes itself after it finished. */ class MAILCOMMON_EXPORT BackupJob : public QObject { Q_OBJECT public: // These enum values have to stay in sync with the format combobox of ArchiveFolderDialog! enum ArchiveType { Zip = 0, Tar = 1, TarBz2 = 2, TarGz = 3 }; explicit BackupJob(QWidget *parent = nullptr); ~BackupJob(); void setRootFolder(const Akonadi::Collection &rootFolder); void setSaveLocation(const QUrl &savePath); void setArchiveType(ArchiveType type); void setDeleteFoldersAfterCompletion(bool deleteThem); void setRecursive(bool recursive); void setDisplayMessageBox(bool display); void setRealPath(const QString &path); void start(); Q_SIGNALS: void backupDone(const QString &); void error(const QString &); private: void itemFetchJobResult(KJob *job); void cancelJob(); void archiveNextFolder(); void onArchiveNextFolderDone(KJob *job); void archiveNextMessage(); bool queueFolders(const Akonadi::Collection &root); void processMessage(const Akonadi::Item &item); QString pathForCollection(const Akonadi::Collection &collection) const; QString subdirPathForCollection(const Akonadi::Collection &collection) const; bool hasChildren(const Akonadi::Collection &collection) const; void finish(); void abort(const QString &errorMessage); bool writeDirHelper(const QString &directoryPath); // Helper function to return the name of the given collection. // Some Collection's don't have the name fetched. However, in mAllFolders, // we have a list of Collection's that have that information in them, so // we can just look it up there. QString collectionName(const Akonadi::Collection &collection) const; QString mRealPath; QUrl mMailArchivePath; QDateTime mArchiveTime; ArchiveType mArchiveType; Akonadi::Collection mRootFolder; KArchive *mArchive = nullptr; QWidget *mParentWidget = nullptr; int mArchivedMessages; uint mArchivedSize; QPointer mProgressItem; bool mAborted; bool mDeleteFoldersAfterCompletion; bool mRecursive; Akonadi::Collection::List mPendingFolders; Akonadi::Collection::List mAllFolders; Akonadi::Collection mCurrentFolder; Akonadi::Item::List mPendingMessages; Akonadi::ItemFetchJob *mCurrentJob = nullptr; bool mDisplayMessageBox = false; }; } #endif