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 <qobject.h>
00024 #include <qptrlist.h>
00025 #include <qdatetime.h>
00026 
00027 #include <kdelibs_export.h>
00028 
00029 #include "kpreloadobject.h"
00030 
00031 class KMPrinter;
00032 class KMManager;
00033 class QWidget;
00034 
00035 class KDEPRINT_EXPORT KMVirtualManager : public QObject, 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(QPtrList<KMPrinter>& list, const QString& prname);
00044     void triggerSave();
00045 
00046     KMPrinter* findPrinter(const QString& name);
00047     KMPrinter* findInstance(KMPrinter *p, const QString& name);
00048     void setDefault(KMPrinter *p, bool save = true);
00049     QString defaultPrinterName();
00050     bool isDefault(KMPrinter *p, const QString& name);
00051     bool testInstance(KMPrinter *p);
00052 
00053     void create(KMPrinter *p, const QString& name);
00054     void remove(KMPrinter *p, const QString& name);
00055     void copy(KMPrinter *p, const QString& src, const QString& name);
00056     void setAsDefault(KMPrinter *p, const QString& name, QWidget *parent = NULL);
00057 
00058 protected:
00059     void loadFile(const QString& filename);
00060     void saveFile(const QString& 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         QString                 m_defaultprinter;
00070 };
00071 
00072 inline void KMVirtualManager::reset()
00073 { m_checktime = QDateTime(); }
00074 
00075 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys