File indexing completed on 2024-05-05 17:15:15

0001 /*
0002  *  Copyright 2003  Nadeem Hasan <nhasan@kde.org>
0003  *  Copyright 2015  Andreas Cord-Landwehr <cordlandwehr@kde.org>
0004  *
0005  *  This program is free software; you can redistribute it and/or
0006  *  modify it under the terms of the GNU Library General Public
0007  *  License as published by the Free Software Foundation; either
0008  *  version 2 of the License, or (at your option) any later version.
0009  *
0010  *  This program is distributed in the hope that it will be useful,
0011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  *  GNU General Public License for more details.
0014  *
0015  *  You should have received a copy of the GNU Library General Public License
0016  *  along with this library; see the file COPYING.LIB.  If not, write to
0017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0018  *  Boston, MA 02110-1301, USA.
0019  */
0020 
0021 
0022 #ifndef KILEVALIDATORINPUTDIALOG_H
0023 #define KILEVALIDATORINPUTDIALOG_H
0024 
0025 #include <QDialog>
0026 
0027 class QDialogButtonBox;
0028 class QLineEdit;
0029 class QString;
0030 class QWidget;
0031 class QValidator;
0032 
0033 namespace KileDialog {
0034 /**
0035  * Static convenience function to get a validated string from the user.
0036  *
0037  * @p caption is the text that is displayed in the title bar. @p label is the
0038  * text that appears as a label for the line edit. @p value is the initial
0039  * value of the line edit.
0040  *
0041  * If you provide a validator, the Ok button is disabled as long as
0042  * the validator doesn't return Acceptable. If there is no validator,
0043  * the Ok button is enabled whenever the line edit isn't empty. If you
0044  * want to accept empty input, create a trivial QValidator that
0045  * always returns acceptable, e.g. QRegExpValidator with a regexp
0046  * of ".*".
0047  *
0048  * @param caption   Caption of the dialog
0049  * @param label     Text of the label for the line edit
0050  * @param value     Initial value of the line edit
0051  * @param parent    Parent of the dialog widget
0052  * @param validator A @ref QValidator to be associated with the line edit
0053  * @param mask      Mask associated with the line edit. See the
0054  *                  documentation for @ref QLineEdit about masks
0055  * @return String user entered if Ok was pressed, else a null string
0056  */
0057 QString getText(const QString &caption, const QString &label,
0058                 const QString &value = QString(), QWidget *parent = Q_NULLPTR,
0059                 QValidator *validator = 0,
0060                 const QString &mask = QString());
0061 }
0062 
0063 #endif