kurlcompletion.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef KURLCOMPLETION_H
00024 #define KURLCOMPLETION_H
00025
00026 #include <kcompletion.h>
00027 #include <kio/jobclasses.h>
00028 #include <qstring.h>
00029 #include <qstringlist.h>
00030
00031 class KURL;
00032 class KURLCompletionPrivate;
00033
00042 class KURLCompletion : public KCompletion
00043 {
00044 Q_OBJECT
00045
00046 public:
00054 enum Mode { ExeCompletion=1, FileCompletion, DirCompletion };
00055
00059 KURLCompletion();
00064 KURLCompletion(Mode);
00068 virtual ~KURLCompletion();
00069
00080 virtual QString makeCompletion(const QString&);
00081
00086 virtual void setDir(const QString &dir);
00087
00091 virtual QString dir() const;
00092
00096 virtual bool isRunning() const;
00097
00101 virtual void stop();
00102
00106 virtual Mode mode() const;
00107
00111 virtual void setMode( Mode mode );
00112
00118 virtual bool replaceEnv() const;
00119
00124 virtual void setReplaceEnv( bool replace );
00125
00131 virtual bool replaceHome() const;
00132
00138 virtual void setReplaceHome( bool replace );
00139
00146 QString replacedPath( const QString& text );
00147
00148 class MyURL;
00149 class DirLister;
00150 protected:
00151
00152 void postProcessMatch( QString *match ) const;
00153 void postProcessMatches( QStringList *matches ) const;
00154 void postProcessMatches( KCompletionMatches* matches ) const;
00155
00156 protected slots:
00157 void slotEntries( KIO::Job *, const KIO::UDSEntryList& );
00158 void slotIOFinished( KIO::Job * );
00159
00160 private slots:
00161 void slotTimer();
00162
00163 private:
00164
00165 bool isAutoCompletion();
00166
00167 bool userCompletion(const MyURL &url, QString *match);
00168 bool envCompletion(const MyURL &url, QString *match);
00169 bool exeCompletion(const MyURL &url, QString *match);
00170 bool fileCompletion(const MyURL &url, QString *match);
00171 bool urlCompletion(const MyURL &url, QString *match);
00172
00173
00174 void listDir( const QString& dir,
00175 QStringList *matches,
00176 const QString& filter,
00177 bool only_exe,
00178 bool no_hidden );
00179
00180
00181 QString listDirectories(const QStringList &,
00182 const QString &,
00183 bool only_exe = false,
00184 bool only_dir = false,
00185 bool no_hidden = false,
00186 bool stat_files = true);
00187
00188 void listURLs( const QValueList<KURL *> &urls,
00189 const QString &filter = QString::null,
00190 bool only_exe = false,
00191 bool no_hidden = false );
00192
00193 void addMatches( QStringList * );
00194 QString finished();
00195
00196 void init(Mode mode);
00197
00198 void setListedURL(int compl_type ,
00199 QString dir = QString::null,
00200 QString filter = QString::null,
00201 bool no_hidden = false );
00202
00203 bool isListedURL( int compl_type ,
00204 QString dir = QString::null,
00205 QString filter = QString::null,
00206 bool no_hidden = false );
00207
00208 protected:
00209 virtual void virtual_hook( int id, void* data );
00210 private:
00211 KURLCompletionPrivate *d;
00212 };
00213
00214 #endif // KURLCOMPLETION_H
This file is part of the documentation for kdelibs Version 3.1.0.