1 /*
2     SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
3     This file was part of KMail.
4     SPDX-FileCopyrightText: 2005 Cornelius Schumacher <schumacher@kde.org>
5 
6     SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 #pragma once
9 
10 #include <MessageComposer/Recipient>
11 
12 #include <KContacts/Addressee>
13 #include <QDialog>
14 
15 class QPushButton;
16 class QLabel;
17 namespace PimCommon
18 {
19 class LdapSearchDialog;
20 }
21 
22 namespace Akonadi
23 {
24 class RecipientsPickerWidget;
25 }
26 
27 namespace MessageComposer
28 {
29 class RecipientsPicker : public QDialog
30 {
31     Q_OBJECT
32 
33 public:
34     explicit RecipientsPicker(QWidget *parent);
35     ~RecipientsPicker() override;
36 
37     void setRecipients(const Recipient::List &);
38 
39     void setDefaultType(Recipient::Type);
40 
41 Q_SIGNALS:
42     void pickedRecipient(const Recipient &, bool &);
43 
44 protected:
45     void readConfig();
46     void writeConfig();
47 
48     void pick(Recipient::Type);
49 
50     void keyPressEvent(QKeyEvent *) override;
51 
52 protected Q_SLOTS:
53     void slotToClicked();
54     void slotCcClicked();
55     void slotBccClicked();
56     void slotReplyToClicked();
57     void slotPicked();
58     void slotSearchLDAP();
59     void ldapSearchResult();
60     void slotSelectionChanged();
61 
62 private:
63     void updateLabel(int nbSelected);
64     Akonadi::RecipientsPickerWidget *const mView;
65 
66     PimCommon::LdapSearchDialog *mLdapSearchDialog = nullptr;
67 
68     Recipient::Type mDefaultType;
69     QPushButton *mUser4Button = nullptr;
70     QPushButton *mUser3Button = nullptr;
71     QPushButton *mUser2Button = nullptr;
72     QPushButton *mUser1Button = nullptr;
73     QLabel *const mSelectedLabel = nullptr;
74 };
75 }
76 
77