\section{KCompletion Class Reference}
\label{classKCompletion}\index{KCompletion@{KCompletion}}
A generic class for completing QStrings.  


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

Inheritance diagram for KCompletion:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=65pt]{classKCompletion__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KCompletion:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=213pt]{classKCompletion__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Comp\-Order} \{ {\bf Sorted}, 
{\bf Insertion}, 
{\bf Weighted}
 \}
\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Make\-Completion} (const {\bf QString} \&string)
\item 
void {\bf slot\-Previous\-Match} ()
\item 
void {\bf slot\-Next\-Match} ()
\item 
void {\bf insert\-Items} (const {\bf QString\-List} \&items)
\item 
virtual void {\bf set\-Items} (const {\bf QString\-List} \&list)
\item 
void {\bf add\-Item} (const {\bf QString} \&item)
\item 
void {\bf add\-Item} (const {\bf QString} \&item, uint weight)
\item 
void {\bf remove\-Item} (const {\bf QString} \&item)
\item 
virtual void {\bf clear} ()
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf match} (const {\bf QString} \&item)
\item 
void {\bf matches} (const {\bf QString\-List} \&matchlist)
\item 
void {\bf multiple\-Matches} ()
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KCompletion} ()
\item 
virtual {\bf $\sim$KCompletion} ()
\item 
virtual {\bf QString} {\bf make\-Completion} (const {\bf QString} \&string)
\item 
{\bf QString\-List} {\bf substring\-Completion} (const {\bf QString} \&string) const 
\item 
{\bf QString} {\bf previous\-Match} ()
\item 
{\bf QString} {\bf next\-Match} ()
\item 
virtual const {\bf QString} \& {\bf last\-Match} () const 
\item 
{\bf QString\-List} {\bf items} () const 
\item 
bool {\bf is\-Empty} () const 
\item 
virtual void {\bf set\-Completion\-Mode} ({\bf KGlobal\-Settings::Completion} mode)
\item 
{\bf KGlobal\-Settings::Completion} {\bf completion\-Mode} () const 
\item 
virtual void {\bf set\-Order} ({\bf Comp\-Order} order)
\item 
{\bf Comp\-Order} {\bf order} () const 
\item 
virtual void {\bf set\-Ignore\-Case} (bool ignore\-Case)
\item 
bool {\bf ignore\-Case} () const 
\item 
{\bf QString\-List} {\bf all\-Matches} ()
\item 
{\bf QString\-List} {\bf all\-Matches} (const {\bf QString} \&string)
\item 
{\bf KCompletion\-Matches} {\bf all\-Weighted\-Matches} ()
\item 
{\bf KCompletion\-Matches} {\bf all\-Weighted\-Matches} (const {\bf QString} \&string)
\item 
virtual void {\bf set\-Enable\-Sounds} (bool enable)
\item 
bool {\bf is\-Sounds\-Enabled} () const 
\item 
bool {\bf has\-Multiple\-Matches} () const 
\item 
void {\bf enable\-Sounds} ()
\item 
void {\bf disable\-Sounds} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf post\-Process\-Match} ({\bf QString} $\ast$match) const 
\item 
virtual void {\bf post\-Process\-Matches} ({\bf QString\-List} $\ast$matches) const 
\item 
virtual void {\bf post\-Process\-Matches} ({\bf KCompletion\-Matches} $\ast$matches) const 
\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKCompletion_b3}

\end{CompactItemize}
\subsection*{Properties}
\begin{CompactItemize}
\item 
{\bf Comp\-Order} {\bf order}\label{classKCompletion_00}

\item 
bool {\bf ignore\-Case}\label{classKCompletion_01}

\item 
{\bf QString\-List} {\bf items}\label{classKCompletion_02}

\end{CompactItemize}


\subsection{Detailed Description}
A generic class for completing QStrings. 

This class offers easy use of \char`\"{}auto-completion\char`\"{}, \char`\"{}manual-completion\char`\"{} or \char`\"{}shell completion\char`\"{} on {\bf QString} objects. A common use is completing filenames or URLs (see KURLCompletion()). But it is not limited to URL-completion -- everything should be completable! The user should be able to complete email-addresses, telephone-numbers, commands, SQL queries, ... Every time your program knows what the user can type into an edit-field, you should offer completion. With KCompletion, this is very easy, and if you are using a line edit widget ( {\bf KLine\-Edit}), it is even more easy. Basically, you tell a KCompletion object what strings should be completable and whenever completion should be invoked, you call {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})}. {\bf KLine\-Edit} and (an editable) {\bf KCombo\-Box} even do this automatically for you.

