Commit 03a65d8c authored by Laurent Montel's avatar Laurent Montel 😁

Add akonadicombobox

parent db3b8e43
......@@ -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);
}
......
......@@ -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
......@@ -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")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment