summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pppdargs.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdargs.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index d1143cf..66a4d82 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -18,91 +18,76 @@
18 * This library is distributed in the hope that it will be useful, 18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 21 * Library General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU Library General Public 23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free 24 * License along with this program; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30//#include <kwin.h>
31#include <qapplication.h> 30#include <qapplication.h>
32#include "pppdargs.h" 31#include "pppdargs.h"
33#include "pppdata.h" 32#include "pppdata.h"
34//#include <klocale.h> 33
35#define i18n QObject::tr
36 34
37PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) 35PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name)
38 : QDialog(parent, name, TRUE), _pppdata(pd) 36 : QDialog(parent, name, TRUE), _pppdata(pd)
39{ 37{
40 setCaption(i18n("Customize pppd Arguments")); 38 setCaption(tr("Customize pppd Arguments"));
41// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 39// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
42 QVBoxLayout *l = new QVBoxLayout(this, 10, 10); 40 QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
43 QHBoxLayout *tl = new QHBoxLayout(10); 41 QHBoxLayout *tl = new QHBoxLayout(10);
44 l->addLayout(tl); 42 l->addLayout(tl);
45 QVBoxLayout *l1 = new QVBoxLayout(); 43 QVBoxLayout *l1 = new QVBoxLayout();
46 QVBoxLayout *l2 = new QVBoxLayout(); 44 QVBoxLayout *l2 = new QVBoxLayout();
47 tl->addLayout(l1, 1); 45 tl->addLayout(l1, 1);
48 tl->addLayout(l2, 0); 46 tl->addLayout(l2, 0);
49 47
50 QHBoxLayout *l11 = new QHBoxLayout(10); 48 QHBoxLayout *l11 = new QHBoxLayout(10);
51 l1->addLayout(l11); 49 l1->addLayout(l11);
52 50
53 argument_label = new QLabel(i18n("Argument:"), this); 51 argument_label = new QLabel(tr("Argument:"), this);
54 l11->addWidget(argument_label); 52 l11->addWidget(argument_label);
55 53
56 argument = new QLineEdit(this); 54 argument = new QLineEdit(this);
57 connect(argument, SIGNAL(returnPressed()), 55 connect(argument, SIGNAL(returnPressed()),
58 SLOT(addbutton())); 56 SLOT(addbutton()));
59 l11->addWidget(argument); 57 l11->addWidget(argument);
60 connect(argument, SIGNAL(textChanged(const QString &)), 58 connect(argument, SIGNAL(textChanged(const QString &)),
61 this, SLOT(textChanged(const QString &))); 59 this, SLOT(textChanged(const QString &)));
62 60
63 arguments = new QListBox(this); 61 arguments = new QListBox(this);
64 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); 62 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
65 connect(arguments, SIGNAL(highlighted(int)), 63 connect(arguments, SIGNAL(highlighted(int)),
66 this, SLOT(itemSelected(int))); 64 this, SLOT(itemSelected(int)));
67 l1->addWidget(arguments, 1); 65 l1->addWidget(arguments, 1);
68 66
69 add = new QPushButton(i18n("Add"), this); 67 add = new QPushButton(tr("Add"), this);
70 connect(add, SIGNAL(clicked()), SLOT(addbutton())); 68 connect(add, SIGNAL(clicked()), SLOT(addbutton()));
71 l2->addWidget(add); 69 l2->addWidget(add);
72 l2->addStretch(1); 70 l2->addStretch(1);
73 71
74 remove = new QPushButton(i18n("Remove"), this); 72 remove = new QPushButton(tr("Remove"), this);
75 connect(remove, SIGNAL(clicked()), SLOT(removebutton())); 73 connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
76 l2->addWidget(remove); 74 l2->addWidget(remove);
77 75
78 defaults = new QPushButton(i18n("Defaults"), this); 76 defaults = new QPushButton(tr("Defaults"), this);
79 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); 77 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
80 l2->addWidget(defaults); 78 l2->addWidget(defaults);
81 79
82 l->addSpacing(5); 80 l->addSpacing(5);
83 81
84// QButtonGroup *bbox = new QButtonGroup(this);
85// // bbox->addStretch(1);
86// closebtn = new QPushButton( bbox, i18n("OK"));
87// bbox->insert(closebtn);
88// connect(closebtn, SIGNAL(clicked()), SLOT(closebutton()));
89// QPushButton *cancel = new QPushButton( bbox, i18n("Cancel"));
90// bbox->insert(cancel);
91// connect(cancel, SIGNAL(clicked()),
92 // this, SLOT(reject()));
93// bbox->layout();
94// l->addWidget(bbox);
95
96// setFixedSize(sizeHint());
97 82
98 //load info from gpppdata 83 //load info from gpppdata
99 init(); 84 init();
100 85
101 add->setEnabled(false); 86 add->setEnabled(false);
102 remove->setEnabled(false); 87 remove->setEnabled(false);
103 argument->setFocus(); 88 argument->setFocus();
104} 89}
105 90
106 91
107void PPPdArguments::addbutton() { 92void PPPdArguments::addbutton() {
108 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { 93 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) {
@@ -123,31 +108,31 @@ void PPPdArguments::defaultsbutton() {
123 // save current list 108 // save current list
124 QStringList arglist(_pppdata->pppdArgument()); 109 QStringList arglist(_pppdata->pppdArgument());
125 110
126 // get defaults 111 // get defaults
127 _pppdata->setpppdArgumentDefaults(); 112 _pppdata->setpppdArgumentDefaults();
128 init(); 113 init();
129 114
130 // restore old list 115 // restore old list
131 _pppdata->setpppdArgument(arglist); 116 _pppdata->setpppdArgument(arglist);
132} 117}
133 118
134 119
135void PPPdArguments::closebutton() { 120void PPPdArguments::accept() {
136 QStringList arglist; 121 QStringList arglist;
137 for(uint i=0; i < arguments->count(); i++) 122 for(uint i=0; i < arguments->count(); i++)
138 arglist.append(arguments->text(i)); 123 arglist.append(arguments->text(i));
139 _pppdata->setpppdArgument(arglist); 124 _pppdata->setpppdArgument(arglist);
140 125
141 done(0); 126 QDialog::accept();
142} 127}
143 128
144 129
145void PPPdArguments::init() { 130void PPPdArguments::init() {
146 while(arguments->count()) 131 while(arguments->count())
147 arguments->removeItem(0); 132 arguments->removeItem(0);
148 133
149 QStringList &arglist = _pppdata->pppdArgument(); 134 QStringList &arglist = _pppdata->pppdArgument();
150 for ( QStringList::Iterator it = arglist.begin(); 135 for ( QStringList::Iterator it = arglist.begin();
151 it != arglist.end(); 136 it != arglist.end();
152 ++it ) 137 ++it )
153 arguments->insertItem(*it); 138 arguments->insertItem(*it);