\section{KURLDrag Class Reference}
\label{classKURLDrag}\index{KURLDrag@{KURLDrag}}
This class is to be used instead of {\bf QUri\-Drag} when using {\bf KURL}{\rm (p.\,\pageref{classKURL})}.  


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

Inheritance diagram for KURLDrag:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=50pt]{classKURLDrag__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KURLDrag:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=170pt]{classKURLDrag__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KURLDrag} (const {\bf KURL::List} \&urls, {\bf QWidget} $\ast$drag\-Source=0, const char $\ast$name=0)
\item 
{\bf KURLDrag} (const {\bf KURL::List} \&urls, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&meta\-Data, {\bf QWidget} $\ast$drag\-Source=0, const char $\ast$name=0)
\item 
void {\bf set\-Export\-As\-Text} (bool exp)
\item 
{\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\bf meta\-Data} ()
\end{CompactItemize}
\subsection*{Static Public Member Functions}
\begin{CompactItemize}
\item 
static {\bf KURLDrag} $\ast$ {\bf new\-Drag} (const {\bf KURL::List} \&urls, {\bf QWidget} $\ast$drag\-Source=0, const char $\ast$name=0) KDE\_\-DEPRECATED
\item 
static {\bf KURLDrag} $\ast$ {\bf new\-Drag} (const {\bf KURL::List} \&urls, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&meta\-Data, {\bf QWidget} $\ast$drag\-Source=0, const char $\ast$name=0) KDE\_\-DEPRECATED
\item 
static bool {\bf decode} (const {\bf QMime\-Source} $\ast$e, {\bf KURL::List} \&urls)
\item 
static bool {\bf decode} (const {\bf QMime\-Source} $\ast$e, {\bf KURL::List} \&urls, {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&meta\-Data)
\item 
static {\bf QString} {\bf url\-To\-String} (const {\bf KURL} \&url)
\item 
static {\bf KURL} {\bf string\-To\-Url} (const {\bf QCString} \&s)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KURLDrag} (const {\bf QStr\-List} \&urls, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \&meta\-Data, {\bf QWidget} $\ast$drag\-Source, const char $\ast$name) KDE\_\-DEPRECATED
\item 
virtual const char $\ast$ {\bf format} (int i) const \label{classKURLDrag_b1}

\item 
virtual {\bf QByte\-Array} {\bf encoded\-Data} (const char $\ast$mime) const \label{classKURLDrag_b2}

\end{CompactItemize}


\subsection{Detailed Description}
This class is to be used instead of {\bf QUri\-Drag} when using {\bf KURL}{\rm (p.\,\pageref{classKURL})}. 

The reason is: {\bf QUri\-Drag} (and the XDND/W3C standards) expect URLs to be encoded in UTF-8 (unicode), but {\bf KURL}{\rm (p.\,\pageref{classKURL})} uses the current locale by default. The other reasons for using this class are: \begin{itemize}
\item it exports text/plain (for dropping/pasting into lineedits, mails etc.) \item it has support for metadata, shipped as part of the dragobject This is important, for instance to set a correct HTTP referrer (some websites require it for downloading e.g. an image).\end{itemize}
To create a drag object, use the KURLDrag constructor. To handle drops, use {\bf QUri\-Drag::can\-Decode()} and {\bf KURLDrag::decode()}{\rm (p.\,\pageref{classKURLDrag_e2})} 



Definition at line 44 of file kurldrag.h.

\subsection{Constructor \& Destructor Documentation}
\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLDrag::KURLDrag (const {\bf KURL::List} \& {\em urls}, {\bf QWidget} $\ast$ {\em drag\-Source} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKURLDrag_a0}


Constructs an object to drag the list of URLs in {\tt urls}. 

The {\tt drag\-Source} and {\tt name} arguments are passed on to {\bf QUri\-Drag}, and the list of urls is converted to UTF-8 before being passed to {\bf QUri\-Drag}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em urls}]the list of URLs \item[{\em drag\-Source}]the parent of the {\bf QObject}. Should be set when doing drag-n-drop, but should be 0 when copying to the clipboard \item[{\em name}]the name of the {\bf QObject} \end{description}
\end{Desc}


Definition at line 37 of file kurldrag.cpp.

Referenced by new\-Drag().\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLDrag::KURLDrag (const {\bf KURL::List} \& {\em urls}, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em meta\-Data}, {\bf QWidget} $\ast$ {\em drag\-Source} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKURLDrag_a1}


Constructs an object to drag the list of URLs in {\tt urls}. 

This version also includes metadata. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em urls}]the list of URLs \item[{\em meta\-Data}]a map containing meta data \item[{\em drag\-Source}]the parent of the {\bf QObject}. Should be set when doing drag-n-drop, but should be 0 when copying to the clipboard \item[{\em name}]the name of the {\bf QObject} \end{description}
\end{Desc}
\begin{Desc}
\item[See also:]{\bf meta\-Data()}{\rm (p.\,\pageref{classKURLDrag_a4})} \end{Desc}


Definition at line 43 of file kurldrag.cpp.\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\index{KURLDrag@{KURLDrag}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KURLDrag::KURLDrag (const {\bf QStr\-List} \& {\em urls}, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em meta\-Data}, {\bf QWidget} $\ast$ {\em drag\-Source}, const char $\ast$ {\em name})\hspace{0.3cm}{\tt  [protected]}}\label{classKURLDrag_b0}


