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 #ifndef RECIPIENTLINE_H
9 #define RECIPIENTLINE_H
10 
11 #include <QSharedPointer>
12 
13 #include "MessageComposer/Recipient"
14 
15 #include <Libkdepim/MultiplyingLine>
16 #include <MessageComposer/ComposerLineEdit>
17 
18 #include <QComboBox>
19 
20 namespace MessageComposer {
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 };
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 
54 class MESSAGECOMPOSER_EXPORT RecipientLineNG : public KPIM::MultiplyingLine
55 {
56  Q_OBJECT
57 public:
58  explicit RecipientLineNG(QWidget *parent);
59  ~RecipientLineNG() override
60  {
61  }
62 
63  void activate() override;
64  Q_REQUIRED_RESULT bool isActive() const override;
65 
66  Q_REQUIRED_RESULT bool isEmpty() const override;
67  void clear() override;
68  Q_REQUIRED_RESULT bool canDeleteLineEdit() const override;
69 
70  Q_REQUIRED_RESULT bool isModified() const override;
71  void clearModified() override;
72 
73  Q_REQUIRED_RESULT KPIM::MultiplyingLineData::Ptr data() const override;
74  void setData(const KPIM::MultiplyingLineData::Ptr &data) override;
75 
76  void fixTabOrder(QWidget *previous) override;
77  Q_REQUIRED_RESULT QWidget *tabOut() const override;
78 
79  void setCompletionMode(KCompletion::CompletionMode mode) override;
80 
81  Q_REQUIRED_RESULT int setColumnWidth(int w) override;
82 
83  // recipient specific methods
84  Q_REQUIRED_RESULT int recipientsCount() const;
85 
86  void setRecipientType(Recipient::Type);
87  Q_REQUIRED_RESULT Recipient::Type recipientType() const;
88  Q_REQUIRED_RESULT QSharedPointer<Recipient> recipient() const;
89 
90  void setIcon(const QIcon &icon, const QString &tooltip = QString());
91 
95  void setRecentAddressConfig(KConfig *config);
96 
97  void setEnableIndexSearch(bool enableIndexSearch);
98  Q_REQUIRED_RESULT bool enableIndexSearch() const;
99 
100  void setEnableAkonadiSearch(bool enableAkonadiSearch);
101  Q_REQUIRED_RESULT bool enableAkonadiSearch() const;
102 
103  Q_REQUIRED_RESULT QString rawData() const;
104 
105 Q_SIGNALS:
106  void typeModified(RecipientLineNG *);
107  void addRecipient(RecipientLineNG *, const QString &);
108  void countChanged();
109  void iconClicked();
110  void activeChanged();
111 
112 protected Q_SLOTS:
113  void slotEditingFinished();
114  void slotTypeModified();
115  void analyzeLine(const QString &);
116 
117 protected:
118  bool eventFilter(QObject *watched, QEvent *event) override;
119 
120 private:
121  void dataFromFields();
122  void fieldsFromData();
123  void slotAddRecipient(const QString &);
124  RecipientComboBox *mCombo = nullptr;
125  RecipientLineEdit *mEdit = nullptr;
126  int mRecipientsCount = 0;
127  bool mModified = false;
129 };
130 }
131 
132 #endif // RECIPIENTLINE_H
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-2020 The KDE developers.
Generated on Thu Aug 13 2020 23:13:07 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.