KCompletion offers the completed string via the signal {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})} and all matching strings (when the result is ambiguous) via the method {\bf all\-Matches()}{\rm (p.\,\pageref{classKCompletion_a15})}.

Notice: auto-completion, shell completion and manual completion work slightly differently:

\begin{itemize}
\item auto-completion always returns a complete item as match. When more than one matching items are available, it will deliver just the first (depending on sorting order) item. Iterating over all matches is possible via {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} and {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})}.\end{itemize}
\begin{itemize}
\item popup-completion works in the same way, the only difference being that the completed items are not put into the edit-widget, but into a separate popup-box.\end{itemize}
\begin{itemize}
\item manual completion works the same way as auto-completion, the subtle difference is, that it isn't invoked automatically while the user is typing, but only when the user presses a special key. The difference of manual and auto-completion is therefore only visible in UI classes, KCompletion needs to know whether to deliver partial matches (shell completion) or whole matches (auto/manual completion), therefore {\bf KGlobal\-Settings::Completion\-Man}{\rm (p.\,\pageref{classKGlobalSettings_w10w5})} and {\bf KGlobal\-Settings::Completion\-Auto}{\rm (p.\,\pageref{classKGlobalSettings_w10w4})} have the exact same effect in KCompletion.\end{itemize}
\begin{itemize}
\item shell completion works like how shells complete filenames: when multiple matches are available, the longest possible string of all matches is returned (i.e. only a partial item). Iterating over all matching items (complete, not partial) is possible via {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} and {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})}.\end{itemize}
You don't have to worry much about that though, KCompletion handles that for you, according to the setting {\bf set\-Completion\-Mode()}{\rm (p.\,\pageref{classKCompletion_a9})}. The default setting is globally configured by the user and read from {\bf KGlobal\-Settings::completion\-Mode()}{\rm (p.\,\pageref{classKGlobalSettings_e9})}.

A short example: 

\footnotesize\begin{verbatim} KCompletion completion;
 completion.setOrder( KCompletion::Sorted );
 completion.addItem( "pfeiffer@kde.org" );
 completion.addItem( "coolo@kde.org" );
 completion.addItem( "carpdjih@sp.zrz.tu-berlin.de" );
 completion.addItem( "carp@cs.tu-berlin.de" );

 cout << completion.makeCompletion( "ca" ).latin1() << endl;
\end{verbatim}
\normalsize


In shell-completion-mode, this will be \char`\"{}carp\char`\"{}; in auto-completion- mode it will be \char`\"{}carp$\backslash$@cs.tu-berlin.de\char`\"{}, as that is alphabetically smaller. If set\-Order was set to Insertion, \char`\"{}carpdjih$\backslash$@sp.zrz.tu-berlin.de\char`\"{} would be completed in auto-completion-mode, as that was inserted before \char`\"{}carp$\backslash$@cs.tu-berlin.de\char`\"{}.

You can dynamically update the completable items by removing and adding them whenever you want. For advanced usage, you could even use multiple KCompletion objects. E.g. imagine an editor like kwrite with multiple open files. You could store items of each file in a different KCompletion object, so that you know (and tell the user) where a completion comes from.

Note: KCompletion does not work with strings that contain 0x0 characters (unicode nul), as this is used internally as a delimiter.

You may inherit from KCompletion and override {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})} in special cases (like reading directories/urls and then supplying the contents to KCompletion, as {\bf KURLCompletion} does), but generally, this is not necessary.

\begin{Desc}
\item[Author:]Carsten Pfeiffer $<${\tt pfeiffer@kde.org}$>$ \end{Desc}




Definition at line 132 of file kcompletion.h.

\subsection{Member Enumeration Documentation}
\index{KCompletion@{KCompletion}!CompOrder@{CompOrder}}
\index{CompOrder@{CompOrder}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KCompletion::Comp\-Order}}\label{classKCompletion_w3}


Constants that represent the order in which KCompletion performs completion-lookups. 

