\section{KURL Class Reference}
\label{classKURL}\index{KURL@{KURL}}
Represents and parses a URL.  


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

Collaboration diagram for KURL:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=79pt]{classKURL__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf Adjustement\-Flags} \{ {\bf No\-Adjustements} =  0, 
{\bf Strip\-File\-Protocol} =  1
 \}
\item 
enum {\bf URIMode} \{ \par
{\bf Auto}, 
{\bf Invalid}, 
{\bf Raw\-URI}, 
{\bf URL}, 
\par
{\bf Mailto}
 \}
\item 
enum {\bf Query\-Items\-Options} \{ {\bf Case\-Insensitive\-Keys} =  1
 \}
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KURL} ()
\item 
{\bf $\sim$KURL} ()
\item 
{\bf KURL} (const {\bf QString} \&url, int encoding\_\-hint=0)
\item 
{\bf KURL} (const char $\ast$url, int encoding\_\-hint=0)
\item 
{\bf KURL} (const {\bf QCString} \&url, int encoding\_\-hint=0)
\item 
{\bf KURL} (const {\bf KURL} \&u)
\item 
{\bf KURL} (const {\bf QUrl} \&u)
\item 
{\bf KURL} (const {\bf KURL} \&\_\-baseurl, const {\bf QString} \&\_\-rel\_\-url, int encoding\_\-hint=0)
\item 
{\bf QString} {\bf protocol} () const 
\item 
void {\bf set\-Protocol} (const {\bf QString} \&\_\-txt)
\item 
int {\bf uri\-Mode} () const 
\item 
{\bf QString} {\bf user} () const 
\item 
void {\bf set\-User} (const {\bf QString} \&\_\-txt)
\item 
bool {\bf has\-User} () const 
\item 
{\bf QString} {\bf pass} () const 
\item 
void {\bf set\-Pass} (const {\bf QString} \&\_\-txt)
\item 
bool {\bf has\-Pass} () const 
\item 
{\bf QString} {\bf host} () const 
\item 
void {\bf set\-Host} (const {\bf QString} \&\_\-txt)
\item 
bool {\bf has\-Host} () const 
\item 
unsigned short int {\bf port} () const 
\item 
void {\bf set\-Port} (unsigned short int \_\-p)
\item 
{\bf QString} {\bf path} () const 
\item 
{\bf QString} {\bf path} (int \_\-trailing) const 
\item 
void {\bf set\-Path} (const {\bf QString} \&path)
\item 
bool {\bf has\-Path} () const 
\item 
void {\bf clean\-Path} (bool clean\-Dir\-Separator=true)
\item 
void {\bf adjust\-Path} (int \_\-trailing)
\item 
void {\bf set\-Encoded\-Path\-And\-Query} (const {\bf QString} \&\_\-txt, int encoding\_\-hint=0)
\item 
void {\bf set\-Encoded\-Path} (const {\bf QString} \&\_\-txt, int encoding\_\-hint=0)
\item 
{\bf QString} {\bf encoded\-Path\-And\-Query} (int \_\-trailing=0, bool \_\-no\_\-empty\_\-path=false, int encoding\_\-hint=0) const 
\item 
void {\bf set\-Query} (const {\bf QString} \&\_\-txt, int encoding\_\-hint=0)
\item 
{\bf QString} {\bf query} () const 
\item 
{\bf QString} {\bf ref} () const 
\item 
void {\bf set\-Ref} (const {\bf QString} \&\_\-txt)
\item 
bool {\bf has\-Ref} () const 
\item 
{\bf QString} {\bf html\-Ref} () const 
\item 
{\bf QString} {\bf encoded\-Html\-Ref} () const 
\item 
void {\bf set\-HTMLRef} (const {\bf QString} \&\_\-ref)
\item 
bool {\bf has\-HTMLRef} () const 
\item 
bool {\bf is\-Valid} () const 
\item 
KDE\_\-DEPRECATED bool {\bf is\-Malformed} () const 
\item 
bool {\bf is\-Local\-File} () const 
\item 
void {\bf set\-File\-Encoding} (const {\bf QString} \&encoding)
\item 
{\bf QString} {\bf file\-Encoding} () const 
\item 
bool {\bf has\-Sub\-URL} () const 
\item 
void {\bf add\-Path} (const {\bf QString} \&txt)
\item 
{\bf QString} {\bf query\-Item} (const {\bf QString} \&item) const 
\item 
{\bf QString} {\bf query\-Item} (const {\bf QString} \&item, int encoding\_\-hint) const 
\item 
{\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ {\bf query\-Items} (int options=0) const \label{classKURL_a49}

\item 
{\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ {\bf query\-Items} (int options, int encoding\_\-hint) const 
\item 
void {\bf add\-Query\-Item} (const {\bf QString} \&\_\-item, const {\bf QString} \&\_\-value, int encoding\_\-hint=0)
\item 
void {\bf remove\-Query\-Item} (const {\bf QString} \&\_\-item)
\item 
void {\bf set\-File\-Name} (const {\bf QString} \&\_\-txt)
\item 
{\bf QString} {\bf file\-Name} (bool \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path=true) const 
\item 
{\bf QString} {\bf directory} (bool \_\-strip\_\-trailing\_\-slash\_\-from\_\-result=true, bool \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path=true) const 
\item 
void {\bf set\-Directory} (const {\bf QString} \&dir)
\item 
bool {\bf cd} (const {\bf QString} \&\_\-dir)
\item 
{\bf QString} {\bf url} (int \_\-trailing=0, int encoding\_\-hint=0) const 
\item 
{\bf QString} {\bf pretty\-URL} (int \_\-trailing=0) const 
\item 
{\bf QString} {\bf pretty\-URL} (int \_\-trailing, Adjustement\-Flags \_\-flags) const 
\item 
{\bf QString} {\bf path\-Or\-URL} () const 
\item 
{\bf QString} {\bf html\-URL} () const 
\item 
bool {\bf is\-Empty} () const 
\item 
{\bf KURL} {\bf up\-URL} () const 
\item 
bool {\bf operator$<$} (const {\bf KURL} \&\_\-u) const \label{classKURL_a65}

\item 
{\bf KURL} \& {\bf operator=} (const {\bf KURL} \&\_\-u)\label{classKURL_a66}

\item 
{\bf KURL} \& {\bf operator=} (const {\bf QString} \&\_\-url)\label{classKURL_a67}

\item 
{\bf KURL} \& {\bf operator=} (const char $\ast$\_\-url)\label{classKURL_a68}

\item 
{\bf KURL} \& {\bf operator=} (const {\bf QUrl} \&u)\label{classKURL_a69}

\item 
bool {\bf operator==} (const {\bf KURL} \&\_\-u) const \label{classKURL_a70}

\item 
bool {\bf operator==} (const {\bf QString} \&\_\-u) const \label{classKURL_a71}

\item 
bool {\bf operator!=} (const {\bf KURL} \&\_\-u) const \label{classKURL_a72}

\item 
bool {\bf operator!=} (const {\bf QString} \&\_\-u) const \label{classKURL_a73}

\item 
bool {\bf cmp} (const {\bf KURL} \&u, bool ignore\_\-trailing=false) const KDE\_\-DEPRECATED
\item 
bool {\bf equals} (const {\bf KURL} \&u, bool ignore\_\-trailing=false) const 
\item 
bool {\bf is\-Parent\-Of} (const {\bf KURL} \&u) const 
\item 
{\bf QString} {\bf filename} (bool \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path=true) const 
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf List} {\bf split} (const {\bf QString} \&\_\-url)
\item 
static {\bf List} {\bf split} (const {\bf KURL} \&\_\-url)
\item 
static {\bf KURL} {\bf join} (const {\bf List} \&\_\-list)
\item 
static {\bf KURL} {\bf from\-Path\-Or\-URL} (const {\bf QString} \&text)
\item 
static {\bf QString} {\bf encode\_\-string} (const {\bf QString} \&str, int encoding\_\-hint=0)
\item 
static {\bf QString} {\bf encode\_\-string\_\-no\_\-slash} (const {\bf QString} \&str, int encoding\_\-hint=0)
\item 
static {\bf QString} {\bf decode\_\-string} (const {\bf QString} \&str, int encoding\_\-hint=0)
\item 
static bool {\bf is\-Relative\-URL} (const {\bf QString} \&\_\-url)
\item 
static {\bf QString} {\bf relative\-URL} (const {\bf KURL} \&base\_\-url, const {\bf KURL} \&url, int encoding\_\-hint=0)
\item 
static {\bf QString} {\bf relative\-Path} (const {\bf QString} \&base\_\-dir, const {\bf QString} \&path, bool $\ast$is\-Parent=0)
\item 
static {\bf URIMode} {\bf uri\-Mode\-For\-Protocol} (const {\bf QString} \&protocol)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf reset} ()\label{classKURL_b0}

\item 
void {\bf parse\-URL} (const {\bf QString} \&\_\-url, int encoding\_\-hint=0)\label{classKURL_b1}

\item 
void {\bf parse\-Raw\-URI} (const {\bf QString} \&\_\-url, int encoding\_\-hint=0)\label{classKURL_b2}

\item 
void {\bf parse\-Mailto} (const {\bf QString} \&\_\-url, int encoding\_\-hint=0)\label{classKURL_b3}

\item 
void {\bf parse} (const {\bf QString} \&\_\-url, int encoding\_\-hint=0)\label{classKURL_b4}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
KDECORE\_\-EXPORT {\bf QData\-Stream} \& {\bf operator$<$$<$} ({\bf QData\-Stream} \&s, const {\bf KURL} \&a)\label{classKURL_n0}

\item 
KDECORE\_\-EXPORT {\bf QData\-Stream} \& {\bf operator$>$$>$} ({\bf QData\-Stream} \&s, {\bf KURL} \&a)\label{classKURL_n1}

\end{CompactItemize}
\subsection*{Related Functions}
(Note that these are not member functions.) \begin{CompactItemize}
\item 
KDECORE\_\-EXPORT bool {\bf urlcmp} (const {\bf QString} \&\_\-url1, const {\bf QString} \&\_\-url2)
\item 
KDECORE\_\-EXPORT bool {\bf urlcmp} (const {\bf QString} \&\_\-url1, const {\bf QString} \&\_\-url2, bool \_\-ignore\_\-trailing, bool \_\-ignore\_\-ref)
\end{CompactItemize}
\subsection*{Classes}
\begin{CompactItemize}
\item 
class {\bf List}
\begin{CompactList}\small\item\em KURL::List is a {\bf QValue\-List} that contains KURLs with a few convenience methods. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Represents and parses a URL. 

A prototypical URL looks like: 

\footnotesize\begin{verbatim}   protocol://user:password\@hostname:port/path/to/file.ext#reference
\end{verbatim}
\normalsize


KURL handles escaping of URLs. This means that the specification of a full URL will differ from the corresponding string that would specify a local file or directory in file-operations like fopen. This is because an URL doesn't allow certain characters and escapes them. (e.g. '\#'-$>$\char`\"{}\%23\char`\"{}, space-$>$\char`\"{}\%20\char`\"{}) (In a URL the hash-character '\#' is used to specify a \char`\"{}reference\char`\"{}, i.e. the position within a document).

The constructor KURL(const QString\&) expects a string properly escaped, or at least non-ambiguous. For instance a local file or directory \char`\"{}/bar/\#foo\#\char`\"{} would have the URL {\tt file:///bar/\%23foo\%23.} If you have the absolute path and need the URL-escaping you should create KURL via the default-constructor and then call {\bf set\-Path(const QString\&)}{\rm (p.\,\pageref{classKURL_a24})}. 

\footnotesize\begin{verbatim}     KURL kurl;
     kurl.setPath("/bar/#foo#");
     QString url = kurl.url();    // -> "file:///bar/%23foo%23"
\end{verbatim}
\normalsize


If you have the URL of a local file or directory and need the absolute path, you would use {\bf path()}{\rm (p.\,\pageref{classKURL_a22})}. 

\footnotesize\begin{verbatim}    KURL url( "file:///bar/%23foo%23" );
    ...
    if ( url.isLocalFile() )
       QString path = url.path();       // -> "/bar/#foo#"
\end{verbatim}
\normalsize


The other way round: if the user can enter a string, that can be either a path or a URL, then you need to use {\bf KURL::from\-Path\-Or\-URL()}{\rm (p.\,\pageref{classKURL_e3})} to build a KURL.

This must also be considered, when you have separated directory and file strings and need to put them together. While you can simply concatenate normal path strings, you must take care if the directory-part is already an escaped URL. (This might be needed if the user specifies a relative path, and your program supplies the rest from elsewhere.)

Wrong: 

\footnotesize\begin{verbatim}    QString dirUrl = "file:///bar/";
    QString fileName = "#foo#";
    QString invalidURL = dirUrl + fileName;   // -> "file:///bar/#foo#" won't behave like you would expect.
\end{verbatim}
\normalsize
 Instead you should use {\bf add\-Path()}{\rm (p.\,\pageref{classKURL_a46})}: Right: 

\footnotesize\begin{verbatim}    KURL url( "file:///bar/" );
    QString fileName = "#foo#";
    url.addPath( fileName );
    QString validURL = url.url();    // -> "file:///bar/%23foo%23"
\end{verbatim}
\normalsize


Also consider that some URLs contain the password, but this shouldn't be visible. Your program should use {\bf pretty\-URL()}{\rm (p.\,\pageref{classKURL_a59})} every time it displays a URL, whether in the GUI or in debug output or...



\footnotesize\begin{verbatim}    KURL url( "ftp://name:password@ftp.faraway.org/bar/%23foo%23");
    QString visibleURL = url.prettyURL(); // -> "ftp://name@ftp.faraway.org/bar/%23foo%23"
\end{verbatim}
\normalsize
 Note that {\bf pretty\-URL()}{\rm (p.\,\pageref{classKURL_a59})} doesn't change the character escapes (like \char`\"{}\%23\char`\"{}). Otherwise the URL would be invalid and the user wouldn't be able to use it in another context.

KURL has some restrictions regarding the path encoding. KURL works internally with the decoded path and and encoded query. For example, 

\footnotesize\begin{verbatim} http://localhost/cgi-bin/test%20me.pl?cmd=Hello%20you
\end{verbatim}
\normalsize
 would result in a decoded path \char`\"{}/cgi-bin/test me.pl\char`\"{} and in the encoded query \char`\"{}?cmd=Hello\%20you\char`\"{}. Since path is internally always encoded you may {\em not\/} use \char`\"{}\%00\char`\"{} in the path, although this is OK for the query.

\begin{Desc}
\item[Author:]Torben Weis $<${\tt weis@kde.org}$>$ \end{Desc}




Definition at line 122 of file kurl.h.

\subsection{Member Enumeration Documentation}
\index{KURL@{KURL}!URIMode@{URIMode}}
\index{URIMode@{URIMode}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KURL::URIMode}}\label{classKURL_w9}


Defines the type of URI we are processing. 

\begin{Desc}
\item[Enumeration values: ]\par
\begin{description}
\index{Auto@{Auto}!KURL@{KURL}}\index{KURL@{KURL}!Auto@{Auto}}\item[{\em 
Auto\label{classKURL_w9w2}
}]Automatically detected. 

Using this mode, an appropriate processing mode will be selected when the URI is first processed. \index{Invalid@{Invalid}!KURL@{KURL}}\index{KURL@{KURL}!Invalid@{Invalid}}\item[{\em 
Invalid\label{classKURL_w9w3}
}]Invalid URI. 

This is something that can't be parsed as a URI at all. The contents are accessible through the {\bf protocol()}{\rm (p.\,\pageref{classKURL_a8})} method. \index{RawURI@{RawURI}!KURL@{KURL}}\index{KURL@{KURL}!RawURI@{RawURI}}\item[{\em 
Raw\-URI\label{classKURL_w9w4}
}]Raw URI. 

This type of URI should not be processed in any way. Contents are accessible through the {\bf path()}{\rm (p.\,\pageref{classKURL_a22})} method. \index{URL@{URL}!KURL@{KURL}}\index{KURL@{KURL}!URL@{URL}}\item[{\em 
URL\label{classKURL_w9w5}
}]Standards compliant URL. 

Process as a syntactically correct URL. \index{Mailto@{Mailto}!KURL@{KURL}}\index{KURL@{KURL}!Mailto@{Mailto}}\item[{\em 
Mailto\label{classKURL_w9w6}
}]Mailto URI. 

{\bf path()}{\rm (p.\,\pageref{classKURL_a22})} contains an email address which should have its domain part processed as a DNS name. The email address is accessible through the {\bf path()}{\rm (p.\,\pageref{classKURL_a22})} method. \end{description}
\end{Desc}



Definition at line 134 of file kurl.h.\index{KURL@{KURL}!QueryItemsOptions@{QueryItemsOptions}}
\index{QueryItemsOptions@{QueryItemsOptions}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KURL::Query\-Items\-Options}}\label{classKURL_w10}


Options for query\-Items. 

