Messagelib

recipientseditor.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  Refactored from earlier code by:
6  SPDX-FileCopyrightText: 2010 Volker Krause <[email protected]>
7  SPDX-FileCopyrightText: 2004 Cornelius Schumacher <[email protected]>
8 
9  SPDX-License-Identifier: LGPL-2.0-or-later
10 */
11 #pragma once
12 
13 #include "messagecomposer_export.h"
14 
15 #include "recipientline.h"
16 
17 #include <Libkdepim/MultiplyingLineEditor>
18 
19 namespace KMime
20 {
21 namespace Types
22 {
23 class Mailbox;
24 }
25 }
26 namespace MessageComposer
27 {
28 /**
29  * @brief The RecipientLineFactory class
30  */
31 class MESSAGECOMPOSER_EXPORT RecipientLineFactory : public KPIM::MultiplyingLineFactory
32 {
33  Q_OBJECT
34 public:
35  explicit RecipientLineFactory(QObject *parent);
36  KPIM::MultiplyingLine *newLine(QWidget *parent) override;
37  int maximumRecipients() override;
38 };
39 
40 class RecipientsPicker;
41 class RecipientsEditorPrivate;
42 /**
43  * @brief The RecipientsEditor class
44  */
45 class MESSAGECOMPOSER_EXPORT RecipientsEditor : public KPIM::MultiplyingLineEditor
46 {
47  Q_OBJECT
48 public:
49  explicit RecipientsEditor(QWidget *parent = nullptr);
50  explicit RecipientsEditor(RecipientLineFactory *lineFactory, QWidget *parent = nullptr);
51  ~RecipientsEditor() override;
52 
53  Q_REQUIRED_RESULT Recipient::List recipients() const;
54  Q_REQUIRED_RESULT QSharedPointer<Recipient> activeRecipient() const;
55 
56  Q_REQUIRED_RESULT MessageComposer::RecipientsPicker *picker() const;
57 
58  bool setRecipientString(const QVector<KMime::Types::Mailbox> &mailboxes, Recipient::Type);
59  Q_REQUIRED_RESULT QString recipientString(Recipient::Type) const;
60  Q_REQUIRED_RESULT QStringList recipientStringList(Recipient::Type) const;
61 
62  /** Adds a recipient (or multiple recipients) to one line of the editor.
63  @param recipient The recipient(s) you want to add.
64  @param type The recipient type.
65  */
66  bool addRecipient(const QString &recipient, Recipient::Type type);
67 
68  /** Removes the recipient provided it can be found and has the given type.
69  @param recipient The recipient(s) you want to remove.
70  @param type The recipient type.
71  */
72  void removeRecipient(const QString &recipient, Recipient::Type type);
73 
74  /**
75  * Sets the config file used for storing recent addresses.
76  */
77  void setRecentAddressConfig(KConfig *config);
78 
79 public Q_SLOTS:
80  void selectRecipients();
81  void saveDistributionList();
82 
83 protected Q_SLOTS:
84  void slotPickedRecipient(const Recipient &, bool &tooManyAddress);
85  void slotLineAdded(KPIM::MultiplyingLine *);
86  void slotLineDeleted(int pos);
87  void slotCalculateTotal();
88  void addRecipient(RecipientLineNG *, const QString &);
89 
90 protected:
91  bool eventFilter(QObject *object, QEvent *event) override;
92  Q_REQUIRED_RESULT RecipientLineNG *activeLine() const override;
93 
94 Q_SIGNALS:
95  void focusInRecipientLineEdit();
96 
97 private:
98  std::unique_ptr<RecipientsEditorPrivate> const d;
99 };
100 }
101 
The RecipientLineNG class.
Definition: recipientline.h:54
The RecipientLineFactory class.
PartitionTable::TableType type
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
The Recipient class.
Definition: recipient.h:27
The RecipientsEditor class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.