23 #if !defined( _TDEPRINT_COMPILE ) && defined( __GNUC__ )
24 #warning internal header, do not use except if you are a TDEPrint developer
28 #include <tqstringlist.h>
29 #include <tqptrlist.h>
32 #include <tdeprint/kmobject.h>
46 class TDEPRINT_EXPORT KMPrinter :
public KMObject
85 KMPrinter(
const KMPrinter& p);
87 void copy(
const KMPrinter& p);
91 const TQString& name()
const {
return m_name; }
92 void setName(
const TQString& s) { m_name = s;
if (m_printername.isEmpty()) m_printername = s; }
93 const TQString& printerName()
const {
return m_printername; }
94 void setPrinterName(
const TQString& s) { m_printername = s;
if (m_name.isEmpty()) m_name = s; }
95 const TQString& instanceName()
const {
return m_instancename; }
96 void setInstanceName(
const TQString& s) { m_instancename = s; }
97 int type()
const {
return m_type; }
98 void setType(
int t) { m_type = t; }
99 void addType(
int t) { m_type |= t; }
100 PrinterState state(
bool complete =
false)
const {
return PrinterState(m_state & (complete ? ~0x0 : StateMask)); }
101 TQString stateString()
const;
102 void setState(PrinterState s) { m_state = PrinterState((m_state & ~StateMask) | s); }
103 bool acceptJobs()
const {
return !(m_state & Rejecting); }
104 void setAcceptJobs(
bool on) { m_state = PrinterState((m_state & StateMask) | (on ? 0 : Rejecting)); }
105 const TQString& device()
const {
return m_device; }
106 TQString deviceProtocol()
const;
107 void setDevice(
const TQString& d) { m_device = d; }
108 const TQStringList& members()
const {
return m_members; }
109 void setMembers(
const TQStringList& l) { m_members = l; }
110 void addMember(
const TQString& s) { m_members.append(s); }
111 const TQString& description()
const {
return m_description; }
112 void setDescription(
const TQString& s) { m_description = s; }
113 const TQString& location()
const {
return m_location; }
114 void setLocation(
const TQString& s) { m_location = s; }
115 const KURL& uri()
const {
return m_uri; }
116 void setUri(
const KURL& u) { m_uri = u; }
117 const TQString& manufacturer()
const {
return m_manufacturer; }
118 void setManufacturer(
const TQString&s ) { m_manufacturer = s; }
119 const TQString& model()
const {
return m_model; }
120 void setModel(
const TQString& s) { m_model = s; }
121 const TQString& driverInfo()
const {
return m_driverinfo; }
122 void setDriverInfo(
const TQString& s) { m_driverinfo = s; }
123 int printerCap()
const {
return m_printercap; }
124 void setPrinterCap(
int c ) { m_printercap = c; }
125 void addPrinterCap(
int c ) { m_printercap |= c; }
128 bool isClass(
bool useImplicit =
true)
const {
return ((m_type & KMPrinter::Class) || (useImplicit && isImplicit())); }
129 bool isImplicit()
const {
return (m_type & KMPrinter::Implicit); }
130 bool isPrinter()
const {
return (m_type & KMPrinter::Printer); }
131 bool isRemote()
const {
return (m_type & KMPrinter::Remote); }
132 bool isLocal()
const {
return !isRemote(); }
133 bool isVirtual()
const {
return (m_type & KMPrinter::Virtual); }
134 bool isValid()
const {
return !(m_type & KMPrinter::Invalid); }
135 bool isSpecial()
const {
return (m_type & KMPrinter::Special); }
138 KMDBEntry* dbEntry()
const {
return m_dbentry; }
139 void setDbEntry(KMDBEntry *e) { m_dbentry = e; }
141 void setPixmap(
const TQString& s) { m_pixmap = s; }
142 bool isHardDefault()
const {
return m_harddefault; }
143 void setHardDefault(
bool on) { m_harddefault = on; }
144 bool isSoftDefault()
const {
return m_softdefault; }
145 void setSoftDefault(
bool on) { m_softdefault = on; }
146 bool ownSoftDefault()
const {
return m_ownsoftdefault; }
147 void setOwnSoftDefault(
bool on) { m_ownsoftdefault = on; }
148 static int compare(KMPrinter *p1, KMPrinter *p2);
149 const TQString& option(
const TQString& key)
const {
return m_options[key]; }
150 bool hasOption(
const TQString& key)
const {
return m_options.contains(key); }
151 void setOption(
const TQString& key,
const TQString& value) {
if (!key.isEmpty()) m_options[key] = value; }
152 void removeOption(
const TQString& key) { m_options.remove(key); }
153 TQMap<TQString,TQString> options()
const {
return m_options; }
154 void setOptions(
const TQMap<TQString,TQString>& opts) { m_options = opts; }
155 DrMain* driver()
const {
return m_driver; }
156 void setDriver(DrMain*);
157 DrMain* takeDriver();
160 bool autoConfigure(
KPrinter *prt, TQWidget *parent = 0);
163 const TQString& defaultOption(
const TQString& key)
const {
return m_defaultoptions[key]; }
164 void setDefaultOption(
const TQString& key,
const TQString& value) {
if (!key.isEmpty()) m_defaultoptions[key] = value; }
165 TQMap<TQString,TQString> defaultOptions()
const {
return m_defaultoptions; }
166 void setDefaultOptions(
const TQMap<TQString,TQString>& opts) { m_defaultoptions = opts; }
168 const TQString& editedOption(
const TQString& key)
const {
return m_editedoptions[key]; }
169 void setEditedOption(
const TQString& key,
const TQString& value) {
if (!key.isEmpty()) m_editedoptions[key] = value; }
170 TQMap<TQString,TQString> editedOptions()
const {
return m_editedoptions; }
171 void setEditedOptions(
const TQMap<TQString,TQString>& opts) { m_editedoptions = opts; }
173 bool isEdited()
const {
return m_isedited; }
174 void setEdited(
bool on) { m_isedited = on; }
180 TQString m_printername;
181 TQString m_instancename;
183 PrinterState m_state;
192 TQStringList m_members;
195 TQString m_description;
198 TQString m_manufacturer;
200 TQString m_driverinfo;
203 KMDBEntry *m_dbentry;
210 bool m_ownsoftdefault;
213 TQMap<TQString,TQString> m_options;
220 TQMap<TQString,TQString> m_defaultoptions;
221 TQMap<TQString,TQString> m_editedoptions;
228 class KMPrinterList :
public TQPtrList<KMPrinter>
231 KMPrinterList() : TQPtrList<KMPrinter>() {}
232 virtual int compareItems(TQPtrCollection::Item i1, TQPtrCollection::Item i2)
233 {
return KMPrinter::compare((KMPrinter*)i1, (KMPrinter*)i2); }
This class is the main interface to access the TDE print framework.