kmjobviewer.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 KMJOBVIEWER_H
00021 #define KMJOBVIEWER_H
00022 
00023 #if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
00024 #warning internal header, do not use except if you are a KDEPrint developer
00025 #endif
00026 
00027 #include <kmainwindow.h>
00028 #include "kmprinterpage.h"
00029 #include "kpreloadobject.h"
00030 
00031 class KMJobManager;
00032 class KMJob;
00033 class KListView;
00034 class JobItem;
00035 class QPopupMenu;
00036 class QListViewItem;
00037 class KMPrinter;
00038 class QTimer;
00039 class QLineEdit;
00040 class QCheckBox;
00041 
00049 class KDEPRINT_EXPORT KMJobViewer : public KMainWindow, public KMPrinterPage, public KPReloadObject
00050 {
00051     Q_OBJECT
00052 public:
00053     KMJobViewer(QWidget *parent = 0, const char *name = 0);
00054     ~KMJobViewer();
00055 
00056     void setPrinter(const QString& prname);
00057     void setPrinter(KMPrinter *p);
00058     void refresh(bool reload = false);
00059     QString printer() const;
00060     bool isSticky() const;
00061 
00062 signals:
00063     void jobsShown(KMJobViewer*, bool hasJobs);
00064     void refreshClicked();
00065     void printerChanged(KMJobViewer*, const QString& prname);
00066     void viewerDestroyed(KMJobViewer*);
00067 
00068 public slots:
00069     void pluginActionActivated(int);
00070 
00071 protected slots:
00072     void slotSelectionChanged();
00073     void slotHold();
00074     void slotResume();
00075     void slotRemove();
00076     void slotRestart();
00077     void slotRightClicked(QListViewItem*,const QPoint&,int);
00078     void slotMove(int prID);
00079     void slotPrinterSelected(int);
00080     void slotShowCompleted(bool);
00081     void slotRefresh();
00082     void slotClose();
00083     void slotShowMoveMenu();
00084     void slotShowPrinterMenu();
00085     void slotUserOnly(bool);
00086     void slotUserChanged();
00087     void slotConfigure();
00088     void slotDropped( QDropEvent*, QListViewItem* );
00089 
00090 protected:
00091     void init();
00092     void updateJobs();
00093     void initActions();
00094     JobItem* findItem(const QString& uri);
00095     void jobSelection(QPtrList<KMJob>& l);
00096     void send(int cmd, const QString& name, const QString& arg = QString::null);
00097     void loadPrinters();
00098     void loadPluginActions();
00099     void removePluginActions();
00100     void reload();
00101     //void aboutToReload();
00102     void closeEvent(QCloseEvent*);
00103     void triggerRefresh();
00104     void addToManager();
00105     void removeFromManager();
00106     void buildPrinterMenu(QPopupMenu *menu, bool use_all = false, bool use_specials = false);
00107     void updateCaption();
00108     void updateStatusBar();
00109 
00110 private:
00111     KListView       *m_view;
00112     QPtrList<KMJob>     m_jobs;
00113     QPtrList<JobItem>       m_items;
00114     QPopupMenu      *m_pop;
00115     QPtrList<KMPrinter> m_printers;
00116     QString m_prname;
00117     int m_type;
00118     QString m_username;
00119     QLineEdit   *m_userfield;
00120     QCheckBox   *m_stickybox;
00121     bool m_standalone;
00122 };
00123 
00124 inline QString KMJobViewer::printer() const
00125 { return m_prname; }
00126 
00127 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys