diff --git a/CMakeLists.txt b/CMakeLists.txt index 159e70d9..6a9a8d48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,165 +1,165 @@ cmake_minimum_required(VERSION 3.1) set(PIM_VERSION "5.7.40") project(kdepim-addons VERSION ${PIM_VERSION}) if (POLICY CMP0063) cmake_policy(SET CMP0063 NEW) endif() set(KF5_VERSION "5.41.0") find_package(ECM ${KF5_VERSION} CONFIG REQUIRED) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) # Do NOT add quote set(KDEPIM_DEV_VERSION alpha) # add an extra space if(DEFINED KDEPIM_DEV_VERSION) set(KDEPIM_DEV_VERSION " ${KDEPIM_DEV_VERSION}") endif() if(NOT CMAKE_VERSION VERSION_LESS "3.10.0") # CMake 3.9+ warns about automoc on files without Q_OBJECT, and doesn't know about other macros. # 3.10+ lets us provide more macro names that require automoc. # Remove this when depending on a Frameworks or ECM version that solves this upstream. list(APPEND CMAKE_AUTOMOC_MACRO_NAMES "K_PLUGIN_FACTORY_WITH_JSON" "K_PLUGIN_FACTORY") endif() set(KDEPIMADDONS_VERSION_NUMBER ${PIM_VERSION}) set(KDEPIMADDONS_VERSION "${KDEPIMADDONS_VERSION_NUMBER}${KDEPIM_DEV_VERSION}") set(KDEPIMADDONS_LIB_VERSION "${KDEPIMADDONS_VERSION_NUMBER}") set(KDEPIMADDONS_LIB_SOVERSION "5") set(AKONADINOTES_LIB_VERSION "5.7.0") set(QT_REQUIRED_VERSION "5.8.0") include(ECMOptionalAddSubdirectory) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMAddTests) include(ECMMarkNonGuiExecutable) include(GenerateExportHeader) include(ECMGenerateHeaders) include(CMakePackageConfigHelpers) include(FeatureSummary) include(CheckFunctionExists) include(ECMGeneratePriFile) include(ECMCoverageOption) include(KDEInstallDirs) include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(ECMAddAppIcon) include(ECMQtDeclareLoggingCategory) option(KDEPIMADDONS_BUILD_EXAMPLES "Build the kdepim-addons example applications." TRUE) 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) find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED WebEngine WebEngineWidgets Widgets Test) find_package(KF5I18n ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5Config ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5DBusAddons ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiNotes ${AKONADINOTES_LIB_VERSION} CONFIG REQUIRED) find_package(KF5XmlGui ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5Declarative ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5SyntaxHighlighting ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5KIO ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5IconThemes ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5Parts ${KF5_VERSION} CONFIG REQUIRED) find_package(KF5Prison ${KF5_VERSION} CONFIG REQUIRED) set(MAILCOMMON_LIB_VERSION "5.7.40") set(GRAVATAR_LIB_VERSION "5.7.40") set(PIMCOMMON_LIB_VERSION "5.7.42") set(GRANTLEETHEME_LIB_VERSION "5.7.40") set(CALENDARSUPPORT_LIB_VERSION "5.7.40") set(EVENTVIEW_LIB_VERSION "5.7.40") set(LIBKDEPIM_LIB_VERSION "5.7.40") set(KDEPIM_APPS_LIB_VERSION "5.7.40") set(LIBKLEO_LIB_VERSION "5.7.40") set(AKONADI_LIB_VERSION "5.7.40") set(INCIDENCEEDITOR_LIB_VERSION "5.7.40") set(KTNEF_LIB_VERSION "5.7.40") -set(MESSAGELIB_LIB_VERSION "5.7.41") +set(MESSAGELIB_LIB_VERSION "5.7.46") set(AKONADICALENDAR_LIB_VERSION "5.7.40") set(CALENDAR_UTILS_VERSION "5.7.40") set(KPIMTEXTEDIT_LIB_VERSION "5.7.40") set(KIMAP_LIB_VERSION "5.7.40") set(LIBKSIEVE_LIB_VERSION "5.7.40") set(KMAILTRANSPORT_LIB_VERSION "5.7.40") set(AKONADICONTACT_LIB_VERSION "5.7.40") set(IMPORTWIZARD_LIB_VERSION "5.7.40") set(MAILIMPORTER_LIB_VERSION "5.7.40") find_package(KF5CalendarUtils ${CALENDAR_UTILS_VERSION} CONFIG REQUIRED) find_package(KF5WebEngineViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5TemplateParser ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailCommon ${MAILCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5KaddressbookGrantlee ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageViewer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5KaddressbookImportExport ${KDEPIM_APPS_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Libkleo ${LIBKLEO_LIB_VERSION} CONFIG REQUIRED) find_package(KF5GrantleeTheme ${GRANTLEETHEME_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimCommonAkonadi ${PIMCOMMON_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibkdepimAkonadi ${LIBKDEPIM_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IncidenceEditor ${INCIDENCEEDITOR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageCore ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageComposer ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MessageList ${MESSAGELIB_LIB_VERSION} CONFIG REQUIRED) find_package(KF5CalendarSupport ${CALENDARSUPPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5EventViews ${EVENTVIEW_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Akonadi ${AKONADI_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiCalendar ${AKONADICALENDAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Gravatar ${GRAVATAR_LIB_VERSION} CONFIG REQUIRED) find_package(KF5PimTextEdit ${KPIMTEXTEDIT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IdentityManagement ${KIDENTITYMANAGEMENT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5IMAP ${KIMAP_LIB_VERSION} CONFIG REQUIRED) find_package(KF5LibKSieve ${LIBKSIEVE_LIB_VERSION} CONFIG REQUIRED) find_package(KF5Tnef ${KTNEF_LIB_VERSION} CONFIG REQUIRED) find_package(KF5MailTransportAkonadi ${KMAILTRANSPORT_LIB_VERSION} CONFIG REQUIRED) find_package(KF5AkonadiContact ${AKONADICONTACT_LIB_VERSION} CONFIG REQUIRED) find_package(KPimImportWizard ${IMPORTWIZARD_LIB_VERSION} CONFIG) find_package(KF5MailImporterAkonadi ${MAILIMPORTER_LIB_VERSION} CONFIG REQUIRED) add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII ) add_definitions(-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT) add_definitions(-DQT_NO_URL_CAST_FROM_STRING) if(KDEPIM_ENTERPRISE_BUILD) set(KDEPIM_ENTERPRISE_BUILD true) else() set(KDEPIM_ENTERPRISE_BUILD false) endif() # Extra package find_package(Gpgmepp 1.8.0 CONFIG) set_package_properties(Gpgmepp PROPERTIES DESCRIPTION "GpgME library" URL "http://www.gnupg.org" TYPE REQUIRED) set( SharedMimeInfo_MINIMUM_VERSION "1.0" ) find_package(SharedMimeInfo ${SharedMimeInfo_MINIMUM_VERSION} REQUIRED) find_package(Poppler COMPONENTS Qt5) set_package_properties("Poppler" PROPERTIES TYPE OPTIONAL PURPOSE "Support for PDF booking confirmations in the semantic extraction plugin.") if (KDEPIMADDONS_BUILD_EXAMPLES) add_subdirectory(examples) endif() add_subdirectory(plugins) add_subdirectory(korganizer) add_subdirectory(kmail) add_subdirectory(kaddressbook) add_subdirectory(akregator) add_subdirectory(sieveeditor) add_subdirectory(kmailtransport) if (KPimImportWizard_FOUND) add_subdirectory(akonadi-import-wizard) endif() install( FILES kdepim-addons.categories kdepim-addons.renamecategories DESTINATION ${KDE_INSTALL_CONFDIR} ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/kmail/editorplugins/changecase/changecaseplugineditorinterface.cpp b/kmail/editorplugins/changecase/changecaseplugineditorinterface.cpp index 836a2824..a1387227 100644 --- a/kmail/editorplugins/changecase/changecaseplugineditorinterface.cpp +++ b/kmail/editorplugins/changecase/changecaseplugineditorinterface.cpp @@ -1,122 +1,123 @@ /* Copyright (C) 2016-2017 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 "changecaseplugineditorinterface.h" #include "changecaseeditorplugin_debug.h" #include #include #include #include #include ChangeCasePluginEditorInterface::ChangeCasePluginEditorInterface(QObject *parent) : MessageComposer::PluginEditorInterface(parent) { + setNeedSelectedText(true); } ChangeCasePluginEditorInterface::~ChangeCasePluginEditorInterface() { } void ChangeCasePluginEditorInterface::createAction(KActionCollection *ac) { PimCommon::KActionMenuChangeCase *ChangeCaseMenu = new PimCommon::KActionMenuChangeCase(this); ChangeCaseMenu->appendInActionCollection(ac); ac->addAction(QStringLiteral("change_case_menu"), ChangeCaseMenu); connect(ChangeCaseMenu, &PimCommon::KActionMenuChangeCase::upperCase, this, &ChangeCasePluginEditorInterface::slotUpperCase); connect(ChangeCaseMenu, &PimCommon::KActionMenuChangeCase::lowerCase, this, &ChangeCasePluginEditorInterface::slotLowerCase); connect(ChangeCaseMenu, &PimCommon::KActionMenuChangeCase::sentenceCase, this, &ChangeCasePluginEditorInterface::slotSentenceCase); connect(ChangeCaseMenu, &PimCommon::KActionMenuChangeCase::reverseCase, this, &ChangeCasePluginEditorInterface::slotReverseCase); MessageComposer::ActionType type(ChangeCaseMenu, MessageComposer::ActionType::Edit); setActionType(type); } void ChangeCasePluginEditorInterface::exec() { switch (mType) { case Unknown: qCDebug(KMAIL_EDITOR_CHANGECASE_PLUGIN_LOG) << " There is an error here. We can't call this plugin with unknown type"; break; case UpperCase: upperCase(); break; case LowerCase: lowerCase(); break; case SentenseCase: sentenceCase(); break; case ReverseCase: reverseCase(); break; } mType = Unknown; } void ChangeCasePluginEditorInterface::sentenceCase() { QTextCursor textCursor = richTextEditor()->textCursor(); KPIMTextEdit::EditorUtil editorUtil; editorUtil.sentenceCase(textCursor); } void ChangeCasePluginEditorInterface::upperCase() { KPIMTextEdit::EditorUtil editorUtil; QTextCursor textCursor = richTextEditor()->textCursor(); editorUtil.upperCase(textCursor); } void ChangeCasePluginEditorInterface::lowerCase() { QTextCursor textCursor = richTextEditor()->textCursor(); KPIMTextEdit::EditorUtil editorUtil; editorUtil.lowerCase(textCursor); } void ChangeCasePluginEditorInterface::reverseCase() { QTextCursor textCursor = richTextEditor()->textCursor(); KPIMTextEdit::EditorUtil editorUtil; editorUtil.reverseCase(textCursor); } void ChangeCasePluginEditorInterface::slotUpperCase() { mType = UpperCase; Q_EMIT emitPluginActivated(this); } void ChangeCasePluginEditorInterface::slotLowerCase() { mType = LowerCase; Q_EMIT emitPluginActivated(this); } void ChangeCasePluginEditorInterface::slotSentenceCase() { mType = SentenseCase; Q_EMIT emitPluginActivated(this); } void ChangeCasePluginEditorInterface::slotReverseCase() { mType = ReverseCase; Q_EMIT emitPluginActivated(this); } diff --git a/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp b/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp index 595f0c08..c7a776ba 100644 --- a/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp +++ b/kmail/editorplugins/insertshorturl/insertshorturlplugineditor.cpp @@ -1,62 +1,63 @@ /* Copyright (C) 2017 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 K_PLUGIN_FACTORY_WITH_JSON(InsertShorturlPluginEditorFactory, "kmail_insertshorturleditorplugin.json", registerPlugin(); ) InsertShorturlPluginEditor::InsertShorturlPluginEditor(QObject *parent, const QList &) : MessageComposer::PluginEditor(parent) { + } InsertShorturlPluginEditor::~InsertShorturlPluginEditor() { } MessageComposer::PluginEditorInterface *InsertShorturlPluginEditor::createInterface(KActionCollection *ac, QObject *parent) { InsertShorturlPluginEditorInterface *interface = new InsertShorturlPluginEditorInterface(parent); interface->createAction(ac); return interface; } bool InsertShorturlPluginEditor::hasPopupMenuSupport() const { return true; } bool InsertShorturlPluginEditor::hasConfigureDialog() const { return true; } void InsertShorturlPluginEditor::showConfigureDialog(QWidget *parent) { QPointer dlg = new InsertShorturlConfigureDialog(parent); dlg->exec(); delete dlg; } #include "insertshorturlplugineditor.moc" diff --git a/kmail/editorplugins/insertshorturl/insertshorturlplugineditorinterface.cpp b/kmail/editorplugins/insertshorturl/insertshorturlplugineditorinterface.cpp index 95c04e06..51193a9a 100644 --- a/kmail/editorplugins/insertshorturl/insertshorturlplugineditorinterface.cpp +++ b/kmail/editorplugins/insertshorturl/insertshorturlplugineditorinterface.cpp @@ -1,126 +1,124 @@ /* Copyright (C) 2017 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 "insertshorturlplugineditorinterface.h" #include #include #include #include #include #include #include #include "shorturlengineplugin/shorturlengineinterface.h" #include "shorturlengineplugin/shorturlengineplugin.h" #include "shorturlengineplugin/shorturlenginepluginmanager.h" InsertShorturlPluginEditorInterface::InsertShorturlPluginEditorInterface(QObject *parent) : MessageComposer::PluginEditorInterface(parent) { + setNeedSelectedText(true); initializePlugins(); } InsertShorturlPluginEditorInterface::~InsertShorturlPluginEditorInterface() { } void InsertShorturlPluginEditorInterface::initializePlugins() { const QVector lstPlugin = ShortUrlEnginePluginManager::self()->pluginsList(); for (ShortUrlEnginePlugin *plugin : lstPlugin) { ShortUrlEngineInterface *interface = plugin->createInterface(this); if (interface) { mLstInterface.insert(interface->engineName(), interface); } } } void InsertShorturlPluginEditorInterface::loadEngine() { if (mCurrentEngine) { disconnect(mCurrentEngine, &ShortUrlEngineInterface::shortUrlGenerated, this, &InsertShorturlPluginEditorInterface::slotShortUrlDone); disconnect(mCurrentEngine, &ShortUrlEngineInterface::shortUrlFailed, this, &InsertShorturlPluginEditorInterface::slotShortUrlFailed); } KConfigGroup grp(KSharedConfig::openConfig(), "ShortUrl"); const QString engineName = grp.readEntry("EngineName"); mCurrentEngine = mLstInterface.value(engineName); if (!mCurrentEngine && !mLstInterface.isEmpty()) { mCurrentEngine = mLstInterface.cbegin().value(); } if (mCurrentEngine) { connect(mCurrentEngine, &ShortUrlEngineInterface::shortUrlGenerated, this, &InsertShorturlPluginEditorInterface::slotShortUrlDone); connect(mCurrentEngine, &ShortUrlEngineInterface::shortUrlFailed, this, &InsertShorturlPluginEditorInterface::slotShortUrlFailed); } } void InsertShorturlPluginEditorInterface::createAction(KActionCollection *ac) { QAction *action = new QAction(i18n("Insert Short Url..."), this); ac->addAction(QStringLiteral("insert_shortulr"), action); connect(action, &QAction::triggered, this, &InsertShorturlPluginEditorInterface::slotActivated); MessageComposer::ActionType type(action, MessageComposer::ActionType::PopupMenu); setActionType(type); } void InsertShorturlPluginEditorInterface::slotActivated() { Q_EMIT emitPluginActivated(this); } void InsertShorturlPluginEditorInterface::exec() { QTextCursor textCursor = richTextEditor()->textCursor(); - if (textCursor.hasSelection()) { - QString urlStr = textCursor.selectedText(); - if (urlStr.startsWith(QLatin1String("http:")) || urlStr.startsWith(QLatin1String("https:"))) { - /* + QString urlStr = textCursor.selectedText(); + if (urlStr.startsWith(QLatin1String("http:")) || urlStr.startsWith(QLatin1String("https:"))) { + /* if (!mCurrentEngine) { return; } if (!PimCommon::NetworkManager::self()->networkConfigureManager()->isOnline()) { KMessageBox::information(this, i18n("No network connection detected, we cannot shorten URL."), i18n("No network")); return; } if (mOriginalUrl->text().isEmpty()) { return; } mIndicatorLabel->start(); mCurrentEngine->setShortUrl(mOriginalUrl->text()); mShortUrl->clear(); mCurrentEngine->generateShortUrl(); */ - //textCursor.insertText(newText); - } + //textCursor.insertText(newText); } - //editorUtil.upperCase(textCursor); } void InsertShorturlPluginEditorInterface::slotShortUrlDone(const QString &url) { //mIndicatorLabel->stop(); } void InsertShorturlPluginEditorInterface::slotShortUrlFailed(const QString &errMsg) { //KMessageBox::error(this, i18n("An error occurred: \"%1\"", errMsg)); //mIndicatorLabel->stop(); }