\section{KFile\-Meta\-Info Class Reference}
\label{classKFileMetaInfo}\index{KFileMetaInfo@{KFileMetaInfo}}
This is the class for objects that hold meta information about a file.  


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

\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef {\bf KFile\-Mime\-Type\-Info::Hint} {\bf Hint}\label{classKFileMetaInfo_w0}

\item 
typedef {\bf KFile\-Mime\-Type\-Info::Unit} {\bf Unit}\label{classKFileMetaInfo_w1}

\item 
typedef {\bf KFile\-Mime\-Type\-Info::Attributes} {\bf Attributes}\label{classKFileMetaInfo_w2}

\item 
enum {\bf What} \{ \par
{\bf Fastest} =  0x1, 
{\bf Dont\-Care} =  0x2, 
{\bf Technical\-Info} =  0x4, 
{\bf Content\-Info} =  0x8, 
\par
{\bf Extened\-Attr} =  0x10, 
{\bf Thumbnail} =  0x20, 
{\bf Preferred} =  0x40, 
{\bf Everything} =  0xffff
 \}
\begin{CompactList}\small\item\em This is used to specify what a KFile\-Meta\-Info object should read, so you can specify if you want to read \char`\"{}expensive\char`\"{} items or not. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KFile\-Meta\-Info} (const  {\bf QString} \&path, const  {\bf QString} \&mime\-Type=QString::null, uint what=Fastest)
\begin{CompactList}\small\item\em The constructor. \item\end{CompactList}\item 
{\bf KFile\-Meta\-Info} ()
\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
{\bf KFile\-Meta\-Info} (const  {\bf KFile\-Meta\-Info} \&original)
\begin{CompactList}\small\item\em Copy constructor. \item\end{CompactList}\item 
const  {\bf KFile\-Meta\-Info} \& {\bf operator=} (const  {\bf KFile\-Meta\-Info} \&info)
\begin{CompactList}\small\item\em The assignment operator, so you can do e.g.:. \item\end{CompactList}\item 
{\bf QString\-List} {\bf groups} () const 
\item 
{\bf QString\-List} {\bf supported\-Groups} () const \label{classKFileMetaInfo_a6}

\item 
{\bf QString\-List} {\bf preferred\-Groups} () const \label{classKFileMetaInfo_a7}

\item 
{\bf QString\-List} {\bf preferred\-Keys} () const \label{classKFileMetaInfo_a8}

\item 
{\bf QString\-List} {\bf supported\-Keys} () const \label{classKFileMetaInfo_a9}

\item 
{\bf QString\-List} {\bf editable\-Groups} () const 
\item 
{\bf KFile\-Meta\-Info\-Item} {\bf item} (const  {\bf QString} \&key) const \label{classKFileMetaInfo_a11}

\item 
{\bf KFile\-Meta\-Info\-Item} {\bf item} (const  KFile\-Meta\-Info\-Item::Hint hint) const \label{classKFileMetaInfo_a12}

\item 
{\bf KFile\-Meta\-Info\-Item} {\bf save\-Item} (const  {\bf QString} \&key, const  {\bf QString} \&preferred\-Group=QString::null, bool create\-Group=true)\label{classKFileMetaInfo_a13}

\item 
{\bf KFile\-Meta\-Info\-Group} {\bf group} (const  {\bf QString} \&key) const \label{classKFileMetaInfo_a14}

\item 
{\bf KFile\-Meta\-Info\-Group} {\bf operator[$\,$]} (const  {\bf QString} \&key) const \label{classKFileMetaInfo_a15}

\item 
bool {\bf add\-Group} (const  {\bf QString} \&name)
\begin{CompactList}\small\item\em Try to add the specified group. \item\end{CompactList}\item 
bool {\bf remove\-Group} (const  {\bf QString} \&name)
\begin{CompactList}\small\item\em remove the specified group. \item\end{CompactList}\item 
{\bf QString\-List} {\bf removed\-Groups} ()\label{classKFileMetaInfo_a18}

\item 
bool {\bf apply\-Changes} ()
\begin{CompactList}\small\item\em This method writes all pending changes of the meta info back to the file. \item\end{CompactList}\item 
bool {\bf contains} (const  {\bf QString} \&key) const 
\item 
bool {\bf contains\-Group} (const  {\bf QString} \&key) const 
\item 
const  {\bf QVariant} {\bf value} (const  {\bf QString} \&key) const \label{classKFileMetaInfo_a22}

\item 
bool {\bf is\-Valid} () const 
\item 
bool {\bf is\-Empty} () const 
\item 
{\bf QString} {\bf mime\-Type} () const \label{classKFileMetaInfo_a25}

\item 
{\bf QString} {\bf path} () const \label{classKFileMetaInfo_a26}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
{\bf KFile\-Meta\-Info\-Group} {\bf append\-Group} (const  {\bf QString} \&name)\label{classKFileMetaInfo_b0}

\item 
{\bf KFile\-Plugin} $\ast$const  {\bf plugin} () const 
\item 
void {\bf ref} ()\label{classKFileMetaInfo_b2}

\item 
void {\bf deref} ()\label{classKFileMetaInfo_b3}

\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
Data $\ast$ {\bf d}\label{classKFileMetaInfo_p0}

\end{CompactItemize}
\subsection*{Friends}
\begin{CompactItemize}
\item 
class {\bf KFile\-Plugin}\label{classKFileMetaInfo_n0}

\item 
{\bf QData\-Stream} \& {\bf operator$>$$>$} ({\bf QData\-Stream} \&s, {\bf KFile\-Meta\-Info} \&)\label{classKFileMetaInfo_n1}

\item 
{\bf QData\-Stream} \& {\bf operator$<$$<$} ({\bf QData\-Stream} \&s, const  {\bf KFile\-Meta\-Info} \&)\label{classKFileMetaInfo_n2}

\end{CompactItemize}


\subsection{Detailed Description}
This is the class for objects that hold meta information about a file. 

The information is kept in form of a system of key/value pairs. See also {\bf KFile\-Meta\-Info\-Item}{\rm (p.\,\pageref{classKFileMetaInfoItem})}. This information is retrieved from the file through a plugin system, and this class is the main interface to it. If you want to write your own plugin, have a look at {\bf KFile\-Plugin}{\rm (p.\,\pageref{classKFilePlugin})}. There are basically two different kinds of meta information: Fixed ones that the plugin knows about (e.g. an mp3 id3v1 tag has a well defined fixed list of fields), and variable keys that exist in mimetypes that support their own key/value system (comments in png files are of this type). Almost every file has fixed keys, but some also have variable keys.

The groups and the What enum are not yet supported, but already added to the interface so that adding support doesn't break compatibility. 



Definition at line 853 of file kfilemetainfo.h.

\subsection{Member Enumeration Documentation}
\index{KFileMetaInfo@{KFile\-Meta\-Info}!What@{What}}
\index{What@{What}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf KFile\-Meta\-Info::What}}\label{classKFileMetaInfo_w11}


This is used to specify what a KFile\-Meta\-Info object should read, so you can specify if you want to read \char`\"{}expensive\char`\"{} items or not. 

\begin{itemize}
\item {\tt Fastest} do the fastest possible read and omit all items that might need a significantly longer time than the others \item {\tt Everything} read everything, even if it might take a while \item {\tt Dont\-Care} let the plugin decide what to read \item {\tt Technical\-Info} extract technical details about the file, like e.g. play time, resolution or a compression type \item {\tt Content\-Info} read information about the content of the file, like comments or id3 tags \item {\tt Extended\-Attr} read filesystem based extended attributes if they are supported for the filesystem \item {\tt Thumbnail} only read the file's thumbnail, if it contains one \item {\tt Preferred} get at least the preferred items \end{itemize}


Definition at line 880 of file kfilemetainfo.h.

\subsection{Constructor \& Destructor Documentation}
\index{KFileMetaInfo@{KFile\-Meta\-Info}!KFileMetaInfo@{KFileMetaInfo}}
\index{KFileMetaInfo@{KFileMetaInfo}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFile\-Meta\-Info::KFile\-Meta\-Info (const {\bf QString} \& {\em path}, const {\bf QString} \& {\em mime\-Type} = QString::null, uint {\em what} = Fastest)}\label{classKFileMetaInfo_a0}


