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 
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     class DirLister;
00171 protected:
00172     
00173     void postProcessMatch( QString *match ) const;
00174     void postProcessMatches( QStringList *matches ) const;
00175         void postProcessMatches( KCompletionMatches* matches ) const;
00176 
00177 protected slots:
00178     void slotEntries( KIO::Job *, const KIO::UDSEntryList& );
00179     void slotIOFinished( KIO::Job * );
00180 
00181 private slots:
00182     void slotTimer();
00183 
00184 private:
00185 
00186     bool isAutoCompletion();
00187 
00188     bool userCompletion(const MyURL &url, QString *match);
00189     bool envCompletion(const MyURL &url, QString *match);
00190     bool exeCompletion(const MyURL &url, QString *match);
00191     bool fileCompletion(const MyURL &url, QString *match);
00192     bool urlCompletion(const MyURL &url, QString *match);
00193 
00194     
00195     void listDir( const QString& dir,
00196                   QStringList *matches,
00197                   const QString& filter,
00198                   bool only_exe,
00199                   bool no_hidden );
00200 
00201     
00202     QString listDirectories(const QStringList &,
00203                             const QString &,
00204                             bool only_exe = false,
00205                             bool only_dir = false,
00206                             bool no_hidden = false,
00207                             bool stat_files = true);
00208 
00209     void listURLs( const QValueList<KURL *> &urls,
00210                    const QString &filter = QString::null,
00211                    bool only_exe = false,
00212                    bool no_hidden = false );
00213 
00214     void addMatches( QStringList * );
00215     QString finished();
00216 
00217     void init();
00218 
00219     void setListedURL(int compl_type ,
00220                       QString dir = QString::null,
00221                       QString filter = QString::null,
00222                       bool no_hidden = false );
00223 
00224     bool isListedURL( int compl_type ,
00225                       QString dir = QString::null,
00226                       QString filter = QString::null,
00227                       bool no_hidden = false );
00228 
00229 protected:
00230     virtual void virtual_hook( int id, void* data );
00231 private:
00232     KURLCompletionPrivate *d;
00233 };
00234 
00235 #endif // KURLCOMPLETION_H
 
This file is part of the documentation for kio Library Version 3.2.0.