Commit f493a082 authored by Laurent Montel's avatar Laurent Montel
Browse files

Adapt to new api

parent c0238c3d
Pipeline #219885 failed with stage
in 4 minutes and 33 seconds
......@@ -55,7 +55,7 @@ set(QT_REQUIRED_VERSION "5.15.2")
find_package(Qt${QT_MAJOR_VERSION} ${QT_REQUIRED_VERSION} CONFIG REQUIRED Widgets Test DBus PrintSupport)
set(LIBKDEPIM_LIB_VERSION "5.21.40")
set(LIBGRANTLEETHEME_LIB_VERSION "5.21.40")
set(PIMCOMMON_LIB_VERSION "5.21.40")
set(PIMCOMMON_LIB_VERSION "5.21.41")
set(AKONADI_SEARCH_VERSION "5.21.40")
set(AKONADI_CONTACT_VERSION "5.21.40")
......
......@@ -829,18 +829,20 @@ void MainWidget::setQRCodeShow(bool on)
}
}
Akonadi::Item::List MainWidget::selectedItems()
Akonadi::Item::List MainWidget::selectedItems(bool &canceled)
{
Akonadi::Item::List items;
QPointer<KAddressBookImportExport::ContactSelectionDialog> dlg =
new KAddressBookImportExport::ContactSelectionDialog(mItemView->selectionModel(), false, this);
dlg->setDefaultAddressBook(currentAddressBook());
if (!dlg->exec() || !dlg) {
canceled = true;
delete dlg;
return items;
}
items = dlg->selectedItems();
canceled = false;
delete dlg;
return items;
......
......@@ -67,16 +67,16 @@ public:
~MainWidget() override;
void updateQuickSearchText();
const Akonadi::Item::List collectSelectedAllContactsItem();
Q_REQUIRED_RESULT const Akonadi::Item::List collectSelectedAllContactsItem();
/**
* Returns the address book collection that is currently
* selected by the user or an invalid collection if no
* address book is selected.
*/
Akonadi::Collection currentAddressBook() const;
Q_REQUIRED_RESULT Akonadi::Collection currentAddressBook() const;
Akonadi::Item::List selectedItems();
Q_REQUIRED_RESULT Akonadi::Item::List selectedItems(bool &canceled);
void initializePluginActions();
public Q_SLOTS:
......
......@@ -26,19 +26,20 @@ KAddressBookPluginInterface *KAddressBookPluginInterface::self()
return &s_self;
}
void KAddressBookPluginInterface::initializeInterfaceRequires(PimCommon::AbstractGenericPluginInterface *abstractInterface)
bool KAddressBookPluginInterface::initializeInterfaceRequires(PimCommon::AbstractGenericPluginInterface *abstractInterface)
{
if (!mMainWidget) {
qCCritical(KADDRESSBOOK_LOG) << "Main windows pointer not defined";
return;
return false;
}
bool canceled = false;
auto interface = static_cast<PimCommon::GenericPluginInterface *>(abstractInterface);
PimCommon::GenericPluginInterface::RequireTypes requiresFeatures = interface->requiresFeatures();
const PimCommon::GenericPluginInterface::RequireTypes requiresFeatures = interface->requiresFeatures();
if (requiresFeatures & PimCommon::GenericPluginInterface::CurrentItems) {
interface->setCurrentItems(mMainWidget->collectSelectedAllContactsItem());
}
if (requiresFeatures & PimCommon::GenericPluginInterface::Items) {
interface->setItems(mMainWidget->selectedItems());
interface->setItems(mMainWidget->selectedItems(canceled));
}
if (requiresFeatures & PimCommon::GenericPluginInterface::CurrentCollection) {
interface->setCurrentCollection(mMainWidget->currentAddressBook());
......@@ -46,6 +47,11 @@ void KAddressBookPluginInterface::initializeInterfaceRequires(PimCommon::Abstrac
if (requiresFeatures & PimCommon::GenericPluginInterface::Collections) {
qCDebug(KADDRESSBOOK_LOG) << "PimCommon::GenericPluginInterface::Collections not implemented";
}
if (canceled) {
return false;
} else {
return true;
}
}
void KAddressBookPluginInterface::setMainWidget(MainWidget *mainWidget)
......
......@@ -23,7 +23,7 @@ public:
void setMainWidget(MainWidget *mainWidget);
void initializeInterfaceRequires(PimCommon::AbstractGenericPluginInterface *interface) override;
bool initializeInterfaceRequires(PimCommon::AbstractGenericPluginInterface *interface) override;
static KAddressBookPluginInterface *self();
private:
......
Supports Markdown
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