\section{KURLCompletion Class Reference}
\label{classKURLCompletion}\index{KURLCompletion@{KURLCompletion}}
This class does completion of URLs including user directories ($\sim$user) and environment variables. Completion of a single URL.  


{\tt \#include $<$kurlcompletion.h$>$}

Inheritance diagram for KURLCompletion:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=65pt]{classKURLCompletion__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KURLCompletion:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=64pt]{classKURLCompletion__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Mode} \{ {\bf Exe\-Completion} = 1, 
{\bf File\-Completion}, 
{\bf Dir\-Completion}
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KURLCompletion} ()
\item 
{\bf KURLCompletion} ({\bf Mode})
\item 
virtual {\bf $\sim$KURLCompletion} ()
\item 
virtual {\bf QString} {\bf make\-Completion} (const {\bf QString} \&text)
\item 
virtual void {\bf set\-Dir} (const {\bf QString} \&dir)
\item 
virtual {\bf QString} {\bf dir} () const 
\item 
virtual bool {\bf is\-Running} () const 
\item 
virtual void {\bf stop} ()
\item 
virtual {\bf Mode} {\bf mode} () const 
\item 
virtual void {\bf set\-Mode} ({\bf Mode} mode)
\item 
virtual bool {\bf replace\-Env} () const 
\item 
virtual void {\bf set\-Replace\-Env} (bool replace)
\item 
virtual bool {\bf replace\-Home} () const 
\item 
virtual void {\bf set\-Replace\-Home} (bool replace)
\item 
{\bf QString} {\bf replaced\-Path} (const {\bf QString} \&text)
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf QString} {\bf replaced\-Path} (const {\bf QString} \&text, bool replace\-Home, bool replace\-Env=true)\label{classKURLCompletion_e0}

\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Entries} ({\bf KIO::Job} $\ast$, const {\bf KIO::UDSEntry\-List} \&)\label{classKURLCompletion_j0}

\item 
void {\bf slot\-IOFinished} ({\bf KIO::Job} $\ast$)\label{classKURLCompletion_j1}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf post\-Process\-Match} ({\bf QString} $\ast${\bf match}) const \label{classKURLCompletion_b0}

\item 
void {\bf post\-Process\-Matches} ({\bf QString\-List} $\ast${\bf matches}) const \label{classKURLCompletion_b1}

\item 
void {\bf post\-Process\-Matches} ({\bf KCompletion\-Matches} $\ast${\bf matches}) const \label{classKURLCompletion_b2}

\item 
virtual void {\bf custom\-Event} ({\bf QCustom\-Event} $\ast$e)\label{classKURLCompletion_b3}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKURLCompletion_b4}

\end{CompactItemize}


\subsection{Detailed Description}
This class does completion of URLs including user directories ($\sim$user) and environment variables. Completion of a single URL. 

Remote URLs are passed to {\bf KIO}{\rm (p.\,\pageref{namespaceKIO})}.

\begin{Desc}
\item[Author:]David Smith $<${\tt dsmith@algonet.se}$>$ \end{Desc}




Definition at line 41 of file kurlcompletion.h.

\subsection{Member Enumeration Documentation}
\index{KURLCompletion@{KURLCompletion}!Mode@{Mode}}
\index{Mode@{Mode}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KURLCompletion::Mode}}\label{classKURLCompletion_w3}


Determines how completion is done. 

\begin{itemize}
\item Exe\-Completion - executables in \$PATH or with full path. \item File\-Completion - all files with full path or in {\bf dir()}{\rm (p.\,\pageref{classKURLCompletion_a5})}, URLs are listed using {\bf KIO}{\rm (p.\,\pageref{namespaceKIO})}. \item Dir\-Completion - Same as File\-Completion but only returns directories.\end{itemize}


Definition at line 53 of file kurlcompletion.h.

\subsection{Constructor \& Destructor Documentation}
\index{KURLCompletion@{KURLCompletion}!KURLCompletion@{KURLCompletion}}
\index{KURLCompletion@{KURLCompletion}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLCompletion::KURLCompletion ()}\label{classKURLCompletion_a0}


Constructs a KURLCompletion object in File\-Completion mode. 



Definition at line 478 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!KURLCompletion@{KURLCompletion}}
\index{KURLCompletion@{KURLCompletion}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLCompletion::KURLCompletion ({\bf Mode})}\label{classKURLCompletion_a1}


This overloaded constructor allows you to set the Mode to Exe\-Completion or File\-Completion without using set\-Mode. 

Default is File\-Completion.

Definition at line 484 of file kurlcompletion.cpp.

References set\-Mode().\index{KURLCompletion@{KURLCompletion}!~KURLCompletion@{$\sim$KURLCompletion}}
\index{~KURLCompletion@{$\sim$KURLCompletion}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLCompletion::$\sim${\bf KURLCompletion} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a2}


Destructs the KURLCompletion object. 



Definition at line 490 of file kurlcompletion.cpp.

References stop().

