20 #include "kmlprjobmanager.h"
21 #include "kmlprmanager.h"
22 #include "lpqhelper.h"
23 #include "lpchelper.h"
25 #include "lprsettings.h"
27 #include <tqptrlist.h>
28 #include <tdelocale.h>
30 KMLprJobManager::KMLprJobManager(TQObject *parent,
const char *name,
const TQStringList & )
31 : KMJobManager(parent, name)
33 m_lpqhelper =
new LpqHelper(
this,
"LpqHelper");
36 bool KMLprJobManager::listJobs(
const TQString& prname, JobType,
int limit)
38 TQPtrList<KMJob> jobList;
39 jobList.setAutoDelete(
false);
40 m_lpqhelper->listJobs(jobList, prname, limit);
41 TQPtrListIterator<KMJob> it(jobList);
42 for (; it.current(); ++it)
47 LpcHelper* KMLprJobManager::lpcHelper()
49 return static_cast<KMLprManager*
>(KMManager::self())->lpcHelper();
52 int KMLprJobManager::actions()
54 if (LprSettings::self()->mode() == LprSettings::LPR)
58 return (KMJob::Remove | KMJob::Hold | KMJob::Resume);
61 bool KMLprJobManager::sendCommandSystemJob(
const TQPtrList<KMJob>& jobs,
int action,
const TQString& arg)
64 TQPtrListIterator<KMJob> it(jobs);
66 LpcHelper *helper = lpcHelper();
68 for (; it.current() && status; ++it)
73 status = helper->removeJob(it.current(), msg);
76 status = helper->changeJobState(it.current(), KMJob::Held, msg);
79 status = helper->changeJobState(it.current(), KMJob::Queued, msg);
83 msg = i18n(
"Unsupported operation.");
87 if (!status && !msg.isEmpty())
88 KMManager::self()->setErrorMsg(msg);