\begin{Desc}
\item[{\bf Deprecated}]Use a KURLDrag constructor with a {\bf KURL::List}{\rm (p.\,\pageref{classKURL_1_1List})} \end{Desc}


Definition at line 268 of file kurldrag.cpp.

\subsection{Member Function Documentation}
\index{KURLDrag@{KURLDrag}!setExportAsText@{setExportAsText}}
\index{setExportAsText@{setExportAsText}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KURLDrag::set\-Export\-As\-Text (bool {\em exp})}\label{classKURLDrag_a3}


By default, KURLDrag also exports the URLs as plain text, for e.g. 

dropping onto a text editor. But in some cases this might not be wanted, e.g. if using the KURLDrag in a {\bf KMultiple\-Drag}{\rm (p.\,\pageref{classKMultipleDrag})} and another component of the multiple-drag provides better plain text data. In such a case, set\-Export\-As\-Text( false ) should be called. \begin{Desc}
\item[Since:]3.4 \end{Desc}


Definition at line 68 of file kurldrag.cpp.\index{KURLDrag@{KURLDrag}!newDrag@{newDrag}}
\index{newDrag@{newDrag}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURLDrag} $\ast$ KURLDrag::new\-Drag (const {\bf KURL::List} \& {\em urls}, {\bf QWidget} $\ast$ {\em drag\-Source} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e0}


\begin{Desc}
\item[{\bf Deprecated}]Is equivalent with \char`\"{}new KURLDrag(urls, drag\-Source, name)\char`\"{}. \end{Desc}


Definition at line 76 of file kurldrag.cpp.

References KURLDrag().\index{KURLDrag@{KURLDrag}!newDrag@{newDrag}}
\index{newDrag@{newDrag}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURLDrag} $\ast$ KURLDrag::new\-Drag (const {\bf KURL::List} \& {\em urls}, const {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em meta\-Data}, {\bf QWidget} $\ast$ {\em drag\-Source} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e1}


\begin{Desc}
\item[{\bf Deprecated}]Is equivalent with \char`\"{}new KURLDrag(urls, meta\-Data, drag\-Source, name)\char`\"{}. \end{Desc}


Definition at line 81 of file kurldrag.cpp.

References KURLDrag(), and meta\-Data().\index{KURLDrag@{KURLDrag}!metaData@{metaData}}
\index{metaData@{metaData}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QMap}$<${\bf QString}, {\bf QString}$>$\& KURLDrag::meta\-Data ()\hspace{0.3cm}{\tt  [inline]}}\label{classKURLDrag_a4}


Meta-data to associate with those URLs. 

This is an alternative way of setting the metadata: either use the constructor to pass it all at once, or use drag-$>${\bf meta\-Data()}{\rm (p.\,\pageref{classKURLDrag_a4})}[\char`\"{}key\char`\"{}] = data; \begin{Desc}
\item[See also:]{\bf KIO::Transfer\-Job} \end{Desc}


Definition at line 100 of file kurldrag.h.

Referenced by decode(), and new\-Drag().\index{KURLDrag@{KURLDrag}!decode@{decode}}
\index{decode@{decode}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURLDrag::decode (const {\bf QMime\-Source} $\ast$ {\em e}, {\bf KURL::List} \& {\em urls})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e2}


Convenience method that decodes the contents of {\tt e} into a list of KURLs. 

Decoding will fail if at least one decoded value is not a valid {\bf KURL}{\rm (p.\,\pageref{classKURL})}. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em e}]the mime source \item[{\em urls}]the list of urls will be written here \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}


Definition at line 87 of file kurldrag.cpp.

References QUri\-Drag::decode(), KURL::is\-Empty(), KURL::is\-Valid(), and string\-To\-Url().

Referenced by decode().\index{KURLDrag@{KURLDrag}!decode@{decode}}
\index{decode@{decode}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KURLDrag::decode (const {\bf QMime\-Source} $\ast$ {\em e}, {\bf KURL::List} \& {\em urls}, {\bf QMap}$<$ {\bf QString}, {\bf QString} $>$ \& {\em meta\-Data})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e3}


Convenience method that decodes the contents of {\tt e} into a list of KURLs and a set of metadata. 

Decoding will fail if at least one decoded value is not a valid {\bf KURL}{\rm (p.\,\pageref{classKURL})}. You should be using this one, if possible. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em e}]the mime source \item[{\em urls}]the list of urls will be written here \item[{\em meta\-Data}]the metadata map will be written here \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]true if successful, false otherwise \end{Desc}


Definition at line 104 of file kurldrag.cpp.

References decode(), meta\-Data(), QMap::replace(), and QString\-List::split().\index{KURLDrag@{KURLDrag}!urlToString@{urlToString}}
\index{urlToString@{urlToString}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KURLDrag::url\-To\-String (const {\bf KURL} \& {\em url})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e4}


Converts a URL to a string representation suitable for dragging. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 237 of file kurldrag.cpp.

References QString::mid(), and QString::starts\-With().\index{KURLDrag@{KURLDrag}!stringToUrl@{stringToUrl}}
\index{stringToUrl@{stringToUrl}!KURLDrag@{KURLDrag}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KURL} KURLDrag::string\-To\-Url (const {\bf QCString} \& {\em s})\hspace{0.3cm}{\tt  [static]}}\label{classKURLDrag_e5}


Converts a string used for dragging to a URL. 

\begin{Desc}
\item[Since:]3.2 \end{Desc}


Definition at line 229 of file kurldrag.cpp.

Referenced by decode().

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