\section{KNew\-Stuff Class Reference}
\label{classKNewStuff}\index{KNewStuff@{KNewStuff}}
This class provides the functionality to download and upload \char`\"{}new stuff\char`\"{}.  


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

Inheritance diagram for KNew\-Stuff:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=123pt]{classKNewStuff__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KNew\-Stuff:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=56pt]{classKNewStuff__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KNew\-Stuff} (const {\bf QString} \&type, {\bf QWidget} $\ast$parent\-Widget=0)
\item 
{\bf KNew\-Stuff} (const {\bf QString} \&type, const {\bf QString} \&provider\-List, {\bf QWidget} $\ast$parent\-Widget=0)
\item 
{\bf QString} {\bf type} () const 
\item 
{\bf QWidget} $\ast$ {\bf parent\-Widget} () const 
\item 
void {\bf download} ()
\item 
void {\bf upload} ()
\item 
void {\bf upload} (const {\bf QString} \&file\-Name, const {\bf QString} preview\-Name)
\item 
virtual bool {\bf install} (const {\bf QString} \&file\-Name)=0
\item 
virtual bool {\bf create\-Upload\-File} (const {\bf QString} \&file\-Name)=0
\item 
virtual {\bf QString} {\bf download\-Destination} ({\bf KNS::Entry} $\ast$entry)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KNS::Engine} $\ast$ {\bf engine} ()
\end{CompactItemize}


\subsection{Detailed Description}
This class provides the functionality to download and upload \char`\"{}new stuff\char`\"{}. 

Applications have to subclass KNew\-Stuff, implement the pure virtual functions and link to against libknewstuff.

By calling {\bf download()}{\rm (p.\,\pageref{classKNewStuff_a5})} the download process is started which means that a list of \char`\"{}providers\char`\"{} is fetched from a \char`\"{}master server\char`\"{}, information about new stuff is collected from the providers and presented to the user. Selected entries get downloaded and installed to the application. The required functions to install new stuff are provided by implementing {\bf install()}{\rm (p.\,\pageref{classKNewStuff_a8})}. The location where the downloaded files are stored can be customized by reimplementing {\bf download\-Destination()}{\rm (p.\,\pageref{classKNewStuff_a10})}.

By calling {\bf upload()}{\rm (p.\,\pageref{classKNewStuff_a6})} the upload process is started which means the user has to select a provider from the list fetched from the master server and to put in information about the entry to be uploaded. Then the file to be uploaded is fetched from the application by calling {\bf create\-Upload\-File()}{\rm (p.\,\pageref{classKNewStuff_a9})} and transfered to the upload destination specified in the provider list.

\begin{Desc}
\item[Author:]Cornelius Schumacher ({\tt schumacher@kde.org}) \end{Desc}
\begin{Desc}
\item[Maintainer:]Josef Spillner ({\tt spillner@kde.org})\end{Desc}
\begin{Desc}
\item[Since:]3.3 \end{Desc}




Definition at line 69 of file knewstuff.h.

\subsection{Constructor \& Destructor Documentation}
\index{KNewStuff@{KNew\-Stuff}!KNewStuff@{KNewStuff}}
\index{KNewStuff@{KNewStuff}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KNew\-Stuff::KNew\-Stuff (const {\bf QString} \& {\em type}, {\bf QWidget} $\ast$ {\em parent\-Widget} = {\tt 0})}\label{classKNewStuff_a0}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]type of data to be handled, should be something like korganizer/calendar, kword/template, kdesktop/wallpaper \item[{\em parent\-Widget}]parent widget of dialogs opened by the KNew\-Stuff engine \end{description}
\end{Desc}


Definition at line 42 of file knewstuff.cpp.

References parent\-Widget(), and type().\index{KNewStuff@{KNew\-Stuff}!KNewStuff@{KNewStuff}}
\index{KNewStuff@{KNewStuff}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KNew\-Stuff::KNew\-Stuff (const {\bf QString} \& {\em type}, const {\bf QString} \& {\em provider\-List}, {\bf QWidget} $\ast$ {\em parent\-Widget} = {\tt 0})}\label{classKNewStuff_a1}


Constructor. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em type}]type of data to be handled, should be something like korganizer/calendar, kword/template, kdesktop/wallpaper \item[{\em provider\-List}]the URL of the provider list \item[{\em parent\-Widget}]parent widget of dialogs opened by the KNew\-Stuff engine \end{description}
\end{Desc}


Definition at line 47 of file knewstuff.cpp.

References parent\-Widget(), and type().

\subsection{Member Function Documentation}
\index{KNewStuff@{KNew\-Stuff}!type@{type}}
\index{type@{type}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KNew\-Stuff::type () const}\label{classKNewStuff_a3}


Return type of data. 



Definition at line 52 of file knewstuff.cpp.

References KNS::Engine::type().

Referenced by KNew\-Stuff().\index{KNewStuff@{KNew\-Stuff}!parentWidget@{parentWidget}}
\index{parentWidget@{parentWidget}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QWidget} $\ast$ KNew\-Stuff::parent\-Widget () const}\label{classKNewStuff_a4}


Return parent widget. 



Definition at line 57 of file knewstuff.cpp.

References KNS::Engine::parent\-Widget().

Referenced by KNew\-Stuff\-Generic::download\-Destination(), KNew\-Stuff\-Secure::install(), KNew\-Stuff(), and KNew\-Stuff\-Secure::remove\-Temp\-Directory().\index{KNewStuff@{KNew\-Stuff}!download@{download}}
\index{download@{download}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KNew\-Stuff::download ()}\label{classKNewStuff_a5}


Start download process. 



Definition at line 67 of file knewstuff.cpp.

References KNS::Engine::download().

Referenced by KNew\-Stuff\-Secure::download\-Resource().\index{KNewStuff@{KNew\-Stuff}!upload@{upload}}
\index{upload@{upload}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KNew\-Stuff::upload ()}\label{classKNewStuff_a6}


Start upload process. 



Definition at line 78 of file knewstuff.cpp.

References KNS::Engine::upload().\index{KNewStuff@{KNew\-Stuff}!upload@{upload}}
\index{upload@{upload}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KNew\-Stuff::upload (const {\bf QString} \& {\em file\-Name}, const {\bf QString} {\em preview\-Name})}\label{classKNewStuff_a7}


Upload with pre-defined files. 



Definition at line 83 of file knewstuff.cpp.

References KNS::Engine::upload().\index{KNewStuff@{KNew\-Stuff}!install@{install}}
\index{install@{install}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KNew\-Stuff::install (const {\bf QString} \& {\em file\-Name})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKNewStuff_a8}


Install file to application. 

The given file\-Name points to the file downloaded by the KNew\-Stuff engine. This is a temporary file by default. The application can do whatever is needed to handle the information contained in the file.

The function returns true, when the installation was successful and false if were errors.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]name of downloaded file \end{description}
\end{Desc}


Implemented in {\bf KNew\-Stuff\-Generic} {\rm (p.\,\pageref{classKNewStuffGeneric_a2})}, and {\bf KNew\-Stuff\-Secure} {\rm (p.\,\pageref{classKNewStuffSecure_a2})}.\index{KNewStuff@{KNew\-Stuff}!createUploadFile@{createUploadFile}}
\index{createUploadFile@{createUploadFile}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}virtual bool KNew\-Stuff::create\-Upload\-File (const {\bf QString} \& {\em file\-Name})\hspace{0.3cm}{\tt  [pure virtual]}}\label{classKNewStuff_a9}


Create a file to be uploaded to a \char`\"{}new stuff provider\char`\"{} and return the filename. 

The format of the file is application specific. The only constraint is that the corresponding {\bf install()}{\rm (p.\,\pageref{classKNewStuff_a8})} implementation is able to use the file.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file\-Name}]name of the file to be written \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]{\tt true} on success, {\tt false} on error. \end{Desc}


Implemented in {\bf KNew\-Stuff\-Generic} {\rm (p.\,\pageref{classKNewStuffGeneric_a3})}, and {\bf KNew\-Stuff\-Secure} {\rm (p.\,\pageref{classKNewStuffSecure_a3})}.\index{KNewStuff@{KNew\-Stuff}!downloadDestination@{downloadDestination}}
\index{downloadDestination@{downloadDestination}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KNew\-Stuff::download\-Destination ({\bf KNS::Entry} $\ast$ {\em entry})\hspace{0.3cm}{\tt  [virtual]}}\label{classKNewStuff_a10}


Return a filename which should be used as destination for downloading the specified new stuff entry. 

Reimplement this function, if you don't want the new stuff to be downloaded to a temporary file. 

Reimplemented in {\bf KNew\-Stuff\-Generic} {\rm (p.\,\pageref{classKNewStuffGeneric_a4})}.

Definition at line 72 of file knewstuff.cpp.\index{KNewStuff@{KNew\-Stuff}!engine@{engine}}
\index{engine@{engine}!KNewStuff@{KNew\-Stuff}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KNS::Engine}$\ast$ KNew\-Stuff::engine ()\hspace{0.3cm}{\tt  [inline, protected]}}\label{classKNewStuff_b0}


Get the pointer to the engine. 

Needed by subclasses to access the {\bf KNS::Engine}{\rm (p.\,\pageref{classKNS_1_1Engine})} object. 

Definition at line 154 of file knewstuff.h.

Referenced by KNew\-Stuff\-Secure::download\-Resource(), and KNew\-Stuff\-Secure::KNew\-Stuff\-Secure().

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