kmjob.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 KMJOB_H
00022 #define KMJOB_H
00023 
00024 #if !defined( _KDEPRINT_COMPILE ) && defined( __GNUC__ )
00025 #warning internal header, do not use except if you are a KDEPrint developer
00026 #endif
00027 
00028 #include <qstring.h>
00029 #include <qvaluevector.h>
00030 #include <kdeprint/kmobject.h>
00031 #include <kdelibs_export.h>
00032 
00040 class KDEPRINT_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     QString pixmap();
00073     QString 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 QString& name() const     { return m_name; }
00081     void setName(const QString& s)      { m_name = s; }
00082     const QString& printer() const      { return m_printer; }
00083     void setPrinter(const QString& s)   { m_printer = s; }
00084     const QString& owner() const        { return m_owner; }
00085     void setOwner(const QString& 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 QString& uri() const      { return m_uri; }
00091     void setUri(const QString& 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     QString attribute(int i) const  { return m_attributes[i]; }
00104     void setAttribute(int i, const QString& 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     QValueVector<QString>   m_attributes;
00128 };
00129 
00130 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys