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

tdeprint

  • tdeprint
  • cups
kmwusers.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 <config.h>
21 
22 #include "kmwusers.h"
23 #include "kmwizard.h"
24 #include "kmprinter.h"
25 
26 #include <tqlabel.h>
27 #include <tqlayout.h>
28 #include <tqcombobox.h>
29 #include <tdelocale.h>
30 #include <keditlistbox.h>
31 
32 KMWUsers::KMWUsers(TQWidget *parent, const char *name)
33 : KMWizardPage(parent, name)
34 {
35  m_ID = KMWizard::Custom+4;
36  m_title = i18n("Users Access Settings");
37  m_nextpage = KMWizard::Name;
38 
39  m_users = new KEditListBox(i18n("Users"), this, 0, false, KEditListBox::Add|KEditListBox::Remove);
40  m_type = new TQComboBox(this);
41  m_type->insertItem(i18n("Allowed Users"));
42  m_type->insertItem(i18n("Denied Users"));
43 
44  TQLabel *lab1 = new TQLabel(i18n("Define here a group of allowed/denied users for this printer."), this);
45  TQLabel *lab2 = new TQLabel(i18n("&Type:"), this);
46 
47  lab2->setBuddy(m_type);
48 
49  TQVBoxLayout *l0 = new TQVBoxLayout(this, 0, 10);
50  TQHBoxLayout *l1 = new TQHBoxLayout(0, 0, 10);
51  l0->addWidget(lab1, 0);
52  l0->addLayout(l1, 0);
53  l1->addWidget(lab2, 0);
54  l1->addWidget(m_type, 1);
55  l0->addWidget(m_users, 1);
56 }
57 
58 KMWUsers::~KMWUsers()
59 {
60 }
61 
62 void KMWUsers::initPrinter(KMPrinter *p)
63 {
64  TQStringList l;
65  int i(1);
66  if (!p->option("requesting-user-name-denied").isEmpty())
67  {
68  l = TQStringList::split(",", p->option("requesting-user-name-denied"), false);
69  if (l.count() == 1 && l[0] == "none")
70  l.clear();
71  }
72  else if (!p->option("requesting-user-name-allowed").isEmpty())
73  {
74  i = 0;
75  l = TQStringList::split(",", p->option("requesting-user-name-allowed"), false);
76  if (l.count() && l[0] == "all")
77  l.clear();
78  }
79  m_users->insertStringList(l);
80  m_type->setCurrentItem(i);
81 }
82 
83 void KMWUsers::updatePrinter(KMPrinter *p)
84 {
85  p->removeOption("requesting-user-name-denied");
86  p->removeOption("requesting-user-name-allowed");
87 
88  TQString str;
89  if (m_users->count() > 0)
90  str = m_users->items().join(",");
91  else
92  str = (m_type->currentItem() == 0 ? "all" : "none");
93  TQString optname = (m_type->currentItem() == 0 ? "requesting-user-name-allowed" : "requesting-user-name-denied");
94  p->setOption(optname, str);
95 }
96 #include "kmwusers.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.