\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{Sorted@{Sorted}!KCompletion@{KCompletion}}\index{KCompletion@{KCompletion}!Sorted@{Sorted}}\item[{\em 
Sorted\label{classKCompletion_w3w0}
}]Use order of insertion. \index{Insertion@{Insertion}!KCompletion@{KCompletion}}\index{KCompletion@{KCompletion}!Insertion@{Insertion}}\item[{\em 
Insertion\label{classKCompletion_w3w1}
}]Use alphabetically sorted order. \index{Weighted@{Weighted}!KCompletion@{KCompletion}}\index{KCompletion@{KCompletion}!Weighted@{Weighted}}\item[{\em 
Weighted\label{classKCompletion_w3w2}
}]Use weighted order. \end{description}
\end{Desc}



Definition at line 145 of file kcompletion.h.

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


Constructor, nothing special here :). 



Definition at line 41 of file kcompletion.cpp.

References KGlobal\-Settings::completion\-Mode(), Insertion, and set\-Order().\index{KCompletion@{KCompletion}!~KCompletion@{$\sim$KCompletion}}
\index{~KCompletion@{$\sim$KCompletion}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCompletion::$\sim${\bf KCompletion} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKCompletion_a1}


Destructor, nothing special here, either. 



Definition at line 54 of file kcompletion.cpp.

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


Attempts to find an item in the list of available completions, that begins with {\tt string}. 

Will either return the first matching item (if there is more than one match) or QString::null, if no match was found.

In the latter case, a sound will be issued, depending on {\bf is\-Sounds\-Enabled()}{\rm (p.\,\pageref{classKCompletion_a20})}. If a match was found, it will also be emitted via the signal {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})}.

If this is called twice or more often with the same string while no items were added or removed in the meantime, all available completions will be emitted via the signal {\bf matches()}{\rm (p.\,\pageref{classKCompletion_l1})}. This happens only in shell-completion-mode.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]the string to complete \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the matching item, or QString::null if there is no matching item. \end{Desc}
\begin{Desc}
\item[See also:]{\bf slot\-Make\-Completion}{\rm (p.\,\pageref{classKCompletion_i0})} 

{\bf substring\-Completion}{\rm (p.\,\pageref{classKCompletion_a3})} \end{Desc}


Reimplemented in {\bf KShell\-Completion}, and {\bf KURLCompletion}.

Definition at line 189 of file kcompletion.cpp.

References KShortcut::is\-Null(), match(), matches(), multiple\-Matches(), post\-Process\-Match(), and post\-Process\-Matches().\index{KCompletion@{KCompletion}!substringCompletion@{substringCompletion}}
\index{substringCompletion@{substringCompletion}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCompletion::substring\-Completion (const {\bf QString} \& {\em string}) const}\label{classKCompletion_a3}


Returns a list of all completion items that contain the given {\tt string}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]the string to complete \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a list of items which all contain {\tt text} as a substring, i.e. not necessarily at the beginning.\end{Desc}
\begin{Desc}
\item[See also:]{\bf make\-Completion}{\rm (p.\,\pageref{classKCompletion_a2})} \end{Desc}


Definition at line 251 of file kcompletion.cpp.

