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

kdeprint

kmlprjobmanager.cpp
00001 /*
00002  *  This file is part of the KDE libraries
00003  *  Copyright (c) 2001 Michael Goffioul <kdeprint@swing.be>
00004  *
00005  *  This library is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU Library General Public
00007  *  License version 2 as published by the Free Software Foundation.
00008  *
00009  *  This library is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *  Library General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU Library General Public License
00015  *  along with this library; see the file COPYING.LIB.  If not, write to
00016  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  *  Boston, MA 02110-1301, USA.
00018  **/
00019 
00020 #include "kmlprjobmanager.h"
00021 #include "kmlprmanager.h"
00022 #include "lpqhelper.h"
00023 #include "lpchelper.h"
00024 #include "kmjob.h"
00025 #include "lprsettings.h"
00026 
00027 #include <tqptrlist.h>
00028 #include <klocale.h>
00029 
00030 KMLprJobManager::KMLprJobManager(TQObject *parent, const char *name, const TQStringList & /*args*/)
00031 : KMJobManager(parent, name)
00032 {
00033     m_lpqhelper = new LpqHelper(this, "LpqHelper");
00034 }
00035 
00036 bool KMLprJobManager::listJobs(const TQString& prname, JobType, int limit)
00037 {
00038     TQPtrList<KMJob>    jobList;
00039     jobList.setAutoDelete(false);
00040     m_lpqhelper->listJobs(jobList, prname, limit);
00041     TQPtrListIterator<KMJob>    it(jobList);
00042     for (; it.current(); ++it)
00043         addJob(it.current());
00044     return false;
00045 }
00046 
00047 LpcHelper* KMLprJobManager::lpcHelper()
00048 {
00049     return static_cast<KMLprManager*>(KMManager::self())->lpcHelper();
00050 }
00051 
00052 int KMLprJobManager::actions()
00053 {
00054     if (LprSettings::self()->mode() == LprSettings::LPR)
00055         return KMJob::Remove;
00056     else
00057         // some additional actions to be added here
00058         return (KMJob::Remove | KMJob::Hold | KMJob::Resume);
00059 }
00060 
00061 bool KMLprJobManager::sendCommandSystemJob(const TQPtrList<KMJob>& jobs, int action, const TQString& arg)
00062 {
00063     TQString    msg;
00064     TQPtrListIterator<KMJob>    it(jobs);
00065     bool    status(true);
00066     LpcHelper   *helper = lpcHelper();
00067 
00068     for (; it.current() && status; ++it)
00069     {
00070         switch (action)
00071         {
00072             case KMJob::Remove:
00073                 status = helper->removeJob(it.current(), msg);
00074                 break;
00075             case KMJob::Hold:
00076                 status = helper->changeJobState(it.current(), KMJob::Held, msg);
00077                 break;
00078             case KMJob::Resume:
00079                 status = helper->changeJobState(it.current(), KMJob::Queued, msg);
00080                 break;
00081             default:
00082                 status = false;
00083                 msg = i18n("Unsupported operation.");
00084                 break;
00085         }
00086     }
00087     if (!status && !msg.isEmpty())
00088         KMManager::self()->setErrorMsg(msg);
00089     return status;
00090 }

kdeprint

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

kdeprint

Skip menu "kdeprint"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdeprint by doxygen 1.7.6.1
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |