kio Library API Documentation

kurlcompletion.h

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., 59 Temple Place - Suite 330,
00020     Boston, MA 02111-1307, USA.
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         // Called by KCompletion, adds '/' to directories
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         // List a directory using readdir()
00174         void listDir( const QString& dir,
00175                       QStringList *matches,
00176                       const QString& filter,
00177                       bool only_exe,
00178                       bool no_hidden );
00179 
00180         // List the next dir in m_dirs
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 /* enum ComplType */,
00199                           QString dir = QString::null,
00200                           QString filter = QString::null,
00201                           bool no_hidden = false );
00202 
00203         bool isListedURL( int compl_type /* enum ComplType */,
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
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:14:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001