References QString::find(), matches(), post\-Process\-Match(), post\-Process\-Matches(), and Weighted.\index{KCompletion@{KCompletion}!previousMatch@{previousMatch}}
\index{previousMatch@{previousMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCompletion::previous\-Match ()}\label{classKCompletion_a4}


Returns the next item from the matching-items-list. 

When reaching the beginning, the list is rotated so it will return the last match and a sound is issued (depending on {\bf is\-Sounds\-Enabled()}{\rm (p.\,\pageref{classKCompletion_a20})}). \begin{Desc}
\item[Returns:]the next item from the matching-items-list. When there is no match, QString::null is returned and a sound is be issued. \end{Desc}
\begin{Desc}
\item[See also:]{\bf slot\-Previous\-Match}{\rm (p.\,\pageref{classKCompletion_i1})} \end{Desc}


Definition at line 378 of file kcompletion.cpp.

References match(), matches(), and post\-Process\-Match().\index{KCompletion@{KCompletion}!nextMatch@{nextMatch}}
\index{nextMatch@{nextMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCompletion::next\-Match ()}\label{classKCompletion_a5}


Returns the next item from the matching-items-list. 

When reaching the last item, the list is rotated, so it will return the first match and a sound is issued (depending on {\bf is\-Sounds\-Enabled()}{\rm (p.\,\pageref{classKCompletion_a20})}). \begin{Desc}
\item[Returns:]the next item from the matching-items-list. When there is no match, QString::null is returned and a sound is issued \end{Desc}
\begin{Desc}
\item[See also:]{\bf slot\-Next\-Match}{\rm (p.\,\pageref{classKCompletion_i2})} \end{Desc}


Definition at line 345 of file kcompletion.cpp.

References match(), matches(), and post\-Process\-Match().\index{KCompletion@{KCompletion}!lastMatch@{lastMatch}}
\index{lastMatch@{lastMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual const {\bf QString}\& KCompletion::last\-Match () const\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKCompletion_a6}


Returns the last match. 

Might be useful if you need to check whether a completion is different from the last one. \begin{Desc}
\item[Returns:]the last match. QString::null is returned when there is no last match. \end{Desc}


Definition at line 224 of file kcompletion.h.\index{KCompletion@{KCompletion}!items@{items}}
\index{items@{items}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCompletion::items () const}\label{classKCompletion_a7}


Returns a list of all items inserted into KCompletion. 

This is useful if you need to save the state of a KCompletion object and restore it later.

Important note: when {\bf order()}{\rm (p.\,\pageref{classKCompletion_a12})} == Weighted, then every item in the stringlist has its weight appended, delimited by a colon. E.g. an item \char`\"{}www.kde.org\char`\"{} might look like \char`\"{}www.kde.org:4\char`\"{}, where 4 is the weight.

This is necessary so that you can save the items along with its weighting on disk and load them back with {\bf set\-Items()}{\rm (p.\,\pageref{classKCompletion_i4})}, restoring its weight as well. If you really don't want the appended weightings, call set\-Order( KCompletion::Insertion ) before calling {\bf items()}{\rm (p.\,\pageref{classKCompletion_a7})}.

\begin{Desc}
\item[Returns:]a list of all items \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Items}{\rm (p.\,\pageref{classKCompletion_i4})} \end{Desc}
\index{KCompletion@{KCompletion}!isEmpty@{isEmpty}}
\index{isEmpty@{isEmpty}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion::is\-Empty () const}\label{classKCompletion_a8}


Returns true when the completion object contains no entries. 



Definition at line 101 of file kcompletion.cpp.

References KComp\-Tree\-Node::children\-Count().\index{KCompletion@{KCompletion}!setCompletionMode@{setCompletionMode}}
\index{setCompletionMode@{setCompletionMode}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::set\-Completion\-Mode ({\bf KGlobal\-Settings::Completion} {\em mode})\hspace{0.3cm}{\tt  [virtual]}}\label{classKCompletion_a9}


Sets the completion mode to Auto/Manual, Shell or None. 

If you don't set the mode explicitly, the global default value {\bf KGlobal\-Settings::completion\-Mode()}{\rm (p.\,\pageref{classKGlobalSettings_e9})} is used. {\bf KGlobal\-Settings::Completion\-None}{\rm (p.\,\pageref{classKGlobalSettings_w10w3})} disables completion. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em mode}]the completion mode \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf completion\-Mode}{\rm (p.\,\pageref{classKCompletion_a10})} 

{\bf KGlobal\-Settings::completion\-Mode}{\rm (p.\,\pageref{classKGlobalSettings_e9})} \end{Desc}


Definition at line 290 of file kcompletion.cpp.\index{KCompletion@{KCompletion}!completionMode@{completionMode}}
\index{completionMode@{completionMode}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KGlobal\-Settings::Completion} KCompletion::completion\-Mode () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a10}


Return the current completion mode. 

May be different from {\bf KGlobal\-Settings::completion\-Mode()}{\rm (p.\,\pageref{classKGlobalSettings_e9})}, if you explicitly called {\bf set\-Completion\-Mode()}{\rm (p.\,\pageref{classKCompletion_a9})}. \begin{Desc}
\item[Returns:]the current completion mode \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Completion\-Mode}{\rm (p.\,\pageref{classKCompletion_a9})} \end{Desc}


Definition at line 269 of file kcompletion.h.\index{KCompletion@{KCompletion}!setOrder@{setOrder}}
\index{setOrder@{setOrder}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::set\-Order ({\bf Comp\-Order} {\em order})\hspace{0.3cm}{\tt  [virtual]}}\label{classKCompletion_a11}


KCompletion offers three different ways in which it offers its items: \begin{itemize}
\item in the order of insertion \item sorted alphabetically \item weighted. \end{itemize}


Choosing weighted makes KCompletion perform an implicit weighting based on how often an item is inserted. Imagine a web browser with a location bar, where the user enters URLs. The more often a URL is entered, the higher priority it gets.

Note: Setting the order to sorted only affects new inserted items, already existing items will stay in the current order. So you probably want to call set\-Order( Sorted ) before inserting items, when you want everything sorted.

Default is insertion order. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em order}]the new order \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf order}{\rm (p.\,\pageref{classKCompletion_a12})} \end{Desc}


Definition at line 60 of file kcompletion.cpp.

References Weighted.

Referenced by KCompletion().\index{KCompletion@{KCompletion}!order@{order}}
\index{order@{order}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf Comp\-Order} KCompletion::order () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a12}


Returns the completion order. 

\begin{Desc}
\item[Returns:]the current completion order. \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Order}{\rm (p.\,\pageref{classKCompletion_a11})} \end{Desc}


Definition at line 300 of file kcompletion.h.\index{KCompletion@{KCompletion}!setIgnoreCase@{setIgnoreCase}}
\index{setIgnoreCase@{setIgnoreCase}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::set\-Ignore\-Case (bool {\em ignore\-Case})\hspace{0.3cm}{\tt  [virtual]}}\label{classKCompletion_a13}


Setting this to true makes KCompletion behave case insensitively. 

E.g. make\-Completion( \char`\"{}CA\char`\"{} ); might return \char`\"{}carp$\backslash$@cs.tu-berlin.de\char`\"{}. Default is false (case sensitive). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ignore\-Case}]true to ignore the case \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf ignore\-Case}{\rm (p.\,\pageref{classKCompletion_a14})} \end{Desc}


Definition at line 66 of file kcompletion.cpp.\index{KCompletion@{KCompletion}!ignoreCase@{ignoreCase}}
\index{ignoreCase@{ignoreCase}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion::ignore\-Case () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a14}


Return whether KCompletion acts case insensitively or not. 

Default is false (case sensitive). \begin{Desc}
\item[Returns:]true if the case will be ignored \end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Ignore\-Case}{\rm (p.\,\pageref{classKCompletion_a13})} \end{Desc}


Definition at line 317 of file kcompletion.h.\index{KCompletion@{KCompletion}!allMatches@{allMatches}}
\index{allMatches@{allMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCompletion::all\-Matches ()}\label{classKCompletion_a15}


Returns a list of all items matching the last completed string. 

Might take some time, when you have LOTS of items. \begin{Desc}
\item[Returns:]a list of all matches for the last completed string. \end{Desc}
\begin{Desc}
\item[See also:]{\bf substring\-Completion}{\rm (p.\,\pageref{classKCompletion_a3})} \end{Desc}


Definition at line 295 of file kcompletion.cpp.

References matches(), post\-Process\-Matches(), and Weighted.\index{KCompletion@{KCompletion}!allMatches@{allMatches}}
\index{allMatches@{allMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCompletion::all\-Matches (const {\bf QString} \& {\em string})}\label{classKCompletion_a16}


Returns a list of all items matching {\tt string}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]the string to match \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the list of all matches \end{Desc}


Definition at line 321 of file kcompletion.cpp.

References matches(), post\-Process\-Matches(), and Weighted.\index{KCompletion@{KCompletion}!allWeightedMatches@{allWeightedMatches}}
\index{allWeightedMatches@{allWeightedMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KCompletion\-Matches} KCompletion::all\-Weighted\-Matches ()}\label{classKCompletion_a17}


Returns a list of all items matching the last completed string. 

Might take some time, when you have LOTS of items. The matches are returned as {\bf KCompletion\-Matches}{\rm (p.\,\pageref{classKCompletionMatches})}, which also keeps the weight of the matches, allowing you to modify some matches or merge them with matches from another call to {\bf all\-Weighted\-Matches()}{\rm (p.\,\pageref{classKCompletion_a17})}, and sort the matches after that in order to have the matches ordered correctly.

\begin{Desc}
\item[Returns:]a list of all completion matches \end{Desc}
\begin{Desc}
\item[See also:]{\bf substring\-Completion}{\rm (p.\,\pageref{classKCompletion_a3})} \end{Desc}


Definition at line 308 of file kcompletion.cpp.

References matches(), post\-Process\-Matches(), and Weighted.\index{KCompletion@{KCompletion}!allWeightedMatches@{allWeightedMatches}}
\index{allWeightedMatches@{allWeightedMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KCompletion\-Matches} KCompletion::all\-Weighted\-Matches (const {\bf QString} \& {\em string})}\label{classKCompletion_a18}


Returns a list of all items matching {\tt string}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]the string to match \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]a list of all matches \end{Desc}


Definition at line 331 of file kcompletion.cpp.

References matches(), post\-Process\-Matches(), and Weighted.\index{KCompletion@{KCompletion}!setEnableSounds@{setEnableSounds}}
\index{setEnableSounds@{setEnableSounds}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCompletion::set\-Enable\-Sounds (bool {\em enable})\hspace{0.3cm}{\tt  [inline, virtual]}}\label{classKCompletion_a19}


Enables/disables playing a sound when \begin{itemize}
\item {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})} can't find a match \item there is a partial completion (= multiple matches in Shell-completion mode) \item {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} or {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} hit the last possible match -$>$ rotation. \end{itemize}


For playing the sounds, KNotify\-Client() is used.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em enable}]true to enable sounds \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf is\-Sounds\-Enabled}{\rm (p.\,\pageref{classKCompletion_a20})} \end{Desc}


Definition at line 368 of file kcompletion.h.\index{KCompletion@{KCompletion}!isSoundsEnabled@{isSoundsEnabled}}
\index{isSoundsEnabled@{isSoundsEnabled}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion::is\-Sounds\-Enabled () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a20}


Tells you whether KCompletion will play sounds on certain occasions. 

Default is enabled. \begin{Desc}
\item[Returns:]true if sounds are enabled \end{Desc}
\begin{Desc}
\item[See also:]{\bf enable\-Sounds}{\rm (p.\,\pageref{classKCompletion_a22})} 

{\bf disable\-Sounds}{\rm (p.\,\pageref{classKCompletion_a23})} \end{Desc}


Definition at line 377 of file kcompletion.h.\index{KCompletion@{KCompletion}!hasMultipleMatches@{hasMultipleMatches}}
\index{hasMultipleMatches@{hasMultipleMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion::has\-Multiple\-Matches () const\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a21}


Returns true when more than one match is found. 

\begin{Desc}
\item[Returns:]true if there are more than one match \end{Desc}
\begin{Desc}
\item[See also:]{\bf multiple\-Matches}{\rm (p.\,\pageref{classKCompletion_l2})} \end{Desc}


Definition at line 384 of file kcompletion.h.\index{KCompletion@{KCompletion}!enableSounds@{enableSounds}}
\index{enableSounds@{enableSounds}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::enable\-Sounds ()\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a22}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Enable\-Sounds}{\rm (p.\,\pageref{classKCompletion_a19})} \end{Desc}


Definition at line 391 of file kcompletion.h.\index{KCompletion@{KCompletion}!disableSounds@{disableSounds}}
\index{disableSounds@{disableSounds}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::disable\-Sounds ()\hspace{0.3cm}{\tt  [inline]}}\label{classKCompletion_a23}


\begin{Desc}
\item[{\bf Deprecated}]\end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-Enable\-Sounds}{\rm (p.\,\pageref{classKCompletion_a19})} \end{Desc}


Definition at line 397 of file kcompletion.h.\index{KCompletion@{KCompletion}!slotMakeCompletion@{slotMakeCompletion}}
\index{slotMakeCompletion@{slotMakeCompletion}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::slot\-Make\-Completion (const {\bf QString} \& {\em string})\hspace{0.3cm}{\tt  [inline, slot]}}\label{classKCompletion_i0}


Attempts to complete \char`\"{}string\char`\"{} and emits the completion via {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})}. 

Same as {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})} (just as a slot). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em string}]the string to complete \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf make\-Completion}{\rm (p.\,\pageref{classKCompletion_a2})} \end{Desc}


Definition at line 407 of file kcompletion.h.\index{KCompletion@{KCompletion}!slotPreviousMatch@{slotPreviousMatch}}
\index{slotPreviousMatch@{slotPreviousMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::slot\-Previous\-Match ()\hspace{0.3cm}{\tt  [inline, slot]}}\label{classKCompletion_i1}


Searches the previous matching item and emits it via {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})}. 

Same as {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} (just as a slot). \begin{Desc}
\item[See also:]{\bf previous\-Match}{\rm (p.\,\pageref{classKCompletion_a4})} \end{Desc}


