Messagelib

recipientseditor.h
1/*
2 SPDX-FileCopyrightText: 2010 Casey Link <unnamedrambler@gmail.com>
3 SPDX-FileCopyrightText: 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
4
5 Refactored from earlier code by:
6 SPDX-FileCopyrightText: 2010 Volker Krause <vkrause@kde.org>
7 SPDX-FileCopyrightText: 2004 Cornelius Schumacher <schumacher@kde.org>
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
19namespace KMime
20{
21namespace Types
22{
23class Mailbox;
24}
25}
26namespace MessageComposer
27{
28/**
29 * @brief The RecipientLineFactory class
30 */
31class MESSAGECOMPOSER_EXPORT RecipientLineFactory : public KPIM::MultiplyingLineFactory
32{
33 Q_OBJECT
34public:
35 explicit RecipientLineFactory(QObject *parent);
36 KPIM::MultiplyingLine *newLine(QWidget *parent) override;
37 int maximumRecipients() override;
38};
39
40class RecipientsPicker;
41class RecipientsEditorPrivate;
42/**
43 * @brief The RecipientsEditor class
44 */
45class MESSAGECOMPOSER_EXPORT RecipientsEditor : public KPIM::MultiplyingLineEditor
46{
47 Q_OBJECT
48public:
49 explicit RecipientsEditor(QWidget *parent = nullptr);
50 explicit RecipientsEditor(RecipientLineFactory *lineFactory, QWidget *parent = nullptr);
51 ~RecipientsEditor() override;
52
53 [[nodiscard]] Recipient::List recipients() const;
54 [[nodiscard]] QSharedPointer<Recipient> activeRecipient() const;
55
56 [[nodiscard]] MessageComposer::RecipientsPicker *picker() const;
57
58 bool setRecipientString(const QList<KMime::Types::Mailbox> &mailboxes, Recipient::Type);
59 [[nodiscard]] QString recipientString(Recipient::Type) const;
60 [[nodiscard]] 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
79public Q_SLOTS:
80 void selectRecipients();
81 void saveDistributionList();
82
83protected 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
90protected:
91 bool eventFilter(QObject *object, QEvent *event) override;
92 [[nodiscard]] RecipientLineNG *activeLine() const override;
93
94Q_SIGNALS:
95 void focusInRecipientLineEdit();
96
97private:
98 std::unique_ptr<RecipientsEditorPrivate> const d;
99};
100}
The RecipientLineFactory class.
The RecipientLineNG class.
The Recipient class.
Definition recipient.h:28
The RecipientsEditor class.
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-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.