kmjob.h
00001 /* 00002 * This file is part of the KDE libraries 00003 * Copyright (c) 2001 Michael Goffioul <tdeprint@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 KMJOB_H 00022 #define KMJOB_H 00023 00024 #if !defined( _TDEPRINT_COMPILE ) && defined( __GNUC__ ) 00025 #warning internal header, do not use except if you are a TDEPrint developer 00026 #endif 00027 00028 #include <tqstring.h> 00029 #include <tqvaluevector.h> 00030 #include <tdeprint/kmobject.h> 00031 #include <tdelibs_export.h> 00032 00040 class TDEPRINT_EXPORT KMJob : public KMObject 00041 { 00042 public: 00043 enum JobAction { 00044 Remove = 0x01, 00045 Move = 0x02, 00046 Hold = 0x04, 00047 Resume = 0x08, 00048 Restart = 0x10, 00049 ShowCompleted = 0x20, 00050 All = 0xFF 00051 }; 00052 enum JobState { 00053 Printing = 1, 00054 Queued = 2, 00055 Held = 3, 00056 Error = 4, 00057 Cancelled = 5, 00058 Aborted = 6, 00059 Completed = 7, 00060 Unknown = 8 00061 }; 00062 enum JobType { 00063 System = 0, 00064 Threaded = 1 00065 }; 00066 00067 KMJob(); 00068 KMJob(const KMJob& j); 00069 00070 KMJob& operator=(const KMJob& j); 00071 void copy(const KMJob& j); 00072 TQString pixmap(); 00073 TQString stateString(); 00074 bool isCompleted() const { return (m_state >= Cancelled && m_state <= Completed); } 00075 bool isActive() const { return !isCompleted(); } 00076 00077 // inline access functions 00078 int id() const { return m_ID; } 00079 void setId(int id) { m_ID = id; } 00080 const TQString& name() const { return m_name; } 00081 void setName(const TQString& s) { m_name = s; } 00082 const TQString& printer() const { return m_printer; } 00083 void setPrinter(const TQString& s) { m_printer = s; } 00084 const TQString& owner() const { return m_owner; } 00085 void setOwner(const TQString& s) { m_owner = s; } 00086 int state() const { return m_state; } 00087 void setState(int s) { m_state = s; } 00088 int size() const { return m_size; } 00089 void setSize(int s) { m_size = s; } 00090 const TQString& uri() const { return m_uri; } 00091 void setUri(const TQString& s) { m_uri = s; } 00092 int type() const { return m_type; } 00093 void setType(int t) { m_type = t; } 00094 int pages() const { return m_pages; } 00095 void setPages(int p) { m_pages = p; }; 00096 int processedPages() const { return m_processedpages; } 00097 void setProcessedPages(int p) { m_processedpages = p; } 00098 int processedSize() const { return m_processedsize; } 00099 void setProcessedSize(int s) { m_processedsize = s; } 00100 bool isRemote() const { return m_remote; } 00101 void setRemote(bool on) { m_remote = on; } 00102 00103 TQString attribute(int i) const { return m_attributes[i]; } 00104 void setAttribute(int i, const TQString& att) { m_attributes[i] = att; } 00105 int attributeCount() const { return m_attributes.size(); } 00106 void setAttributeCount(int c) { m_attributes.resize(c); } 00107 00108 protected: 00109 void init(); 00110 00111 protected: 00112 // normal members 00113 int m_ID; 00114 QString m_name; 00115 QString m_printer; 00116 QString m_owner; 00117 int m_state; 00118 int m_size; 00119 int m_type; 00120 int m_pages; 00121 int m_processedsize; 00122 int m_processedpages; 00123 bool m_remote; 00124 00125 // internal members 00126 QString m_uri; 00127 TQValueVector<TQString> m_attributes; 00128 }; 00129 00130 #endif