kdeprint Library API Documentation

kxmlcommand.h

00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be> 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License version 2 as published by the Free Software Foundation. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this library; see the file COPYING.LIB. If not, write to 00016 * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 **/ 00019 00020 #ifndef KXMLCOMMAND_H 00021 #define KXMLCOMMAND_H 00022 00023 #include <qdom.h> 00024 #include <qmap.h> 00025 #include <qobject.h> 00026 00027 class DrMain; 00028 class DrGroup; 00029 class DrBase; 00030 00031 class KXmlCommand : public QObject 00032 { 00033 friend class KXmlCommandManager; 00034 00035 public: 00036 ~KXmlCommand(); 00037 00038 QString name() const; 00039 void setName(const QString&); 00040 QString command(); 00041 void setCommand(const QString&); 00042 DrMain* driver(); 00043 DrMain* takeDriver(); 00044 void setDriver(DrMain*); 00045 QString io(bool io_input = true, bool io_pipe = false); 00046 void setIo(const QString&, bool io_input = true, bool io_pipe = false); 00047 QString description(); 00048 void setDescription(const QString&); 00049 QString mimeType(); 00050 void setMimeType(const QString&); 00051 bool acceptMimeType(const QString&); 00052 QStringList inputMimeTypes(); 00053 void setInputMimeTypes(const QStringList&); 00054 QStringList requirements(); 00055 void setRequirements(const QStringList&); 00056 QString comment(); 00057 void setComment( const QString& ); 00058 bool isValid(); 00059 00060 QString buildCommand(const QMap<QString,QString>& opts, bool pipein = true, bool pipeout = true); 00061 void setOptions(const QMap<QString,QString>& opts); 00062 void getOptions(QMap<QString,QString>& opts, bool incldef = false); 00063 00064 protected: 00065 void init(); 00066 void loadXml(); 00067 void saveXml(); 00068 void loadDesktop(); 00069 void saveDesktop(); 00070 void check(bool use_xml = false); 00071 DrGroup* parseGroup(const QDomElement& e, DrGroup *grp = 0); 00072 DrBase* parseArgument(const QDomElement& e); 00073 void parseIO(const QDomElement& e, int n); 00074 QDomElement createIO(QDomDocument&, int, const QString&); 00075 QDomElement createGroup(QDomDocument&, DrGroup*); 00076 QDomElement createElement(QDomDocument&, DrBase*); 00077 00078 // use protected constructor to only allow the manager to 00079 // create KXmlCommand object. 00080 KXmlCommand(const QString& xmlId = QString::null); 00081 00082 private: 00083 class KXmlCommandPrivate; 00084 KXmlCommandPrivate *d; 00085 }; 00086 00087 class KXmlCommandManager : public QObject 00088 { 00089 public: 00090 enum IO_CheckType { None = 0, Basic, Advanced }; 00091 00092 KXmlCommandManager(); 00093 ~KXmlCommandManager(); 00094 00095 KXmlCommand* loadCommand(const QString& xmlId, bool check = false); 00096 void saveCommand(KXmlCommand *xmlCmd); 00097 QStringList commandList(); 00098 QStringList commandListWithDescription(); 00099 QString selectCommand(QWidget *parent = 0); 00100 00101 QStringList autoConvert(const QString& mimesrc, const QString& mimedest); 00102 int insertCommand(QStringList& list, const QString& filtername, bool defaultToStart = true); 00103 bool checkCommand(const QString&, int inputCheck = Advanced, int outputCheck = Advanced, QString *msg = 0); 00104 bool configure(KXmlCommand*, QWidget *parent = 0); 00105 void cleanUp(); 00106 00107 static KXmlCommandManager* self(); 00108 00109 protected: 00110 void preload(); 00111 KXmlCommand* command(const QString&) const; 00112 00113 private: 00114 class KXmlCommandManagerPrivate; 00115 KXmlCommandManagerPrivate *d; 00116 static KXmlCommandManager *m_self; 00117 }; 00118 00119 #endif
KDE Logo
This file is part of the documentation for kdeprint Library Version 3.2.3.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Mon Aug 30 22:55:50 2004 by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2003