SVN_SILENT made messages (.desktop file)
[kdegames.git] / kolf / kcomboboxdialog.h
blob103e7ba10674550191bd7395079c89ade20bbf26
1 // Copyright (C) 2002 Jason Katz-Brown <jason@katzbrown.com>
2 // Copyright (C) 2002 Neil Stevens <neil@qualityassistant.com>
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 // AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20 //
21 // Except as contained in this notice, the name(s) of the author(s) shall not be
22 // used in advertising or otherwise to promote the sale, use or other dealings
23 // in this Software without prior written authorization from the author(s).
25 #ifndef KCOMBOBOX_DIALOG_H
26 #define KCOMBOBOX_DIALOG_H
28 #include <klocale.h>
29 #include <kdialog.h>
30 #include <kglobal.h>
31 #include <kconfig.h>
33 class QCheckBox;
34 class KHistoryComboBox;
36 /**
37 * Dialog for user to choose an item from a QStringList.
40 class KComboBoxDialog : public KDialog
42 Q_OBJECT
44 public:
45 /**
46 * Create a dialog that asks for a single line of text. _value is
47 * the initial value of the line. _text appears as the current text
48 * of the combobox.
50 * @param _items Items in the combobox
51 * @param _text Text of the label
52 * @param _value Initial value of the combobox
54 KComboBoxDialog( const QString &_text, const QStringList& _items, const QString& _value = QString(), bool showDontAskAgain = false, QWidget *parent = 0 );
55 virtual ~KComboBoxDialog();
57 /**
58 * @return the value the user chose
60 QString text() const;
62 /**
63 * @return the line edit widget
65 KHistoryComboBox *comboBox() const { return combo; }
67 /**
68 * Static convenience function to get input from the user.
70 * @param _text Text of the label
71 * @param _items Items in the combobox
72 * @param _value Initial value of the inputline
73 * @param dontAskAgainName Name for saving whether the user doesn't want to be asked again; use QString() to disable
75 static QString getItem( const QString &_text, const QStringList &_items, const QString& _value = QString(), const QString &dontAskAgainName = QString(), QWidget *parent = 0 );
77 /**
78 * Static convenience function to get input from the user.
79 * This method includes a caption.
81 * @param _caption Caption of the dialog
82 * @param _text Text of the label
83 * @param _items Items in the combobox
84 * @param _value Initial value of the inputline
85 * @param dontAskAgainName Name for saving whether the user doesn't want to be asked again; use QString() to disable
87 static QString getItem( const QString &_text, const QString &_caption, const QStringList &_items, const QString& _value = QString(), const QString &dontAskAgainName = QString(), QWidget *parent = 0 );
89 /**
90 * Static convenience method.
91 * This method is meant as a replacement for KLineEditDlg::getText() for cases
92 * when a history and autocompletion are desired.
94 * @param _caption Caption of the dialog
95 * @param _text Text of the label
96 * @param _value Initial value of the inputline
97 * @param ok Variable to store whether the user hit OK
98 * @param parent Parent widget for the dialog
99 * @param configName Name of the dialog for saving the completion and history
100 * @parma config KConfig for saving the completion and history
102 static QString getText(const QString &_caption, const QString &_text,
103 const QString &_value = QString(),
104 bool *ok = 0, QWidget *parent = 0,
105 const QString &configName = QString(),
106 KSharedConfigPtr config = KGlobal::config());
108 protected:
109 KHistoryComboBox *combo;
110 QCheckBox *dontAskAgainCheckBox;
111 bool dontAskAgainChecked();
114 #endif