2 simplestringlisteditor.h
4 This file is part of KMail, the KDE mail client.
5 Copyright (c) 2001 Marc Mutz <mutz@kde.org>
7 KMail is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License, version 2, as
9 published by the Free Software Foundation.
11 KMail is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 In addition, as a special exception, the copyright holders give
21 permission to link the code of this program with any edition of
22 the Qt library by Trolltech AS, Norway (or with modified versions
23 of Qt that use the same license as Qt), and distribute linked
24 combinations including the two. You must obey the GNU General
25 Public License in all respects for all of the code used other than
26 Qt. If you modify this file, you may extend this exception to
27 your version of the file, but you are not obligated to do so. If
28 you do not wish to do so, delete this exception statement from
32 #ifndef _SIMPLESTRINGLISTEDITOR_H_
33 #define _SIMPLESTRINGLISTEDITOR_H_
36 #include <QStringList>
44 // SimpleStringListEditor (a listbox with "add..." and "remove" buttons)
48 class SimpleStringListEditor
: public QWidget
{
52 None
= 0x00, Add
= 0x01,
53 Remove
= 0x02, Modify
= 0x04,
54 Up
= 0x08, Down
= 0x10,
55 All
= Add
|Remove
|Modify
|Up
|Down
,
56 Unsorted
= Add
|Remove
|Modify
59 /** Constructor. Populates the list with @p strings. */
60 explicit SimpleStringListEditor( QWidget
* parent
=0,
61 ButtonCode buttons
=Unsorted
,
62 const QString
& addLabel
=QString(),
63 const QString
& removeLabel
=QString(),
64 const QString
& modifyLabel
=QString(),
65 const QString
& addDialogLabel
=QString() );
67 /** Sets the list of strings displayed to @p strings */
68 void setStringList( const QStringList
& strings
);
69 /** Adds @p strings to the list of displayed strings */
70 void appendStringList( const QStringList
& strings
);
71 /** Retrieves the current list of strings */
72 QStringList
stringList() const;
74 /** Sets the text of button @p button to @p text */
75 void setButtonText( ButtonCode button
, const QString
& text
);
78 /** Connected slots can alter the argument to be added or set the
79 argument to QString() to suppress adding.
81 void aboutToAdd(QString
&);
91 void slotSelectionChanged();
94 bool containsString( const QString
& str
);
95 QListWidget
*mListBox
;
96 QPushButton
*mAddButton
;
97 QPushButton
*mRemoveButton
;
98 QPushButton
*mModifyButton
;
99 QPushButton
*mUpButton
;
100 QPushButton
*mDownButton
;
101 const QString mAddDialogLabel
;
107 #endif // _SIMPLESTRINGLISTEDITOR_H_