kmvirtualmanager.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., 51 Franklin Street, Fifth Floor, 00017 * Boston, MA 02110-1301, USA. 00018 **/ 00019 00020 #ifndef KMVIRTUALMANAGER_H 00021 #define KMVIRTUALMANAGER_H 00022 00023 #include <tqobject.h> 00024 #include <tqptrlist.h> 00025 #include <tqdatetime.h> 00026 00027 #include <kdelibs_export.h> 00028 00029 #include "kpreloadobject.h" 00030 00031 class KMPrinter; 00032 class KMManager; 00033 class TQWidget; 00034 00035 class KDEPRINT_EXPORT KMVirtualManager : public TQObject, public KPReloadObject 00036 { 00037 public: 00038 KMVirtualManager(KMManager *parent = 0, const char *name = 0); 00039 ~KMVirtualManager(); 00040 00041 void refresh(); 00042 void reset(); 00043 void virtualList(TQPtrList<KMPrinter>& list, const TQString& prname); 00044 void triggerSave(); 00045 00046 KMPrinter* findPrinter(const TQString& name); 00047 KMPrinter* findInstance(KMPrinter *p, const TQString& name); 00048 void setDefault(KMPrinter *p, bool save = true); 00049 TQString defaultPrinterName(); 00050 bool isDefault(KMPrinter *p, const TQString& name); 00051 bool testInstance(KMPrinter *p); 00052 00053 void create(KMPrinter *p, const TQString& name); 00054 void remove(KMPrinter *p, const TQString& name); 00055 void copy(KMPrinter *p, const TQString& src, const TQString& name); 00056 void setAsDefault(KMPrinter *p, const TQString& name, TQWidget *parent = NULL); 00057 00058 protected: 00059 void loadFile(const TQString& filename); 00060 void saveFile(const TQString& filename); 00061 void addPrinter(KMPrinter *p); 00062 void checkPrinter(KMPrinter*); 00063 void reload(); 00064 void configChanged(); 00065 00066 private: 00067 KMManager *m_manager; 00068 QDateTime m_checktime; 00069 TQString m_defaultprinter; 00070 }; 00071 00072 inline void KMVirtualManager::reset() 00073 { m_checktime = TQDateTime(); } 00074 00075 #endif