Diffstat (limited to 'noncore/settings/networksettings/ppp/modemcmds.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/modemcmds.cpp | 129 |
1 files changed, 72 insertions, 57 deletions
diff --git a/noncore/settings/networksettings/ppp/modemcmds.cpp b/noncore/settings/networksettings/ppp/modemcmds.cpp index 1d9db6e..e797795 100644 --- a/noncore/settings/networksettings/ppp/modemcmds.cpp +++ b/noncore/settings/networksettings/ppp/modemcmds.cpp | |||
@@ -29,9 +29,7 @@ | |||
29 | #include <qbuttongroup.h> | 29 | #include <qbuttongroup.h> |
30 | #include <qscrollview.h> | ||
31 | #include <qapplication.h> | ||
30 | #include <stdlib.h> | 32 | #include <stdlib.h> |
31 | //#include <kapplication.h> // for getMiniIcon() | ||
32 | //#include <klocale.h> | ||
33 | #define i18n QObject::tr | ||
34 | #include "modemcmds.h" | 33 | #include "modemcmds.h" |
35 | #include "pppdata.h" | 34 | #include "pppdata.h" |
36 | //#include <kwin.h> | ||
37 | 35 | ||
@@ -42,6 +40,6 @@ | |||
42 | 40 | ||
43 | ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | 41 | ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name , bool modal, WFlags f) |
44 | : QDialog(parent, name, true ), _pppdata(pd) | 42 | : QDialog( parent, name, modal, f ), _pppdata(pd) |
45 | { | 43 | { |
46 | setCaption(i18n("Edit Modem Commands")); | 44 | setCaption(QObject::tr("Edit Modem Commands")); |
47 | 45 | ||
@@ -50,4 +48,15 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
50 | 48 | ||
49 | QVBoxLayout *main = new QVBoxLayout( this ); | ||
50 | QScrollView *sv = new QScrollView( this ); | ||
51 | QWidget *mainW = new QWidget( sv->viewport() ); | ||
52 | sv->setResizePolicy( QScrollView::AutoOneFit ); | ||
53 | sv->setHScrollBarMode( QScrollView::AlwaysOff ); | ||
54 | sv->setFrameShape( QFrame::NoFrame ); | ||
55 | sv->addChild( mainW ); | ||
56 | main->addWidget( sv ); | ||
57 | // evil hack | ||
58 | mainW->setMaximumWidth( QApplication::desktop()->width() - 10 ); | ||
59 | |||
51 | // toplevel layout | 60 | // toplevel layout |
52 | QVBoxLayout *tl = new QVBoxLayout(this, 10, 4); | 61 | QVBoxLayout *tl = new QVBoxLayout( mainW, 10, 4); |
53 | 62 | ||
@@ -56,3 +65,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
56 | tl->addLayout(l1); | 65 | tl->addLayout(l1); |
57 | box = new QGroupBox(this, "box"); | 66 | box = new QGroupBox(mainW, "box"); |
67 | box->setMargin( 0 ); | ||
58 | l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); | 68 | l1->addMultiCellWidget(box, row++, GRIDROWS, 0, 3); |
@@ -62,3 +72,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
62 | l1->addLayout(l2, row, 2); | 72 | l1->addLayout(l2, row, 2); |
63 | lpreinitslider = new QLabel("MMMM", this); | 73 | lpreinitslider = new QLabel("MMMM", mainW); |
64 | FORMATSLIDERLABEL(lpreinitslider); | 74 | FORMATSLIDERLABEL(lpreinitslider); |
@@ -66,3 +76,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
66 | QSlider *preinitslider = new QSlider(0, 300, 1, 0, | 76 | QSlider *preinitslider = new QSlider(0, 300, 1, 0, |
67 | QSlider::Horizontal, this); | 77 | QSlider::Horizontal, mainW); |
68 | // preinitslider->setFixedHeight(preinitslider->sizeHint().height()); | 78 | // preinitslider->setFixedHeight(preinitslider->sizeHint().height()); |
@@ -73,3 +83,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
73 | 83 | ||
74 | lpreinit = new QLabel(i18n("Pre-init delay (sec/100):"), this); | 84 | lpreinit = new QLabel(QObject::tr("Pre-init delay (sec/100):"), mainW); |
75 | l1->addWidget(lpreinit, row++, 1); | 85 | l1->addWidget(lpreinit, row++, 1); |
@@ -77,5 +87,5 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
77 | for(int i = 0; i < PPPData::NumInitStrings; i++) { | 87 | for(int i = 0; i < PPPData::NumInitStrings; i++) { |
78 | initstr[i] = new QLineEdit(this); | 88 | initstr[i] = new QLineEdit(mainW); |
79 | QLabel *initLabel = new QLabel(i18n("Initialization string %1:").arg(i + 1), | 89 | QLabel *initLabel = new QLabel(QObject::tr("Initialization string %1:").arg(i + 1), |
80 | this); | 90 | mainW); |
81 | ADJUSTEDIT(initstr[i]); | 91 | ADJUSTEDIT(initstr[i]); |
@@ -87,6 +97,6 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
87 | l1->addLayout(l3, row, 2); | 97 | l1->addLayout(l3, row, 2); |
88 | linitslider = new QLabel("MMMM", this); | 98 | linitslider = new QLabel("MMMM", mainW); |
89 | FORMATSLIDERLABEL(linitslider); | 99 | FORMATSLIDERLABEL(linitslider); |
90 | QSlider *initslider = new QSlider(1, 300, 1, 0, | 100 | QSlider *initslider = new QSlider(1, 300, 1, 0, |
91 | QSlider::Horizontal, this); | 101 | QSlider::Horizontal, mainW); |
92 | // initslider->setFixedHeight(initslider->sizeHint().height()); | 102 | // initslider->setFixedHeight(initslider->sizeHint().height()); |
@@ -97,3 +107,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
97 | 107 | ||
98 | label3 = new QLabel(i18n("Post-init delay (sec/100):"), this); | 108 | label3 = new QLabel(QObject::tr("Post-init delay (sec/100):"), mainW); |
99 | l1->addWidget(label3, row++, 1); | 109 | l1->addWidget(label3, row++, 1); |
@@ -103,6 +113,6 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
103 | l1->addLayout(l4, row, 2); | 113 | l1->addLayout(l4, row, 2); |
104 | ldurationslider = new QLabel("MMMM", this); | 114 | ldurationslider = new QLabel("MMMM", mainW); |
105 | FORMATSLIDERLABEL(ldurationslider); | 115 | FORMATSLIDERLABEL(ldurationslider); |
106 | QSlider *durationslider = new QSlider(1, 255, 1, 0, | 116 | QSlider *durationslider = new QSlider(1, 255, 1, 0, |
107 | QSlider::Horizontal, this); | 117 | QSlider::Horizontal, mainW); |
108 | // durationslider->setFixedHeight(durationslider->sizeHint().height()); | 118 | // durationslider->setFixedHeight(durationslider->sizeHint().height()); |
@@ -113,3 +123,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
113 | 123 | ||
114 | lduration = new QLabel(i18n("Dialing speed (sec/100):"), this); | 124 | lduration = new QLabel(QObject::tr("Dialing speed (sec/100):"), mainW); |
115 | l1->addWidget(lduration, row++, 1); | 125 | l1->addWidget(lduration, row++, 1); |
@@ -117,4 +127,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
117 | 127 | ||
118 | initresp = new QLineEdit(this); | 128 | initresp = new QLineEdit(mainW); |
119 | label2 = new QLabel(i18n("Init response:"), this); | 129 | label2 = new QLabel(QObject::tr("Init response:"), mainW); |
120 | ADJUSTEDIT(initresp); | 130 | ADJUSTEDIT(initresp); |
@@ -123,4 +133,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
123 | 133 | ||
124 | nodetectdialtone = new QLineEdit(this); | 134 | nodetectdialtone = new QLineEdit(mainW); |
125 | lnodetectdialtone = new QLabel(i18n("No dial tone detection:"), this); | 135 | lnodetectdialtone = new QLabel(QObject::tr("No dial tone detection:"), mainW); |
126 | ADJUSTEDIT(nodetectdialtone); | 136 | ADJUSTEDIT(nodetectdialtone); |
@@ -129,4 +139,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
129 | 139 | ||
130 | dialstr = new QLineEdit(this); | 140 | dialstr = new QLineEdit(mainW); |
131 | label4 = new QLabel(i18n("Dial string:"),this); | 141 | label4 = new QLabel(QObject::tr("Dial string:"),mainW); |
132 | ADJUSTEDIT(dialstr); | 142 | ADJUSTEDIT(dialstr); |
@@ -135,4 +145,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
135 | 145 | ||
136 | connectresp = new QLineEdit(this); | 146 | connectresp = new QLineEdit(mainW); |
137 | label5 = new QLabel(i18n("Connect response:"), this); | 147 | label5 = new QLabel(QObject::tr("Connect response:"), mainW); |
138 | ADJUSTEDIT(connectresp); | 148 | ADJUSTEDIT(connectresp); |
@@ -141,4 +151,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
141 | 151 | ||
142 | busyresp = new QLineEdit(this); | 152 | busyresp = new QLineEdit(mainW); |
143 | label6 = new QLabel(i18n("Busy response:"), this); | 153 | label6 = new QLabel(QObject::tr("Busy response:"), mainW); |
144 | ADJUSTEDIT(busyresp); | 154 | ADJUSTEDIT(busyresp); |
@@ -147,4 +157,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
147 | 157 | ||
148 | nocarrierresp = new QLineEdit(this); | 158 | nocarrierresp = new QLineEdit(mainW); |
149 | label7 = new QLabel(i18n("No carrier response:"), this); | 159 | label7 = new QLabel(QObject::tr("No carrier response:"), mainW); |
150 | ADJUSTEDIT(nocarrierresp); | 160 | ADJUSTEDIT(nocarrierresp); |
@@ -153,4 +163,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
153 | 163 | ||
154 | nodialtoneresp = new QLineEdit(this); | 164 | nodialtoneresp = new QLineEdit(mainW); |
155 | label8 = new QLabel(i18n("No dial tone response:"), this); | 165 | label8 = new QLabel(QObject::tr("No dial tone response:"), mainW); |
156 | ADJUSTEDIT(nodialtoneresp); | 166 | ADJUSTEDIT(nodialtoneresp); |
@@ -159,4 +169,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
159 | 169 | ||
160 | hangupstr = new QLineEdit(this); | 170 | hangupstr = new QLineEdit(mainW); |
161 | label9 = new QLabel(i18n("Hangup string:"), this); | 171 | label9 = new QLabel(QObject::tr("Hangup string:"), mainW); |
162 | ADJUSTEDIT(hangupstr); | 172 | ADJUSTEDIT(hangupstr); |
@@ -165,4 +175,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
165 | 175 | ||
166 | hangupresp = new QLineEdit(this); | 176 | hangupresp = new QLineEdit(mainW); |
167 | label10 = new QLabel(i18n("Hangup response:"), this); | 177 | label10 = new QLabel(QObject::tr("Hangup response:"), mainW); |
168 | ADJUSTEDIT(hangupresp); | 178 | ADJUSTEDIT(hangupresp); |
@@ -171,4 +181,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
171 | 181 | ||
172 | answerstr = new QLineEdit(this); | 182 | answerstr = new QLineEdit(mainW); |
173 | label11 = new QLabel(i18n("Answer string:"), this); | 183 | label11 = new QLabel(QObject::tr("Answer string:"), mainW); |
174 | ADJUSTEDIT(answerstr); | 184 | ADJUSTEDIT(answerstr); |
@@ -177,4 +187,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
177 | 187 | ||
178 | ringresp = new QLineEdit(this); | 188 | ringresp = new QLineEdit(mainW); |
179 | label12 = new QLabel(i18n("Ring response:"), this); | 189 | label12 = new QLabel(QObject::tr("Ring response:"), mainW); |
180 | ADJUSTEDIT(ringresp); | 190 | ADJUSTEDIT(ringresp); |
@@ -183,4 +193,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
183 | 193 | ||
184 | answerresp = new QLineEdit(this); | 194 | answerresp = new QLineEdit(mainW); |
185 | label13 = new QLabel(i18n("Answer response:"), this); | 195 | label13 = new QLabel(QObject::tr("Answer response:"), mainW); |
186 | ADJUSTEDIT(answerresp); | 196 | ADJUSTEDIT(answerresp); |
@@ -189,4 +199,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
189 | 199 | ||
190 | escapestr = new QLineEdit(this); | 200 | escapestr = new QLineEdit(mainW); |
191 | label14 = new QLabel(i18n("Escape string:"), this); | 201 | label14 = new QLabel(QObject::tr("Escape string:"), mainW); |
192 | ADJUSTEDIT(escapestr); | 202 | ADJUSTEDIT(escapestr); |
@@ -195,4 +205,4 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
195 | 205 | ||
196 | escaperesp = new QLineEdit(this); | 206 | escaperesp = new QLineEdit(mainW); |
197 | label15 = new QLabel(i18n("Escape response:"), this); | 207 | label15 = new QLabel(QObject::tr("Escape response:"), mainW); |
198 | ADJUSTEDIT(escaperesp); | 208 | ADJUSTEDIT(escaperesp); |
@@ -203,3 +213,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
203 | l1->addLayout(l5, row, 2); | 213 | l1->addLayout(l5, row, 2); |
204 | lslider = new QLabel("MMMM", this); | 214 | lslider = new QLabel("MMMM", mainW); |
205 | FORMATSLIDERLABEL(lslider); | 215 | FORMATSLIDERLABEL(lslider); |
@@ -207,3 +217,3 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
207 | QSlider *slider = new QSlider(0, 255, 1, 0, | 217 | QSlider *slider = new QSlider(0, 255, 1, 0, |
208 | QSlider::Horizontal, this); | 218 | QSlider::Horizontal, mainW); |
209 | // slider->setFixedHeight(slider->sizeHint().height()); | 219 | // slider->setFixedHeight(slider->sizeHint().height()); |
@@ -214,6 +224,6 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
214 | 224 | ||
215 | label16 = new QLabel(i18n("Guard time (sec/50):"), this); | 225 | label16 = new QLabel(QObject::tr("Guard time (sec/50):"), mainW); |
216 | l1->addWidget(label16, row++, 1); | 226 | l1->addWidget(label16, row++, 1); |
217 | 227 | ||
218 | QLabel *l = new QLabel(i18n("Volume off/low/high:"), this); | 228 | QLabel *l = new QLabel(QObject::tr("Volume off/low/high:"), mainW); |
219 | l1->addWidget(l, row, 1); | 229 | l1->addWidget(l, row, 1); |
@@ -221,9 +231,9 @@ ModemCommands::ModemCommands(PPPData *pd, QWidget *parent, const char *name) | |||
221 | l1->addLayout(l6, row++, 2); | 231 | l1->addLayout(l6, row++, 2); |
222 | volume_off = new QLineEdit(this); | 232 | volume_off = new QLineEdit(mainW); |
223 | // volume_off->setFixedHeight(volume_off->sizeHint().height()); | 233 | // volume_off->setFixedHeight(volume_off->sizeHint().height()); |
224 | // volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2)); | 234 | // volume_off->setMinimumWidth((int)(volume_off->sizeHint().width() / 2)); |
225 | volume_medium = new QLineEdit(this); | 235 | volume_medium = new QLineEdit(mainW); |
226 | // volume_medium->setFixedHeight(volume_medium->sizeHint().height()); | 236 | // volume_medium->setFixedHeight(volume_medium->sizeHint().height()); |
227 | // volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2)); | 237 | // volume_medium->setMinimumWidth((int)(volume_medium->sizeHint().width() / 2)); |
228 | volume_high = new QLineEdit(this); | 238 | volume_high = new QLineEdit(mainW); |
229 | // volume_high->setFixedHeight(volume_high->sizeHint().height()); | 239 | // volume_high->setFixedHeight(volume_high->sizeHint().height()); |
@@ -309,3 +319,8 @@ void ModemCommands::slotOk() { | |||
309 | _pppdata->save(); | 319 | _pppdata->save(); |
310 | accept(); | 320 | QDialog::accept(); |
321 | } | ||
322 | |||
323 | void ModemCommands::accept() | ||
324 | { | ||
325 | slotOk(); | ||
311 | } | 326 | } |