File indexing completed on 2024-06-02 05:18:56
0001 /* 0002 SPDX-FileCopyrightText: 2009 Tobias Koenig <tokoe@kde.org> 0003 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #pragma once 0009 0010 #include "contactlist.h" 0011 #include "exportselectionwidget.h" 0012 #include "kaddressbook_importexport_export.h" 0013 0014 #include <Akonadi/Item> 0015 #include <QDialog> 0016 0017 class QItemSelectionModel; 0018 namespace Akonadi 0019 { 0020 class Collection; 0021 } 0022 0023 namespace KAddressBookImportExport 0024 { 0025 class ContactSelectionWidget; 0026 0027 /** 0028 * @short A dialog to select a group of contacts. 0029 * 0030 * @author Tobias Koenig <tokoe@kde.org> 0031 */ 0032 class KADDRESSBOOK_IMPORTEXPORT_EXPORT ContactSelectionDialog : public QDialog 0033 { 0034 Q_OBJECT 0035 0036 public: 0037 /** 0038 * Creates a new contact selection dialog. 0039 * 0040 * @param selectionModel The model that contains the currently selected contacts. 0041 * @param parent The parent widget. 0042 */ 0043 explicit ContactSelectionDialog(QItemSelectionModel *selectionModel, bool allowToSelectTypeToExport, QWidget *parent = nullptr); 0044 0045 /** 0046 * Sets the @p message text. 0047 */ 0048 void setMessageText(const QString &message); 0049 0050 /** 0051 * Sets the default addressbook. 0052 */ 0053 void setDefaultAddressBook(const Akonadi::Collection &addressBook); 0054 0055 /** 0056 * Returns the list of selected contacts. 0057 */ 0058 [[nodiscard]] ContactList selectedContacts() const; 0059 0060 [[nodiscard]] ExportSelectionWidget::ExportFields exportType() const; 0061 void setAddGroupContact(bool addGroupContact); 0062 0063 [[nodiscard]] Akonadi::Item::List selectedItems() const; 0064 0065 private: 0066 ContactSelectionWidget *const mSelectionWidget; 0067 ExportSelectionWidget *mVCardExport = nullptr; 0068 }; 0069 }