author | tille <tille> | 2003-05-24 17:03:27 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-24 17:03:27 (UTC) |
commit | 58947769d80d49faaccac1703da0e66c90158957 (patch) (unidiff) | |
tree | 4ba8961b94ca5cd74265346bf9b48afdb126c07a | |
parent | ea6b12007f4b5af926f6732637cb159904c4da7a (diff) | |
download | opie-58947769d80d49faaccac1703da0e66c90158957.zip opie-58947769d80d49faaccac1703da0e66c90158957.tar.gz opie-58947769d80d49faaccac1703da0e66c90158957.tar.bz2 |
layout fixes
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 54 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdargs.cpp | 26 |
2 files changed, 42 insertions, 38 deletions
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 6132b80..eee643d 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -1,170 +1,170 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd Front End for the KDE project | 2 | * kPPP: A pppd Front End for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * Copyright (C) 1997 Bernd Johannes Wuebben | 5 | * Copyright (C) 1997 Bernd Johannes Wuebben |
6 | * wuebben@math.cornell.edu | 6 | * wuebben@math.cornell.edu |
7 | * | 7 | * |
8 | * based on EzPPP: | 8 | * based on EzPPP: |
9 | * Copyright (C) 1997 Jay Painter | 9 | * Copyright (C) 1997 Jay Painter |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU Library General Public | 12 | * modify it under the terms of the GNU Library General Public |
13 | * License as published by the Free Software Foundation; either | 13 | * License as published by the Free Software Foundation; either |
14 | * version 2 of the License, or (at your option) any later version. | 14 | * version 2 of the License, or (at your option) any later version. |
15 | * | 15 | * |
16 | * This program is distributed in the hope that it will be useful, | 16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. | 19 | * Library General Public License for more details. |
20 | * | 20 | * |
21 | * You should have received a copy of the GNU Library General Public | 21 | * You should have received a copy of the GNU Library General Public |
22 | * License along with this program; if not, write to the Free | 22 | * License along with this program; if not, write to the Free |
23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <termios.h> | 27 | #include <termios.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <kiconloader.h> | 33 | //#include <kiconloader.h> |
34 | #include <qbuttongroup.h> | 34 | #include <qbuttongroup.h> |
35 | //#include <klocale.h> | 35 | //#include <klocale.h> |
36 | #define i18n QObject::tr | 36 | #define i18n QObject::tr |
37 | #include <qvgroupbox.h> | 37 | #include <qvgroupbox.h> |
38 | #include <qhbox.h> | 38 | #include <qhbox.h> |
39 | #include <qdialog.h> | 39 | #include <qdialog.h> |
40 | //#include <kwin.h> | 40 | //#include <kwin.h> |
41 | 41 | ||
42 | #include "edit.h" | 42 | #include "edit.h" |
43 | #include "pppdata.h" | 43 | #include "pppdata.h" |
44 | //#include "newwidget.h" | 44 | //#include "newwidget.h" |
45 | #include "iplined.h" | 45 | #include "iplined.h" |
46 | #include "auth.h" | 46 | #include "auth.h" |
47 | 47 | ||
48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | 48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) |
49 | : QWidget(parent, name) | 49 | : QWidget(parent, name) |
50 | { | 50 | { |
51 | const int GRIDROWS = 6; | 51 | const int GRIDROWS = 6; |
52 | 52 | ||
53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); | 53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); |
54 | 54 | ||
55 | connect_label = new QLabel(i18n("Connection name:"), this); | 55 | connect_label = new QLabel(i18n("Connection name:"), this); |
56 | tl->addWidget(connect_label, 0, 0); | 56 | tl->addWidget(connect_label, 0, 0); |
57 | 57 | ||
58 | connectname_l = new QLineEdit(this); | 58 | connectname_l = new QLineEdit(this); |
59 | // connectname_l->setMaxLength(ACCNAME_SIZE); | 59 | // connectname_l->setMaxLength(ACCNAME_SIZE); |
60 | tl->addWidget(connectname_l, 0, 1); | 60 | tl->addWidget(connectname_l, 0, 1); |
61 | QString tmp = i18n("Type in a unique name for this connection"); | 61 | QString tmp = i18n("Type in a unique name for this connection"); |
62 | 62 | ||
63 | QWhatsThis::add(connect_label,tmp); | 63 | QWhatsThis::add(connect_label,tmp); |
64 | QWhatsThis::add(connectname_l,tmp); | 64 | QWhatsThis::add(connectname_l,tmp); |
65 | 65 | ||
66 | 66 | ||
67 | number_label = new QLabel(i18n("Phone number:"), this); | 67 | number_label = new QLabel(i18n("Phone number:"), this); |
68 | number_label->setAlignment(AlignTop|AlignLeft); | 68 | number_label->setAlignment(AlignTop|AlignLeft); |
69 | tl->addWidget(number_label, 1, 0); | 69 | tl->addWidget(number_label, 1, 0); |
70 | 70 | ||
71 | QHBoxLayout *lpn = new QHBoxLayout(5); | 71 | QHBoxLayout *lpn = new QHBoxLayout(5); |
72 | tl->addLayout(lpn, 1, 1); | 72 | tl->addLayout(lpn, 1, 1); |
73 | numbers = new QListBox(this); | 73 | numbers = new QListBox(this); |
74 | numbers->setMinimumSize(120, 70); | 74 | // numbers->setMinimumSize(120, 70); |
75 | lpn->addWidget(numbers); | 75 | lpn->addWidget(numbers); |
76 | QVBoxLayout *lpn1 = new QVBoxLayout; | 76 | QVBoxLayout *lpn1 = new QVBoxLayout; |
77 | lpn->addLayout(lpn1); | 77 | lpn->addLayout(lpn1); |
78 | add = new QPushButton(i18n("&Add..."), this); | 78 | add = new QPushButton(i18n("&Add..."), this); |
79 | del = new QPushButton(i18n("&Remove"), this); | 79 | del = new QPushButton(i18n("&Remove"), this); |
80 | 80 | ||
81 | up = new QPushButton(this); | 81 | up = new QPushButton(this); |
82 | //FIXME: QPixmap pm = BarIcon("up"); | 82 | //FIXME: QPixmap pm = BarIcon("up"); |
83 | // up->setPixmap(pm); | 83 | // up->setPixmap(pm); |
84 | down = new QPushButton(this); | 84 | down = new QPushButton(this); |
85 | //FIXME: pm = BarIcon("down"); | 85 | //FIXME: pm = BarIcon("down"); |
86 | // down->setPixmap(pm); | 86 | // down->setPixmap(pm); |
87 | lpn1->addWidget(add); | 87 | lpn1->addWidget(add); |
88 | lpn1->addWidget(del); | 88 | lpn1->addWidget(del); |
89 | lpn1->addStretch(1); | 89 | lpn1->addStretch(1); |
90 | lpn1->addWidget(up); | 90 | lpn1->addWidget(up); |
91 | lpn1->addWidget(down); | 91 | lpn1->addWidget(down); |
92 | connect(add, SIGNAL(clicked()), | 92 | connect(add, SIGNAL(clicked()), |
93 | this, SLOT(addNumber())); | 93 | this, SLOT(addNumber())); |
94 | connect(del, SIGNAL(clicked()), | 94 | connect(del, SIGNAL(clicked()), |
95 | this, SLOT(delNumber())); | 95 | this, SLOT(delNumber())); |
96 | connect(up, SIGNAL(clicked()), | 96 | connect(up, SIGNAL(clicked()), |
97 | this, SLOT(upNumber())); | 97 | this, SLOT(upNumber())); |
98 | connect(down, SIGNAL(clicked()), | 98 | connect(down, SIGNAL(clicked()), |
99 | this, SLOT(downNumber())); | 99 | this, SLOT(downNumber())); |
100 | connect(numbers, SIGNAL(highlighted(int)), | 100 | connect(numbers, SIGNAL(highlighted(int)), |
101 | this, SLOT(selectionChanged(int))); | 101 | this, SLOT(selectionChanged(int))); |
102 | numbersChanged(); | 102 | numbersChanged(); |
103 | 103 | ||
104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" | 104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" |
105 | "can supply multiple numbers here, simply\n" | 105 | "can supply multiple numbers here, simply\n" |
106 | "click on \"Add\". You can arrange the\n" | 106 | "click on \"Add\". You can arrange the\n" |
107 | "order the numbers are tried by using the\n" | 107 | "order the numbers are tried by using the\n" |
108 | "arrow buttons.\n\n" | 108 | "arrow buttons.\n\n" |
109 | "When a number is busy or fails, <i>kppp</i> will \n" | 109 | "When a number is busy or fails, <i>kppp</i> will \n" |
110 | "try the next number and so on"); | 110 | "try the next number and so on"); |
111 | 111 | ||
112 | QWhatsThis::add(number_label,tmp); | 112 | QWhatsThis::add(number_label,tmp); |
113 | QWhatsThis::add(numbers,tmp); | 113 | QWhatsThis::add(numbers,tmp); |
114 | 114 | ||
115 | auth_l = new QLabel(i18n("Authentication:"), this); | 115 | auth_l = new QLabel(i18n("Authentication:"), this); |
116 | tl->addWidget(auth_l, 3, 0); | 116 | tl->addWidget(auth_l, 3, 0); |
117 | 117 | ||
118 | auth = new QComboBox(this); | 118 | auth = new QComboBox(this); |
119 | auth->insertItem(i18n("Script-based")); | 119 | auth->insertItem(i18n("Script-based")); |
120 | auth->insertItem(i18n("PAP")); | 120 | auth->insertItem(i18n("PAP")); |
121 | auth->insertItem(i18n("Terminal-based")); | 121 | auth->insertItem(i18n("Terminal-based")); |
122 | auth->insertItem(i18n("CHAP")); | 122 | auth->insertItem(i18n("CHAP")); |
123 | auth->insertItem(i18n("PAP/CHAP")); | 123 | auth->insertItem(i18n("PAP/CHAP")); |
124 | tl->addWidget(auth, 3, 1); | 124 | tl->addWidget(auth, 3, 1); |
125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" | 125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" |
126 | "the PPP server. Most universities still use\n" | 126 | "the PPP server. Most universities still use\n" |
127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | 127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" |
128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | 128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" |
129 | "unsure, contact your ISP.\n" | 129 | "unsure, contact your ISP.\n" |
130 | "\n" | 130 | "\n" |
131 | "If you can choose between PAP and CHAP,\n" | 131 | "If you can choose between PAP and CHAP,\n" |
132 | "choose CHAP, because it's much safer. If you don't know\n" | 132 | "choose CHAP, because it's much safer. If you don't know\n" |
133 | "whether PAP or CHAP is right, choose PAP/CHAP."); | 133 | "whether PAP or CHAP is right, choose PAP/CHAP."); |
134 | 134 | ||
135 | QWhatsThis::add(auth_l,tmp); | 135 | QWhatsThis::add(auth_l,tmp); |
136 | QWhatsThis::add(auth,tmp); | 136 | QWhatsThis::add(auth,tmp); |
137 | 137 | ||
138 | store_password = new QCheckBox(i18n("Store password"), this); | 138 | store_password = new QCheckBox(i18n("Store password"), this); |
139 | store_password->setChecked(true); | 139 | store_password->setChecked(true); |
140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); | 140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); |
141 | QWhatsThis::add(store_password, | 141 | QWhatsThis::add(store_password, |
142 | i18n("<p>When this is turned on, your ISP password\n" | 142 | i18n("<p>When this is turned on, your ISP password\n" |
143 | "will be saved in <i>kppp</i>'s config file, so\n" | 143 | "will be saved in <i>kppp</i>'s config file, so\n" |
144 | "you do not need to type it in every time.\n" | 144 | "you do not need to type it in every time.\n" |
145 | "\n" | 145 | "\n" |
146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | 146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" |
147 | "plain text in the config file, which is\n" | 147 | "plain text in the config file, which is\n" |
148 | "readable only to you. Make sure nobody\n" | 148 | "readable only to you. Make sure nobody\n" |
149 | "gains access to this file!")); | 149 | "gains access to this file!")); |
150 | 150 | ||
151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); | 151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); |
152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); | 153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); |
154 | 154 | ||
155 | // Set defaults if editing an existing connection | 155 | // Set defaults if editing an existing connection |
156 | if(!isnewaccount) { | 156 | if(!isnewaccount) { |
157 | connectname_l->setText(PPPData::data()->accname()); | 157 | connectname_l->setText(PPPData::data()->accname()); |
158 | 158 | ||
159 | // insert the phone numbers into the listbox | 159 | // insert the phone numbers into the listbox |
160 | QString n = PPPData::data()->phonenumber(); | 160 | QString n = PPPData::data()->phonenumber(); |
161 | QString tmp = ""; | 161 | QString tmp = ""; |
162 | uint idx = 0; | 162 | uint idx = 0; |
163 | while(idx != n.length()) { | 163 | while(idx != n.length()) { |
164 | if(n[idx] == ':') { | 164 | if(n[idx] == ':') { |
165 | if(tmp.length() > 0) | 165 | if(tmp.length() > 0) |
166 | numbers->insertItem(tmp); | 166 | numbers->insertItem(tmp); |
167 | tmp = ""; | 167 | tmp = ""; |
168 | } else | 168 | } else |
169 | tmp += n[idx]; | 169 | tmp += n[idx]; |
170 | idx++; | 170 | idx++; |
@@ -733,224 +733,222 @@ void DNSWidget::removedns() { | |||
733 | // GatewayWidget | 733 | // GatewayWidget |
734 | // | 734 | // |
735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) | 735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) |
736 | : QWidget(parent, name) | 736 | : QWidget(parent, name) |
737 | { | 737 | { |
738 | QVBoxLayout *topLayout = new QVBoxLayout(this); | 738 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); | 739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); |
740 | 740 | ||
741 | box = new QVGroupBox(i18n("Configuration"), this); | 741 | box = new QVGroupBox(i18n("Configuration"), this); |
742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); | 742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); |
743 | 743 | ||
744 | rb = new QButtonGroup(this); | 744 | rb = new QButtonGroup(this); |
745 | rb->hide(); | 745 | rb->hide(); |
746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); | 746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); |
747 | 747 | ||
748 | defaultgateway = new QRadioButton(box); | 748 | defaultgateway = new QRadioButton(box); |
749 | defaultgateway->setText(i18n("Default gateway")); | 749 | defaultgateway->setText(i18n("Default gateway")); |
750 | rb->insert(defaultgateway, 0); | 750 | rb->insert(defaultgateway, 0); |
751 | QWhatsThis::add(defaultgateway, | 751 | QWhatsThis::add(defaultgateway, |
752 | i18n("This makes the PPP peer computer (the computer\n" | 752 | i18n("This makes the PPP peer computer (the computer\n" |
753 | "you are connected to with your modem) to act as\n" | 753 | "you are connected to with your modem) to act as\n" |
754 | "a gateway. Your computer will send all packets not\n" | 754 | "a gateway. Your computer will send all packets not\n" |
755 | "going to a computer inside your local net to this\n" | 755 | "going to a computer inside your local net to this\n" |
756 | "computer, which will route these packets.\n" | 756 | "computer, which will route these packets.\n" |
757 | "\n" | 757 | "\n" |
758 | "This is the default for most ISPs, so you should\n" | 758 | "This is the default for most ISPs, so you should\n" |
759 | "probably leave this option on.")); | 759 | "probably leave this option on.")); |
760 | 760 | ||
761 | 761 | ||
762 | staticgateway = new QRadioButton(box); | 762 | staticgateway = new QRadioButton(box); |
763 | staticgateway->setText(i18n("Static gateway")); | 763 | staticgateway->setText(i18n("Static gateway")); |
764 | rb->insert(staticgateway, 1); | 764 | rb->insert(staticgateway, 1); |
765 | QWhatsThis::add(staticgateway, | 765 | QWhatsThis::add(staticgateway, |
766 | i18n("<p>Allows you to specify which computer you want\n" | 766 | i18n("<p>Allows you to specify which computer you want\n" |
767 | "to use as gateway (see <i>Default Gateway</i> above)")); | 767 | "to use as gateway (see <i>Default Gateway</i> above)")); |
768 | 768 | ||
769 | QHBox *gateBox = new QHBox(box); | 769 | QHBox *gateBox = new QHBox(box); |
770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); | 770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); |
771 | gatewayaddr = new IPLineEdit(gateBox); | 771 | gatewayaddr = new IPLineEdit(gateBox); |
772 | 772 | ||
773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), | 773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), |
774 | this); | 774 | this); |
775 | QWhatsThis::add(defaultroute, | 775 | QWhatsThis::add(defaultroute, |
776 | i18n("If this option is enabled, all packets not\n" | 776 | i18n("If this option is enabled, all packets not\n" |
777 | "going to the local net are routed through\n" | 777 | "going to the local net are routed through\n" |
778 | "the PPP connection.\n" | 778 | "the PPP connection.\n" |
779 | "\n" | 779 | "\n" |
780 | "Normally, you should turn this on")); | 780 | "Normally, you should turn this on")); |
781 | 781 | ||
782 | topLayout->addWidget(box); | 782 | topLayout->addWidget(box); |
783 | topLayout->addWidget(defaultroute); | 783 | topLayout->addWidget(defaultroute); |
784 | topLayout->addStretch(); | 784 | topLayout->addStretch(); |
785 | 785 | ||
786 | //load info from gpppdata | 786 | //load info from gpppdata |
787 | if(!isnewaccount) { | 787 | if(!isnewaccount) { |
788 | if(PPPData::data()->gateway() == "0.0.0.0") { | 788 | if(PPPData::data()->gateway() == "0.0.0.0") { |
789 | defaultgateway->setChecked(true); | 789 | defaultgateway->setChecked(true); |
790 | hitGatewaySelect(0); | 790 | hitGatewaySelect(0); |
791 | } | 791 | } |
792 | else { | 792 | else { |
793 | gatewayaddr->setText(PPPData::data()->gateway()); | 793 | gatewayaddr->setText(PPPData::data()->gateway()); |
794 | staticgateway->setChecked(true); | 794 | staticgateway->setChecked(true); |
795 | } | 795 | } |
796 | defaultroute->setChecked(PPPData::data()->defaultroute()); | 796 | defaultroute->setChecked(PPPData::data()->defaultroute()); |
797 | } | 797 | } |
798 | else { | 798 | else { |
799 | defaultgateway->setChecked(true); | 799 | defaultgateway->setChecked(true); |
800 | hitGatewaySelect(0); | 800 | hitGatewaySelect(0); |
801 | defaultroute->setChecked(true); | 801 | defaultroute->setChecked(true); |
802 | } | 802 | } |
803 | } | 803 | } |
804 | 804 | ||
805 | void GatewayWidget::save() { | 805 | void GatewayWidget::save() { |
806 | PPPData::data()->setGateway(gatewayaddr->text()); | 806 | PPPData::data()->setGateway(gatewayaddr->text()); |
807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); | 807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
811 | void GatewayWidget::hitGatewaySelect( int i ) { | 811 | void GatewayWidget::hitGatewaySelect( int i ) { |
812 | if(i == 0) { | 812 | if(i == 0) { |
813 | gatewayaddr->setText("0.0.0.0"); | 813 | gatewayaddr->setText("0.0.0.0"); |
814 | gatewayaddr->setEnabled(false); | 814 | gatewayaddr->setEnabled(false); |
815 | gate_label->setEnabled(false); | 815 | gate_label->setEnabled(false); |
816 | } | 816 | } |
817 | else { | 817 | else { |
818 | gatewayaddr->setEnabled(true); | 818 | gatewayaddr->setEnabled(true); |
819 | gatewayaddr->setText(""); | 819 | gatewayaddr->setText(""); |
820 | gate_label->setEnabled(true); | 820 | gate_label->setEnabled(true); |
821 | } | 821 | } |
822 | } | 822 | } |
823 | 823 | ||
824 | 824 | ||
825 | 825 | ||
826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) | 826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) |
827 | : QWidget(parent, name) | 827 | : QWidget(parent, name) |
828 | { | 828 | { |
829 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 829 | |
830 | QVBoxLayout *tl = new QVBoxLayout(this, 0 ); | ||
830 | se = new ScriptEdit(this); | 831 | se = new ScriptEdit(this); |
831 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); | 832 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); |
832 | tl->addWidget(se); | 833 | tl->addWidget(se); |
833 | 834 | ||
834 | // insert equal-sized buttons | 835 | // insert equal-sized buttons |
835 | QButtonGroup *bbox = new QButtonGroup(this); | 836 | QHBoxLayout *hl = new QHBoxLayout( this ); |
836 | add = new QPushButton( bbox, i18n("Add") ); | 837 | tl->addLayout( hl ); |
837 | bbox->insert(add); | 838 | add = new QPushButton( i18n("Add"), this ); |
839 | hl->addWidget( add ); | ||
838 | connect(add, SIGNAL(clicked()), SLOT(addButton())); | 840 | connect(add, SIGNAL(clicked()), SLOT(addButton())); |
839 | // bbox->addStretch(1); | 841 | insert = new QPushButton( i18n("Insert"), this ); |
840 | insert = new QPushButton( bbox, i18n("Insert") ); | 842 | hl->addWidget( insert ); |
841 | bbox->insert(insert); | ||
842 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); | 843 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); |
843 | // bbox->addStretch(1); | 844 | remove = new QPushButton( i18n("Remove"), this ); |
844 | remove = new QPushButton( bbox, i18n("Remove") ); | 845 | hl->addWidget( remove ); |
845 | bbox->insert(remove); | ||
846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); | 846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); |
847 | bbox->layout(); | ||
848 | tl->addWidget(bbox); | ||
849 | 847 | ||
850 | QHBoxLayout *l12 = new QHBoxLayout(0); | 848 | QHBoxLayout *l12 = new QHBoxLayout(0); |
851 | tl->addLayout(l12); | 849 | tl->addLayout(l12); |
852 | stl = new QListBox(this); | 850 | stl = new QListBox(this); |
853 | stl->setVScrollBarMode( QScrollView::AlwaysOff ); | 851 | // stl->setVScrollBarMode( QScrollView::AlwaysOff ); |
854 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); | 852 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); |
855 | stl->setMinimumSize(QSize(70, 140)); | 853 | // stl->setMinimumSize(QSize(70, 140)); |
856 | 854 | ||
857 | sl = new QListBox(this); | 855 | sl = new QListBox(this); |
858 | sl->setVScrollBarMode( QScrollView::AlwaysOff ); | 856 | // sl->setVScrollBarMode( QScrollView::AlwaysOff ); |
859 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); | 857 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); |
860 | sl->setMinimumSize(QSize(150, 140)); | 858 | // sl->setMinimumSize(QSize(150, 140)); |
861 | 859 | ||
862 | slb = new QScrollBar(this); | 860 | slb = new QScrollBar(this); |
863 | // slb->setFixedWidth(slb->sizeHint().width()); | 861 | // slb->setFixedWidth(slb->sizeHint().width()); |
864 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); | 862 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); |
865 | 863 | ||
866 | l12->addWidget(stl, 1); | 864 | l12->addWidget(stl, 1); |
867 | l12->addWidget(sl, 3); | 865 | l12->addWidget(sl, 3); |
868 | l12->addWidget(slb, 0); | 866 | l12->addWidget(slb, 0); |
869 | 867 | ||
870 | //load data from gpppdata | 868 | //load data from gpppdata |
871 | if(!isnewaccount) { | 869 | if(!isnewaccount) { |
872 | QStringList &comlist = PPPData::data()->scriptType(); | 870 | QStringList &comlist = PPPData::data()->scriptType(); |
873 | QStringList &arglist = PPPData::data()->script(); | 871 | QStringList &arglist = PPPData::data()->script(); |
874 | QStringList::Iterator itcom = comlist.begin(); | 872 | QStringList::Iterator itcom = comlist.begin(); |
875 | QStringList::Iterator itarg = arglist.begin(); | 873 | QStringList::Iterator itarg = arglist.begin(); |
876 | 874 | ||
877 | for ( ; | 875 | for ( ; |
878 | itcom != comlist.end() && itarg != arglist.end(); | 876 | itcom != comlist.end() && itarg != arglist.end(); |
879 | ++itcom, ++itarg ) | 877 | ++itcom, ++itarg ) |
880 | { | 878 | { |
881 | stl->insertItem(*itcom); | 879 | stl->insertItem(*itcom); |
882 | sl->insertItem(*itarg); | 880 | sl->insertItem(*itarg); |
883 | } | 881 | } |
884 | } | 882 | } |
885 | 883 | ||
886 | insert->setEnabled(false); | 884 | insert->setEnabled(false); |
887 | remove->setEnabled(false); | 885 | remove->setEnabled(false); |
888 | adjustScrollBar(); | 886 | adjustScrollBar(); |
889 | tl->activate(); | 887 | tl->activate(); |
890 | } | 888 | } |
891 | 889 | ||
892 | bool ScriptWidget::check() { | 890 | bool ScriptWidget::check() { |
893 | uint lstart = 0; | 891 | uint lstart = 0; |
894 | uint lend = 0; | 892 | uint lend = 0; |
895 | uint errcnt = 0; | 893 | uint errcnt = 0; |
896 | 894 | ||
897 | if(sl->count() > 0) { | 895 | if(sl->count() > 0) { |
898 | for( uint i=0; i <= sl->count()-1; i++) { | 896 | for( uint i=0; i <= sl->count()-1; i++) { |
899 | if(stl->text(i) == "LoopStart") { | 897 | if(stl->text(i) == "LoopStart") { |
900 | lstart++; | 898 | lstart++; |
901 | } | 899 | } |
902 | if (stl->text(i) == "LoopEnd") { | 900 | if (stl->text(i) == "LoopEnd") { |
903 | lend++; | 901 | lend++; |
904 | } | 902 | } |
905 | if ( lend > lstart ) errcnt++; | 903 | if ( lend > lstart ) errcnt++; |
906 | } | 904 | } |
907 | return ( (errcnt == 0 ) && (lstart == lend) ); | 905 | return ( (errcnt == 0 ) && (lstart == lend) ); |
908 | } | 906 | } |
909 | return true; | 907 | return true; |
910 | } | 908 | } |
911 | 909 | ||
912 | 910 | ||
913 | void ScriptWidget::save() { | 911 | void ScriptWidget::save() { |
914 | QStringList typelist, arglist; | 912 | QStringList typelist, arglist; |
915 | for(uint i=0; i < sl->count(); i++) { | 913 | for(uint i=0; i < sl->count(); i++) { |
916 | typelist.append(stl->text(i)); | 914 | typelist.append(stl->text(i)); |
917 | arglist.append(sl->text(i)); | 915 | arglist.append(sl->text(i)); |
918 | } | 916 | } |
919 | PPPData::data()->setScriptType(typelist); | 917 | PPPData::data()->setScriptType(typelist); |
920 | PPPData::data()->setScript(arglist); | 918 | PPPData::data()->setScript(arglist); |
921 | } | 919 | } |
922 | 920 | ||
923 | 921 | ||
924 | 922 | ||
925 | void ScriptWidget::adjustScrollBar() { | 923 | void ScriptWidget::adjustScrollBar() { |
926 | if((int)sl->count() <= sl->numItemsVisible()) | 924 | if((int)sl->count() <= sl->numItemsVisible()) |
927 | slb->setRange(0, 0); | 925 | slb->setRange(0, 0); |
928 | else | 926 | else |
929 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); | 927 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); |
930 | } | 928 | } |
931 | 929 | ||
932 | 930 | ||
933 | void ScriptWidget::scrolling(int i) { | 931 | void ScriptWidget::scrolling(int i) { |
934 | sl->setTopItem(i); | 932 | sl->setTopItem(i); |
935 | stl->setTopItem(i); | 933 | stl->setTopItem(i); |
936 | } | 934 | } |
937 | 935 | ||
938 | 936 | ||
939 | void ScriptWidget::slhighlighted(int i) { | 937 | void ScriptWidget::slhighlighted(int i) { |
940 | insert->setEnabled(true); | 938 | insert->setEnabled(true); |
941 | remove->setEnabled(true); | 939 | remove->setEnabled(true); |
942 | stl->setCurrentItem(i); | 940 | stl->setCurrentItem(i); |
943 | } | 941 | } |
944 | 942 | ||
945 | 943 | ||
946 | void ScriptWidget::stlhighlighted(int i) { | 944 | void ScriptWidget::stlhighlighted(int i) { |
947 | insert->setEnabled(true); | 945 | insert->setEnabled(true); |
948 | remove->setEnabled(true); | 946 | remove->setEnabled(true); |
949 | sl->setCurrentItem(i); | 947 | sl->setCurrentItem(i); |
950 | } | 948 | } |
951 | 949 | ||
952 | 950 | ||
953 | void ScriptWidget::addButton() { | 951 | void ScriptWidget::addButton() { |
954 | //don't allow more than the maximum script entries | 952 | //don't allow more than the maximum script entries |
955 | if(sl->count() == MAX_SCRIPT_ENTRIES-1) | 953 | if(sl->count() == MAX_SCRIPT_ENTRIES-1) |
956 | return; | 954 | return; |
@@ -1061,133 +1059,139 @@ void ScriptWidget::insertButton() { | |||
1061 | stl->insertItem("Send", stl->currentItem()); | 1059 | stl->insertItem("Send", stl->currentItem()); |
1062 | sl->insertItem(se->text(), sl->currentItem()); | 1060 | sl->insertItem(se->text(), sl->currentItem()); |
1063 | break; | 1061 | break; |
1064 | 1062 | ||
1065 | case ScriptEdit::SendNoEcho: | 1063 | case ScriptEdit::SendNoEcho: |
1066 | stl->insertItem("SendNoEcho", stl->currentItem()); | 1064 | stl->insertItem("SendNoEcho", stl->currentItem()); |
1067 | sl->insertItem(se->text(), sl->currentItem()); | 1065 | sl->insertItem(se->text(), sl->currentItem()); |
1068 | break; | 1066 | break; |
1069 | 1067 | ||
1070 | case ScriptEdit::Pause: | 1068 | case ScriptEdit::Pause: |
1071 | stl->insertItem("Pause", stl->currentItem()); | 1069 | stl->insertItem("Pause", stl->currentItem()); |
1072 | sl->insertItem(se->text(), sl->currentItem()); | 1070 | sl->insertItem(se->text(), sl->currentItem()); |
1073 | break; | 1071 | break; |
1074 | 1072 | ||
1075 | case ScriptEdit::Hangup: | 1073 | case ScriptEdit::Hangup: |
1076 | stl->insertItem("Hangup", stl->currentItem()); | 1074 | stl->insertItem("Hangup", stl->currentItem()); |
1077 | sl->insertItem("", sl->currentItem()); | 1075 | sl->insertItem("", sl->currentItem()); |
1078 | break; | 1076 | break; |
1079 | 1077 | ||
1080 | case ScriptEdit::Answer: | 1078 | case ScriptEdit::Answer: |
1081 | stl->insertItem("Answer", stl->currentItem()); | 1079 | stl->insertItem("Answer", stl->currentItem()); |
1082 | sl->insertItem("", sl->currentItem()); | 1080 | sl->insertItem("", sl->currentItem()); |
1083 | break; | 1081 | break; |
1084 | 1082 | ||
1085 | case ScriptEdit::Timeout: | 1083 | case ScriptEdit::Timeout: |
1086 | stl->insertItem("Timeout", stl->currentItem()); | 1084 | stl->insertItem("Timeout", stl->currentItem()); |
1087 | sl->insertItem(se->text(), sl->currentItem()); | 1085 | sl->insertItem(se->text(), sl->currentItem()); |
1088 | break; | 1086 | break; |
1089 | 1087 | ||
1090 | case ScriptEdit::Password: | 1088 | case ScriptEdit::Password: |
1091 | stl->insertItem("Password", stl->currentItem()); | 1089 | stl->insertItem("Password", stl->currentItem()); |
1092 | sl->insertItem(se->text(), sl->currentItem()); | 1090 | sl->insertItem(se->text(), sl->currentItem()); |
1093 | break; | 1091 | break; |
1094 | 1092 | ||
1095 | case ScriptEdit::ID: | 1093 | case ScriptEdit::ID: |
1096 | stl->insertItem("ID", stl->currentItem()); | 1094 | stl->insertItem("ID", stl->currentItem()); |
1097 | sl->insertItem(se->text(), sl->currentItem()); | 1095 | sl->insertItem(se->text(), sl->currentItem()); |
1098 | break; | 1096 | break; |
1099 | 1097 | ||
1100 | case ScriptEdit::Prompt: | 1098 | case ScriptEdit::Prompt: |
1101 | stl->insertItem("Prompt", stl->currentItem()); | 1099 | stl->insertItem("Prompt", stl->currentItem()); |
1102 | sl->insertItem(se->text(), sl->currentItem()); | 1100 | sl->insertItem(se->text(), sl->currentItem()); |
1103 | break; | 1101 | break; |
1104 | 1102 | ||
1105 | case ScriptEdit::PWPrompt: | 1103 | case ScriptEdit::PWPrompt: |
1106 | stl->insertItem("PWPrompt", stl->currentItem()); | 1104 | stl->insertItem("PWPrompt", stl->currentItem()); |
1107 | sl->insertItem(se->text(), sl->currentItem()); | 1105 | sl->insertItem(se->text(), sl->currentItem()); |
1108 | break; | 1106 | break; |
1109 | 1107 | ||
1110 | case ScriptEdit::LoopStart: | 1108 | case ScriptEdit::LoopStart: |
1111 | stl->insertItem("LoopStart", stl->currentItem()); | 1109 | stl->insertItem("LoopStart", stl->currentItem()); |
1112 | sl->insertItem(se->text(), sl->currentItem()); | 1110 | sl->insertItem(se->text(), sl->currentItem()); |
1113 | break; | 1111 | break; |
1114 | 1112 | ||
1115 | case ScriptEdit::LoopEnd: | 1113 | case ScriptEdit::LoopEnd: |
1116 | stl->insertItem("LoopEnd", stl->currentItem()); | 1114 | stl->insertItem("LoopEnd", stl->currentItem()); |
1117 | sl->insertItem(se->text(), sl->currentItem()); | 1115 | sl->insertItem(se->text(), sl->currentItem()); |
1118 | break; | 1116 | break; |
1119 | 1117 | ||
1120 | case ScriptEdit::Scan: | 1118 | case ScriptEdit::Scan: |
1121 | stl->insertItem("Scan", stl->currentItem()); | 1119 | stl->insertItem("Scan", stl->currentItem()); |
1122 | sl->insertItem(se->text(), sl->currentItem()); | 1120 | sl->insertItem(se->text(), sl->currentItem()); |
1123 | break; | 1121 | break; |
1124 | 1122 | ||
1125 | case ScriptEdit::Save: | 1123 | case ScriptEdit::Save: |
1126 | stl->insertItem("Save", stl->currentItem()); | 1124 | stl->insertItem("Save", stl->currentItem()); |
1127 | sl->insertItem(se->text(), sl->currentItem()); | 1125 | sl->insertItem(se->text(), sl->currentItem()); |
1128 | break; | 1126 | break; |
1129 | 1127 | ||
1130 | default: | 1128 | default: |
1131 | break; | 1129 | break; |
1132 | } | 1130 | } |
1133 | adjustScrollBar(); | 1131 | adjustScrollBar(); |
1134 | se->setText(""); | 1132 | se->setText(""); |
1135 | } | 1133 | } |
1136 | 1134 | ||
1137 | 1135 | ||
1138 | void ScriptWidget::removeButton() { | 1136 | void ScriptWidget::removeButton() { |
1139 | if(sl->currentItem() >= 0) { | 1137 | if(sl->currentItem() >= 0) { |
1140 | int stlc = stl->currentItem(); | 1138 | int stlc = stl->currentItem(); |
1141 | sl->removeItem(sl->currentItem()); | 1139 | sl->removeItem(sl->currentItem()); |
1142 | stl->removeItem(stlc); | 1140 | stl->removeItem(stlc); |
1143 | adjustScrollBar(); | 1141 | adjustScrollBar(); |
1144 | insert->setEnabled(sl->currentItem() != -1); | 1142 | insert->setEnabled(sl->currentItem() != -1); |
1145 | remove->setEnabled(sl->currentItem() != -1); | 1143 | remove->setEnabled(sl->currentItem() != -1); |
1146 | } | 1144 | } |
1147 | } | 1145 | } |
1148 | 1146 | ||
1149 | 1147 | ||
1150 | 1148 | ||
1151 | ///////////////////////////////////////////////////////////////////////////// | 1149 | ///////////////////////////////////////////////////////////////////////////// |
1152 | // | 1150 | // |
1153 | // Used to specify a new phone number | 1151 | // Used to specify a new phone number |
1154 | // | 1152 | // |
1155 | ///////////////////////////////////////////////////////////////////////////// | 1153 | ///////////////////////////////////////////////////////////////////////////// |
1156 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) | 1154 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) |
1157 | : QDialog(parent,"PhoneNumberDialog",true) { | 1155 | : QDialog(parent,"PhoneNumberDialog",true) |
1156 | { | ||
1158 | setCaption( i18n("Add Phone Number") ); | 1157 | setCaption( i18n("Add Phone Number") ); |
1159 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | ||
1160 | 1158 | ||
1161 | QHBox *hbox = new QHBox(this); | 1159 | |
1160 | QVBoxLayout *layout = new QVBoxLayout( this ); | ||
1161 | layout->setSpacing( 3 ); | ||
1162 | layout->setMargin( 3 ); | ||
1163 | |||
1164 | // QHBox *hbox = new QHBox(this); | ||
1162 | // setMainWidget(hbox); | 1165 | // setMainWidget(hbox); |
1163 | 1166 | ||
1164 | hbox->setSpacing( 2 );//KDialog::spacingHint()); | 1167 | // hbox->setSpacing( 2 );//KDialog::spacingHint()); |
1165 | 1168 | ||
1166 | new QLabel(i18n("Enter a phone number:"), hbox); | 1169 | QLabel *label = new QLabel(this, tr("Enter a phone number:")); |
1170 | layout->addWidget( label ); | ||
1167 | 1171 | ||
1168 | le = new QLineEdit(hbox); | 1172 | le = new QLineEdit(this, "lineEdit"); |
1169 | // le->setMinimumWidth(125); | 1173 | layout->addWidget( le ); |
1170 | 1174 | ||
1171 | connect(le, SIGNAL(textChanged(const QString &)), | 1175 | connect(le, SIGNAL(textChanged(const QString &)), |
1172 | this, SLOT(textChanged(const QString &))); | 1176 | this, SLOT(textChanged(const QString &))); |
1173 | 1177 | ||
1174 | le->setFocus(); | 1178 | le->setFocus(); |
1175 | textChanged(""); | 1179 | textChanged(""); |
1176 | 1180 | ||
1177 | // enableButtonSeparator(true); | 1181 | |
1178 | } | 1182 | } |
1179 | 1183 | ||
1180 | 1184 | ||
1181 | QString PhoneNumberDialog::phoneNumber() { | 1185 | QString PhoneNumberDialog::phoneNumber() { |
1182 | QString s = le->text(); | 1186 | QString s = le->text(); |
1183 | 1187 | ||
1184 | return s; | 1188 | return s; |
1185 | } | 1189 | } |
1186 | 1190 | ||
1187 | 1191 | ||
1188 | void PhoneNumberDialog::textChanged(const QString &s) { | 1192 | void PhoneNumberDialog::textChanged(const QString &s) { |
1189 | // enableButtonOK(s.length() > 0); | 1193 | // enableButtonOK(s.length() > 0); |
1190 | } | 1194 | } |
1191 | 1195 | ||
1192 | 1196 | ||
1193 | //#include "edit.moc" | 1197 | //#include "edit.moc" |
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp index b7fca3f..4039939 100644 --- a/noncore/settings/networksettings/ppp/pppdargs.cpp +++ b/noncore/settings/networksettings/ppp/pppdargs.cpp | |||
@@ -1,166 +1,166 @@ | |||
1 | /* | 1 | /* |
2 | * kPPP: A pppd front end for the KDE project | 2 | * kPPP: A pppd front end for the KDE project |
3 | * | 3 | * |
4 | * $Id$ | 4 | * $Id$ |
5 | * | 5 | * |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
11 | * | 11 | * |
12 | * | 12 | * |
13 | * This library is free software; you can redistribute it and/or | 13 | * This library is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU Library General Public | 14 | * modify it under the terms of the GNU Library General Public |
15 | * License as published by the Free Software Foundation; either | 15 | * License as published by the Free Software Foundation; either |
16 | * version 2 of the License, or (at your option) any later version. | 16 | * version 2 of the License, or (at your option) any later version. |
17 | * | 17 | * |
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> | 30 | //#include <kwin.h> |
31 | #include <qapplication.h> | 31 | #include <qapplication.h> |
32 | #include "pppdargs.h" | 32 | #include "pppdargs.h" |
33 | #include "pppdata.h" | 33 | #include "pppdata.h" |
34 | //#include <klocale.h> | 34 | //#include <klocale.h> |
35 | #define i18n QObject::tr | 35 | #define i18n QObject::tr |
36 | 36 | ||
37 | PPPdArguments::PPPdArguments(QWidget *parent, const char *name) | 37 | PPPdArguments::PPPdArguments(QWidget *parent, const char *name) |
38 | : QDialog(parent, name, TRUE) | 38 | : QDialog(parent, name, TRUE) |
39 | { | 39 | { |
40 | setCaption(i18n("Customize pppd Arguments")); | 40 | setCaption(i18n("Customize pppd Arguments")); |
41 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 41 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
42 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); | 42 | QVBoxLayout *l = new QVBoxLayout(this, 10, 10); |
43 | QHBoxLayout *tl = new QHBoxLayout(10); | 43 | QHBoxLayout *tl = new QHBoxLayout(10); |
44 | l->addLayout(tl); | 44 | l->addLayout(tl); |
45 | QVBoxLayout *l1 = new QVBoxLayout(); | 45 | QVBoxLayout *l1 = new QVBoxLayout(); |
46 | QVBoxLayout *l2 = new QVBoxLayout(); | 46 | QVBoxLayout *l2 = new QVBoxLayout(); |
47 | tl->addLayout(l1, 1); | 47 | tl->addLayout(l1, 1); |
48 | tl->addLayout(l2, 0); | 48 | tl->addLayout(l2, 0); |
49 | 49 | ||
50 | QHBoxLayout *l11 = new QHBoxLayout(10); | 50 | QHBoxLayout *l11 = new QHBoxLayout(10); |
51 | l1->addLayout(l11); | 51 | l1->addLayout(l11); |
52 | 52 | ||
53 | argument_label = new QLabel(i18n("Argument:"), this); | 53 | argument_label = new QLabel(i18n("Argument:"), this); |
54 | l11->addWidget(argument_label); | 54 | l11->addWidget(argument_label); |
55 | 55 | ||
56 | argument = new QLineEdit(this); | 56 | argument = new QLineEdit(this); |
57 | connect(argument, SIGNAL(returnPressed()), | 57 | connect(argument, SIGNAL(returnPressed()), |
58 | SLOT(addbutton())); | 58 | SLOT(addbutton())); |
59 | l11->addWidget(argument); | 59 | l11->addWidget(argument); |
60 | connect(argument, SIGNAL(textChanged(const QString &)), | 60 | connect(argument, SIGNAL(textChanged(const QString &)), |
61 | this, SLOT(textChanged(const QString &))); | 61 | this, SLOT(textChanged(const QString &))); |
62 | 62 | ||
63 | arguments = new QListBox(this); | 63 | arguments = new QListBox(this); |
64 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); | 64 | arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); |
65 | connect(arguments, SIGNAL(highlighted(int)), | 65 | connect(arguments, SIGNAL(highlighted(int)), |
66 | this, SLOT(itemSelected(int))); | 66 | this, SLOT(itemSelected(int))); |
67 | l1->addWidget(arguments, 1); | 67 | l1->addWidget(arguments, 1); |
68 | 68 | ||
69 | add = new QPushButton(i18n("Add"), this); | 69 | add = new QPushButton(i18n("Add"), this); |
70 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); | 70 | connect(add, SIGNAL(clicked()), SLOT(addbutton())); |
71 | l2->addWidget(add); | 71 | l2->addWidget(add); |
72 | l2->addStretch(1); | 72 | l2->addStretch(1); |
73 | 73 | ||
74 | remove = new QPushButton(i18n("Remove"), this); | 74 | remove = new QPushButton(i18n("Remove"), this); |
75 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); | 75 | connect(remove, SIGNAL(clicked()), SLOT(removebutton())); |
76 | l2->addWidget(remove); | 76 | l2->addWidget(remove); |
77 | 77 | ||
78 | defaults = new QPushButton(i18n("Defaults"), this); | 78 | defaults = new QPushButton(i18n("Defaults"), this); |
79 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); | 79 | connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); |
80 | l2->addWidget(defaults); | 80 | l2->addWidget(defaults); |
81 | 81 | ||
82 | l->addSpacing(5); | 82 | l->addSpacing(5); |
83 | 83 | ||
84 | QButtonGroup *bbox = new QButtonGroup(this); | 84 | // QButtonGroup *bbox = new QButtonGroup(this); |
85 | // bbox->addStretch(1); | 85 | // // bbox->addStretch(1); |
86 | closebtn = new QPushButton( bbox, i18n("OK")); | 86 | // closebtn = new QPushButton( bbox, i18n("OK")); |
87 | bbox->insert(closebtn); | 87 | // bbox->insert(closebtn); |
88 | connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); | 88 | // connect(closebtn, SIGNAL(clicked()), SLOT(closebutton())); |
89 | QPushButton *cancel = new QPushButton( bbox, i18n("Cancel")); | 89 | // QPushButton *cancel = new QPushButton( bbox, i18n("Cancel")); |
90 | bbox->insert(cancel); | 90 | // bbox->insert(cancel); |
91 | connect(cancel, SIGNAL(clicked()), | 91 | // connect(cancel, SIGNAL(clicked()), |
92 | this, SLOT(reject())); | 92 | // this, SLOT(reject())); |
93 | bbox->layout(); | 93 | // bbox->layout(); |
94 | l->addWidget(bbox); | 94 | // l->addWidget(bbox); |
95 | 95 | ||
96 | setFixedSize(sizeHint()); | 96 | // setFixedSize(sizeHint()); |
97 | 97 | ||
98 | //load info from gpppdata | 98 | //load info from gpppdata |
99 | init(); | 99 | init(); |
100 | 100 | ||
101 | add->setEnabled(false); | 101 | add->setEnabled(false); |
102 | remove->setEnabled(false); | 102 | remove->setEnabled(false); |
103 | argument->setFocus(); | 103 | argument->setFocus(); |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | void PPPdArguments::addbutton() { | 107 | void PPPdArguments::addbutton() { |
108 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { | 108 | if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { |
109 | arguments->insertItem(argument->text()); | 109 | arguments->insertItem(argument->text()); |
110 | argument->setText(""); | 110 | argument->setText(""); |
111 | } | 111 | } |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | void PPPdArguments::removebutton() { | 115 | void PPPdArguments::removebutton() { |
116 | if(arguments->currentItem() >= 0) | 116 | if(arguments->currentItem() >= 0) |
117 | arguments->removeItem(arguments->currentItem()); | 117 | arguments->removeItem(arguments->currentItem()); |
118 | } | 118 | } |
119 | 119 | ||
120 | 120 | ||
121 | void PPPdArguments::defaultsbutton() { | 121 | void PPPdArguments::defaultsbutton() { |
122 | // all of this is a hack | 122 | // all of this is a hack |
123 | // save current list | 123 | // save current list |
124 | QStringList arglist(PPPData::data()->pppdArgument()); | 124 | QStringList arglist(PPPData::data()->pppdArgument()); |
125 | 125 | ||
126 | // get defaults | 126 | // get defaults |
127 | PPPData::data()->setpppdArgumentDefaults(); | 127 | PPPData::data()->setpppdArgumentDefaults(); |
128 | init(); | 128 | init(); |
129 | 129 | ||
130 | // restore old list | 130 | // restore old list |
131 | PPPData::data()->setpppdArgument(arglist); | 131 | PPPData::data()->setpppdArgument(arglist); |
132 | } | 132 | } |
133 | 133 | ||
134 | 134 | ||
135 | void PPPdArguments::closebutton() { | 135 | void PPPdArguments::closebutton() { |
136 | QStringList arglist; | 136 | QStringList arglist; |
137 | for(uint i=0; i < arguments->count(); i++) | 137 | for(uint i=0; i < arguments->count(); i++) |
138 | arglist.append(arguments->text(i)); | 138 | arglist.append(arguments->text(i)); |
139 | PPPData::data()->setpppdArgument(arglist); | 139 | PPPData::data()->setpppdArgument(arglist); |
140 | 140 | ||
141 | done(0); | 141 | done(0); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void PPPdArguments::init() { | 145 | void PPPdArguments::init() { |
146 | while(arguments->count()) | 146 | while(arguments->count()) |
147 | arguments->removeItem(0); | 147 | arguments->removeItem(0); |
148 | 148 | ||
149 | QStringList &arglist = PPPData::data()->pppdArgument(); | 149 | QStringList &arglist = PPPData::data()->pppdArgument(); |
150 | for ( QStringList::Iterator it = arglist.begin(); | 150 | for ( QStringList::Iterator it = arglist.begin(); |
151 | it != arglist.end(); | 151 | it != arglist.end(); |
152 | ++it ) | 152 | ++it ) |
153 | arguments->insertItem(*it); | 153 | arguments->insertItem(*it); |
154 | } | 154 | } |
155 | 155 | ||
156 | 156 | ||
157 | void PPPdArguments::textChanged(const QString &s) { | 157 | void PPPdArguments::textChanged(const QString &s) { |
158 | add->setEnabled(s.length() > 0); | 158 | add->setEnabled(s.length() > 0); |
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | void PPPdArguments::itemSelected(int idx) { | 162 | void PPPdArguments::itemSelected(int idx) { |
163 | remove->setEnabled(idx != -1); | 163 | remove->setEnabled(idx != -1); |
164 | } | 164 | } |
165 | 165 | ||
166 | 166 | ||