3 #ifndef _WVPRINTCONFWATCHER_H
4 #define _WVPRINTCONFWATCHER_H
14 class WvZeroconfBrowser
;
19 AliasMap(WvStringParm _alias
, WvStringParm _queue
):
20 alias(_alias
), queue(_queue
) {}
23 DeclareWvDict(AliasMap
, WvString
, alias
);
26 class WvPrintConfWatcher
32 PrintQueueNameDict queues
;
33 WvBaseCUPSManager
*cups
;
34 WvZeroconfBrowser
*zeroconf
;
35 AliasMapDict
*aliases
;
38 WvPrintConfWatcher(WvLog
&_log
, const UniConf
&_cfg
);
39 ~WvPrintConfWatcher();
42 void set_cupsmanager(WvBaseCUPSManager
*_cups
)
45 void set_zeroconf(WvZeroconfBrowser
*_zeroconf
)
46 { zeroconf
= _zeroconf
; };
48 int count_queues(void)
49 { return queues
.count(); }
50 bool has_queue(WvStringParm queuename
)
51 { return (queues
[queuename
] != NULL
); }
52 PrintQueueNameDict
&get_queues(void)
54 WvString
get_printer_state(WvStringParm queuname
);
56 int count_jobs(WvStringParm queuename
);
57 bool job_exists(WvStringParm queuename
, int job_num
);
58 bool cancel_job(WvStringParm queuenmame
, int job_num
);
60 /** set the queue that will be used as default. */
61 void set_default_queue(WvStringParm queuename
);
65 void test_add_printer(WvStringParm name
)
67 void test_remove_printer(WvStringParm name
)
68 { _remove_queue(name
); }
71 void addalias_callback(const UniConf
&_cfg
, const UniConfKey
&_key
);
72 void addqueue_callback(const UniConf
&_cfg
, const UniConfKey
&_key
);
74 void configure_aliases();
76 void _remove_queue(WvStringParm queuename
);
77 void _add_queue(WvStringParm name
, bool is_alias
= false);
78 void _update_queue(WvStringParm name
);
80 /** update an alias. create it if needed */
81 void _update_alias(WvStringParm alias
, WvStringParm queue
);