Back to index

kdeartwork  4.3.2
kxsxml.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //
00003 // KDE xscreensaver configuration dialog
00004 //
00005 // Copyright (c)  Martin R. Jones <mjones@kde.org> 2002
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public
00009 // License as published by the Free Software Foundation;
00010 // version 2 of the License.
00011 //
00012 // This program is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015 // General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with this program; see the file COPYING.  If not, write to
00019 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020 // Boston, MA 02110-1301, USA.
00021 
00022 #ifndef KXSXML_H
00023 #define KXSXML_H
00024 
00025 #include "kxsconfig.h"
00026 #include <QXmlDefaultHandler>
00027 #include <QList>
00028 #include <QStack>
00029 
00030 class QWidget;
00031 class KXSXmlHandler;
00032 
00033 class KXSXml
00034 {
00035 public:
00036     KXSXml( QWidget *p );
00037 
00038     bool parse( const QString &filename );
00039     QList<KXSConfigItem*> items() const;
00040     QString description() const;
00041 
00042 private:
00043     QWidget *parent;
00044     KXSXmlHandler *handler;
00045 };
00046 
00047 class KXSXmlHandler : public QXmlDefaultHandler
00048 {
00049 public:
00050     KXSXmlHandler( QWidget *p );
00051 
00052     bool startDocument();
00053     bool startElement( const QString&, const QString&, const QString& ,
00054            const QXmlAttributes& );
00055     bool endElement( const QString&, const QString&, const QString& );
00056     bool characters( const QString & );
00057 
00058     QList<KXSConfigItem*> items() const { return mConfigItemList; }
00059     const QString &description() const { return desc; }
00060 
00061 private:
00062     QWidget *parent;
00063     KXSSelectItem *selItem;
00064     bool inDesc;
00065     QString desc;
00066     QList<KXSConfigItem*> mConfigItemList;
00067     QStack<QWidget*> mParentStack;
00068 };
00069 
00070 #endif // KXSXML_H
00071