Currently, only one option is defined:

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em Case\-Insensitive\-Keys}]normalize query keys to lowercase.\end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 604 of file kurl.h.

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


Constructs an empty URL. 



Definition at line 447 of file kurl.cpp.

Referenced by from\-Path\-Or\-URL(), join(), KURL::List::List(), split(), and up\-URL().\index{KURL@{KURL}!~KURL@{$\sim$KURL}}
\index{~KURL@{$\sim$KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::$\sim${\bf KURL} ()}\label{classKURL_a1}


Destructs the KURL object. 



Definition at line 452 of file kurl.cpp.\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const {\bf QString} \& {\em url}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a2}


Usual constructor, to construct from a string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em url}]A URL, not a filename. If the URL does not have a protocol part, \char`\"{}file:\char`\"{} is assumed. It is dangerous to feed unix filenames into this function, this will work most of the time but not always. For example \char`\"{}/home/Torben\%20Weis\char`\"{} will be considered a URL pointing to the file \char`\"{}/home/Torben Weis\char`\"{} instead of to the file \char`\"{}/home/Torben\%20Weis\char`\"{}. This means that if you have a usual UNIX like path you should not use this constructor. Instead create an empty url and set the path by using {\bf set\-Path()}{\rm (p.\,\pageref{classKURL_a24})}. \item[{\em encoding\_\-hint}]MIB of original encoding of URL. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 457 of file kurl.cpp.

References url().\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const char $\ast$ {\em url}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a3}


Constructor taking a char $\ast$ {\tt url}, which is an \_\-encoded\_\- representation of the URL, exactly like the usual constructor. 

This is useful when then URL, in its encoded form, is strictly ascii. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em url}]A encoded URL. If the URL does not have a protocol part, \char`\"{}file:\char`\"{} is assumed. \item[{\em encoding\_\-hint}]MIB of original encoding of URL. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 463 of file kurl.cpp.

References url().\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const {\bf QCString} \& {\em url}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a4}


Constructor taking a {\bf QCString} {\tt url}, which is an \_\-encoded\_\- representation of the URL, exactly like the usual constructor. 

This is useful when then URL, in its encoded form, is strictly ascii. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em url}]A encoded URL. If the URL does not have a protocol part, \char`\"{}file:\char`\"{} is assumed. \item[{\em encoding\_\-hint}]MIB of original encoding of URL. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 469 of file kurl.cpp.

References url().\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const {\bf KURL} \& {\em u})}\label{classKURL_a5}


Copy constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em u}]the KURL to copy \end{description}
\end{Desc}


Definition at line 475 of file kurl.cpp.\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const {\bf QUrl} \& {\em u})}\label{classKURL_a6}


Converts from a {\bf QUrl}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em u}]the {\bf QUrl} \end{description}
\end{Desc}


Definition at line 514 of file kurl.cpp.\index{KURL@{KURL}!KURL@{KURL}}
\index{KURL@{KURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURL::KURL (const {\bf KURL} \& {\em \_\-baseurl}, const {\bf QString} \& {\em \_\-rel\_\-url}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a7}


Constructor allowing relative URLs. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-baseurl}]The base url. \item[{\em \_\-rel\_\-url}]A relative or absolute URL. If this is an absolute URL then {\tt \_\-baseurl} will be ignored. If this is a relative URL it will be combined with {\tt \_\-baseurl}. Note that \_\-rel\_\-url should be encoded too, in any case. So do NOT pass a path here (use set\-Path or add\-Path instead). \item[{\em encoding\_\-hint}]MIB of original encoding of URL. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 520 of file kurl.cpp.

References QValue\-List::append(), clean\-Path(), QString::find(), QString::find\-Rev(), QString::is\-Empty(), QString::is\-Null(), is\-Relative\-URL(), join(), QValue\-List::last(), QString::length(), m\_\-str\-Protocol, QString::mid(), ref(), QString::remove(), QValue\-List::remove(), split(), QString::truncate(), and url().

\subsection{Member Function Documentation}
\index{KURL@{KURL}!protocol@{protocol}}
\index{protocol@{protocol}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::protocol () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a8}


Returns the protocol for the URL (i.e., file, http, etc.). 

\begin{Desc}
\item[Returns:]the protocol of the URL, does not include the colon. If the URL is malformed, QString::null will be returned. \end{Desc}


Definition at line 271 of file kurl.h.

Referenced by KApplication::authorize\-URLAction(), and uri\-Mode\-For\-Protocol().\index{KURL@{KURL}!setProtocol@{setProtocol}}
\index{setProtocol@{setProtocol}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Protocol (const {\bf QString} \& {\em \_\-txt})}\label{classKURL_a9}


Sets the protocol for the URL (i.e., file, http, etc.). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the new protocol of the URL (without colon) \end{description}
\end{Desc}


Definition at line 1925 of file kurl.cpp.

References Auto, and uri\-Mode\-For\-Protocol().

Referenced by KApplication::invoke\-Mailer().\index{KURL@{KURL}!uriMode@{uriMode}}
\index{uriMode@{uriMode}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KURL::uri\-Mode () const}\label{classKURL_a10}


Returns the URI processing mode for the URL. 

\begin{Desc}
\item[Returns:]the URI processing mode set for this URL. \end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 2314 of file kurl.cpp.\index{KURL@{KURL}!user@{user}}
\index{user@{user}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::user () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a11}


Returns the decoded user name (login, user id, ...) included in the URL. 

\begin{Desc}
\item[Returns:]the user name or QString::null if there is no user name \end{Desc}


Definition at line 289 of file kurl.h.\index{KURL@{KURL}!setUser@{setUser}}
\index{setUser@{setUser}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-User (const {\bf QString} \& {\em \_\-txt})}\label{classKURL_a12}


Sets the user name (login, user id, ...) included in the URL. 

Special characters in the user name will appear encoded in the URL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the name of the user or QString::null to remove the user \end{description}
\end{Desc}


Definition at line 1933 of file kurl.cpp.\index{KURL@{KURL}!hasUser@{hasUser}}
\index{hasUser@{hasUser}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-User () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a13}


{\bf Test} to see if this URL has a user name included in it. 

\begin{Desc}
\item[Returns:]true if the URL has an non-empty user name \end{Desc}


Definition at line 301 of file kurl.h.

Referenced by pretty\-URL(), and url().\index{KURL@{KURL}!pass@{pass}}
\index{pass@{pass}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::pass () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a14}


Returns the decoded password (corresponding to {\bf user()}{\rm (p.\,\pageref{classKURL_a11})}) included in the URL. 

\begin{Desc}
\item[Returns:]the password or QString::null if it does not exist \end{Desc}


Definition at line 307 of file kurl.h.\index{KURL@{KURL}!setPass@{setPass}}
\index{setPass@{setPass}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Pass (const {\bf QString} \& {\em \_\-txt})}\label{classKURL_a15}


Sets the password (corresponding to {\bf user()}{\rm (p.\,\pageref{classKURL_a11})}) included in the URL. 

Special characters in the password will appear encoded in the URL. Note that a password can only appear in a URL string if you also set a user. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the password to set or QString::null to remove the password \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf set\-User}{\rm (p.\,\pageref{classKURL_a12})} 

{\bf has\-User}{\rm (p.\,\pageref{classKURL_a13})} \end{Desc}


Definition at line 1939 of file kurl.cpp.\index{KURL@{KURL}!hasPass@{hasPass}}
\index{hasPass@{hasPass}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-Pass () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a16}


{\bf Test} to see if this URL has a password included in it. 

\begin{Desc}
\item[Returns:]true if there is a non-empty password set \end{Desc}


Definition at line 323 of file kurl.h.

Referenced by url().\index{KURL@{KURL}!host@{host}}
\index{host@{host}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::host () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a17}


Returns the decoded hostname included in the URL. 

\begin{Desc}
\item[Returns:]the name of the host or QString::null if no host is set \end{Desc}


Definition at line 329 of file kurl.h.\index{KURL@{KURL}!setHost@{setHost}}
\index{setHost@{setHost}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Host (const {\bf QString} \& {\em \_\-txt})}\label{classKURL_a18}


Sets the hostname included in the URL. 

Special characters in the hostname will appear encoded in the URL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the new name of the host or QString::null to remove the host \end{description}
\end{Desc}


Definition at line 1945 of file kurl.cpp.

References Auto, and URL.\index{KURL@{KURL}!hasHost@{hasHost}}
\index{hasHost@{hasHost}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-Host () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a19}


{\bf Test} to see if this URL has a hostname included in it. 

\begin{Desc}
\item[Returns:]true if the URL has a host \end{Desc}


Definition at line 342 of file kurl.h.

