24 #include "kmprinter.h"
28 #include <tqcombobox.h>
29 #include <tdelocale.h>
30 #include <keditlistbox.h>
32 KMWUsers::KMWUsers(TQWidget *parent,
const char *name)
33 : KMWizardPage(parent, name)
35 m_ID = KMWizard::Custom+4;
36 m_title = i18n(
"Users Access Settings");
37 m_nextpage = KMWizard::Name;
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"));
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);
47 lab2->setBuddy(m_type);
49 TQVBoxLayout *l0 =
new TQVBoxLayout(
this, 0, 10);
50 TQHBoxLayout *l1 =
new TQHBoxLayout(0, 0, 10);
51 l0->addWidget(lab1, 0);
53 l1->addWidget(lab2, 0);
54 l1->addWidget(m_type, 1);
55 l0->addWidget(m_users, 1);
62 void KMWUsers::initPrinter(KMPrinter *p)
66 if (!p->option(
"requesting-user-name-denied").isEmpty())
68 l = TQStringList::split(
",", p->option(
"requesting-user-name-denied"),
false);
69 if (l.count() == 1 && l[0] ==
"none")
72 else if (!p->option(
"requesting-user-name-allowed").isEmpty())
75 l = TQStringList::split(
",", p->option(
"requesting-user-name-allowed"),
false);
76 if (l.count() && l[0] ==
"all")
79 m_users->insertStringList(l);
80 m_type->setCurrentItem(i);
83 void KMWUsers::updatePrinter(KMPrinter *p)
85 p->removeOption(
"requesting-user-name-denied");
86 p->removeOption(
"requesting-user-name-allowed");
89 if (m_users->count() > 0)
90 str = m_users->items().join(
",");
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);
96 #include "kmwusers.moc"