Messagelib

recipientline.h
1 /*
2  SPDX-FileCopyrightText: 2010 Casey Link <[email protected]>
3  SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #pragma once
9 
10 #include <QSharedPointer>
11 
12 #include "MessageComposer/Recipient"
13 
14 #include <Libkdepim/MultiplyingLine>
15 #include <MessageComposer/ComposerLineEdit>
16 
17 #include <QComboBox>
18 
19 namespace MessageComposer
20 {
21 class RecipientComboBox : public QComboBox
22 {
23  Q_OBJECT
24 public:
25  explicit RecipientComboBox(QWidget *parent);
26 
27 Q_SIGNALS:
28  void rightPressed();
29 
30 protected:
31  void keyPressEvent(QKeyEvent *ev) override;
32 };
33 /**
34  * @brief The RecipientLineEdit class
35  */
36 class MESSAGECOMPOSER_EXPORT RecipientLineEdit : public MessageComposer::ComposerLineEdit
37 {
38  Q_OBJECT
39 public:
40  explicit RecipientLineEdit(QWidget *parent);
41 
42 Q_SIGNALS:
43  void deleteMe();
44  void leftPressed();
45  void rightPressed();
46 
47 protected:
48  void keyPressEvent(QKeyEvent *ev) override;
49 };
50 
51 /**
52  * @brief The RecipientLineNG class
53  */
54 class MESSAGECOMPOSER_EXPORT RecipientLineNG : public KPIM::MultiplyingLine
55 {
56  Q_OBJECT
57 public:
58  explicit RecipientLineNG(QWidget *parent);
59  ~RecipientLineNG() override = default;
60 
61  void activate() override;
62  Q_REQUIRED_RESULT bool isActive() const override;
63 
64  Q_REQUIRED_RESULT bool isEmpty() const override;
65  void clear() override;
66  Q_REQUIRED_RESULT bool canDeleteLineEdit() const override;
67 
68  Q_REQUIRED_RESULT bool isModified() const override;
69  void clearModified() override;
70 
71  Q_REQUIRED_RESULT KPIM::MultiplyingLineData::Ptr data() const override;
72  void setData(const KPIM::MultiplyingLineData::Ptr &data) override;
73 
74  void fixTabOrder(QWidget *previous) override;
75  Q_REQUIRED_RESULT QWidget *tabOut() const override;
76 
77  void setCompletionMode(KCompletion::CompletionMode mode) override;
78 
79  Q_REQUIRED_RESULT int setColumnWidth(int w) override;
80 
81  // recipient specific methods
82  Q_REQUIRED_RESULT int recipientsCount() const;
83 
84  void setRecipientType(Recipient::Type);
85  Q_REQUIRED_RESULT Recipient::Type recipientType() const;
86  Q_REQUIRED_RESULT QSharedPointer<Recipient> recipient() const;
87 
88  void setIcon(const QIcon &icon, const QString &tooltip = QString());
89 
90  /**
91  * Sets the config file used for storing recent addresses.
92  */
93  void setRecentAddressConfig(KConfig *config);
94 
95  void setEnableIndexSearch(bool enableIndexSearch);
96  Q_REQUIRED_RESULT bool enableIndexSearch() const;
97 
98  void setEnableAkonadiSearch(bool enableAkonadiSearch);
99  Q_REQUIRED_RESULT bool enableAkonadiSearch() const;
100 
101  Q_REQUIRED_RESULT QString rawData() const;
102 
103 Q_SIGNALS:
104  void typeModified(RecipientLineNG *);
105  void addRecipient(RecipientLineNG *, const QString &);
106  void countChanged();
107  void iconClicked();
108  void activeChanged();
109 
110 protected Q_SLOTS:
111  void slotEditingFinished();
112  void slotTypeModified();
113  void analyzeLine(const QString &);
114 
115 protected:
116  bool eventFilter(QObject *watched, QEvent *event) override;
117 
118 private:
119  void dataFromFields();
120  void fieldsFromData();
121  void slotAddRecipient(const QString &);
122  RecipientComboBox *mCombo = nullptr;
123  RecipientLineEdit *mEdit = nullptr;
124  int mRecipientsCount = 0;
125  bool mModified = false;
127 };
128 }
129 
Q_SIGNALSQ_SIGNALS
The ComposerLineEdit class.
The RecipientLineNG class.
Definition: recipientline.h:54
Q_OBJECTQ_OBJECT
The RecipientLineEdit class.
Definition: recipientline.h:36
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:16:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.