1/*
2 This file is part of libkabc.
3 Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef KABC_DISTRIBUTIONLISTDIALOG_H
22#define KABC_DISTRIBUTIONLISTDIALOG_H
23
24#include <QWidget>
25
26#include <kdialog.h>
27#include "kabc_export.h"
28
29namespace KABC {
30
31class AddressBook;
32class DistributionListEditorWidget;
33
34/**
35 @short Frontend to create distribution lists
36
37 Creating a new DistributionListDialog does automatically
38 load all addressees and distribution lists from the config
39 files. The changes will be saved when clicking the 'OK'
40 button.
41
42 Example:
43
44 \code
45 KABC::DistributionListDialog *dlg = new
46 KABC::DistributionListDialog( KABC::StdAddressBook::self(), this );
47
48 dlg->exec();
49 \endcode
50*/
51class KABC_DEPRECATED_EXPORT DistributionListDialog : public KDialog
52{
53 Q_OBJECT
54
55 public:
56 /**
57 Constructor.
58
59 @param ab The addressbook, the addressees should be used from
60 @param parent The parent widget
61 */
62 explicit DistributionListDialog( AddressBook *ab, QWidget *parent = 0 );
63
64 /**
65 Destructor.
66 */
67 virtual ~DistributionListDialog();
68
69 private:
70 class Private;
71 Private *const d;
72};
73
74/**
75 @short Helper class
76*/
77class KABC_DEPRECATED_EXPORT EmailSelector : public KDialog
78{
79 public:
80 /**
81 Creates a dialog for selecting an email address from a list.
82
83 It will usually be more convenient to use getEmail() instead.
84
85 @param emails The list of email addresses to choose from
86 @param current The email address to pre-select. Can be @c QString()
87 @param parent The QWidget parent for the dialog
88 */
89 EmailSelector( const QStringList &emails, const QString &current, QWidget *parent = 0 );
90
91 /**
92 Destroys the dialog instance.
93 */
94 ~EmailSelector();
95
96 /**
97 Returns the selected email address.
98 */
99 QString selected() const;
100
101 /**
102 Returns the user's choice from a list of possible email addresses.
103
104 Convenience method that creates and executes the selection dialog
105 and returns the selected email address.
106
107 @param emails The list of email addresses to choose from
108 @param current The email address to pre-select. Can be @c QString()
109 @param parent The QWidget parent for the dialog
110
111 @return the selected email address or @c QString() if non was selected
112 */
113 static QString getEmail( const QStringList &emails, const QString &current,
114 QWidget *parent = 0 );
115
116 private:
117 class Private;
118 Private *const d;
119};
120
121/**
122 @short Helper class
123*/
124class KABC_EXPORT DistributionListEditorWidget : public QWidget
125{
126 Q_OBJECT
127
128 public:
129 /**
130 Creates an editor widget for distribution lists.
131
132 @param addressBook The address book to get addressees from
133 @param parent The QWidget parent
134 */
135 explicit DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent = 0 );
136
137 /**
138 Destroys the widget instance.
139 */
140 virtual ~DistributionListEditorWidget();
141
142 private:
143 class Private;
144 Private *const d;
145
146 Q_PRIVATE_SLOT( d, void newList() )
147 Q_PRIVATE_SLOT( d, void editList() )
148 Q_PRIVATE_SLOT( d, void removeList() )
149 Q_PRIVATE_SLOT( d, void addEntry() )
150 Q_PRIVATE_SLOT( d, void removeEntry() )
151 Q_PRIVATE_SLOT( d, void changeEmail() )
152 Q_PRIVATE_SLOT( d, void updateEntryView() )
153 Q_PRIVATE_SLOT( d, void updateAddresseeView() )
154 Q_PRIVATE_SLOT( d, void updateNameCombo() )
155 Q_PRIVATE_SLOT( d, void slotSelectionEntryViewChanged() )
156 Q_PRIVATE_SLOT( d, void slotSelectionAddresseeViewChanged() )
157 Q_PRIVATE_SLOT( d, void save() )
158};
159
160}
161#endif
162