The constructor. 

creating a KFile\-Meta\-Info item through this will autoload the plugin belonging to the mimetype and try to get meta information about the specified file.

If no info is available, you'll get an empty (not invalid) object. You can test for it with the {\bf is\-Empty}{\rm (p.\,\pageref{classKFileMetaInfo_a24})}() method.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em path}]The file name. This must be the path to a local file. \item[{\em mime\-Type}]The name of the file's mimetype. If ommited, the mimetype is autodetected \item[{\em what}]one or more of the {\tt What} enum values. It gives some hint to the plugin what information is desired. The plugin may still return more items. \end{description}
\end{Desc}


Definition at line 288 of file kfilemetainfo.cpp.

References KMime\-Type::find\-By\-Path(), QString::is\-Empty(), KFile\-Meta\-Info(), plugin(), and KFile\-Plugin::read\-Info().\index{KFileMetaInfo@{KFile\-Meta\-Info}!KFileMetaInfo@{KFileMetaInfo}}
\index{KFileMetaInfo@{KFileMetaInfo}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFile\-Meta\-Info::KFile\-Meta\-Info ()}\label{classKFileMetaInfo_a1}


Default constructor. 

This will create an invalid object (see {\bf is\-Valid}{\rm (p.\,\pageref{classKFileMetaInfo_a23})}(). 

Definition at line 325 of file kfilemetainfo.cpp.

Referenced by KFile\-Meta\-Info().\index{KFileMetaInfo@{KFile\-Meta\-Info}!KFileMetaInfo@{KFileMetaInfo}}
\index{KFileMetaInfo@{KFileMetaInfo}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KFile\-Meta\-Info::KFile\-Meta\-Info (const {\bf KFile\-Meta\-Info} \& {\em original})}\label{classKFileMetaInfo_a2}


Copy constructor. 



Definition at line 318 of file kfilemetainfo.cpp.

\subsection{Member Function Documentation}
\index{KFileMetaInfo@{KFile\-Meta\-Info}!operator=@{operator=}}
\index{operator=@{operator=}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const  {\bf KFile\-Meta\-Info} \& KFile\-Meta\-Info::operator= (const {\bf KFile\-Meta\-Info} \& {\em info})}\label{classKFileMetaInfo_a4}


The assignment operator, so you can do e.g.:. 

\small\begin{alltt}
    KFileMetaInfo info;
    if (something) info = KFileMetaInfo("/the/file");
 \end{alltt}\normalsize 


This will create a shared copy of the object. The actual data is automatically deleted if all copies go out of scope 

Definition at line 470 of file kfilemetainfo.cpp.

References d.\index{KFileMetaInfo@{KFile\-Meta\-Info}!groups@{groups}}
\index{groups@{groups}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KFile\-Meta\-Info::groups () const}\label{classKFileMetaInfo_a5}


\begin{Desc}
\item[Returns:]all keys groups that the file has. \end{Desc}


Definition at line 345 of file kfilemetainfo.cpp.

Referenced by contains(), and contains\-Group().\index{KFileMetaInfo@{KFile\-Meta\-Info}!editableGroups@{editableGroups}}
\index{editableGroups@{editableGroups}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KFile\-Meta\-Info::editable\-Groups () const}\label{classKFileMetaInfo_a10}


\begin{Desc}
\item[Returns:]the list of groups that you can add or remove from the file. \end{Desc}


Definition at line 355 of file kfilemetainfo.cpp.

References KFile\-Mime\-Type\-Info::Group\-Info::attributes().\index{KFileMetaInfo@{KFile\-Meta\-Info}!addGroup@{addGroup}}
\index{addGroup@{addGroup}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::add\-Group (const {\bf QString} \& {\em name})}\label{classKFileMetaInfo_a16}


Try to add the specified group. 

This will only succeed if it is in the list of {\bf editable\-Groups}{\rm (p.\,\pageref{classKFileMetaInfo_a10})}(). Note that all non-variable items that belong to this group are automatically added as empty item. 

Definition at line 417 of file kfilemetainfo.cpp.

References KFile\-Meta\-Info\-Group::append\-Item(), KFile\-Mime\-Type\-Info::Item\-Info::attributes(), KFile\-Mime\-Type\-Info::Group\-Info::item\-Info(), KFile\-Mime\-Type\-Info::Item\-Info::key(), KStd\-Accel::name(), KFile\-Meta\-Info\-Group::set\-Added(), and KFile\-Mime\-Type\-Info::Group\-Info::supported\-Keys().\index{KFileMetaInfo@{KFile\-Meta\-Info}!removeGroup@{removeGroup}}
\index{removeGroup@{removeGroup}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::remove\-Group (const {\bf QString} \& {\em name})}\label{classKFileMetaInfo_a17}


remove the specified group. 

This will only succeed if it is in the list of {\bf editable\-Groups}{\rm (p.\,\pageref{classKFileMetaInfo_a10})}(). Beware that this also removes all the items in that group, so always ask the user before removing it! 

Definition at line 453 of file kfilemetainfo.cpp.

References KStd\-Accel::name().\index{KFileMetaInfo@{KFile\-Meta\-Info}!applyChanges@{applyChanges}}
\index{applyChanges@{applyChanges}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::apply\-Changes ()}\label{classKFileMetaInfo_a19}


This method writes all pending changes of the meta info back to the file. 

If any items are marked as removed, they are really removed from the list. The info object as well as all items are updated. \begin{Desc}
\item[Returns:]true if successful, false if not \end{Desc}


Definition at line 498 of file kfilemetainfo.cpp.

References QMap\-Const\-Iterator::data(), plugin(), and KFile\-Plugin::write\-Info().\index{KFileMetaInfo@{KFile\-Meta\-Info}!contains@{contains}}
\index{contains@{contains}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::contains (const {\bf QString} \& {\em key}) const}\label{classKFileMetaInfo_a20}


\begin{Desc}
\item[Returns:]whether an item for this key exists. \end{Desc}


Definition at line 550 of file kfilemetainfo.cpp.

References KFile\-Meta\-Info\-Group::contains(), groups(), and KStd\-Accel::key().\index{KFileMetaInfo@{KFile\-Meta\-Info}!containsGroup@{containsGroup}}
\index{containsGroup@{containsGroup}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::contains\-Group (const {\bf QString} \& {\em key}) const}\label{classKFileMetaInfo_a21}


\begin{Desc}
\item[Returns:]whether a group with this name exists. \end{Desc}


Definition at line 561 of file kfilemetainfo.cpp.

References groups(), and KStd\-Accel::key().\index{KFileMetaInfo@{KFile\-Meta\-Info}!isValid@{isValid}}
\index{isValid@{isValid}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::is\-Valid () const}\label{classKFileMetaInfo_a23}


\begin{Desc}
\item[Returns:]true if the item is valid, i.e. if actually represents the info about a file, false if the object is uninitialized \end{Desc}


Definition at line 483 of file kfilemetainfo.cpp.

Referenced by KFile\-Item::get\-Tool\-Tip\-Text(), and KFile\-Item::meta\-Info().\index{KFileMetaInfo@{KFile\-Meta\-Info}!isEmpty@{isEmpty}}
\index{isEmpty@{isEmpty}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KFile\-Meta\-Info::is\-Empty () const}\label{classKFileMetaInfo_a24}


\begin{Desc}
\item[Returns:]false if the object contains data, true if it's empty. You'll get an empty object if no plugin for the file could be found. \end{Desc}


Definition at line 489 of file kfilemetainfo.cpp.

Referenced by KFile\-Item::get\-Tool\-Tip\-Text().\index{KFileMetaInfo@{KFile\-Meta\-Info}!plugin@{plugin}}
\index{plugin@{plugin}!KFileMetaInfo@{KFile\-Meta\-Info}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KFile\-Plugin} $\ast$const  KFile\-Meta\-Info::plugin () const\hspace{0.3cm}{\tt  [protected]}}\label{classKFileMetaInfo_b1}


\begin{Desc}
\item[Returns:]a pointer to the plugin that belogs to this object's mimetype. It will be auto-loaded if it's currently not loaded \end{Desc}


Definition at line 539 of file kfilemetainfo.cpp.

Referenced by apply\-Changes(), and KFile\-Meta\-Info().

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