kurlrequester.h
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 1999,2000,2001 Carsten Pfeiffer <pfeiffer@kde.org> 00003 00004 library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2, as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00016 Boston, MA 02111-1307, USA. 00017 */ 00018 00019 00020 #ifndef KURLREQUESTER_H 00021 #define KURLREQUESTER_H 00022 00023 #include <qhbox.h> 00024 00025 #include <keditlistbox.h> 00026 #include <kfile.h> 00027 #include <kpushbutton.h> 00028 #include <kurl.h> 00029 00030 class KComboBox; 00031 class KFileDialog; 00032 class KLineEdit; 00033 class KURLCompletion; 00034 class KURLDragPushButton; 00035 00036 class QString; 00037 class QTimer; 00038 00054 class KURLRequester : public QHBox 00055 { 00056 Q_OBJECT 00057 Q_PROPERTY( QString url READ url WRITE setURL ) 00058 00059 public: 00063 KURLRequester( QWidget *parent=0, const char *name=0 ); 00064 00068 KURLRequester( const QString& url, QWidget *parent=0, const char *name=0 ); 00077 KURLRequester( QWidget *editWidget, QWidget *parent, const char *name=0 ); 00081 ~KURLRequester(); 00082 00088 QString url() const; 00089 00096 void setShowLocalProtocol( bool b ); 00097 00104 void setMode( unsigned int m ); 00105 00110 void setFilter( const QString& filter ); 00111 00117 bool showLocalProtocol() const { return myShowLocalProt; } 00118 00124 virtual KFileDialog * fileDialog() const; 00125 00133 KLineEdit * lineEdit() const; 00134 00139 KComboBox * comboBox() const; 00140 00145 KPushButton * button() const; 00146 00150 KURLCompletion *completionObject() const { return myCompletion; } 00151 00163 KEditListBox::CustomEditor customEditor(); 00164 00165 public slots: 00171 void setURL( const QString& url ); 00172 00178 virtual void setCaption( const QString& caption ); 00179 00183 void clear(); 00184 00185 signals: 00186 // forwards from LineEdit 00192 void textChanged( const QString& ); 00193 00197 void returnPressed(); 00198 00203 void returnPressed( const QString& ); 00204 00216 void openFileDialog( KURLRequester * ); 00217 00222 void urlSelected( const QString& ); 00223 00224 protected: 00225 void init(); 00226 00227 KURLCompletion * myCompletion; 00228 00229 00230 private: 00231 KURLDragPushButton * myButton; 00232 bool myShowLocalProt; 00233 mutable KFileDialog * myFileDialog; 00234 00235 00236 protected slots: 00241 void slotOpenDialog(); 00242 00243 private slots: 00244 void slotUpdateURL(); 00245 00246 protected: 00247 virtual void virtual_hook( int id, void* data ); 00248 private: 00249 class KURLRequesterPrivate; 00250 KURLRequesterPrivate *d; 00251 }; 00252 00253 #endif // KURLREQUESTER_H