Referenced by pretty\-URL(), and url().\index{KURL@{KURL}!port@{port}}
\index{port@{port}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned short int KURL::port () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a20}


Returns the port number included in the URL. 

\begin{Desc}
\item[Returns:]the port number. If there is no port number specified in the URL, returns 0. \end{Desc}


Definition at line 349 of file kurl.h.\index{KURL@{KURL}!setPort@{setPort}}
\index{setPort@{setPort}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Port (unsigned short int {\em \_\-p})}\label{classKURL_a21}


Sets the port number included in the URL. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-p}]the new port number or 0 to have no port number \end{description}
\end{Desc}


Definition at line 1967 of file kurl.cpp.\index{KURL@{KURL}!path@{path}}
\index{path@{path}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::path () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a22}


Returns the current decoded path. 

This does {\em not\/} include the query. \begin{Desc}
\item[Returns:]the path of the URL (without query), or QString::null if no path set. \end{Desc}


Definition at line 361 of file kurl.h.

Referenced by KApplication::authorize\-URLAction(), cd(), encoded\-Path\-And\-Query(), equals(), is\-Parent\-Of(), path(), path\-Or\-URL(), and up\-URL().\index{KURL@{KURL}!path@{path}}
\index{path@{path}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::path (int {\em \_\-trailing}) const}\label{classKURL_a23}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]May be ( -1, 0 +1 ). -1 strips a trailing '/', +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. If the URL has no path, then no '/' is added anyway. And on the other side: If the path is \char`\"{}/\char`\"{}, then this character won't be stripped. Reason: \char`\"{}ftp://weis$\backslash$@host\char`\"{} means something completely different than \char`\"{}ftp://weis$\backslash$@host/\char`\"{}. So adding or stripping the '/' would really alter the URL, while \char`\"{}ftp://host/path\char`\"{} and \char`\"{}ftp://host/path/\char`\"{} mean the same directory.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The current decoded path. This does not include the query. Can be QString::null if no path is set. \end{Desc}


Definition at line 1353 of file kurl.cpp.

References path().\index{KURL@{KURL}!setPath@{setPath}}
\index{setPath@{setPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Path (const {\bf QString} \& {\em path})}\label{classKURL_a24}


Sets the path of the URL. 

The query is not changed by this function.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]The new path. This is considered to be decoded. This means: 3f does not become decoded and the ? does not indicate the start of the query part. Can be QString::null to delete the path. \end{description}
\end{Desc}


Definition at line 1972 of file kurl.cpp.

References Auto, is\-Empty(), and URL.

Referenced by KApplication::authorize\-URLAction(), cd(), from\-Path\-Or\-URL(), KApplication::invoke\-Mailer(), KCmd\-Line\-Args::make\-URL(), KConfig\-INIBack\-End::parse\-Config\-Files(), KDesktop\-File::read\-URL(), set\-Directory(), set\-File\-Name(), and KConfig\-INIBack\-End::sync().\index{KURL@{KURL}!hasPath@{hasPath}}
\index{hasPath@{hasPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-Path () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a25}


{\bf Test} to see if this URL has a path is included in it. 

\begin{Desc}
\item[Returns:]true if there is a path \end{Desc}


Definition at line 392 of file kurl.h.\index{KURL@{KURL}!cleanPath@{cleanPath}}
\index{cleanPath@{cleanPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::clean\-Path (bool {\em clean\-Dir\-Separator} = {\tt true})}\label{classKURL_a26}


Resolves \char`\"{}.\char`\"{} and \char`\"{}..\char`\"{} components in path. 

Some servers seem not to like the removal of extra '/' even though it is against the specification in RFC 2396.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em clean\-Dir\-Separator}]if true, occurrences of consecutive directory separators (e.g. /foo//bar) are cleaned up as well. \end{description}
\end{Desc}


Definition at line 1250 of file kurl.cpp.

References URL.

Referenced by KURL(), KCmd\-Line\-Args::make\-URL(), and set\-File\-Name().\index{KURL@{KURL}!adjustPath@{adjustPath}}
\index{adjustPath@{adjustPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::adjust\-Path (int {\em \_\-trailing})}\label{classKURL_a27}


Add or remove a trailing slash to/from the path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]May be ( -1, 0 +1 ). -1 strips a trailing '/', +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. If the URL has no path, then no '/' is added anyway. And on the other side: If the path is \char`\"{}/\char`\"{}, then this character won't be stripped. Reason: \char`\"{}ftp://weis$\backslash$@host\char`\"{} means something completely different than \char`\"{}ftp://weis$\backslash$@host/\char`\"{}. So adding or stripping the '/' would really alter the URL, while \char`\"{}ftp://host/path\char`\"{} and \char`\"{}ftp://host/path/\char`\"{} mean the same directory. \end{description}
\end{Desc}


Definition at line 1286 of file kurl.cpp.

References QString::is\-Empty().\index{KURL@{KURL}!setEncodedPathAndQuery@{setEncodedPathAndQuery}}
\index{setEncodedPathAndQuery@{setEncodedPathAndQuery}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Encoded\-Path\-And\-Query (const {\bf QString} \& {\em \_\-txt}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a28}


This is useful for HTTP. 

It looks first for '?' and decodes then. The encoded path is the concatenation of the current path and the query. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the new path and query. \item[{\em encoding\_\-hint}]MIB of original encoding of {\tt \_\-txt} . \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 1338 of file kurl.cpp.

References QString::find(), and set\-Encoded\-Path().\index{KURL@{KURL}!setEncodedPath@{setEncodedPath}}
\index{setEncodedPath@{setEncodedPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Encoded\-Path (const {\bf QString} \& {\em \_\-txt}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a29}


Sets the (already encoded) path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]the new path \item[{\em encoding\_\-hint}]MIB of original encoding of {\tt \_\-txt} . \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 1324 of file kurl.cpp.

References Auto, and URL.

Referenced by set\-Encoded\-Path\-And\-Query(), and set\-File\-Name().\index{KURL@{KURL}!encodedPathAndQuery@{encodedPathAndQuery}}
\index{encodedPathAndQuery@{encodedPathAndQuery}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::encoded\-Path\-And\-Query (int {\em \_\-trailing} = {\tt 0}, bool {\em \_\-no\_\-empty\_\-path} = {\tt false}, int {\em encoding\_\-hint} = {\tt 0}) const}\label{classKURL_a30}


Returns the encoded path and the query. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]May be ( -1, 0 +1 ). -1 strips a trailing '/', +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. If the URL has no path, then no '/' is added anyway. And on the other side: If the path is \char`\"{}/\char`\"{}, then this character won't be stripped. Reason: \char`\"{}ftp://weis$\backslash$@host\char`\"{} means something completely different than \char`\"{}ftp://weis$\backslash$@host/\char`\"{}. So adding or stripping the '/' would really alter the URL, while \char`\"{}ftp://host/path\char`\"{} and \char`\"{}ftp://host/path/\char`\"{} mean the same directory. \item[{\em \_\-no\_\-empty\_\-path}]If set to true then an empty path is substituted by \char`\"{}/\char`\"{}. \item[{\em encoding\_\-hint}]MIB of desired encoding of URL. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}
\begin{Desc}
\item[Returns:]The concatenation if the encoded path , '?' and the encoded query. \end{Desc}


Definition at line 1296 of file kurl.cpp.

References QString::is\-Empty(), Mailto, and path().

Referenced by url().\index{KURL@{KURL}!setQuery@{setQuery}}
\index{setQuery@{setQuery}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Query (const {\bf QString} \& {\em \_\-txt}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a31}


\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]This is considered to be encoded. This has a good reason: The query may contain the 0 character.\end{description}
\end{Desc}
The query should start with a '?'. If it doesn't '?' is prepended. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding\_\-hint}]Reserved, should be 0. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 1994 of file kurl.cpp.

Referenced by KApplication::invoke\-Mailer().\index{KURL@{KURL}!query@{query}}
\index{query@{query}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::query () const}\label{classKURL_a32}


Returns the query of the URL. 

The query may contain the 0 character. If a query is present it always starts with a '?'. A single '?' means an empty query. An empty string means no query. \begin{Desc}
\item[Returns:]The encoded query, or QString::null if there is none. \end{Desc}


Definition at line 2041 of file kurl.cpp.

Referenced by file\-Encoding(), set\-File\-Encoding(), and up\-URL().\index{KURL@{KURL}!ref@{ref}}
\index{ref@{ref}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::ref () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a33}


The reference is {\em never\/} decoded automatically. 

\begin{Desc}
\item[Returns:]the undecoded reference, or QString::null if there is none \end{Desc}


Definition at line 477 of file kurl.h.

Referenced by encoded\-Html\-Ref(), html\-Ref(), KURL(), and split().\index{KURL@{KURL}!setRef@{setRef}}
\index{setRef@{setRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Ref (const {\bf QString} \& {\em \_\-txt})\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a34}


Sets the reference part (everything after '\#'). 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]The encoded reference (or QString::null to remove it). \end{description}
\end{Desc}


Definition at line 483 of file kurl.h.\index{KURL@{KURL}!hasRef@{hasRef}}
\index{hasRef@{hasRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-Ref () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a35}


Checks whether the URL has a reference part. 

\begin{Desc}
\item[Returns:]true if the URL has a reference part. In a URL like {\tt http://www.kde.org/kdebase.tar\#tar:/README} it would return true, too. \end{Desc}


Definition at line 491 of file kurl.h.

Referenced by has\-HTMLRef(), pretty\-URL(), and url().\index{KURL@{KURL}!htmlRef@{htmlRef}}
\index{htmlRef@{htmlRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::html\-Ref () const}\label{classKURL_a36}


Returns the HTML reference (the part of the URL after \char`\"{}\#\char`\"{}). 

\begin{Desc}
\item[Returns:]The HTML-style reference. \end{Desc}
\begin{Desc}
\item[See also:]{\bf split}{\rm (p.\,\pageref{classKURL_e0})} 

{\bf has\-Sub\-URL}{\rm (p.\,\pageref{classKURL_a45})} 

{\bf encoded\-Html\-Ref}{\rm (p.\,\pageref{classKURL_a37})} \end{Desc}


Definition at line 1876 of file kurl.cpp.

References QValue\-List::begin(), has\-Sub\-URL(), ref(), and split().\index{KURL@{KURL}!encodedHtmlRef@{encodedHtmlRef}}
\index{encodedHtmlRef@{encodedHtmlRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::encoded\-Html\-Ref () const}\label{classKURL_a37}


Returns the HTML reference (the part of the URL after \char`\"{}\#\char`\"{}) in encoded form. 

\begin{Desc}
\item[Returns:]The HTML-style reference in its original form. \end{Desc}


Definition at line 1887 of file kurl.cpp.

References QValue\-List::begin(), has\-Sub\-URL(), ref(), and split().\index{KURL@{KURL}!setHTMLRef@{setHTMLRef}}
\index{setHTMLRef@{setHTMLRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-HTMLRef (const {\bf QString} \& {\em \_\-ref})}\label{classKURL_a38}


Sets the HTML-style reference. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ref}]The new reference. This is considered to be {\em not\/} encoded in contrast to {\bf set\-Ref()}{\rm (p.\,\pageref{classKURL_a34})}. Use QString::null to remove it. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf html\-Ref()}{\rm (p.\,\pageref{classKURL_a36})} \end{Desc}


Definition at line 1898 of file kurl.cpp.

References QValue\-List::begin(), has\-Sub\-URL(), join(), and split().

Referenced by cd().\index{KURL@{KURL}!hasHTMLRef@{hasHTMLRef}}
\index{hasHTMLRef@{hasHTMLRef}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-HTMLRef () const}\label{classKURL_a39}


Checks whether there is a HTML reference. 

\begin{Desc}
\item[Returns:]true if the URL has an HTML-style reference. \end{Desc}
\begin{Desc}
\item[See also:]{\bf html\-Ref()}{\rm (p.\,\pageref{classKURL_a36})} \end{Desc}


Definition at line 1913 of file kurl.cpp.

References QValue\-List::begin(), has\-Ref(), has\-Sub\-URL(), and split().\index{KURL@{KURL}!isValid@{isValid}}
\index{isValid@{isValid}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::is\-Valid () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a40}


Checks whether the URL is well formed. 

\begin{Desc}
\item[Returns:]false if the URL is malformed. This function does {\em not\/} test whether sub URLs are well-formed, too. \end{Desc}


Definition at line 530 of file kurl.h.

Referenced by KURLDrag::decode(), equals(), and is\-Parent\-Of().\index{KURL@{KURL}!isMalformed@{isMalformed}}
\index{isMalformed@{isMalformed}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDE\_\-DEPRECATED bool KURL::is\-Malformed () const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a41}


\begin{Desc}
\item[{\bf Deprecated}]Use !is\-Valid() instead. \end{Desc}


Definition at line 534 of file kurl.h.\index{KURL@{KURL}!isLocalFile@{isLocalFile}}
\index{isLocalFile@{isLocalFile}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::is\-Local\-File () const}\label{classKURL_a42}


Checks whether the file is local. 

\begin{Desc}
\item[Returns:]true if the file is a plain local file and has no filter protocols attached to it. \end{Desc}


Definition at line 1358 of file kurl.cpp.

References has\-Sub\-URL().

Referenced by file\-Encoding(), path\-Or\-URL(), and set\-File\-Encoding().\index{KURL@{KURL}!setFileEncoding@{setFileEncoding}}
\index{setFileEncoding@{setFileEncoding}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-File\-Encoding (const {\bf QString} \& {\em encoding})}\label{classKURL_a43}


Adds encoding information to url by adding a \char`\"{}charset\char`\"{} parameter. 

If there is already a charset parameter, it will be replaced. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em encoding}]the encoding to add or QString::null to remove the encoding. \end{description}
\end{Desc}


Definition at line 1377 of file kurl.cpp.

References decode\_\-string(), encode\_\-string(), QString::is\-Empty(), is\-Local\-File(), QString\-List::join(), QString::mid(), query(), QString\-List::split(), and QString::starts\-With().\index{KURL@{KURL}!fileEncoding@{fileEncoding}}
\index{fileEncoding@{fileEncoding}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::file\-Encoding () const}\label{classKURL_a44}


Returns encoding information from url, the content of the \char`\"{}charset\char`\"{} parameter. 

\begin{Desc}
\item[Returns:]An encoding suitable for {\bf QText\-Codec::codec\-For\-Name()} or QString::null if not encoding was specified. \end{Desc}


Definition at line 1406 of file kurl.cpp.

References decode\_\-string(), QString::is\-Empty(), is\-Local\-File(), QString::mid(), query(), QString\-List::split(), and QString::starts\-With().\index{KURL@{KURL}!hasSubURL@{hasSubURL}}
\index{hasSubURL@{hasSubURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::has\-Sub\-URL () const}\label{classKURL_a45}


Checks whether the URL has any sub URLs. 

See {\bf split()}{\rm (p.\,\pageref{classKURL_e0})} for examples for sub URLs. \begin{Desc}
\item[Returns:]true if the file has at least one sub URL. \end{Desc}
\begin{Desc}
\item[See also:]{\bf split}{\rm (p.\,\pageref{classKURL_e0})} \end{Desc}


Definition at line 1431 of file kurl.cpp.

Referenced by add\-Path(), cd(), encoded\-Html\-Ref(), file\-Name(), has\-HTMLRef(), html\-Ref(), is\-Local\-File(), set\-HTMLRef(), split(), and up\-URL().\index{KURL@{KURL}!addPath@{addPath}}
\index{addPath@{addPath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::add\-Path (const {\bf QString} \& {\em txt})}\label{classKURL_a46}


Adds to the current path. 

Assumes that the current path is a directory. {\tt \_\-txt} is appended to the current path. The function adds '/' if needed while concatenating. This means it does not matter whether the current path has a trailing '/' or not. If there is none, it becomes appended. If {\tt \_\-txt} has a leading '/' then this one is stripped.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em txt}]The text to add. It is considered to be decoded. \end{description}
\end{Desc}


Definition at line 1723 of file kurl.cpp.

References has\-Sub\-URL(), join(), QValue\-List::last(), QString::length(), QString::mid(), and split().\index{KURL@{KURL}!queryItem@{queryItem}}
\index{queryItem@{queryItem}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::query\-Item (const {\bf QString} \& {\em item}) const}\label{classKURL_a47}


call the function below with encoding\_\-hint = 0 (will be merged for KDE4) 



Definition at line 2152 of file kurl.cpp.\index{KURL@{KURL}!queryItem@{queryItem}}
\index{queryItem@{queryItem}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::query\-Item (const {\bf QString} \& {\em item}, int {\em encoding\_\-hint}) const}\label{classKURL_a48}


Returns the value of a certain query item. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em item}]Item whose value we want \item[{\em encoding\_\-hint}]MIB of encoding of query.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the value of the given query item name or QString::null if the specified item does not exist. \end{Desc}


Definition at line 2157 of file kurl.cpp.

References decode\_\-string(), QString::from\-Latin1(), QString::length(), QString::mid(), QString::replace(), and QString\-List::split().\index{KURL@{KURL}!queryItems@{queryItems}}
\index{queryItems@{queryItems}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ KURL::query\-Items (int {\em options}, int {\em encoding\_\-hint}) const}\label{classKURL_a50}


Returns the list of query items as a map mapping keys to values. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em options}]any of Query\-Items\-Options {\em or\/}ed together. \item[{\em encoding\_\-hint}]MIB of encoding of query.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the map of query items or the empty map if the url has no query items.\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 2121 of file kurl.cpp.