\subsection{Member Function Documentation}
\index{KURLCompletion@{KURLCompletion}!makeCompletion@{makeCompletion}}
\index{makeCompletion@{makeCompletion}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURLCompletion::make\-Completion (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a3}


Finds completions to the given text. 

Remote URLs are listed with {\bf KIO}{\rm (p.\,\pageref{namespaceKIO})}. For performance reasons, local files are listed with {\bf KIO}{\rm (p.\,\pageref{namespaceKIO})} only if KURLCOMPLETION\_\-LOCAL\_\-KIO is set. The completion is done asyncronously if {\bf KIO}{\rm (p.\,\pageref{namespaceKIO})} is used.

Returns the first match for user, environment, and local dir completion and QString::null for asynchronous completion ({\bf KIO}{\rm (p.\,\pageref{namespaceKIO})} or threaded).

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to complete \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the first match, or QString::null if not found\end{Desc}


Reimplemented from {\bf KCompletion}.

Reimplemented in {\bf KShell\-Completion} {\rm (p.\,\pageref{classKShellCompletion_a1})}.

Definition at line 564 of file kurlcompletion.cpp.

References QString::left(), QString::length(), QString::prepend(), QString::ref(), and stop().

Referenced by KShell\-Completion::make\-Completion().\index{KURLCompletion@{KURLCompletion}!setDir@{setDir}}
\index{setDir@{setDir}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLCompletion::set\-Dir (const {\bf QString} \& {\em dir})\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a4}


Sets the current directory (used as base for completion). 

Default = \$HOME. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em dir}]the current directory, either as a path or URL\end{description}
\end{Desc}


Definition at line 519 of file kurlcompletion.cpp.

Referenced by KFile\-Dialog::init().\index{KURLCompletion@{KURLCompletion}!dir@{dir}}
\index{dir@{dir}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURLCompletion::dir () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a5}


Returns the current directory, as it was given in set\-Dir. 

\begin{Desc}
\item[Returns:]the current directory (path or URL)\end{Desc}


Definition at line 524 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!isRunning@{isRunning}}
\index{isRunning@{isRunning}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURLCompletion::is\-Running () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a6}


Check whether asynchronous completion is in progress. 

\begin{Desc}
\item[Returns:]true if asynchronous completion is in progress\end{Desc}


Definition at line 650 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!stop@{stop}}
\index{stop@{stop}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLCompletion::stop ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a7}


Stops asynchronous completion. 



Definition at line 660 of file kurlcompletion.cpp.

References QString::is\-Empty().

Referenced by make\-Completion(), and $\sim$KURLCompletion().\index{KURLCompletion@{KURLCompletion}!mode@{mode}}
\index{mode@{mode}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURLCompletion::Mode} KURLCompletion::mode () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a8}


Returns the completion mode: exe or file completion (default File\-Completion). 

\begin{Desc}
\item[Returns:]the completion mode\end{Desc}


Definition at line 529 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!setMode@{setMode}}
\index{setMode@{setMode}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLCompletion::set\-Mode ({\bf Mode} {\em mode})\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a9}


Changes the completion mode: exe or file completion. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]the new completion mode\end{description}
\end{Desc}


Definition at line 534 of file kurlcompletion.cpp.

Referenced by KDir\-Select\-Dialog::KDir\-Select\-Dialog(), KURLCompletion(), and KShell\-Completion::make\-Completion().\index{KURLCompletion@{KURLCompletion}!replaceEnv@{replaceEnv}}
\index{replaceEnv@{replaceEnv}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURLCompletion::replace\-Env () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a10}


Checks whether environment variables are completed and whether they are replaced internally while finding completions. 

Default is enabled. \begin{Desc}
\item[Returns:]true if environment vvariables will be replaced\end{Desc}


Definition at line 539 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!setReplaceEnv@{setReplaceEnv}}
\index{setReplaceEnv@{setReplaceEnv}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLCompletion::set\-Replace\-Env (bool {\em replace})\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a11}


Enables/disables completion and replacement (internally) of environment variables in URLs. 

Default is enabled. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em replace}]true to replace environment variables\end{description}
\end{Desc}


Definition at line 544 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!replaceHome@{replaceHome}}
\index{replaceHome@{replaceHome}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURLCompletion::replace\-Home () const\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a12}


Returns whether $\sim$username is completed and whether $\sim$username is replaced internally with the user's home directory while finding completions. 

Default is enabled. \begin{Desc}
\item[Returns:]true to replace tilde with the home directory\end{Desc}


Definition at line 549 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!setReplaceHome@{setReplaceHome}}
\index{setReplaceHome@{setReplaceHome}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLCompletion::set\-Replace\-Home (bool {\em replace})\hspace{0.3cm}{\tt  [virtual]}}\label{classKURLCompletion_a13}


Enables/disables completion of $\sim$username and replacement (internally) of $\sim$username with the user's home directory. 

Default is enabled. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em replace}]true to replace tilde with the home directory\end{description}
\end{Desc}


Definition at line 554 of file kurlcompletion.cpp.\index{KURLCompletion@{KURLCompletion}!replacedPath@{replacedPath}}
\index{replacedPath@{replacedPath}!KURLCompletion@{KURLCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURLCompletion::replaced\-Path (const {\bf QString} \& {\em text})}\label{classKURLCompletion_a14}


Replaces username and/or environment variables, depending on the current settings and returns the filtered url. 

Only works with local files, i.e. returns back the original string for non-local urls. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the text to process \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the path or URL resulting from this operation. If you want to convert it to a {\bf KURL}, use {\bf KURL::from\-Path\-Or\-URL}.\end{Desc}


Definition at line 1365 of file kurlcompletion.cpp.

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kurlcompletion.h\item 
kurlcompletion.cpp\end{CompactItemize}
