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
00083
virtual QString makeCompletion(
const QString &text);
00084
00090
virtual void setDir(
const QString &dir);
00091
00096
virtual QString dir() const;
00097
00102 virtual
bool isRunning() const;
00103
00107 virtual
void stop();
00108
00113 virtual Mode mode() const;
00114
00119 virtual
void setMode( Mode mode );
00120
00127 virtual
bool replaceEnv() const;
00128
00134 virtual
void setReplaceEnv(
bool replace );
00135
00142 virtual
bool replaceHome() const;
00143
00150 virtual
void setReplaceHome(
bool replace );
00151
00160
QString replacedPath( const
QString& text );
00161
00166 static
QString replacedPath( const
QString& text,
00167
bool replaceHome,
bool replaceEnv = true );
00168
00169 class MyURL;
00170 protected:
00171
00172
void postProcessMatch(
QString *match ) const;
00173
void postProcessMatches(
QStringList *matches ) const;
00174
void postProcessMatches(
KCompletionMatches* matches ) const;
00175
00176 virtual
void customEvent(
QCustomEvent *e );
00177
00178 protected slots:
00179
void slotEntries( KIO::Job *, const KIO::
UDSEntryList& );
00180
void slotIOFinished( KIO::Job * );
00181
00182 private:
00183
00184
bool isAutoCompletion();
00185
00186
bool userCompletion(const MyURL &url,
QString *match);
00187
bool envCompletion(const MyURL &url,
QString *match);
00188
bool exeCompletion(const MyURL &url,
QString *match);
00189
bool fileCompletion(const MyURL &url,
QString *match);
00190
bool urlCompletion(const MyURL &url,
QString *match);
00191
00192
00193
void listDir( const
QString& dir,
00194
QStringList *matches,
00195 const
QString& filter,
00196
bool only_exe,
00197
bool no_hidden );
00198
00199
00200
QString listDirectories(const
QStringList &,
00201 const
QString &,
00202
bool only_exe = false,
00203
bool only_dir = false,
00204
bool no_hidden = false,
00205
bool stat_files = true);
00206
00207
void listURLs( const
QValueList<
KURL *> &urls,
00208 const QString &filter = QString::null,
00209
bool only_exe = false,
00210
bool no_hidden = false );
00211
00212
void addMatches( const QStringList & );
00213 QString finished();
00214
00215
void init();
00216
00217
void setListedURL(
int compl_type ,
00218 QString dir = QString::null,
00219 QString filter = QString::null,
00220
bool no_hidden = false );
00221
00222
bool isListedURL(
int compl_type ,
00223 QString dir = QString::null,
00224 QString filter = QString::null,
00225
bool no_hidden = false );
00226
00227 protected:
00228 virtual
void virtual_hook(
int id,
void* data );
00229 private:
00230 KURLCompletionPrivate *d;
00231 };
00232
00233 #endif