home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / klineeditdlg.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  4.0 KB  |  126 lines

  1. /* This file is part of the KDE libraries
  2.  
  3.    Copyright (C) 1999 Preston Brown <pbrown@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. #ifndef __klineeditdlg_h__
  21. #define __klineeditdlg_h__
  22.  
  23. class KLineEdit;
  24. class QValidator;
  25.  
  26. #include <kdialogbase.h>
  27.  
  28. /**
  29.  * @deprecated
  30.  * Please use KInputDialog instead.
  31.  *
  32.  * Dialog for user to enter a single line of text.
  33.  *
  34.  * @version $Id: klineeditdlg.h 465272 2005-09-29 09:47:40Z mueller $
  35.  * @author David Faure <faure@kde.org>, layout management by Preston Brown <pbrown@kde.org>
  36.  */
  37.  
  38. class KDEUI_EXPORT_DEPRECATED KLineEditDlg : public KDialogBase
  39. {
  40.   Q_OBJECT
  41. public:
  42.   /**
  43.    * Create a dialog that asks for a single line of text. _value is
  44.    * the initial value of the line. _text appears as label on top of
  45.    * the entry box. If the internal line edit has an associated
  46.    * QValidator set, the OK button is disabled as long as the
  47.    * validator doesn't return Acceptable. If there's no validator, the
  48.    * OK button is enabled whenever the line edit isn't empty.
  49.    *
  50.    * If you want to accept empty input, make a trivial QValidator that
  51.    * always returns Acceptable, e.g. QRegExpValidator with a
  52.    * regexp of ".*".
  53.    *
  54.    * @param _text      Text of the label
  55.    * @param _value     Initial value of the inputline
  56.    * @param parent     Parent widget for the line edit dialog
  57.    */
  58.   KLineEditDlg( const QString& _text, const QString& _value, QWidget *parent ) KDE_DEPRECATED;
  59.   virtual ~KLineEditDlg();
  60.  
  61.   /**
  62.    * @return the value the user entered
  63.    */
  64.   QString text() const;
  65.  
  66.   /**
  67.    * @return the line edit widget
  68.    */
  69.   KLineEdit *lineEdit() const { return edit; }
  70.  
  71.   /**
  72.    * Static convenience function to get a textual input from the user.
  73.    *
  74.    * @param text      Text of the label
  75.    * @param value     Initial value of the inputline
  76.    * @param ok         this bool will be set to true if user pressed "Ok"
  77.    * @param validator Validator to be stuffed into the line edit.
  78.    * @param parent    The parent widget
  79.    */
  80.   static QString getText(const QString &text, const QString& value,
  81.          bool *ok, QWidget *parent, QValidator *validator=0 ) KDE_DEPRECATED;
  82.  
  83.   /**
  84.    * Static convenience function to get a textual input from the user.
  85.    * This method includes a caption, and has (almost) the same API as QInputDialog::getText
  86.    * (no echo mode, we have KPasswordDialog).
  87.    *
  88.    * @param caption   Caption of the dialog
  89.    * @param text      Text of the label
  90.    * @param value     Initial value of the inputline
  91.    * @param ok         this bool will be set to true if user pressed "Ok"
  92.    * @param parent    The parent widget for this text input dialog
  93.    * @param validator Validator to be stuffed into the line edit.
  94.    */
  95.   static QString getText(const QString &caption, const QString &text,
  96.                          const QString& value=QString::null,
  97.                          bool *ok=0, QWidget *parent=0,
  98.              QValidator *validator=0) KDE_DEPRECATED;
  99.  
  100. public slots:
  101.   /**
  102.    * Clears the edit widget
  103.    */
  104.   void slotClear();
  105.  
  106. protected slots:
  107.   /**
  108.    * Enables and disables the OK button depending on the state
  109.    * returned by the lineedit's QValidator.
  110.    */
  111.   void slotTextChanged( const QString& );
  112.  
  113. protected:
  114.   /**
  115.    * The line edit widget
  116.    */
  117.   KLineEdit *edit;
  118. protected:
  119.   virtual void virtual_hook( int id, void* data );
  120. private:
  121.   class KLineEditDlgPrivate;
  122.   KLineEditDlgPrivate* d;
  123. };
  124.  
  125. #endif
  126.