References decode\_\-string(), QString::find(), QMap::insert(), QString::is\-Empty(), QString::left(), QString::lower(), QString::mid(), QString::replace(), and QString\-List::split().\index{KURL@{KURL}!addQueryItem@{addQueryItem}}
\index{addQueryItem@{addQueryItem}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::add\-Query\-Item (const {\bf QString} \& {\em \_\-item}, const {\bf QString} \& {\em \_\-value}, int {\em encoding\_\-hint} = {\tt 0})}\label{classKURL_a51}


Add an additional query item. 

To replace an existing query item, the item should first be removed with {\bf remove\-Query\-Item()}{\rm (p.\,\pageref{classKURL_a52})}

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-item}]Name of item to add \item[{\em \_\-value}]Value of item to add \item[{\em encoding\_\-hint}]MIB of encoding to use for \_\-value. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 2206 of file kurl.cpp.\index{KURL@{KURL}!removeQueryItem@{removeQueryItem}}
\index{removeQueryItem@{removeQueryItem}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::remove\-Query\-Item (const {\bf QString} \& {\em \_\-item})}\label{classKURL_a52}


Remove an item from the query. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-item}]Item to be removed \end{description}
\end{Desc}


Definition at line 2183 of file kurl.cpp.

References QString\-List::join(), and QString\-List::split().\index{KURL@{KURL}!setFileName@{setFileName}}
\index{setFileName@{setFileName}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-File\-Name (const {\bf QString} \& {\em \_\-txt})}\label{classKURL_a53}


Sets the filename of the path. 

In comparison to {\bf add\-Path()}{\rm (p.\,\pageref{classKURL_a46})} this function does not assume that the current path is a directory. This is only assumed if the current path ends with '/'.

Any reference is reset.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-txt}]The filename to be set. It is considered to be decoded. If the current path ends with '/' then {\tt \_\-txt} int just appended, otherwise all text behind the last '/' in the current path is erased and {\tt \_\-txt} is appended then. It does not matter whether {\tt \_\-txt} starts with '/' or not. \end{description}
\end{Desc}


Definition at line 1211 of file kurl.cpp.

References clean\-Path(), encode\_\-string(), QString::find\-Rev(), QString::is\-Empty(), QString::mid(), QString::right(), set\-Encoded\-Path(), set\-Path(), and QString::truncate().\index{KURL@{KURL}!fileName@{fileName}}
\index{fileName@{fileName}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::file\-Name (bool {\em \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path} = {\tt true}) const}\label{classKURL_a54}


Returns the filename of the path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path}]This tells whether a trailing '/' should be ignored. This means that the function would return \char`\"{}torben\char`\"{} for {\tt {\tt file:///hallo/torben/}} and {\tt {\tt file:///hallo/torben}}. If the flag is set to false, then everything behind the last '/' is considered to be the filename. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The filename of the current path. The returned string is decoded. Null if there is no file (and thus no path). \end{Desc}


Definition at line 1664 of file kurl.cpp.

References QString::contains(), QString::find\-Rev(), QValue\-List::from\-Last(), has\-Sub\-URL(), QString::is\-Empty(), QString::left(), QString::length(), QString::mid(), and split().\index{KURL@{KURL}!directory@{directory}}
\index{directory@{directory}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::directory (bool {\em \_\-strip\_\-trailing\_\-slash\_\-from\_\-result} = {\tt true}, bool {\em \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path} = {\tt true}) const}\label{classKURL_a55}


Returns the directory of the path. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-strip\_\-trailing\_\-slash\_\-from\_\-result}]tells whether the returned result should end with '/' or not. If the path is empty or just \char`\"{}/\char`\"{} then this flag has no effect. \item[{\em \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path}]means that {\tt {\tt file:///hallo/torben}} and {\tt {\tt file:///hallo/torben/}\char`\"{}} would both return {\tt /hallo/} or {\tt /hallo} depending on the other flag \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The directory part of the current path. Everything between the last and the second last '/' is returned. For example {\tt {\tt file:///hallo/torben/}} would return \char`\"{}/hallo/torben/\char`\"{} while {\tt {\tt file:///hallo/torben}} would return \char`\"{}hallo/\char`\"{}. The returned string is decoded. QString::null is returned when there is no path. \end{Desc}


Definition at line 1756 of file kurl.cpp.

References QString::find\-Rev(), QString::is\-Empty(), and QString::left().

Referenced by KConfig\-INIBack\-End::parse\-Config\-Files(), and KConfig\-INIBack\-End::sync().\index{KURL@{KURL}!setDirectory@{setDirectory}}
\index{setDirectory@{setDirectory}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURL::set\-Directory (const {\bf QString} \& {\em dir})}\label{classKURL_a56}


Set the directory to {\tt dir}, leaving the filename empty. 



Definition at line 1986 of file kurl.cpp.

References set\-Path().\index{KURL@{KURL}!cd@{cd}}
\index{cd@{cd}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::cd (const {\bf QString} \& {\em \_\-dir})}\label{classKURL_a57}


Changes the directory by descending into the given directory. 

It is assumed the current URL represents a directory. If {\tt dir} starts with a \char`\"{}/\char`\"{} the current URL will be \char`\"{}protocol://host/dir\char`\"{} otherwise {\tt \_\-dir} will be appended to the path. {\tt \_\-dir} can be \char`\"{}..\char`\"{} This function won't strip protocols. That means that when you are in {\tt file:///dir/dir2/my.tgz\#tar:/} and you do cd(\char`\"{}..\char`\"{}) you will still be in {\tt file:///dir/dir2/my.tgz\#tar:/}

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-dir}]the directory to change to \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful \end{Desc}


Definition at line 1790 of file kurl.cpp.

References has\-Sub\-URL(), QDir::home\-Dir\-Path(), join(), QValue\-List::last(), path(), QString::right(), set\-HTMLRef(), set\-Path(), and split().

Referenced by up\-URL().\index{KURL@{KURL}!url@{url}}
\index{url@{url}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::url (int {\em \_\-trailing} = {\tt 0}, int {\em encoding\_\-hint} = {\tt 0}) const}\label{classKURL_a58}


Returns the URL as string, with all escape sequences intact, encoded in a given charset. 

This is used in particular for encoding URLs in UTF-8 before using them in a drag and drop operation. Please note that the string returned by {\bf url()}{\rm (p.\,\pageref{classKURL_a58})} will include the password of the URL. If you want to show the URL to the user, use {\bf pretty\-URL()}{\rm (p.\,\pageref{classKURL_a59})}.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]This may be ( -1, 0 +1 ). -1 strips a trailing '/' from the path, +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. \item[{\em encoding\_\-hint}]MIB of encoding to use. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The complete URL, with all escape sequences intact, encoded in a given charset. \end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} 

{\bf pretty\-URL()}{\rm (p.\,\pageref{classKURL_a59})} \end{Desc}


Definition at line 1454 of file kurl.cpp.

References encoded\-Path\-And\-Query(), has\-Host(), has\-Pass(), has\-Ref(), has\-User(), QString::is\-Empty(), Mailto, QString::sprintf(), and URL.

Referenced by from\-Path\-Or\-URL(), KApplication::invoke\-Mailer(), join(), KURL(), KDesktop\-File::read\-URL(), relative\-URL(), and split().\index{KURL@{KURL}!prettyURL@{prettyURL}}
\index{prettyURL@{prettyURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::pretty\-URL (int {\em \_\-trailing} = {\tt 0}) const}\label{classKURL_a59}


Returns the URL as string in human-friendly format. 

Example: 

\footnotesize\begin{verbatim} http://localhost:8080/test.cgi?test=hello world&name=fred
\end{verbatim}
\normalsize
 \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]-1 to strip a trailing '/' from the path, +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A human readable URL, with no non-necessary encodings/escaped characters. Password will not be shown. \end{Desc}
\begin{Desc}
\item[See also:]{\bf url()}{\rm (p.\,\pageref{classKURL_a58})} \end{Desc}


Definition at line 1514 of file kurl.cpp.

