• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeprint
 

tdeprint

  • tdeprint
  • lpr
kmlprjobmanager.cpp
1 /*
2  * This file is part of the KDE libraries
3  * Copyright (c) 2001 Michael Goffioul <tdeprint@swing.be>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License version 2 as published by the Free Software Foundation.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB. If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  **/
19 
20 #include "kmlprjobmanager.h"
21 #include "kmlprmanager.h"
22 #include "lpqhelper.h"
23 #include "lpchelper.h"
24 #include "kmjob.h"
25 #include "lprsettings.h"
26 
27 #include <tqptrlist.h>
28 #include <tdelocale.h>
29 
30 KMLprJobManager::KMLprJobManager(TQObject *parent, const char *name, const TQStringList & /*args*/)
31 : KMJobManager(parent, name)
32 {
33  m_lpqhelper = new LpqHelper(this, "LpqHelper");
34 }
35 
36 bool KMLprJobManager::listJobs(const TQString& prname, JobType, int limit)
37 {
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)
43  addJob(it.current());
44  return false;
45 }
46 
47 LpcHelper* KMLprJobManager::lpcHelper()
48 {
49  return static_cast<KMLprManager*>(KMManager::self())->lpcHelper();
50 }
51 
52 int KMLprJobManager::actions()
53 {
54  if (LprSettings::self()->mode() == LprSettings::LPR)
55  return KMJob::Remove;
56  else
57  // some additional actions to be added here
58  return (KMJob::Remove | KMJob::Hold | KMJob::Resume);
59 }
60 
61 bool KMLprJobManager::sendCommandSystemJob(const TQPtrList<KMJob>& jobs, int action, const TQString& arg)
62 {
63  TQString msg;
64  TQPtrListIterator<KMJob> it(jobs);
65  bool status(true);
66  LpcHelper *helper = lpcHelper();
67 
68  for (; it.current() && status; ++it)
69  {
70  switch (action)
71  {
72  case KMJob::Remove:
73  status = helper->removeJob(it.current(), msg);
74  break;
75  case KMJob::Hold:
76  status = helper->changeJobState(it.current(), KMJob::Held, msg);
77  break;
78  case KMJob::Resume:
79  status = helper->changeJobState(it.current(), KMJob::Queued, msg);
80  break;
81  default:
82  status = false;
83  msg = i18n("Unsupported operation.");
84  break;
85  }
86  }
87  if (!status && !msg.isEmpty())
88  KMManager::self()->setErrorMsg(msg);
89  return status;
90 }

tdeprint

Skip menu "tdeprint"
  • Main Page
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

tdeprint

Skip menu "tdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeprint by doxygen 1.8.8
This website is maintained by Timothy Pearson.