File indexing completed on 2024-06-23 05:18:37

0001 /*
0002     SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
0003     This file was part of KMail.
0004     SPDX-FileCopyrightText: 2005 Cornelius Schumacher <schumacher@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 #pragma once
0009 
0010 #include <MessageComposer/Recipient>
0011 
0012 #include <KContacts/Addressee>
0013 #include <QDialog>
0014 
0015 class QPushButton;
0016 class QLabel;
0017 namespace PimCommon
0018 {
0019 class LdapSearchDialog;
0020 }
0021 
0022 namespace Akonadi
0023 {
0024 class RecipientsPickerWidget;
0025 }
0026 
0027 namespace MessageComposer
0028 {
0029 class RecipientsPicker : public QDialog
0030 {
0031     Q_OBJECT
0032 
0033 public:
0034     explicit RecipientsPicker(QWidget *parent);
0035     ~RecipientsPicker() override;
0036 
0037     void setRecipients(const Recipient::List &);
0038 
0039     void setDefaultType(Recipient::Type);
0040 
0041 Q_SIGNALS:
0042     void pickedRecipient(const Recipient &, bool &);
0043 
0044 protected:
0045     void readConfig();
0046     void writeConfig();
0047 
0048     void pick(Recipient::Type);
0049 
0050     void keyPressEvent(QKeyEvent *) override;
0051 
0052 protected Q_SLOTS:
0053     void slotToClicked();
0054     void slotCcClicked();
0055     void slotBccClicked();
0056     void slotReplyToClicked();
0057     void slotPicked();
0058     void slotSearchLDAP();
0059     void ldapSearchResult();
0060     void slotSelectionChanged();
0061 
0062 private:
0063     void updateLabel(int nbSelected);
0064     Akonadi::RecipientsPickerWidget *const mView;
0065 
0066     PimCommon::LdapSearchDialog *mLdapSearchDialog = nullptr;
0067 
0068     Recipient::Type mDefaultType;
0069     QPushButton *mUser4Button = nullptr;
0070     QPushButton *mUser3Button = nullptr;
0071     QPushButton *mUser2Button = nullptr;
0072     QPushButton *mUser1Button = nullptr;
0073     QLabel *const mSelectedLabel = nullptr;
0074 };
0075 }