Definition at line 416 of file kcompletion.h.\index{KCompletion@{KCompletion}!slotNextMatch@{slotNextMatch}}
\index{slotNextMatch@{slotNextMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::slot\-Next\-Match ()\hspace{0.3cm}{\tt  [inline, slot]}}\label{classKCompletion_i2}


Searches the next matching item and emits it via {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})}. 

Same as {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} (just as a slot). \begin{Desc}
\item[See also:]{\bf next\-Match}{\rm (p.\,\pageref{classKCompletion_a5})} \end{Desc}


Definition at line 425 of file kcompletion.h.\index{KCompletion@{KCompletion}!insertItems@{insertItems}}
\index{insertItems@{insertItems}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::insert\-Items (const {\bf QString\-List} \& {\em items})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletion_i3}


Inserts {\tt items} into the list of possible completions. 

Does the same as {\bf set\-Items()}{\rm (p.\,\pageref{classKCompletion_i4})}, but does not call {\bf clear()}{\rm (p.\,\pageref{classKCompletion_i8})} before. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em items}]the items to insert \end{description}
\end{Desc}


Definition at line 78 of file kcompletion.cpp.

References add\-Item(), and Weighted.

Referenced by set\-Items().\index{KCompletion@{KCompletion}!setItems@{setItems}}
\index{setItems@{setItems}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::set\-Items (const {\bf QString\-List} \& {\em list})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKCompletion_i4}


Sets the list of items available for completion. 

Removes all previous items.

Notice: when {\bf order()}{\rm (p.\,\pageref{classKCompletion_a12})} == Weighted, then the weighting is looked up for every item in the stringlist. Every item should have \char`\"{}:number\char`\"{} appended, where number is an unsigned integer, specifying the weighting.

If you don't like this, call set\-Order( KCompletion::Insertion ) before calling {\bf set\-Items()}{\rm (p.\,\pageref{classKCompletion_i4})}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em list}]the list of items that are available for completion \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf items}{\rm (p.\,\pageref{classKCompletion_a7})} \end{Desc}


Definition at line 71 of file kcompletion.cpp.

References clear(), and insert\-Items().\index{KCompletion@{KCompletion}!addItem@{addItem}}
\index{addItem@{addItem}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::add\-Item (const {\bf QString} \& {\em item})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletion_i5}


Adds an item to the list of available completions. 

Resets the current item-state ( {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} and {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} won't work anymore). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]the item to add \end{description}
\end{Desc}


Definition at line 106 of file kcompletion.cpp.

Referenced by insert\-Items().\index{KCompletion@{KCompletion}!addItem@{addItem}}
\index{addItem@{addItem}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::add\-Item (const {\bf QString} \& {\em item}, uint {\em weight})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletion_i6}


Adds an item to the list of available completions. 

Resets the current item-state ( {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} and {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} won't work anymore).

Sets the weighting of the item to {\tt weight} or adds it to the current weighting if the item is already available. The weight has to be greater than 1 to take effect (default weight is 1). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]the item to add \item[{\em weight}]the weight of the item, default is 1 \end{description}
\end{Desc}


Definition at line 115 of file kcompletion.cpp.

References KComp\-Tree\-Node::confirm(), KComp\-Tree\-Node::insert(), Sorted, and Weighted.\index{KCompletion@{KCompletion}!removeItem@{removeItem}}
\index{removeItem@{removeItem}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::remove\-Item (const {\bf QString} \& {\em item})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletion_i7}


Removes an item from the list of available completions. 

Resets the current item-state ( {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} and {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})} won't work anymore). \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]the item to remove \end{description}
\end{Desc}


Definition at line 168 of file kcompletion.cpp.

References KComp\-Tree\-Node::remove().\index{KCompletion@{KCompletion}!clear@{clear}}
\index{clear@{clear}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::clear ()\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKCompletion_i8}


Removes all inserted items. 



Definition at line 178 of file kcompletion.cpp.

Referenced by set\-Items().\index{KCompletion@{KCompletion}!match@{match}}
\index{match@{match}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::match (const {\bf QString} \& {\em item})\hspace{0.3cm}{\tt  [signal]}}\label{classKCompletion_l0}


The matching item. 

Will be emitted by {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})}, {\bf previous\-Match()}{\rm (p.\,\pageref{classKCompletion_a4})} or {\bf next\-Match()}{\rm (p.\,\pageref{classKCompletion_a5})}. May be QString::null if there is no matching item. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]the match, or QString::null if there is none \end{description}
\end{Desc}


Referenced by make\-Completion(), next\-Match(), and previous\-Match().\index{KCompletion@{KCompletion}!matches@{matches}}
\index{matches@{matches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::matches (const {\bf QString\-List} \& {\em matchlist})\hspace{0.3cm}{\tt  [signal]}}\label{classKCompletion_l1}


All matching items. 

Will be emitted by {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})} in shell- completion-mode, when the same string is passed to make\-Completion twice or more often. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em matchlist}]the list of matches \end{description}
\end{Desc}


Referenced by all\-Matches(), all\-Weighted\-Matches(), make\-Completion(), next\-Match(), previous\-Match(), and substring\-Completion().\index{KCompletion@{KCompletion}!multipleMatches@{multipleMatches}}
\index{multipleMatches@{multipleMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion::multiple\-Matches ()\hspace{0.3cm}{\tt  [signal]}}\label{classKCompletion_l2}


This signal is emitted, when calling {\bf make\-Completion()}{\rm (p.\,\pageref{classKCompletion_a2})} and more than one matching item is found. 

\begin{Desc}
\item[See also:]{\bf has\-Multiple\-Matches}{\rm (p.\,\pageref{classKCompletion_a21})} \end{Desc}


Referenced by make\-Completion().\index{KCompletion@{KCompletion}!postProcessMatch@{postProcessMatch}}
\index{postProcessMatch@{postProcessMatch}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCompletion::post\-Process\-Match ({\bf QString} $\ast$ {\em match}) const\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKCompletion_b0}


This method is called after a completion is found and before the matching string is emitted. 

You can override this method to modify the string that will be emitted. This is necessary e.g. in KURLCompletion(), where files with spaces in their names are shown escaped (\char`\"{}filename$\backslash$ with$\backslash$ spaces\char`\"{}), but stored unescaped inside KCompletion. Never delete that pointer!

Default implementation does nothing. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em match}]the match to process \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf post\-Process\-Matches}{\rm (p.\,\pageref{classKCompletion_b1})} \end{Desc}


Reimplemented in {\bf KShell\-Completion}, and {\bf KURLCompletion}.

Definition at line 528 of file kcompletion.h.

Referenced by make\-Completion(), next\-Match(), previous\-Match(), and substring\-Completion().\index{KCompletion@{KCompletion}!postProcessMatches@{postProcessMatches}}
\index{postProcessMatches@{postProcessMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCompletion::post\-Process\-Matches ({\bf QString\-List} $\ast$ {\em matches}) const\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKCompletion_b1}


This method is called before a list of all available completions is emitted via {\bf matches}{\rm (p.\,\pageref{classKCompletion_l1})}. 

You can override this method to modify the found items before {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})} or {\bf matches}{\rm (p.\,\pageref{classKCompletion_l1})} are emitted. Never delete that pointer!

Default implementation does nothing. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em matches}]the matches to process \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf post\-Process\-Match}{\rm (p.\,\pageref{classKCompletion_b0})} \end{Desc}


Reimplemented in {\bf KShell\-Completion}, and {\bf KURLCompletion}.

Definition at line 540 of file kcompletion.h.

Referenced by all\-Matches(), all\-Weighted\-Matches(), make\-Completion(), and substring\-Completion().\index{KCompletion@{KCompletion}!postProcessMatches@{postProcessMatches}}
\index{postProcessMatches@{postProcessMatches}!KCompletion@{KCompletion}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual void KCompletion::post\-Process\-Matches ({\bf KCompletion\-Matches} $\ast$ {\em matches}) const\hspace{0.3cm}{\tt  [inline, protected, virtual]}}\label{classKCompletion_b2}


This method is called before a list of all available completions is emitted via {\bf matches}{\rm (p.\,\pageref{classKCompletion_l1})}. 

You can override this method to modify the found items before {\bf match()}{\rm (p.\,\pageref{classKCompletion_l0})} or {\bf matches()}{\rm (p.\,\pageref{classKCompletion_l1})} are emitted. Never delete that pointer!

Default implementation does nothing. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em matches}]the matches to process \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf post\-Process\-Match}{\rm (p.\,\pageref{classKCompletion_b0})} \end{Desc}


Reimplemented in {\bf KShell\-Completion}, and {\bf KURLCompletion}.

Definition at line 552 of file kcompletion.h.

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