kmfactory.h

00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *
00006  *  This library is free software; you can redistribute it and/or
00007  *  modify it under the terms of the GNU Library General Public
00008  *  License version 2 as published by the Free Software Foundation.
00009  *
00010  *  This library is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  *  Library General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU Library General Public License
00016  *  along with this library; see the file COPYING.LIB.  If not, write to
00017  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  *  Boston, MA 02110-1301, USA.
00019  **/
00020 
00021 #ifndef KMFACTORY_H
00022 #define KMFACTORY_H
00023 
00024 #include <qstring.h>
00025 #include <qvaluelist.h>
00026 #include <qstringlist.h>
00027 #include <qptrlist.h>
00028 #include <qobject.h>
00029 #include <qpair.h>
00030 #include <dcopobject.h>
00031 
00032 #include <sys/types.h>
00033 
00034 class KMManager;
00035 class KMJobManager;
00036 class KMUiManager;
00037 class KMVirtualManager;
00038 class KXmlCommandManager;
00039 class KMSpecialManager;
00040 class KPrinterImpl;
00041 class KLibFactory;
00042 class KConfig;
00043 class KPReloadObject;
00044 
00045 class KDEPRINT_EXPORT KMFactory : public QObject, public DCOPObject
00046 {
00047     Q_OBJECT
00048     K_DCOP
00049 
00050 public:
00051     struct PluginInfo
00052     {
00053         QString     name;
00054         QString     comment;
00055         QStringList detectUris;
00056         int     detectPrecedence;
00057         QStringList mimeTypes;
00058         QString     primaryMimeType;
00059     };
00060 
00061     static KMFactory* self();
00062         static bool exists();
00063     static void release();
00064 
00065     KMFactory();
00066     ~KMFactory();
00067 
00068     KMManager* manager();
00069     KMJobManager* jobManager();
00070     KMUiManager* uiManager();
00071     KMVirtualManager* virtualManager();
00072     KMSpecialManager* specialManager();
00073     KXmlCommandManager* commandManager();
00074     KPrinterImpl* printerImplementation();
00075     KConfig* printConfig(const QString& group = QString::null);
00076     QString printSystem();
00077     QValueList<PluginInfo> pluginList();
00078     PluginInfo pluginInfo(const QString& name);
00079     void saveConfig();
00080 
00081     void reload(const QString& syst, bool saveSyst = true);
00082     void registerObject(KPReloadObject*, bool = false);
00083     void unregisterObject(KPReloadObject*);
00084 
00085     struct Settings
00086     {
00087         int application;
00088         int standardDialogPages;
00089         int pageSelection;
00090         int orientation;
00091         int pageSize;
00092     };
00093     Settings* settings() const  { return m_settings; }
00094 
00095     QPair<QString,QString> requestPassword( int& seqNbr, const QString& user, const QString& host = "localhost", int port = 0 );
00096     void initPassword( const QString& user, const QString& password, const QString& host = "localhsot", int port = 0 );
00097 
00098 k_dcop:
00099     ASYNC slot_pluginChanged(pid_t);
00100     ASYNC slot_configChanged();
00101 
00102 k_dcop_signals:
00103     void pluginChanged(pid_t);
00104     void configChanged();
00105 
00106 private:
00107     void createManager();
00108     void createJobManager();
00109     void createUiManager();
00110     void createPrinterImpl();
00111     void loadFactory(const QString& syst = QString::null);
00112     void unload();
00113     QString autoDetect();
00114 
00115 private:
00116     static KMFactory    *m_self;
00117 
00118     KMManager       *m_manager;
00119     KMJobManager        *m_jobmanager;
00120     KMUiManager     *m_uimanager;
00121     KPrinterImpl        *m_implementation;
00122     KLibFactory     *m_factory;
00123 
00124     KConfig         *m_printconfig;
00125     Settings        *m_settings;
00126     QPtrList<KPReloadObject> m_objects;
00127 };
00128 
00129 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys