1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
/***************************************************************************
* Copyright (C) 2013 by Timothy Pearson *
* kb9vqf@pearsoncomputing.net *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <klocale.h>
#include <klineedit.h>
#include <ktextedit.h>
#include <knuminput.h>
#include <kactionselector.h>
#include <tqlistbox.h>
#include <kpushbutton.h>
#include <tqpixmap.h>
#include <tqiconset.h>
#include <tqlabel.h>
#include <tqgroupbox.h>
#include <kconfig.h>
#include <tqcheckbox.h>
#include <tqradiobutton.h>
#include "terminatedlgbase.h"
#include "terminatedlg.h"
TQListBoxKeyedText::TQListBoxKeyedText(TQListBox* listbox, const TQString & text, const TQ_UINT32 key) : TQListBoxText(listbox, text), m_key(key) {
//
}
TQListBoxKeyedText::TQListBoxKeyedText(const TQString & text, const TQ_UINT32 key) : TQListBoxText(text), m_key(key) {
//
}
TQListBoxKeyedText::TQListBoxKeyedText(TQListBox* listbox, const TQString & text, const TQ_UINT32 key, TQListBoxItem *after) : TQListBoxText(listbox, text, after), m_key(key) {
//
}
TQListBoxKeyedText::~TQListBoxKeyedText() {
//
}
TQ_UINT32 TQListBoxKeyedText::key() {
return m_key;
}
GroupPermissionsDialog::GroupPermissionsDialog(TQWidget* parent, const char* name)
: KDialogBase(parent, name, true, i18n("Manage Permissions"), Ok|Cancel, Ok, true)
{
m_base = new GroupPermissionsDlgBase(this);
m_base->permissionsSelector->availableListBox()->setSelectionMode(TQListBox::Multi);
m_base->permissionsSelector->selectedListBox()->setSelectionMode(TQListBox::Multi);
setMainWidget(m_base);
connect(m_base->m_groupName, SIGNAL(textChanged(const TQString&)), this, SLOT(processLockouts()));
m_base->m_groupName->setFocus();
processLockouts();
}
void GroupPermissionsDialog::processLockouts() {
if (m_base->m_groupName->text() != "") {
enableButtonOK(true);
}
else {
enableButtonOK(false);
}
}
void GroupPermissionsDialog::setGroupName(TQString name, bool editable) {
m_base->m_groupName->setText(name);
m_base->m_groupName->setEnabled(editable);
}
TQString GroupPermissionsDialog::groupName() {
return m_base->m_groupName->text();
}
void GroupPermissionsDialog::setPermissionsSelectorLabel(TQString label) {
m_base->groupPermissionsSelector->setTitle(label);
}
void GroupPermissionsDialog::setAvailableServers(TQKeyedStringList list) {
TQListBox* availableListBox = m_base->permissionsSelector->availableListBox();
for (TQKeyedStringList::Iterator it = list.begin(); it != list.end(); ++it) {
new TQListBoxKeyedText(availableListBox, (*it).first, (*it).second);
}
availableListBox->sort(true);
}
void GroupPermissionsDialog::setSelectedServers(TQKeyedStringList list) {
TQListBox* availableListBox = m_base->permissionsSelector->availableListBox();
TQListBox* selectedListBox = m_base->permissionsSelector->selectedListBox();
for (TQKeyedStringList::Iterator it = list.begin(); it != list.end(); ++it) {
TQListBoxItem* item = availableListBox->findItem((*it).first, ExactMatch);
if (item) {
delete item;
}
new TQListBoxKeyedText(selectedListBox, (*it).first, (*it).second);
}
availableListBox->sort(true);
selectedListBox->sort(true);
}
TQKeyedStringList GroupPermissionsDialog::selectedServers() {
TQKeyedStringList list;
TQListBox* selectedListBox = m_base->permissionsSelector->selectedListBox();
TQListBoxItem* item = selectedListBox->firstItem();
while (item) {
TQListBoxKeyedText* item2 = dynamic_cast<TQListBoxKeyedText*>(item);
if (item2) {
list.append(TQKeyedStringPair(item2->text(), item2->key()));
}
item = item->next();
}
return list;
}
void GroupPermissionsDialog::slotOk() {
accept();
}
#include "terminatedlg.moc"
|