20 #include "printerfilter.h"
21 #include "kmprinter.h"
22 #include "kmfactory.h"
24 #include <tdeconfig.h>
25 #include <tdeglobal.h>
28 PrinterFilter::PrinterFilter(TQObject *parent,
const char *name)
29 : TQObject(parent, name)
31 m_locationRe.setWildcard(
true);
35 PrinterFilter::~PrinterFilter()
39 void PrinterFilter::update()
41 TDEConfig *conf = KMFactory::self()->printConfig();
42 conf->setGroup(
"Filter");
43 m_locationRe.setPattern(conf->readEntry(
"LocationRe"));
44 m_printers = conf->readListEntry(
"Printers");
47 conf = TDEGlobal::config();
48 conf->setGroup(
"KPrinter Settings");
49 m_enabled = conf->readBoolEntry(
"FilterEnabled",
false);
52 void PrinterFilter::setEnabled(
bool on)
55 TDEConfig *conf = TDEGlobal::config();
56 conf->setGroup(
"KPrinter Settings");
57 conf->writeEntry(
"FilterEnabled", m_enabled);
60 bool PrinterFilter::filter(KMPrinter *prt)
64 if ((!m_locationRe.isEmpty() && m_locationRe.exactMatch(prt->location())) ||
65 m_printers.find(prt->printerName()) != m_printers.end())