References has\-Host(), has\-Ref(), has\-User(), QString::is\-Empty(), Mailto, QString::sprintf(), and URL.

Referenced by html\-URL(), path\-Or\-URL(), and pretty\-URL().\index{KURL@{KURL}!prettyURL@{prettyURL}}
\index{prettyURL@{prettyURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::pretty\-URL (int {\em \_\-trailing}, Adjustement\-Flags {\em \_\-flags}) const}\label{classKURL_a60}


Returns the URL as string in human-friendly format. 

Example: 

\footnotesize\begin{verbatim} http://localhost:8080/test.cgi?test=hello world&name=fred
\end{verbatim}
\normalsize
 \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-trailing}]-1 to strip a trailing '/' from the path, +1 adds a trailing '/' if there is none yet and 0 returns the path unchanged. \item[{\em \_\-flags}]if Strip\-File\-Protocol, {\tt file://} will be stripped. The use of this method is now discouraged, better use {\bf path\-Or\-URL()}{\rm (p.\,\pageref{classKURL_a61})}. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]A human readable URL, with no non-necessary encodings/escaped characters. Password will not be shown. \end{Desc}


Definition at line 1581 of file kurl.cpp.

References QDir::convert\-Separators(), pretty\-URL(), QString::remove(), and QString::starts\-With().\index{KURL@{KURL}!pathOrURL@{pathOrURL}}
\index{pathOrURL@{pathOrURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::path\-Or\-URL () const}\label{classKURL_a61}


Return the URL as a string, which will be either the URL (as pretty\-URL would return) or, when the URL is a local file without query or ref, the path. 

Use this method, together with its opposite, {\bf from\-Path\-Or\-URL()}{\rm (p.\,\pageref{classKURL_e3})}, to display and even let the user edit URLs.

\begin{Desc}
\item[Returns:]the new KURL \end{Desc}
\begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 1593 of file kurl.cpp.

References is\-Local\-File(), path(), and pretty\-URL().\index{KURL@{KURL}!htmlURL@{htmlURL}}
\index{htmlURL@{htmlURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::html\-URL () const}\label{classKURL_a62}


Returns the URL as string, escaped for HTML. 

\begin{Desc}
\item[Returns:]A human readable URL, with no non-necessary encodings/escaped characters which is html encoded for safe inclusion in html or rich text. Password will not be shown. \end{Desc}


Definition at line 1602 of file kurl.cpp.

References QStyle\-Sheet::escape(), and pretty\-URL().\index{KURL@{KURL}!isEmpty@{isEmpty}}
\index{isEmpty@{isEmpty}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::is\-Empty () const}\label{classKURL_a63}


{\bf Test} to see if the KURL is empty. 

\begin{Desc}
\item[Returns:]true if the URL is empty \end{Desc}


Definition at line 625 of file kurl.cpp.

References QString::is\-Empty().

Referenced by KURLDrag::decode(), is\-Parent\-Of(), set\-Path(), and up\-URL().\index{KURL@{KURL}!upURL@{upURL}}
\index{upURL@{upURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL} KURL::up\-URL () const}\label{classKURL_a64}


This function is useful to implement the \char`\"{}Up\char`\"{} button in a file manager for example. 

{\bf cd()}{\rm (p.\,\pageref{classKURL_a57})} never strips a sub-protocol. That means that if you are in {\tt file:///home/x.tgz\#gzip:/\#tar:/} and hit the up button you expect to see {\tt file:///home.} The algorithm tries to go up on the right-most URL. If that is not possible it strips the right most URL. It continues stripping URLs. \begin{Desc}
\item[Returns:]a URL that is a level higher \end{Desc}


Definition at line 1842 of file kurl.cpp.

References \_\-set\-Query(), cd(), QValue\-List::count(), QValue\-List::from\-Last(), has\-Sub\-URL(), QValue\-List::is\-Empty(), is\-Empty(), join(), KURL(), QValue\-List::last(), path(), query(), QValue\-List::remove(), and split().\index{KURL@{KURL}!cmp@{cmp}}
\index{cmp@{cmp}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::cmp (const {\bf KURL} \& {\em u}, bool {\em ignore\_\-trailing} = {\tt false}) const}\label{classKURL_a74}


The same as {\bf equals()}{\rm (p.\,\pageref{classKURL_a75})}, just with a less obvious name. 

Compares this url with {\tt u}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em u}]the URL to compare this one with. \item[{\em ignore\_\-trailing}]set to true to ignore trailing '/' characters. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if both urls are the same \end{Desc}
\begin{Desc}
\item[See also:]operator==. This function should be used if you want to ignore trailing '/' characters. \end{Desc}
\begin{Desc}
\item[{\bf Deprecated}]Use {\bf equals()}{\rm (p.\,\pageref{classKURL_a75})} instead. \end{Desc}


Definition at line 1147 of file kurl.cpp.

References equals().\index{KURL@{KURL}!equals@{equals}}
\index{equals@{equals}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::equals (const {\bf KURL} \& {\em u}, bool {\em ignore\_\-trailing} = {\tt false}) const}\label{classKURL_a75}


Compares this url with {\tt u}. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em u}]the URL to compare this one with. \item[{\em ignore\_\-trailing}]set to true to ignore trailing '/' characters. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if both urls are the same \end{Desc}
\begin{Desc}
\item[See also:]operator==. This function should be used if you want to ignore trailing '/' characters. \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 1152 of file kurl.cpp.

References is\-Valid(), and path().

Referenced by cmp().\index{KURL@{KURL}!isParentOf@{isParentOf}}
\index{isParentOf@{isParentOf}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::is\-Parent\-Of (const {\bf KURL} \& {\em u}) const}\label{classKURL_a76}


Checks whether the given URL is parent of this URL. 

For instance, {\tt ftp://host/dir/} is a parent of {\tt ftp://host/dir/subdir/subsubdir/.} \begin{Desc}
\item[Returns:]true if this url is a parent of {\tt u} (or the same URL as {\tt u}) \end{Desc}


Definition at line 1179 of file kurl.cpp.

References QString::is\-Empty(), is\-Empty(), is\-Valid(), QString::length(), path(), and QString::starts\-With().\index{KURL@{KURL}!split@{split}}
\index{split@{split}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL::List} KURL::split (const {\bf QString} \& {\em \_\-url})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e0}


Splits nested URLs like {\tt file:///home/weis/kde.tgz\#gzip:/\#tar:/kdebase} A URL like {\tt http://www.kde.org\#tar:/kde/README.hml\#ref1} will be split in {\tt http://www.kde.org} and tar:/kde/README.html\#ref1. 

That means in turn that \char`\"{}\#ref1\char`\"{} is an HTML-style reference and not a new sub URL. Since HTML-style references mark a certain position in a document this reference is appended to every URL. The idea behind this is that browsers, for example, only look at the first URL while the rest is not of interest to them.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]The URL that has to be split. \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]An empty list on error or the list of split URLs. \end{Desc}
\begin{Desc}
\item[See also:]{\bf has\-Sub\-URL}{\rm (p.\,\pageref{classKURL_a45})} \end{Desc}


Definition at line 1639 of file kurl.cpp.

References KURL().

Referenced by add\-Path(), cd(), encoded\-Html\-Ref(), file\-Name(), has\-HTMLRef(), html\-Ref(), KURL(), set\-HTMLRef(), up\-URL(), and urlcmp().\index{KURL@{KURL}!split@{split}}
\index{split@{split}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL::List} KURL::split (const {\bf KURL} \& {\em \_\-url})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e1}


Splits nested URLs like {\tt file:///home/weis/kde.tgz\#gzip:/\#tar:/kdebase} A URL like {\tt http://www.kde.org\#tar:/kde/README.hml\#ref1} will be split in {\tt http://www.kde.org} and tar:/kde/README.html\#ref1. 

That means in turn that \char`\"{}\#ref1\char`\"{} is an HTML-style reference and not a new sub URL. Since HTML-style references mark a certain position in a document this reference is appended to every URL. The idea behind this is that browsers, for example, only look at the first URL while the rest is not of interest to them.

\begin{Desc}
\item[Returns:]An empty list on error or the list of split URLs.\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]The URL that has to be split. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf has\-Sub\-URL}{\rm (p.\,\pageref{classKURL_a45})} \end{Desc}


Definition at line 1607 of file kurl.cpp.

References QValue\-List::append(), QValue\-List::begin(), QValue\-List::end(), has\-Sub\-URL(), KURL(), m\_\-str\-Ref\_\-encoded, ref(), and url().\index{KURL@{KURL}!join@{join}}
\index{join@{join}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL} KURL::join (const {\bf List} \& {\em \_\-list})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e2}


Reverses {\bf split()}{\rm (p.\,\pageref{classKURL_e0})}. 

Only the first URL may have a reference. This reference is considered to be HTML-like and is appended at the end of the resulting joined URL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-list}]the list to join \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the joined URL \end{Desc}


Definition at line 1644 of file kurl.cpp.

References KURL(), m\_\-str\-Ref\_\-encoded, and url().

Referenced by add\-Path(), cd(), KURL(), set\-HTMLRef(), and up\-URL().\index{KURL@{KURL}!fromPathOrURL@{fromPathOrURL}}
\index{fromPathOrURL@{fromPathOrURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL} KURL::from\-Path\-Or\-URL (const {\bf QString} \& {\em text})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e3}


Creates a KURL object from a {\bf QString} representing either an absolute path or a real URL. 

Use this method instead of 

\footnotesize\begin{verbatim} QString someDir = ...
 KURL url = someDir;
\end{verbatim}
\normalsize


Otherwise some characters (e.g. the '\#') won't be encoded properly. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em text}]the string representation of the URL to convert \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the new KURL \end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}


Definition at line 2217 of file kurl.cpp.

References KURL(), set\-Path(), and url().\index{KURL@{KURL}!encode_string@{encode\_\-string}}
\index{encode_string@{encode\_\-string}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::encode\_\-string (const {\bf QString} \& {\em str}, int {\em encoding\_\-hint} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e4}


Convenience function. 

Convert unicoded string to local encoding and use -style encoding for all common delimiters / non-ascii characters. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]String to encode (can be QString::null). \item[{\em encoding\_\-hint}]MIB of encoding to use. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}
\begin{Desc}
\item[Returns:]the encoded string \end{Desc}


Definition at line 2053 of file kurl.cpp.

Referenced by set\-File\-Encoding(), and set\-File\-Name().\index{KURL@{KURL}!encode_string_no_slash@{encode\_\-string\_\-no\_\-slash}}
\index{encode_string_no_slash@{encode\_\-string\_\-no\_\-slash}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::encode\_\-string\_\-no\_\-slash (const {\bf QString} \& {\em str}, int {\em encoding\_\-hint} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e5}


Convenience function. 

Convert unicoded string to local encoding and use -style encoding for all common delimiters / non-ascii characters as well as the slash '/'. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]String to encode \item[{\em encoding\_\-hint}]MIB of encoding to use. \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 2058 of file kurl.cpp.\index{KURL@{KURL}!decode_string@{decode\_\-string}}
\index{decode_string@{decode\_\-string}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::decode\_\-string (const {\bf QString} \& {\em str}, int {\em encoding\_\-hint} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e6}


Convenience function. 

Decode -style encoding and convert from local encoding to unicode.

Reverse of {\bf encode\_\-string()}{\rm (p.\,\pageref{classKURL_e4})} \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em str}]String to decode (can be QString::null). \item[{\em encoding\_\-hint}]MIB of original encoding of {\tt str} . \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} \end{Desc}


Definition at line 2048 of file kurl.cpp.

Referenced by file\-Encoding(), KApplication::invoke\-Mailer(), query\-Item(), query\-Items(), and set\-File\-Encoding().\index{KURL@{KURL}!isRelativeURL@{isRelativeURL}}
\index{isRelativeURL@{isRelativeURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURL::is\-Relative\-URL (const {\bf QString} \& {\em \_\-url})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e7}


Convenience function. 

Returns whether '\_\-url' is likely to be a \char`\"{}relative\char`\"{} URL instead of an \char`\"{}absolute\char`\"{} URL. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url}]URL to examine \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true when the URL is likely to be \char`\"{}relative\char`\"{}, false otherwise. \end{Desc}


Definition at line 395 of file kurl.cpp.

References QChar::latin1(), QString::length(), and QString::unicode().

Referenced by KURL().\index{KURL@{KURL}!relativeURL@{relativeURL}}
\index{relativeURL@{relativeURL}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::relative\-URL (const {\bf KURL} \& {\em base\_\-url}, const {\bf KURL} \& {\em url}, int {\em encoding\_\-hint} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e8}


Convenience function. 

Returns a \char`\"{}relative URL\char`\"{} based on {\tt base\_\-url} that points to {\tt url}.

If no \char`\"{}relative URL\char`\"{} can be created, e.g. because the protocol and/or hostname differ between {\tt base\_\-url} and {\tt url} an absolute URL is returned. Note that if {\tt base\_\-url} represents a directory, it should contain a trailing slash. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em base\_\-url}]the URL to derive from \item[{\em url}]new URL \item[{\em encoding\_\-hint}]MIB of original encoding of {\tt str} . \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf QText\-Codec::mib\-Enum()} 

{\bf adjust\-Path()}{\rm (p.\,\pageref{classKURL_a27})} \end{Desc}


Definition at line 2281 of file kurl.cpp.

References QString::is\-Empty(), QString::ref(), and url().\index{KURL@{KURL}!relativePath@{relativePath}}
\index{relativePath@{relativePath}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::relative\-Path (const {\bf QString} \& {\em base\_\-dir}, const {\bf QString} \& {\em path}, bool $\ast$ {\em is\-Parent} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e9}


Convenience function. 

Returns a relative path based on {\tt base\_\-dir} that points to {\tt path}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em base\_\-dir}]the base directory to derive from \item[{\em path}]the new target directory \item[{\em is\-Parent}]A pointer to a boolean which, if provided, will be set to reflect whether {\tt path} has {\tt base\_\-dir} is a parent dir. \end{description}
\end{Desc}


Definition at line 2267 of file kurl.cpp.

References QString::prepend().\index{KURL@{KURL}!uriModeForProtocol@{uriModeForProtocol}}
\index{uriModeForProtocol@{uriModeForProtocol}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL::URIMode} KURL::uri\-Mode\-For\-Protocol (const {\bf QString} \& {\em protocol})\hspace{0.3cm}{\tt  [static]}}\label{classKURL_e10}


Determine which URI mode is suitable for processing URIs of a given protocol. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em protocol}]The protocol name. \end{description}
\end{Desc}
\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 2319 of file kurl.cpp.

References Auto, Mailto, protocol(), Raw\-URI, KProtocol\-Info::uri\-Parse\-Mode(), and URL.

Referenced by set\-Protocol().\index{KURL@{KURL}!filename@{filename}}
\index{filename@{filename}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURL::filename (bool {\em \_\-ignore\_\-trailing\_\-slash\_\-in\_\-path} = {\tt true}) const\hspace{0.3cm}{\tt  [inline]}}\label{classKURL_a77}


\begin{Desc}
\item[{\bf Deprecated}]change code to call {\bf file\-Name()}{\rm (p.\,\pageref{classKURL_a54})} \end{Desc}


Definition at line 982 of file kurl.h.

\subsection{Friends And Related Function Documentation}
\index{KURL@{KURL}!urlcmp@{urlcmp}}
\index{urlcmp@{urlcmp}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDECORE\_\-EXPORT bool urlcmp (const {\bf QString} \& {\em \_\-url1}, const {\bf QString} \& {\em \_\-url2})\hspace{0.3cm}{\tt  [related]}}\label{classKURL_m0}


Compares URLs. 

They are parsed, split and compared. Two malformed URLs with the same string representation are nevertheless considered to be unequal. That means no malformed URL equals anything else. 

Definition at line 2063 of file kurl.cpp.

References QValue\-List::is\-Empty(), and split().\index{KURL@{KURL}!urlcmp@{urlcmp}}
\index{urlcmp@{urlcmp}!KURL@{KURL}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDECORE\_\-EXPORT bool urlcmp (const {\bf QString} \& {\em \_\-url1}, const {\bf QString} \& {\em \_\-url2}, bool {\em \_\-ignore\_\-trailing}, bool {\em \_\-ignore\_\-ref})\hspace{0.3cm}{\tt  [related]}}\label{classKURL_m1}


Compares URLs. 

They are parsed, split and compared. Two malformed URLs with the same string representation are nevertheless considered to be unequal. That means no malformed URL equals anything else.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em \_\-url1}]A reference URL \item[{\em \_\-url2}]A URL that will be compared with the reference URL \item[{\em \_\-ignore\_\-trailing}]Described in {\bf KURL::cmp}{\rm (p.\,\pageref{classKURL_a74})} \item[{\em \_\-ignore\_\-ref}]If true, disables comparison of HTML-style references. \end{description}
\end{Desc}


Definition at line 2082 of file kurl.cpp.

References QValue\-List::begin(), QValue\-List::count(), QValue\-List::end(), QValue\-List::is\-Empty(), and split().

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