summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2016-07-12 07:18:16 +0200
committerMontel Laurent <[email protected]>2016-07-12 07:18:16 +0200
commit03a65d8c1ba6715260f4fce094a63078cf28adb9 (patch)
tree27fb4203bf860f0c23e4d7d53a0ae97d5d9c9fd5
parentdb3b8e43b649061ae2837554204a45f330ccc08f (diff)
Add akonadicombobox
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp27
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h6
-rw-r--r--kmail/editorsendcheckplugins/automaticaddcontacts/autotests/CMakeLists.txt2
3 files changed, 34 insertions, 1 deletions
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
index d279c57..8711932 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.cpp
@@ -18,9 +18,13 @@
*/
#include "automaticaddcontactsconfigurewidget.h"
+#include <AkonadiCore/Collection>
+#include <AkonadiWidgets/CollectionComboBox>
+#include <KContacts/Addressee>
#include <KLocalizedString>
#include <QCheckBox>
#include <QVBoxLayout>
+#include <QLabel>
#include <KConfigGroup>
#include <KSharedConfig>
@@ -31,7 +35,30 @@ AutomaticAddContactsWidget::AutomaticAddContactsWidget(QWidget *parent)
mainLayout->setObjectName(QStringLiteral("mainlayout"));
mEnabled = new QCheckBox(i18n("Automatic Add Contacts"), this);
mEnabled->setObjectName(QStringLiteral("enabled"));
+ connect(mEnabled, &QCheckBox::clicked, this, &AutomaticAddContactsWidget::configureChanged);
mainLayout->addWidget(mEnabled);
+
+ QHBoxLayout *hlay = new QHBoxLayout;
+ hlay->setMargin(0);
+ hlay->setObjectName(QStringLiteral("folderlayout"));
+ mainLayout->addLayout(hlay);
+
+ QLabel *lab = new QLabel(i18n("Select the addressbook to store contacts:"), this);
+ lab->setObjectName(QStringLiteral("labelfolder"));
+ mainLayout->addWidget(lab);
+
+
+ mCollectionCombobox = new Akonadi::CollectionComboBox;
+ mCollectionCombobox->setAccessRightsFilter(Akonadi::Collection::CanCreateItem);
+ mCollectionCombobox->setMinimumWidth(250);
+ mCollectionCombobox->setMimeTypeFilter(QStringList() << KContacts::Addressee::mimeType());
+ mCollectionCombobox->setObjectName(QStringLiteral("akonadicombobox"));
+ connect(mCollectionCombobox, static_cast<void (Akonadi::CollectionComboBox::*)(int)>(&Akonadi::CollectionComboBox::currentIndexChanged),
+ this, &AutomaticAddContactsWidget::configureChanged);
+ connect(mCollectionCombobox, static_cast<void (Akonadi::CollectionComboBox::*)(int)>(&Akonadi::CollectionComboBox::activated),
+ this, &AutomaticAddContactsWidget::configureChanged);
+
+
mainLayout->addStretch(1);
}
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
index a2e390e..9b9e179 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/automaticaddcontactsconfigurewidget.h
@@ -23,6 +23,11 @@
#include <QWidget>
#include <MessageComposer/PluginEditorCheckBeforeSendConfigureWidget>
class QCheckBox;
+
+namespace Akonadi {
+class CollectionComboBox;
+}
+
class AutomaticAddContactsWidget : public MessageComposer::PluginEditorCheckBeforeSendConfigureWidget
{
Q_OBJECT
@@ -35,6 +40,7 @@ public:
void resetSettings() Q_DECL_OVERRIDE;
private:
QCheckBox *mEnabled;
+ Akonadi::CollectionComboBox *mCollectionCombobox;
};
#endif // CONFIRMADDRESSCONFIGUREWIDGET_H
diff --git a/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/CMakeLists.txt b/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/CMakeLists.txt
index e3c12ae..40e27ed 100644
--- a/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/CMakeLists.txt
+++ b/kmail/editorsendcheckplugins/automaticaddcontacts/autotests/CMakeLists.txt
@@ -8,7 +8,7 @@ macro(add_kmail_automaticaddscontacts_unittest _source _additional)
add_test( ${_name} ${_name} )
ecm_mark_as_test(kmail_editorplugin-${_name})
- target_link_libraries( ${_name} Qt5::Test KF5::IconThemes KF5::MessageComposer KF5::I18n KF5::PimCommon)
+ target_link_libraries( ${_name} Qt5::Test KF5::IconThemes KF5::MessageComposer KF5::I18n KF5::PimCommon KF5::AkonadiWidgets)
endmacro ()
add_kmail_automaticaddscontacts_unittest(automaticaddcontactsplugintest.cpp "../automaticaddcontactsjob.cpp;../automaticaddcontactsplugin.cpp;../automaticaddcontactsinterface.cpp;../automaticaddcontactsconfigurewidget.cpp")