KIO
kurlcompletion.h
Go to the documentation of this file.
00001 /* This file is part of the KDE libraries 00002 Copyright (C) 2000 David Smith <dsmith@algonet.se> 00003 00004 This class was inspired by a previous KUrlCompletion by 00005 Henner Zeller <zeller@think.de> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License as published by the Free Software Foundation; either 00010 version 2 of the License, or (at your option) any later version. 00011 00012 This library is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 Library General Public License for more details. 00016 00017 You should have received a copy of the GNU Library General Public License 00018 along with this library; see the file COPYING.LIB. If not, write to 00019 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00020 Boston, MA 02110-1301, USA. 00021 */ 00022 00023 #ifndef KURLCOMPLETION_H 00024 #define KURLCOMPLETION_H 00025 00026 #include <kcompletion.h> 00027 #include <kio/jobclasses.h> 00028 #include <QtCore/QString> 00029 00030 class QStringList; 00031 class KUrl; 00032 class KUrlCompletionPrivate; 00033 00041 class KIO_EXPORT KUrlCompletion : public KCompletion 00042 { 00043 Q_OBJECT 00044 00045 public: 00053 enum Mode { ExeCompletion=1, FileCompletion, DirCompletion }; 00054 00058 KUrlCompletion(); 00063 KUrlCompletion(Mode); 00067 virtual ~KUrlCompletion(); 00068 00082 virtual QString makeCompletion(const QString &text); // KDE4: remove return value, it's often null due to threading 00083 00089 virtual void setDir(const QString &dir); 00090 00095 virtual QString dir() const; 00096 00101 virtual bool isRunning() const; 00102 00106 virtual void stop(); 00107 00112 virtual Mode mode() const; 00113 00118 virtual void setMode( Mode mode ); 00119 00126 virtual bool replaceEnv() const; 00127 00133 virtual void setReplaceEnv( bool replace ); 00134 00141 virtual bool replaceHome() const; 00142 00149 virtual void setReplaceHome( bool replace ); 00150 00160 QString replacedPath( const QString& text ) const; 00161 00165 static QString replacedPath( const QString& text, 00166 bool replaceHome, bool replaceEnv = true ); 00167 00168 protected: 00169 // Called by KCompletion, adds '/' to directories 00170 void postProcessMatch( QString *match ) const; 00171 void postProcessMatches( QStringList *matches ) const; 00172 void postProcessMatches( KCompletionMatches* matches ) const; 00173 00174 virtual void customEvent( QEvent *e ); 00175 00176 private: 00177 KUrlCompletionPrivate* const d; 00178 00179 Q_PRIVATE_SLOT( d, void _k_slotEntries( KIO::Job*, const KIO::UDSEntryList& ) ) 00180 Q_PRIVATE_SLOT( d, void _k_slotIOFinished( KJob* ) ) 00181 }; 00182 00183 #endif // KURLCOMPLETION_H
KDE 4.6 API Reference