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

tdeprint

  • tdeprint
  • cups
  • cupsdconf2
cupsdjobspage.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 "cupsdjobspage.h"
21 #include "cupsdconf.h"
22 
23 #include <tqlabel.h>
24 #include <tqcheckbox.h>
25 #include <tqlayout.h>
26 #include <tqwhatsthis.h>
27 
28 #include <tdelocale.h>
29 #include <knuminput.h>
30 
31 CupsdJobsPage::CupsdJobsPage(TQWidget *parent, const char *name)
32  : CupsdPage(parent, name)
33 {
34  setPageLabel(i18n("Jobs"));
35  setHeader(i18n("Print Jobs Settings"));
36  setPixmap("document-print");
37 
38  keepjobhistory_ = new TQCheckBox(i18n("Preserve job history"), this);
39  keepjobfiles_ = new TQCheckBox(i18n("Preserve job files"), this);
40  autopurgejobs_ = new TQCheckBox(i18n("Auto purge jobs"), this);
41  maxjobs_ = new KIntNumInput(this);
42  maxjobsperprinter_ = new KIntNumInput(this);
43  maxjobsperuser_ = new KIntNumInput(this);
44 
45  maxjobs_->setRange(0, 1000, 1, true);
46  maxjobs_->setSteps(1, 10);
47  maxjobs_->setSpecialValueText(i18n("Unlimited"));
48  maxjobsperprinter_->setRange(0, 1000, 1, true);
49  maxjobsperprinter_->setSpecialValueText(i18n("Unlimited"));
50  maxjobsperprinter_->setSteps(1, 10);
51  maxjobsperuser_->setRange(0, 1000, 1, true);
52  maxjobsperuser_->setSpecialValueText(i18n("Unlimited"));
53  maxjobsperuser_->setSteps(1, 10);
54 
55  TQLabel *l1 = new TQLabel(i18n("Max jobs:"), this);
56  TQLabel *l2 = new TQLabel(i18n("Max jobs per printer:"), this);
57  TQLabel *l3 = new TQLabel(i18n("Max jobs per user:"), this);
58 
59  TQGridLayout *m1 = new TQGridLayout(this, 7, 2, 10, 7);
60  m1->setRowStretch(6, 1);
61  m1->setColStretch(1, 1);
62  m1->addWidget(keepjobhistory_, 0, 1);
63  m1->addWidget(keepjobfiles_, 1, 1);
64  m1->addWidget(autopurgejobs_, 2, 1);
65  m1->addWidget(l1, 3, 0, Qt::AlignRight);
66  m1->addWidget(l2, 4, 0, Qt::AlignRight);
67  m1->addWidget(l3, 5, 0, Qt::AlignRight);
68  m1->addWidget(maxjobs_, 3, 1);
69  m1->addWidget(maxjobsperprinter_, 4, 1);
70  m1->addWidget(maxjobsperuser_, 5, 1);
71 
72  connect(keepjobhistory_, TQT_SIGNAL(toggled(bool)), TQT_SLOT(historyChanged(bool)));
73  keepjobhistory_->setChecked(true);
74 }
75 
76 bool CupsdJobsPage::loadConfig(CupsdConf *conf, TQString&)
77 {
78  conf_ = conf;
79  keepjobhistory_->setChecked(conf_->keepjobhistory_);
80  if (conf_->keepjobhistory_)
81  {
82  keepjobfiles_->setChecked(conf_->keepjobfiles_);
83  autopurgejobs_->setChecked(conf_->autopurgejobs_);
84  }
85  maxjobs_->setValue(conf_->maxjobs_);
86  maxjobsperprinter_->setValue(conf_->maxjobsperprinter_);
87  maxjobsperuser_->setValue(conf_->maxjobsperuser_);
88 
89  return true;
90 }
91 
92 bool CupsdJobsPage::saveConfig(CupsdConf *conf, TQString&)
93 {
94  conf->keepjobhistory_ = keepjobhistory_->isChecked();
95  if (conf->keepjobhistory_)
96  {
97  conf->keepjobfiles_ = keepjobfiles_->isChecked();
98  conf->autopurgejobs_ = autopurgejobs_->isChecked();
99  }
100  conf->maxjobs_ = maxjobs_->value();
101  conf->maxjobsperprinter_ = maxjobsperprinter_->value();
102  conf->maxjobsperuser_ = maxjobsperuser_->value();
103 
104  return true;
105 }
106 
107 void CupsdJobsPage::setInfos(CupsdConf *conf)
108 {
109  TQWhatsThis::add(keepjobhistory_, conf->comments_.toolTip("preservejobhistory"));
110  TQWhatsThis::add(keepjobfiles_, conf->comments_.toolTip("preservejobfiles"));
111  TQWhatsThis::add(autopurgejobs_, conf->comments_.toolTip("autopurgejobs"));
112  TQWhatsThis::add(maxjobs_, conf->comments_.toolTip("maxjobs"));
113  TQWhatsThis::add(maxjobsperprinter_, conf->comments_.toolTip("maxjobsperprinter"));
114  TQWhatsThis::add(maxjobsperuser_, conf->comments_.toolTip("maxjobsperuser"));
115 }
116 
117 void CupsdJobsPage::historyChanged(bool on)
118 {
119  keepjobfiles_->setEnabled(on);
120  autopurgejobs_->setEnabled(on);
121 }
122 
123 #include "cupsdjobspage.moc"

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.