diff --git a/messagelist/src/core/widgets/quicksearchline.cpp b/messagelist/src/core/widgets/quicksearchline.cpp index 81cebb0251..81bfaaf301 100644 --- a/messagelist/src/core/widgets/quicksearchline.cpp +++ b/messagelist/src/core/widgets/quicksearchline.cpp @@ -1,276 +1,254 @@ /* Copyright (c) 2014-2015 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 "quicksearchline.h" #include "messagelistsettings.h" #include -#include "PimCommon/LineEditWithCompleter" +#include "PimCommon/LineEditWithKeywords" #include #include #include #include #include #include #include #include #include #include #include #include using namespace MessageList::Core; QuickSearchLine::QuickSearchLine(QWidget *parent) : QWidget(parent), mContainsOutboundMessages(false), mFilterStatusMapper(Q_NULLPTR) { QVBoxLayout *vbox = new QVBoxLayout; vbox->setMargin(0); vbox->setSpacing(0); setLayout(vbox); QWidget *w = new QWidget; QHBoxLayout *hbox = new QHBoxLayout; hbox->setMargin(0); hbox->setSpacing(0); w->setLayout(hbox); vbox->addWidget(w); - listKeyword << i18n("in") << i18n("ago") << i18n("yesterday") << i18n("today") << i18n("first") << i18n("last") << i18n("next") << i18n("PM") << i18n("AM") - << i18n("pm") << i18n("am") << i18n("at") << i18n("containing") << i18n("contains") << i18n("greater than") << i18n("bigger than") << i18n("more than") - << i18n("at least") << i18n(">") << i18n("after") << i18n("since") << i18n("smaller than") << i18n("less than") << i18n("lesser than") << i18n("at most") - << i18n("<") << i18n("Before") << i18n("until") << i18n("equal to") << i18n("equal") << i18n("equals") << i18n("=") << i18n("rated as") << i18n("rated") - << i18n("score is") << i18n("score") << i18n("scored") << i18n("having") << i18n("stars") << i18n("star") << i18n("Comment") << i18n("described as") - << i18n("description is") << i18n("comment is") << i18n("description") << i18n("described") << i18n("comment") << i18n("sent by") << i18n("from") - << i18n("sender is") << i18n("sender") << i18n("title is") << i18n("subject is") << i18n("subject") << i18n("title") << i18n("titled") << i18n("sent to") - << i18n("recipient is") << i18n("recipient") << i18n("sent at") << i18n("sent on") << i18n("sent") << i18n("received at") << i18n("received on") - << i18n("received") << i18n("reception is") << i18n("written by") << i18n("created by") << i18n("composed by") << i18n("author is") << i18n("by") - << i18n("size is") << i18n("size") << i18n("being") << i18n("large") << i18n("name is") << i18n("name") << i18n("named") << i18n("name is") - << i18n("created at") << i18n("dated at") << i18n("created on") << i18n("dated on") << i18n("created in") << i18n("dated in") << i18n("created of") - << i18n("dated of") << i18n("created") << i18n("dated") << i18n("creation date is") << i18n("creation time is") << i18n("creation datetime is") - << i18n("modification date is") << i18n("modification time is") << i18n("modification datetime is") << i18n("edition date is") << i18n("edition time is") - << i18n("edition datetime is") << i18n("edited") << i18n("modified") << i18n("modified at") << i18n("modified on") << i18n("edited on") << i18n("edited at") - << i18n("tagged as") << i18n("has tag") << i18n("tag is") << i18n("#") << i18n("related to") << i18n("a") << i18n("year") << i18n("week") << i18n("month") - << i18n("day") << i18n("hour") << i18n("of") << i18n("by") << i18n("and") << i18n("on") << i18n("in") << i18n("or") << i18n("third") << i18n("second") << i18n("fourth") - << i18n("then"); - - - - mSearchEdit = new PimCommon::LineEditWithCompleter(this); + mSearchEdit = new PimCommon::LineEditWithKeywords(this); mSearchEdit->setPlaceholderText(i18nc("Search for messages.", "Search")); mSearchEdit->setObjectName(QStringLiteral("quicksearch")); mSearchEdit->setClearButtonShown(true); connect(mSearchEdit, &KLineEdit::textChanged, this, &QuickSearchLine::slotSearchEditTextEdited); connect(mSearchEdit, &KLineEdit::clearButtonClicked, this, &QuickSearchLine::slotClearButtonClicked); - Q_FOREACH(const QString &str, listKeyword) { - searchEdit()->completionObject()->addItem(str); - } + hbox->addWidget(mSearchEdit); // The status filter button. Will be populated later, as populateStatusFilterCombo() is virtual mTagFilterCombo = new KComboBox(this); mTagFilterCombo->setMaximumWidth(300); mTagFilterCombo->setMaximumWidth(200); mTagFilterCombo->hide(); hbox->addWidget(mTagFilterCombo); //Be disable until we have a storageModel => logical that it's disable. mSearchEdit->setEnabled(false); mTagFilterCombo->setEnabled(false); installEventFilter(this); mTagFilterCombo->installEventFilter(this); changeQuicksearchVisibility(MessageListSettings::self()->showQuickSearch()); } QuickSearchLine::~QuickSearchLine() { } void QuickSearchLine::slotSearchEditTextEdited(const QString &text) { int minimumStringLength = 3; if (text.startsWith(QLatin1Char('"')) && text.endsWith(QLatin1Char('"'))) { minimumStringLength = 5; } if (!text.trimmed().isEmpty()) { if (text.length() >= minimumStringLength) { Q_EMIT searchEditTextEdited(text); } } else { slotClearButtonClicked(); } } void QuickSearchLine::slotClearButtonClicked() { if (mTagFilterCombo->isVisible()) { mTagFilterCombo->setCurrentIndex(0); } Q_EMIT clearButtonClicked(); } void QuickSearchLine::focusQuickSearch(const QString &selectedText) { if (!selectedText.isEmpty()) { mSearchEdit->setText(selectedText); } mSearchEdit->setFocus(); } KComboBox *QuickSearchLine::tagFilterComboBox() const { return mTagFilterCombo; } KLineEdit *QuickSearchLine::searchEdit() const { return mSearchEdit; } void QuickSearchLine::resetFilter() { Q_FOREACH (QToolButton *button, mListStatusButton) { button->setChecked(false); } if (mTagFilterCombo->isVisible()) { mTagFilterCombo->setCurrentIndex(0); } } void QuickSearchLine::createQuickSearchButton(const QIcon &icon, const QString &text, int value, QLayout *quickSearchButtonLayout) { QToolButton *button = new QToolButton; button->setIcon(icon); button->setText(text); button->setAutoRaise(true); button->setToolTip(text); button->setCheckable(true); button->setChecked(false); button->setProperty("statusvalue", value); mFilterStatusMapper->setMapping(button, value); connect(button, SIGNAL(clicked(bool)), mFilterStatusMapper, SLOT(map())); quickSearchButtonLayout->addWidget(button); button->installEventFilter(this); button->setFocusPolicy(Qt::StrongFocus); mListStatusButton.append(button); } bool QuickSearchLine::containsOutboundMessages() const { return mContainsOutboundMessages; } void QuickSearchLine::setContainsOutboundMessages(bool containsOutboundMessages) { if (mContainsOutboundMessages != containsOutboundMessages) { mContainsOutboundMessages = containsOutboundMessages; } } void QuickSearchLine::initializeStatusSearchButton(QLayout *quickSearchButtonLayout) { //Bug Qt we can't use QButtonGroup + QToolButton + change focus. => use QSignalMapper(); mFilterStatusMapper = new QSignalMapper(this); connect(mFilterStatusMapper, static_cast(&QSignalMapper::mapped), this, &QuickSearchLine::statusButtonsClicked); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-unread")), i18nc("@action:inmenu Status of a message", "Unread"), Akonadi::MessageStatus::statusUnread().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-replied")), i18nc("@action:inmenu Status of a message", "Replied"), Akonadi::MessageStatus::statusReplied().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-forwarded")), i18nc("@action:inmenu Status of a message", "Forwarded"), Akonadi::MessageStatus::statusForwarded().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("emblem-important")), i18nc("@action:inmenu Status of a message", "Important"), Akonadi::MessageStatus::statusImportant().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-task")), i18nc("@action:inmenu Status of a message", "Action Item"), Akonadi::MessageStatus::statusToAct().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("messagelist/pics/mail-thread-watch.png"))), i18nc("@action:inmenu Status of a message", "Watched"), Akonadi::MessageStatus::statusWatched().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("messagelist/pics/mail-thread-ignored.png"))), i18nc("@action:inmenu Status of a message", "Ignored"), Akonadi::MessageStatus::statusIgnored().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-attachment")), i18nc("@action:inmenu Status of a message", "Has Attachment"), Akonadi::MessageStatus::statusHasAttachment().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-invitation")), i18nc("@action:inmenu Status of a message", "Has Invitation"), Akonadi::MessageStatus::statusHasInvitation().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-mark-junk")), i18nc("@action:inmenu Status of a message", "Spam"), Akonadi::MessageStatus::statusSpam().toQInt32(), quickSearchButtonLayout); createQuickSearchButton(QIcon::fromTheme(QStringLiteral("mail-mark-notjunk")), i18nc("@action:inmenu Status of a message", "Ham"), Akonadi::MessageStatus::statusHam().toQInt32(), quickSearchButtonLayout); } QList QuickSearchLine::status() const { QList lstStatus; Q_FOREACH (QToolButton *button, mListStatusButton) { if (button->isChecked()) { Akonadi::MessageStatus status; status.fromQInt32(static_cast< qint32 >(button->property("statusvalue").toInt())); lstStatus.append(status); } } return lstStatus; } void QuickSearchLine::updateComboboxVisibility() { mTagFilterCombo->setVisible(!mSearchEdit->isHidden() && mTagFilterCombo->count()); } bool QuickSearchLine::eventFilter(QObject *object, QEvent *e) { const bool shortCutOverride = (e->type() == QEvent::ShortcutOverride); if (shortCutOverride) { e->accept(); return true; } return QWidget::eventFilter(object, e); } void QuickSearchLine::changeQuicksearchVisibility(bool show) { mSearchEdit->setVisible(show); mTagFilterCombo->setVisible(show && mTagFilterCombo->count()); } diff --git a/messagelist/src/core/widgets/quicksearchline.h b/messagelist/src/core/widgets/quicksearchline.h index 74e35dd33d..0bdf2ec3f0 100644 --- a/messagelist/src/core/widgets/quicksearchline.h +++ b/messagelist/src/core/widgets/quicksearchline.h @@ -1,83 +1,82 @@ /* Copyright (c) 2014-2015 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. */ #ifndef QUICKSEARCHLINE_H #define QUICKSEARCHLINE_H #include #include "messagelist_export.h" #include class KLineEdit; class KComboBox; class QToolButton; class QPushButton; class QSignalMapper; class QPushButton; namespace MessageList { namespace Core { class MESSAGELIST_EXPORT QuickSearchLine : public QWidget { Q_OBJECT public: explicit QuickSearchLine(QWidget *parent = Q_NULLPTR); ~QuickSearchLine(); void focusQuickSearch(const QString &selectedText); KComboBox *tagFilterComboBox() const; KLineEdit *searchEdit() const; void resetFilter(); QList status() const; void updateComboboxVisibility(); bool containsOutboundMessages() const; void setContainsOutboundMessages(bool containsOutboundMessages); void changeQuicksearchVisibility(bool show); Q_SIGNALS: void clearButtonClicked(); void searchEditTextEdited(const QString &); void statusButtonsClicked(); protected: bool eventFilter(QObject *object, QEvent *e) Q_DECL_OVERRIDE; private Q_SLOTS: void slotSearchEditTextEdited(const QString &text); void slotClearButtonClicked(); private: void initializeStatusSearchButton(QLayout *quickSearchButtonLayout); void createQuickSearchButton(const QIcon &icon, const QString &text, int value, QLayout *quickSearchButtonLayout); QList mListStatusButton; KLineEdit *mSearchEdit; KComboBox *mTagFilterCombo; bool mContainsOutboundMessages; QSignalMapper *mFilterStatusMapper; - QStringList listKeyword; }; } } #endif // QUICKSEARCHLINE_H diff --git a/pimcommon/src/CMakeLists.txt b/pimcommon/src/CMakeLists.txt index f5e57e5fb9..8a76b7ee90 100644 --- a/pimcommon/src/CMakeLists.txt +++ b/pimcommon/src/CMakeLists.txt @@ -1,607 +1,609 @@ add_definitions( -DQT_NO_CAST_FROM_ASCII ) add_definitions( -DQT_NO_CAST_TO_ASCII ) add_definitions(-DTRANSLATION_DOMAIN=\"libpimcommon\") set(libpimcommon_sieve_SRCS sievehighlighter/sievesyntaxhighlighter.cpp sievehighlighter/sievesyntaxhighlighterrules.cpp sievehighlighter/sievesyntaxhighlighterutil.cpp ) if( KF5GAPI_FOUND ) set(libpimcommon_storageservice_gdrive storageservice/gdrive/gdrivestorageservice.cpp storageservice/gdrive/gdrivejob.cpp ) endif() set(libpimcommon_storageservice_SRCS ${libpimcommon_storageservice_gdrive} storageservice/storageserviceabstract.cpp storageservice/storageservicemanager.cpp storageservice/storageserviceprogressmanager.cpp storageservice/job/storageserviceabstractjob.cpp storageservice/storageservicejobconfig.cpp storageservice/dropbox/dropboxstorageservice.cpp storageservice/dropbox/dropboxjob.cpp storageservice/dropbox/dropboxutil.cpp storageservice/authdialog/storageauthviewwidget.cpp storageservice/authdialog/storageauthviewdialog.cpp storageservice/authdialog/logindialog.cpp storageservice/authdialog/storageauthwebview.cpp storageservice/hubic/hubicstorageservice.cpp storageservice/hubic/hubicjob.cpp storageservice/settings/storageservicecombobox.cpp storageservice/settings/addservicestoragedialog.cpp storageservice/settings/storagelistwidgetitem.cpp storageservice/settings/storageservicesettingswidget.cpp storageservice/yousendit/yousenditjob.cpp storageservice/yousendit/yousenditstorageservice.cpp storageservice/yousendit/yousenditutil.cpp storageservice/webdav/webdavstorageservice.cpp storageservice/webdav/webdavjob.cpp storageservice/webdav/webdavsettingsdialog.cpp storageservice/webdav/protocol/webdav_url_info.cpp storageservice/utils/storageserviceutils.cpp storageservice/box/boxjob.cpp storageservice/box/boxstorageservice.cpp storageservice/box/boxutil.cpp storageservice/dialog/storageservicedownloaddialog.cpp storageservice/dialog/storageservicechecknamedialog.cpp storageservice/dialog/storageserviceconfiguredialog.cpp storageservice/dialog/storageservicedeletedialog.cpp storageservice/dialog/storageservicepropertiesdialog.cpp storageservice/widgets/storageserviceconfigurewidget.cpp storageservice/widgets/storageservicetreewidget.cpp storageservice/widgets/storageserviceprogresswidget.cpp storageservice/widgets/storageserviceprogressindicator.cpp storageservice/widgets/storageservicetreewidgetitem.cpp storageservice/settings/storageservicesettings.cpp storageservice/storageservicepluginmanager.cpp storageservice/storageserviceplugin.cpp storageservice/storageserviceinterface.cpp storageservice/storageservicemenus.cpp ) qt5_add_dbus_adaptor(libpimcommon_storageservice_SRCS storageservice/org.kde.pim.StorageManager.xml storageservice/storageservicemanager.h PimCommon::StorageServiceManager ) set(libpimcommon_autocorrection_SRCS autocorrection/autocorrection.cpp autocorrection/autocorrectionwidget.cpp autocorrection/autocorrectionlistwidget.cpp autocorrection/autocorrectiontreewidget.cpp autocorrection/autocorrectionlanguage.cpp autocorrection/import/importlibreofficeautocorrection.cpp autocorrection/import/importkmailautocorrection.cpp autocorrection/import/importabstractautocorrection.cpp autocorrection/widgets/lineeditwithautocorrection.cpp autocorrection/widgets/richtexteditwithautocorrection.cpp ) set(libpimcommon_translator_SRCS translator/translatorutil.cpp translator/translatorwidget.cpp translator/translatordebugdialog.cpp translator/googletranslator.cpp ) set(libpimcommon_templatewidgets_SRCS templatewidgets/templatelistwidget.cpp templatewidgets/templateeditdialog.cpp templatewidgets/templatemanager.cpp ) set(libpimcommon_folderdialog_SRCS folderdialog/selectmulticollectionwidget.cpp folderdialog/selectmulticollectiondialog.cpp folderdialog/checkedcollectionwidget.cpp ) set(libpimcommon_acl_SRCS acl/aclentrydialog.cpp acl/aclmanager.cpp acl/aclutils.cpp acl/collectionaclpage.cpp acl/imapaclattribute.cpp acl/collectionaclwidget.cpp acl/acllistview.cpp ) set(libpimcommon_widgets_SRCS widgets/minimumcombobox.cpp widgets/renamefiledialog.cpp widgets/simplestringlisteditor.cpp widgets/customtreeview.cpp widgets/configureimmutablewidgetutils.cpp widgets/annotationdialog.cpp widgets/kactionmenuchangecase.cpp widgets/lineeditwithcompleter.cpp + widgets/lineeditwithkeywords.cpp widgets/spellchecklineedit.cpp ) set(libpimcommon_customtools_SRCS customtools/customtoolsplugin.cpp customtools/customtoolspluginmanager.cpp customtools/customtoolswidgetng.cpp customtools/customtoolsviewinterface.cpp ) set(libpimcommon_util_SRCS util/createresource.cpp util/pimutil.cpp util/imapresourcecapabilitiesmanager.cpp util/networkutil.cpp ) set(libpimcommon_temporary_SRCS temporaryfile/attachmenttemporaryfilesdirs.cpp ) set(libpimcommon_migrate_SRCS migration/migrateapplicationfiles.cpp migration/migratefileinfo.cpp ) set(libpimcommon_shareserviceurl_SRCS shareserviceurl/shareserviceurlmanager.cpp ) set(libpimcommon_manageserversidesubscription_SRCS manageserversidesubscription/manageserversidesubscriptionjob.cpp ) set(libpimcommon_shorturl_SRCS customtools/shorturlplugin/shorturl/shorturlengineplugin/shorturlengineplugin.cpp customtools/shorturlplugin/shorturl/shorturlengineplugin/shorturlengineinterface.cpp ) set(libpimcommon_SRCS settings/pimcommonsettings.cpp ${libpimcommon_shorturl_SRCS} ${libpimcommon_manageserversidesubscription_SRCS} ${libpimcommon_shareserviceurl_SRCS} ${libpimcommon_migrate_SRCS} ${libpimcommon_util_SRCS} ${libpimcommon_texteditor_SRCS} ${libpimcommon_storageservice_SRCS} ${libpimcommon_autocorrection_SRCS} ${libpimcommon_translator_SRCS} ${libpimcommon_templatewidgets_SRCS} ${libpimcommon_folderdialog_SRCS} ${libpimcommon_acl_SRCS} ${libpimcommon_sieve_SRCS} ${libpimcommon_widgets_SRCS} ${libpimcommon_temporary_SRCS} ${libpimcommon_customtools_SRCS} ) ecm_qt_declare_logging_category(libpimcommon_SRCS HEADER pimcommon_debug.h IDENTIFIER PIMCOMMON_LOG CATEGORY_NAME log_pimcommon) ki18n_wrap_ui(libpimcommon_SRCS autocorrection/ui/autocorrectionwidget.ui ) macro(add_resource_iface _kcfgFile _ifaceName _className _fileName) kcfg_generate_dbus_interface(${CMAKE_CURRENT_SOURCE_DIR}/${_kcfgFile} ${_ifaceName}) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${_ifaceName}.xml PROPERTIES INCLUDE "pimcommon/metatype.h") qt5_add_dbus_interface(libpimcommon_SRCS ${CMAKE_CURRENT_BINARY_DIR}/${_ifaceName}.xml ${_fileName} ${_className} ) endmacro() add_resource_iface(util/imapresource.kcfg org.kde.Akonadi.Imap.Settings ImapSettings imapresourcesettings) kconfig_add_kcfg_files(libpimcommon_SRCS settings/pimcommonsetting_base.kcfgc ) add_library(KF5PimCommon ${libpimcommon_SRCS}) generate_export_header(KF5PimCommon BASE_NAME pimcommon) add_library(KF5::PimCommon ALIAS KF5PimCommon) if( KF5GAPI_FOUND ) target_link_libraries(KF5PimCommon PRIVATE KF5::GAPIDrive ) endif() if ( Qt5TextToSpeech_FOUND ) target_link_libraries(KF5PimCommon PRIVATE Qt5::TextToSpeech ) endif() target_link_libraries(KF5PimCommon PUBLIC KF5::AkonadiCore KF5::TextWidgets KF5::AkonadiWidgets KF5::Contacts KF5::AkonadiContact Qt5::Network KF5::KIOCore KF5::ConfigWidgets PRIVATE Qt5::WebKitWidgets KF5::IMAP KF5::Libkdepim KF5::Archive KF5::Codecs KF5::NewStuff KF5::PimTextEdit KF5::SonnetCore KF5::Wallet KF5::DBusAddons KF5::KDELibs4Support KF5::XmlGui KF5::PimTextEdit ) target_include_directories(KF5PimCommon INTERFACE "$") target_include_directories(KF5PimCommon PUBLIC "$") target_include_directories(KF5PimCommon PUBLIC $) set_target_properties(KF5PimCommon PROPERTIES VERSION ${PIMCOMMON_VERSION_STRING} SOVERSION ${PIMCOMMON_SOVERSION} EXPORT_NAME PimCommon ) install(TARGETS KF5PimCommon EXPORT KF5PimCommonTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} ${LIBRARY_NAMELINK} ) if (BUILD_TESTING) add_subdirectory(translator/autotests) add_subdirectory(autocorrection/autotests) add_subdirectory(widgets/autotests) add_subdirectory(acl/autotests) add_subdirectory(temporaryfile/autotests) add_subdirectory(migration/autotests) add_subdirectory(util/autotests) add_subdirectory(shareserviceurl/autotests) add_subdirectory(translator/tests) add_subdirectory(widgets/tests) add_subdirectory(autocorrection/tests) add_subdirectory(folderdialog/tests/) add_subdirectory(storageservice/dropbox/tests) add_subdirectory(storageservice/hubic/tests) add_subdirectory(storageservice/tests) add_subdirectory(storageservice/yousendit/tests) add_subdirectory(storageservice/webdav/tests) add_subdirectory(storageservice/box/tests) add_subdirectory(storageservice/dropbox/icons/) add_subdirectory(storageservice/autotests) add_subdirectory(customtools/autotests) add_subdirectory(autotests) endif() if( LibKGAPI2_FOUND ) add_subdirectory(storageservice/gdrive/tests/) add_subdirectory(storageservice/gdrive/icons/) endif() ecm_generate_headers(PimCommon_CamelCase_HEADERS HEADER_NAMES PimUtil NetworkUtil CreateResource MetaType ImapResourceCapabilitiesManager REQUIRED_HEADERS PimCommon_HEADERS PREFIX PimCommon RELATIVE util ) ecm_generate_headers(PimCommon_Camelcaseshorturl_HEADERS HEADER_NAMES ShortUrlEnginePlugin ShortUrlEngineInterface REQUIRED_HEADERS PimCommon_shorturl_HEADERS PREFIX PimCommon RELATIVE customtools/shorturlplugin/shorturl/shorturlengineplugin/ ) ecm_generate_headers(PimCommon_Camelcasestorageservice_HEADERS HEADER_NAMES StorageServiceAbstract StorageServiceManager StorageServiceProgressManager StorageServiceJobConfig StorageServicePluginManager StorageServicePlugin StorageServiceInterface REQUIRED_HEADERS PimCommon_storageservice_HEADERS PREFIX PimCommon RELATIVE storageservice ) ecm_generate_headers(PimCommon_Camelcasestorageservice_dialog_HEADERS HEADER_NAMES StorageServiceCheckNameDialog REQUIRED_HEADERS PimCommon_storageservice_dialog_HEADERS PREFIX PimCommon RELATIVE storageservice/dialog/ ) ecm_generate_headers(PimCommon_Camelcasesettings_HEADERS HEADER_NAMES PimCommonSettings REQUIRED_HEADERS PimCommon_settings_HEADERS PREFIX PimCommon RELATIVE settings ) ecm_generate_headers(PimCommon_Camelcasestorageservicewidgets_HEADERS HEADER_NAMES StorageServiceProgressWidget StorageServiceTreeWidget StorageServiceConfigureWidget StorageServiceProgressIndicator REQUIRED_HEADERS PimCommon_storageservicewidgets_HEADERS PREFIX PimCommon RELATIVE storageservice/widgets ) ecm_generate_headers(PimCommon_Camelcasestorageservicedialog_HEADERS HEADER_NAMES StorageServiceConfigureDialog REQUIRED_HEADERS PimCommon_storageservicedialog_HEADERS PREFIX PimCommon RELATIVE storageservice/dialog ) ecm_generate_headers(PimCommon_Camelcasestorageservicesettings_HEADERS HEADER_NAMES StorageServiceSettings StorageServiceSettingsWidget REQUIRED_HEADERS PimCommon_storageservicesettings_HEADERS PREFIX PimCommon RELATIVE storageservice/settings ) ecm_generate_headers(PimCommon_Camelcaseshareserviceurl_HEADERS HEADER_NAMES ShareServiceUrlManager REQUIRED_HEADERS PimCommon_shareserviceurl_HEADERS PREFIX PimCommon RELATIVE shareserviceurl ) ecm_generate_headers(PimCommon_Camelcasetranslator_HEADERS HEADER_NAMES TranslatorWidget REQUIRED_HEADERS PimCommon_translator_HEADERS PREFIX PimCommon RELATIVE translator ) ecm_generate_headers(PimCommon_Camelcasecustomtools_HEADERS HEADER_NAMES CustomToolsWidgetng REQUIRED_HEADERS PimCommon_customtools_HEADERS PREFIX PimCommon RELATIVE customtools ) ecm_generate_headers(PimCommon_Camelcasestorageserviceinterface_HEADERS HEADER_NAMES ISettingsJob REQUIRED_HEADERS PimCommon_storageserviceinterface_HEADERS PREFIX PimCommon RELATIVE storageservice/interface ) ecm_generate_headers(PimCommon_Camelcasetemporaryfile_HEADERS HEADER_NAMES AttachmentTemporaryFilesDirs REQUIRED_HEADERS PimCommon_temporaryfile_HEADERS PREFIX PimCommon RELATIVE temporaryfile ) ecm_generate_headers(PimCommon_Camelcasesievehighlighter_HEADERS HEADER_NAMES SieveSyntaxHighlighterUtil SieveSyntaxHighlighter SieveSyntaxHighlighterRules REQUIRED_HEADERS PimCommon_sievehighlighter_HEADERS PREFIX PimCommon RELATIVE sievehighlighter ) ecm_generate_headers(PimCommon_Camelcaseacl_HEADERS HEADER_NAMES CollectionAclPage ImapAclAttribute CollectionAclPage REQUIRED_HEADERS PimCommon_acl_HEADERS PREFIX PimCommon RELATIVE acl ) ecm_generate_headers(PimCommon_Camelcasemigrate_HEADERS HEADER_NAMES MigrateApplicationFiles MigrateFileInfo REQUIRED_HEADERS PimCommon_migrate_HEADERS PREFIX PimCommon RELATIVE migration ) ecm_generate_headers(PimCommon_Camelcaseautocorrectionwidgets_HEADERS HEADER_NAMES RichTexteditWithAutoCorrection LineEditWithAutoCorrection REQUIRED_HEADERS PimCommon_autocorrectionwidgets_HEADERS PREFIX PimCommon RELATIVE autocorrection/widgets/ ) ecm_generate_headers(PimCommon_Camelcasemanagerserversidesubscription_HEADERS HEADER_NAMES ManageServerSideSubscriptionJob REQUIRED_HEADERS PimCommon_managerserversidesubscription_HEADERS PREFIX PimCommon RELATIVE manageserversidesubscription ) ecm_generate_headers(PimCommon_Camelcaseautocorrection_HEADERS HEADER_NAMES AutoCorrectionWidget AutoCorrectionLanguage AutoCorrection REQUIRED_HEADERS PimCommon_autocorrection_HEADERS PREFIX PimCommon RELATIVE autocorrection/ ) ecm_generate_headers(PimCommon_Camelcasefolderdialog_HEADERS HEADER_NAMES CheckedCollectionWidget SelectMultiCollectionDialog REQUIRED_HEADERS PimCommon_folderdialog_HEADERS PREFIX PimCommon RELATIVE folderdialog ) ecm_generate_headers(PimCommon_Camelcasetemplatelist_HEADERS HEADER_NAMES TemplateListWidget TemplateManager REQUIRED_HEADERS PimCommon_templatelist_HEADERS PREFIX PimCommon RELATIVE templatewidgets ) ecm_generate_headers(PimCommon_Camelcasewidgets_HEADERS HEADER_NAMES CustomTreeView SpellCheckLineEdit MinimumComboBox ConfigureImmutableWidgetUtils LineEditWithCompleter + LineEditWithKeywords RenameFileDialog SimpleStringlistEditor KActionMenuChangeCase AnnotationDialog REQUIRED_HEADERS PimCommon_widgets_HEADERS PREFIX PimCommon RELATIVE widgets ) ecm_generate_pri_file(BASE_NAME PimCommon LIB_NAME KF5PimCommon DEPS "AkonadiCore TextWidgets AkonadiWidgets Contacts AkonadiContact Network KIOCore ConfigWidgets" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KDE_INSTALL_INCLUDEDIR_KF5}/PimCommon ) if(${CMAKE_SOURCE_DIR} STREQUAL ${pimcommon_SOURCE_DIR}) install(FILES ${PimCommon_Camelcasestorageservicesettings_HEADERS} ${PimCommon_Camelcasestorageservice_dialog_HEADERS} ${PimCommon_CamelCase_HEADERS} ${PimCommon_Camelcasestorageservice_HEADERS} ${PimCommon_Camelcasesettings_HEADERS} ${PimCommon_Camelcasestorageservicewidgets_HEADERS} ${PimCommon_Camelcasestorageservicedialog_HEADERS} ${PimCommon_Camelcasestorageservicedialog_HEADERS} ${PimCommon_Camelcaseshareserviceurl_HEADERS} ${PimCommon_Camelcasetranslator_HEADERS} ${PimCommon_Camelcasecustomtools_HEADERS} ${PimCommon_Camelcasestorageserviceinterface_HEADERS} ${PimCommon_Camelcasetemporaryfile_HEADERS} ${PimCommon_Camelcasesievehighlighter_HEADERS} ${PimCommon_Camelcaseacl_HEADERS} ${PimCommon_Camelcasemigrate_HEADERS} ${PimCommon_Camelcaseautocorrectionwidgets_HEADERS} ${PimCommon_Camelcasemanagerserversidesubscription_HEADERS} ${PimCommon_Camelcaseautocorrection_HEADERS} ${PimCommon_Camelcaserichtexteditor_HEADERS} ${PimCommon_Camelcasefolderdialog_HEADERS} ${PimCommon_Camelcasetemplatelist_HEADERS} ${PimCommon_Camelcaseplaintexteditor_HEADERS} ${PimCommon_Camelcasetexteditor_commonwidget_HEADERS} ${PimCommon_Camelcasewidgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/PimCommon COMPONENT Devel ) install(FILES ${PimCommon_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/pimcommon_export.h ${CMAKE_CURRENT_BINARY_DIR}/pimcommon_debug.h ${CMAKE_CURRENT_BINARY_DIR}/pimcommonsetting_base.h ${CMAKE_CURRENT_BINARY_DIR}/imapresourcesettings.h ${PimCommon_storageservicesettings_HEADERS} ${PimCommon_storageservice_dialog_HEADERS} ${PimCommon_HEADERS} ${PimCommon_storageservice_HEADERS} ${PimCommon_settings_HEADERS} ${PimCommon_storageservicewidgets_HEADERS} ${PimCommon_storageservicedialog_HEADERS} ${PimCommon_storageservicedialog_HEADERS} ${PimCommon_shareserviceurl_HEADERS} ${PimCommon_translator_HEADERS} ${PimCommon_customtools_HEADERS} ${PimCommon_storageserviceinterface_HEADERS} ${PimCommon_temporaryfile_HEADERS} ${PimCommon_sievehighlighter_HEADERS} ${PimCommon_acl_HEADERS} ${PimCommon_migrate_HEADERS} ${PimCommon_autocorrectionwidgets_HEADERS} ${PimCommon_managerserversidesubscription_HEADERS} ${PimCommon_autocorrection_HEADERS} ${PimCommon_richtexteditor_HEADERS} ${PimCommon_folderdialog_HEADERS} ${PimCommon_templatelist_HEADERS} ${PimCommon_plaintexteditor_HEADERS} ${PimCommon_texteditor_commonwidget_HEADERS} ${PimCommon_widgets_HEADERS} DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/pimcommon COMPONENT Devel ) install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) endif() add_subdirectory(designer) add_subdirectory(customtools) add_subdirectory(storageservice) diff --git a/pimcommon/src/widgets/lineeditwithcompleter.h b/pimcommon/src/widgets/lineeditwithcompleter.h index 6eb2919087..fc0f3d01b7 100644 --- a/pimcommon/src/widgets/lineeditwithcompleter.h +++ b/pimcommon/src/widgets/lineeditwithcompleter.h @@ -1,40 +1,40 @@ /* Copyright (c) 2015 Montel Laurent This program 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. 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 */ #ifndef LINEEDITWITHCOMPLETER_H #define LINEEDITWITHCOMPLETER_H #include #include "pimcommon_export.h" namespace PimCommon { class PIMCOMMON_EXPORT LineEditWithCompleter : public KLineEdit { Q_OBJECT public: explicit LineEditWithCompleter(QWidget *parent = Q_NULLPTR); ~LineEditWithCompleter(); protected: void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE; -private Q_SLOTS: - void slotClearHistory(); +protected Q_SLOTS: + virtual void slotClearHistory(); }; } #endif // LINEEDITWITHCOMPLETER_H diff --git a/pimcommon/src/widgets/lineeditwithkeywords.cpp b/pimcommon/src/widgets/lineeditwithkeywords.cpp new file mode 100644 index 0000000000..106cdb8c80 --- /dev/null +++ b/pimcommon/src/widgets/lineeditwithkeywords.cpp @@ -0,0 +1,81 @@ +/* + Copyright (c) 2016 Rebois Guillaume + + This program 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. + + 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 +*/ + +#include "lineeditwithkeywords.h" +#include + +using namespace PimCommon; + +class Q_DECL_HIDDEN LineEditWithKeywords::Private +{ +public: + Private(LineEditWithKeywords *owner) + : q(owner) + { + } + LineEditWithKeywords *const q; + QStringList mKeywordList; + void initKeywordList(); + void addKeywordList(); + +}; + +LineEditWithKeywords::LineEditWithKeywords(QWidget *parent) + : LineEditWithCompleter(parent), d(new Private(this)) +{ + d->initKeywordList(); + d->addKeywordList(); +} + +LineEditWithKeywords::~LineEditWithKeywords() +{ + delete d; +} + +void LineEditWithKeywords::Private::initKeywordList() +{ + mKeywordList << i18n("in") << i18n("ago") << i18n("yesterday") << i18n("today") << i18n("first") << i18n("last") << i18n("next") << i18n("PM") << i18n("AM") + << i18n("pm") << i18n("am") << i18n("at") << i18n("containing") << i18n("contains") << i18n("greater than") << i18n("bigger than") << i18n("more than") + << i18n("at least") << i18n(">") << i18n("after") << i18n("since") << i18n("smaller than") << i18n("less than") << i18n("lesser than") << i18n("at most") + << i18n("<") << i18n("Before") << i18n("until") << i18n("equal to") << i18n("equal") << i18n("equals") << i18n("=") << i18n("rated as") << i18n("rated") + << i18n("score is") << i18n("score") << i18n("scored") << i18n("having") << i18n("stars") << i18n("star") << i18n("Comment") << i18n("described as") + << i18n("description is") << i18n("comment is") << i18n("description") << i18n("described") << i18n("comment") << i18n("sent by") << i18n("from") + << i18n("sender is") << i18n("sender") << i18n("title is") << i18n("subject is") << i18n("subject") << i18n("title") << i18n("titled") << i18n("sent to") + << i18n("recipient is") << i18n("recipient") << i18n("sent at") << i18n("sent on") << i18n("sent") << i18n("received at") << i18n("received on") + << i18n("received") << i18n("reception is") << i18n("written by") << i18n("created by") << i18n("composed by") << i18n("author is") << i18n("by") + << i18n("size is") << i18n("size") << i18n("being") << i18n("large") << i18n("name is") << i18n("name") << i18n("named") << i18n("name is") + << i18n("created at") << i18n("dated at") << i18n("created on") << i18n("dated on") << i18n("created in") << i18n("dated in") << i18n("created of") + << i18n("dated of") << i18n("created") << i18n("dated") << i18n("creation date is") << i18n("creation time is") << i18n("creation datetime is") + << i18n("modification date is") << i18n("modification time is") << i18n("modification datetime is") << i18n("edition date is") << i18n("edition time is") + << i18n("edition datetime is") << i18n("edited") << i18n("modified") << i18n("modified at") << i18n("modified on") << i18n("edited on") << i18n("edited at") + << i18n("tagged as") << i18n("has tag") << i18n("tag is") << i18n("#") << i18n("related to") << i18n("a") << i18n("year") << i18n("week") << i18n("month") + << i18n("day") << i18n("hour") << i18n("of") << i18n("by") << i18n("and") << i18n("on") << i18n("in") << i18n("or") << i18n("third") << i18n("second") << i18n("fourth") + << i18n("then"); +} + +void LineEditWithKeywords::Private::addKeywordList() +{ + Q_FOREACH(const QString &str, mKeywordList) { + q->completionObject()->addItem(str); + } +} + +void LineEditWithKeywords::slotClearHistory() +{ + LineEditWithCompleter::slotClearHistory(); + d->addKeywordList(); +} diff --git a/pimcommon/src/widgets/lineeditwithcompleter.h b/pimcommon/src/widgets/lineeditwithkeywords.h similarity index 59% copy from pimcommon/src/widgets/lineeditwithcompleter.h copy to pimcommon/src/widgets/lineeditwithkeywords.h index 6eb2919087..740f9a62aa 100644 --- a/pimcommon/src/widgets/lineeditwithcompleter.h +++ b/pimcommon/src/widgets/lineeditwithkeywords.h @@ -1,40 +1,37 @@ /* - Copyright (c) 2015 Montel Laurent + Copyright (c) 2016 Rebois Guillaume This program 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. 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 */ -#ifndef LINEEDITWITHCOMPLETER_H -#define LINEEDITWITHCOMPLETER_H +#ifndef LINEEDITWITHKEYWORDS_H +#define LINEEDITWITHKEYWORDS_H -#include -#include "pimcommon_export.h" +#include "lineeditwithcompleter.h" namespace PimCommon { -class PIMCOMMON_EXPORT LineEditWithCompleter : public KLineEdit +class PIMCOMMON_EXPORT LineEditWithKeywords : public LineEditWithCompleter { Q_OBJECT public: - explicit LineEditWithCompleter(QWidget *parent = Q_NULLPTR); - ~LineEditWithCompleter(); - -protected: - void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE; - -private Q_SLOTS: - void slotClearHistory(); + explicit LineEditWithKeywords(QWidget *parent = Q_NULLPTR); + ~LineEditWithKeywords(); +private: + void slotClearHistory() Q_DECL_OVERRIDE; + class Private; + Private *const d; }; } -#endif // LINEEDITWITHCOMPLETER_H +#endif // KEYWORDS_H