-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 8885b58..8ca55fe 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -153,257 +153,257 @@ static const char *commonCmds[] = | |||
153 | "df", | 153 | "df", |
154 | "dmesg", | 154 | "dmesg", |
155 | "fuser", | 155 | "fuser", |
156 | "hostname", | 156 | "hostname", |
157 | "kill", | 157 | "kill", |
158 | "killall", | 158 | "killall", |
159 | "ln", | 159 | "ln", |
160 | "ping", | 160 | "ping", |
161 | "mount", | 161 | "mount", |
162 | "more", | 162 | "more", |
163 | "sort", | 163 | "sort", |
164 | "touch", | 164 | "touch", |
165 | "umount", | 165 | "umount", |
166 | "mknod", | 166 | "mknod", |
167 | "netstat", | 167 | "netstat", |
168 | */ | 168 | */ |
169 | 169 | ||
170 | "exit", | 170 | "exit", |
171 | NULL | 171 | NULL |
172 | }; | 172 | }; |
173 | 173 | ||
174 | 174 | ||
175 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 175 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
176 | QMainWindow(parent, name, fl) | 176 | QMainWindow(parent, name, fl) |
177 | { | 177 | { |
178 | QStrList args; | 178 | QStrList args; |
179 | init("/bin/sh",args); | 179 | init("/bin/sh",args); |
180 | } | 180 | } |
181 | 181 | ||
182 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 182 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
183 | : QMainWindow(0, name) | 183 | : QMainWindow(0, name) |
184 | { | 184 | { |
185 | init(_pgm,_args); | 185 | init(_pgm,_args); |
186 | } | 186 | } |
187 | 187 | ||
188 | void Konsole::initCommandList() | 188 | void Konsole::initCommandList() |
189 | { | 189 | { |
190 | // qDebug("Konsole::initCommandList"); | 190 | // qDebug("Konsole::initCommandList"); |
191 | Config cfg("Konsole"); | 191 | Config cfg("Konsole"); |
192 | cfg.setGroup("Commands"); | 192 | cfg.setGroup("Commands"); |
193 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 193 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
194 | commonCombo->clear(); | 194 | commonCombo->clear(); |
195 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { | 195 | if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { |
196 | for (int i = 0; commonCmds[i] != NULL; i++) { | 196 | for (int i = 0; commonCmds[i] != NULL; i++) { |
197 | commonCombo->insertItem(commonCmds[i],i); | 197 | commonCombo->insertItem(commonCmds[i],i); |
198 | } | 198 | } |
199 | } else { | 199 | } else { |
200 | for (int i = 0; i < 100; i++) { | 200 | for (int i = 0; i < 100; i++) { |
201 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 201 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
202 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); | 202 | commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); |
203 | } | 203 | } |
204 | } | 204 | } |
205 | 205 | ||
206 | } | 206 | } |
207 | 207 | ||
208 | void Konsole::init(const char* _pgm, QStrList & _args) | 208 | void Konsole::init(const char* _pgm, QStrList & _args) |
209 | { | 209 | { |
210 | b_scroll = TRUE; // histon; | 210 | b_scroll = TRUE; // histon; |
211 | n_keytab = 0; | 211 | n_keytab = 0; |
212 | n_render = 0; | 212 | n_render = 0; |
213 | startUp=0; | 213 | startUp=0; |
214 | fromMenu = FALSE; | 214 | fromMenu = FALSE; |
215 | 215 | ||
216 | setCaption( tr("Terminal") ); | 216 | setCaption( tr("Terminal") ); |
217 | setIcon( Resource::loadPixmap( "konsole" ) ); | 217 | setIcon( Resource::loadPixmap( "konsole" ) ); |
218 | 218 | ||
219 | Config cfg("Konsole"); | 219 | Config cfg("Konsole"); |
220 | cfg.setGroup("Konsole"); | 220 | cfg.setGroup("Konsole"); |
221 | QString tmp; | 221 | QString tmp; |
222 | // initialize the list of allowed fonts /////////////////////////////////// | 222 | // initialize the list of allowed fonts /////////////////////////////////// |
223 | cfont = cfg.readNumEntry("FontID", 1); | 223 | cfont = cfg.readNumEntry("FontID", 1); |
224 | QFont f = QFont("Micro", 4, QFont::Normal); | 224 | QFont f = QFont("Micro", 4, QFont::Normal); |
225 | f.setFixedPitch(TRUE); | 225 | f.setFixedPitch(TRUE); |
226 | fonts.append(new VTFont(tr("Micro"), f)); | 226 | fonts.append(new VTFont(tr("Micro"), f)); |
227 | 227 | ||
228 | f = QFont("Fixed", 7, QFont::Normal); | 228 | f = QFont("Fixed", 7, QFont::Normal); |
229 | f.setFixedPitch(TRUE); | 229 | f.setFixedPitch(TRUE); |
230 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 230 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
231 | 231 | ||
232 | f = QFont("Fixed", 12, QFont::Normal); | 232 | f = QFont("Fixed", 12, QFont::Normal); |
233 | f.setFixedPitch(TRUE); | 233 | f.setFixedPitch(TRUE); |
234 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 234 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
235 | 235 | ||
236 | // create terminal emulation framework //////////////////////////////////// | 236 | // create terminal emulation framework //////////////////////////////////// |
237 | nsessions = 0; | 237 | nsessions = 0; |
238 | 238 | ||
239 | tab = new EKNumTabWidget(this); | 239 | tab = new EKNumTabWidget(this); |
240 | 240 | ||
241 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 241 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
242 | 242 | ||
243 | // create terminal toolbar //////////////////////////////////////////////// | 243 | // create terminal toolbar //////////////////////////////////////////////// |
244 | setToolBarsMovable( FALSE ); | 244 | setToolBarsMovable( FALSE ); |
245 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 245 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
246 | menuToolBar->setHorizontalStretchable( TRUE ); | 246 | menuToolBar->setHorizontalStretchable( TRUE ); |
247 | 247 | ||
248 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 248 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
249 | 249 | ||
250 | fontList = new QPopupMenu( this ); | 250 | fontList = new QPopupMenu( this ); |
251 | for(uint i = 0; i < fonts.count(); i++) { | 251 | for(uint i = 0; i < fonts.count(); i++) { |
252 | VTFont *fnt = fonts.at(i); | 252 | VTFont *fnt = fonts.at(i); |
253 | fontList->insertItem(fnt->getName(), i); | 253 | fontList->insertItem(fnt->getName(), i); |
254 | } | 254 | } |
255 | fontChanged(cfont); | 255 | fontChanged(cfont); |
256 | 256 | ||
257 | configMenu = new QPopupMenu( this); | 257 | configMenu = new QPopupMenu( this); |
258 | colorMenu = new QPopupMenu( this); | 258 | colorMenu = new QPopupMenu( this); |
259 | scrollMenu = new QPopupMenu( this); | 259 | scrollMenu = new QPopupMenu( this); |
260 | editCommandListMenu = new QPopupMenu( this); | 260 | editCommandListMenu = new QPopupMenu( this); |
261 | 261 | ||
262 | configMenu->insertItem(tr("Command List"), editCommandListMenu); | 262 | configMenu->insertItem(tr("Command List"), editCommandListMenu); |
263 | 263 | ||
264 | bool listHidden; | 264 | bool listHidden; |
265 | cfg.setGroup("Menubar"); | 265 | cfg.setGroup("Menubar"); |
266 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 266 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
267 | editCommandListMenu->insertItem( tr( "Show command list" )); | 267 | editCommandListMenu->insertItem( tr( "Show command list" )); |
268 | listHidden=TRUE; | 268 | listHidden=TRUE; |
269 | } else { | 269 | } else { |
270 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 270 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
271 | listHidden=FALSE; | 271 | listHidden=FALSE; |
272 | } | 272 | } |
273 | 273 | ||
274 | cfg.setGroup("Tabs"); | 274 | cfg.setGroup("Tabs"); |
275 | tmp=cfg.readEntry("Position","Bottom"); | 275 | tmp=cfg.readEntry("Position","Bottom"); |
276 | if(tmp=="Top") { | 276 | if(tmp=="Top") { |
277 | tab->setTabPosition(QTabWidget::Top); | 277 | tab->setTabPosition(QTabWidget::Top); |
278 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 278 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
279 | } else { | 279 | } else { |
280 | tab->setTabPosition(QTabWidget::Bottom); | 280 | tab->setTabPosition(QTabWidget::Bottom); |
281 | configMenu->insertItem("Tabs on Top"); | 281 | configMenu->insertItem(tr("Tabs on Top")); |
282 | } | 282 | } |
283 | configMenu->insertSeparator(2); | 283 | configMenu->insertSeparator(2); |
284 | 284 | ||
285 | colorMenu->insertItem(tr( "Green on Black")); | 285 | colorMenu->insertItem(tr( "Green on Black")); |
286 | colorMenu->insertItem(tr( "Black on White")); | 286 | colorMenu->insertItem(tr( "Black on White")); |
287 | colorMenu->insertItem(tr( "White on Black")); | 287 | colorMenu->insertItem(tr( "White on Black")); |
288 | colorMenu->insertItem(tr( "Black on Transparent")); | 288 | colorMenu->insertItem(tr( "Black on Transparent")); |
289 | colorMenu->insertItem(tr( "Black on Red")); | 289 | colorMenu->insertItem(tr( "Black on Red")); |
290 | colorMenu->insertItem(tr( "Red on Black")); | 290 | colorMenu->insertItem(tr( "Red on Black")); |
291 | colorMenu->insertItem(tr( "Green on Yellow")); | 291 | colorMenu->insertItem(tr( "Green on Yellow")); |
292 | colorMenu->insertItem(tr( "Blue on Magenta")); | 292 | colorMenu->insertItem(tr( "Blue on Magenta")); |
293 | colorMenu->insertItem(tr( "Magenta on Blue")); | 293 | colorMenu->insertItem(tr( "Magenta on Blue")); |
294 | colorMenu->insertItem(tr( "Cyan on White")); | 294 | colorMenu->insertItem(tr( "Cyan on White")); |
295 | colorMenu->insertItem(tr( "White on Cyan")); | 295 | colorMenu->insertItem(tr( "White on Cyan")); |
296 | colorMenu->insertItem(tr( "Blue on Black")); | 296 | colorMenu->insertItem(tr( "Blue on Black")); |
297 | colorMenu->insertItem(tr( "Amber on Black")); | 297 | colorMenu->insertItem(tr( "Amber on Black")); |
298 | 298 | ||
299 | #ifdef QT_QWS_OPIE | 299 | #ifdef QT_QWS_OPIE |
300 | colorMenu->insertItem(tr( "Custom")); | 300 | colorMenu->insertItem(tr( "Custom")); |
301 | #endif | 301 | #endif |
302 | 302 | ||
303 | configMenu->insertItem(tr( "Colors") ,colorMenu); | 303 | configMenu->insertItem(tr( "Colors") ,colorMenu); |
304 | 304 | ||
305 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); | 305 | connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); |
306 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); | 306 | connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); |
307 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); | 307 | connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); |
308 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); | 308 | connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); |
309 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); | 309 | connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); |
310 | menuBar->insertItem( tr("Font"), fontList ); | 310 | menuBar->insertItem( tr("Font"), fontList ); |
311 | menuBar->insertItem( tr("Options"), configMenu ); | 311 | menuBar->insertItem( tr("Options"), configMenu ); |
312 | 312 | ||
313 | QPEToolBar *toolbar = new QPEToolBar( this ); | 313 | QPEToolBar *toolbar = new QPEToolBar( this ); |
314 | 314 | ||
315 | QAction *a; | 315 | QAction *a; |
316 | 316 | ||
317 | // Button Commands | 317 | // Button Commands |
318 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); | 318 | a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); |
319 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); | 319 | connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); |
320 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); | 320 | a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); |
321 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); | 321 | connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); |
322 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 322 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
323 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 323 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
324 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 324 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
325 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 325 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
326 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 326 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
327 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 327 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
328 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 328 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
329 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 329 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
330 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 330 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
331 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 331 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
332 | /* | 332 | /* |
333 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 333 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
334 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 334 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
335 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 335 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
336 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 336 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
337 | */ | 337 | */ |
338 | 338 | ||
339 | secondToolBar = new QPEToolBar( this ); | 339 | secondToolBar = new QPEToolBar( this ); |
340 | secondToolBar->setHorizontalStretchable( TRUE ); | 340 | secondToolBar->setHorizontalStretchable( TRUE ); |
341 | 341 | ||
342 | commonCombo = new QComboBox( secondToolBar ); | 342 | commonCombo = new QComboBox( secondToolBar ); |
343 | commonCombo->setMaximumWidth(236); | 343 | commonCombo->setMaximumWidth(236); |
344 | 344 | ||
345 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 345 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
346 | if( listHidden) { | 346 | if( listHidden) { |
347 | secondToolBar->hide(); | 347 | secondToolBar->hide(); |
348 | editCommandListMenu->setItemEnabled(-23 ,FALSE); | 348 | editCommandListMenu->setItemEnabled(-23 ,FALSE); |
349 | } | 349 | } |
350 | editCommandListMenu->insertItem(tr( "Edit" ) ); | 350 | editCommandListMenu->insertItem(tr( "Edit" ) ); |
351 | 351 | ||
352 | cfg.setGroup("Commands"); | 352 | cfg.setGroup("Commands"); |
353 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 353 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
354 | 354 | ||
355 | initCommandList(); | 355 | initCommandList(); |
356 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 356 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
357 | // commonCombo->insertItem( commonCmds[i], i ); | 357 | // commonCombo->insertItem( commonCmds[i], i ); |
358 | // tmp = cfg.readEntry( QString::number(i),""); | 358 | // tmp = cfg.readEntry( QString::number(i),""); |
359 | // if(tmp != "") | 359 | // if(tmp != "") |
360 | // commonCombo->changeItem( tmp,i ); | 360 | // commonCombo->changeItem( tmp,i ); |
361 | // } | 361 | // } |
362 | 362 | ||
363 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 363 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
364 | 364 | ||
365 | scrollMenu->insertItem(tr( "None" )); | 365 | scrollMenu->insertItem(tr( "None" )); |
366 | scrollMenu->insertItem(tr( "Left" )); | 366 | scrollMenu->insertItem(tr( "Left" )); |
367 | scrollMenu->insertItem(tr( "Right" )); | 367 | scrollMenu->insertItem(tr( "Right" )); |
368 | // scrollMenu->insertSeparator(4); | 368 | // scrollMenu->insertSeparator(4); |
369 | // scrollMenu->insertItem(tr( "Horizontal" )); | 369 | // scrollMenu->insertItem(tr( "Horizontal" )); |
370 | 370 | ||
371 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 371 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
372 | 372 | ||
373 | int jut = configMenu->insertItem(tr( "Wrap" )); | 373 | int jut = configMenu->insertItem(tr( "Wrap" )); |
374 | cfg.setGroup("ScrollBar"); | 374 | cfg.setGroup("ScrollBar"); |
375 | configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0)); | 375 | configMenu->setItemChecked(jut, cfg.readBoolEntry("HorzScroll",0)); |
376 | 376 | ||
377 | jut = configMenu->insertItem(tr( "Use Beep" )); | 377 | jut = configMenu->insertItem(tr( "Use Beep" )); |
378 | cfg.setGroup("Menubar"); | 378 | cfg.setGroup("Menubar"); |
379 | configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); | 379 | configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); |
380 | 380 | ||
381 | 381 | ||
382 | //scrollMenuSelected(-29); | 382 | //scrollMenuSelected(-29); |
383 | // cfg.setGroup("ScrollBar"); | 383 | // cfg.setGroup("ScrollBar"); |
384 | // if(cfg.readBoolEntry("HorzScroll",0)) { | 384 | // if(cfg.readBoolEntry("HorzScroll",0)) { |
385 | // if(cfg.readNumEntry("Position",2) == 0) | 385 | // if(cfg.readNumEntry("Position",2) == 0) |
386 | // te->setScrollbarLocation(1); | 386 | // te->setScrollbarLocation(1); |
387 | // else | 387 | // else |
388 | // te->setScrollbarLocation(0); | 388 | // te->setScrollbarLocation(0); |
389 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 389 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
390 | // te->setWrapAt(120); | 390 | // te->setWrapAt(120); |
391 | // } | 391 | // } |
392 | // create applications ///////////////////////////////////////////////////// | 392 | // create applications ///////////////////////////////////////////////////// |
393 | setCentralWidget(tab); | 393 | setCentralWidget(tab); |
394 | 394 | ||
395 | // load keymaps //////////////////////////////////////////////////////////// | 395 | // load keymaps //////////////////////////////////////////////////////////// |
396 | KeyTrans::loadAll(); | 396 | KeyTrans::loadAll(); |
397 | for (int i = 0; i < KeyTrans::count(); i++) | 397 | for (int i = 0; i < KeyTrans::count(); i++) |
398 | { KeyTrans* s = KeyTrans::find(i); | 398 | { KeyTrans* s = KeyTrans::find(i); |
399 | assert( s ); | 399 | assert( s ); |
400 | } | 400 | } |
401 | 401 | ||
402 | se_pgm = _pgm; | 402 | se_pgm = _pgm; |
403 | se_args = _args; | 403 | se_args = _args; |
404 | se_args.prepend("--login"); | 404 | se_args.prepend("--login"); |
405 | parseCommandLine(); | 405 | parseCommandLine(); |
406 | // read and apply default values /////////////////////////////////////////// | 406 | // read and apply default values /////////////////////////////////////////// |
407 | resize(321, 321); // Dummy. | 407 | resize(321, 321); // Dummy. |
408 | QSize currentSize = size(); | 408 | QSize currentSize = size(); |
409 | if (currentSize != size()) | 409 | if (currentSize != size()) |
@@ -687,261 +687,261 @@ void Konsole::colorMenuSelected(int iD) | |||
687 | background.setRgb(0x00,0x00,0x00); | 687 | background.setRgb(0x00,0x00,0x00); |
688 | cfg.writeEntry("Schema","6"); | 688 | cfg.writeEntry("Schema","6"); |
689 | colorMenu->setItemChecked(-6,TRUE); | 689 | colorMenu->setItemChecked(-6,TRUE); |
690 | } | 690 | } |
691 | if(iD==-7) { // black white | 691 | if(iD==-7) { // black white |
692 | foreground.setRgb(0x00,0x00,0x00); | 692 | foreground.setRgb(0x00,0x00,0x00); |
693 | background.setRgb(0xFF,0xFF,0xFF); | 693 | background.setRgb(0xFF,0xFF,0xFF); |
694 | cfg.writeEntry("Schema","7"); | 694 | cfg.writeEntry("Schema","7"); |
695 | colorMenu->setItemChecked(-7,TRUE); | 695 | colorMenu->setItemChecked(-7,TRUE); |
696 | } | 696 | } |
697 | if(iD==-8) { // white black | 697 | if(iD==-8) { // white black |
698 | foreground.setRgb(0xFF,0xFF,0xFF); | 698 | foreground.setRgb(0xFF,0xFF,0xFF); |
699 | background.setRgb(0x00,0x00,0x00); | 699 | background.setRgb(0x00,0x00,0x00); |
700 | cfg.writeEntry("Schema","8"); | 700 | cfg.writeEntry("Schema","8"); |
701 | colorMenu->setItemChecked(-8,TRUE); | 701 | colorMenu->setItemChecked(-8,TRUE); |
702 | } | 702 | } |
703 | if(iD==-10) {// Black, Red | 703 | if(iD==-10) {// Black, Red |
704 | foreground.setRgb(0x00,0x00,0x00); | 704 | foreground.setRgb(0x00,0x00,0x00); |
705 | background.setRgb(0xB2,0x18,0x18); | 705 | background.setRgb(0xB2,0x18,0x18); |
706 | cfg.writeEntry("Schema","10"); | 706 | cfg.writeEntry("Schema","10"); |
707 | colorMenu->setItemChecked(-10,TRUE); | 707 | colorMenu->setItemChecked(-10,TRUE); |
708 | } | 708 | } |
709 | if(iD==-11) {// Red, Black | 709 | if(iD==-11) {// Red, Black |
710 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 710 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
711 | background.setRgb(0x00,0x00,0x00); | 711 | background.setRgb(0x00,0x00,0x00); |
712 | cfg.writeEntry("Schema","11"); | 712 | cfg.writeEntry("Schema","11"); |
713 | colorMenu->setItemChecked(-11,TRUE); | 713 | colorMenu->setItemChecked(-11,TRUE); |
714 | } | 714 | } |
715 | if(iD==-12) {// Green, Yellow - is ugly | 715 | if(iD==-12) {// Green, Yellow - is ugly |
716 | // foreground.setRgb(0x18,0xB2,0x18); | 716 | // foreground.setRgb(0x18,0xB2,0x18); |
717 | foreground.setRgb(36,139,10); | 717 | foreground.setRgb(36,139,10); |
718 | // background.setRgb(0xB2,0x68,0x18); | 718 | // background.setRgb(0xB2,0x68,0x18); |
719 | background.setRgb(255,255,0); | 719 | background.setRgb(255,255,0); |
720 | cfg.writeEntry("Schema","12"); | 720 | cfg.writeEntry("Schema","12"); |
721 | colorMenu->setItemChecked(-12,TRUE); | 721 | colorMenu->setItemChecked(-12,TRUE); |
722 | } | 722 | } |
723 | if(iD==-13) {// Blue, Magenta | 723 | if(iD==-13) {// Blue, Magenta |
724 | foreground.setRgb(0x18,0xB2,0xB2); | 724 | foreground.setRgb(0x18,0xB2,0xB2); |
725 | background.setRgb(0x18,0x18,0xB2); | 725 | background.setRgb(0x18,0x18,0xB2); |
726 | cfg.writeEntry("Schema","13"); | 726 | cfg.writeEntry("Schema","13"); |
727 | colorMenu->setItemChecked(-13,TRUE); | 727 | colorMenu->setItemChecked(-13,TRUE); |
728 | } | 728 | } |
729 | if(iD==-14) {// Magenta, Blue | 729 | if(iD==-14) {// Magenta, Blue |
730 | foreground.setRgb(0x18,0x18,0xB2); | 730 | foreground.setRgb(0x18,0x18,0xB2); |
731 | background.setRgb(0x18,0xB2,0xB2); | 731 | background.setRgb(0x18,0xB2,0xB2); |
732 | cfg.writeEntry("Schema","14"); | 732 | cfg.writeEntry("Schema","14"); |
733 | colorMenu->setItemChecked(-14,TRUE); | 733 | colorMenu->setItemChecked(-14,TRUE); |
734 | } | 734 | } |
735 | if(iD==-15) {// Cyan, White | 735 | if(iD==-15) {// Cyan, White |
736 | foreground.setRgb(0x18,0xB2,0xB2); | 736 | foreground.setRgb(0x18,0xB2,0xB2); |
737 | background.setRgb(0xFF,0xFF,0xFF); | 737 | background.setRgb(0xFF,0xFF,0xFF); |
738 | cfg.writeEntry("Schema","15"); | 738 | cfg.writeEntry("Schema","15"); |
739 | colorMenu->setItemChecked(-15,TRUE); | 739 | colorMenu->setItemChecked(-15,TRUE); |
740 | } | 740 | } |
741 | if(iD==-16) {// White, Cyan | 741 | if(iD==-16) {// White, Cyan |
742 | background.setRgb(0x18,0xB2,0xB2); | 742 | background.setRgb(0x18,0xB2,0xB2); |
743 | foreground.setRgb(0xFF,0xFF,0xFF); | 743 | foreground.setRgb(0xFF,0xFF,0xFF); |
744 | cfg.writeEntry("Schema","16"); | 744 | cfg.writeEntry("Schema","16"); |
745 | colorMenu->setItemChecked(-16,TRUE); | 745 | colorMenu->setItemChecked(-16,TRUE); |
746 | } | 746 | } |
747 | if(iD==-17) {// Black, Blue | 747 | if(iD==-17) {// Black, Blue |
748 | background.setRgb(0x00,0x00,0x00); | 748 | background.setRgb(0x00,0x00,0x00); |
749 | foreground.setRgb(0x18,0xB2,0xB2); | 749 | foreground.setRgb(0x18,0xB2,0xB2); |
750 | cfg.writeEntry("Schema","17"); | 750 | cfg.writeEntry("Schema","17"); |
751 | colorMenu->setItemChecked(-17,TRUE); | 751 | colorMenu->setItemChecked(-17,TRUE); |
752 | } | 752 | } |
753 | if(iD==-18) {// Black, Gold | 753 | if(iD==-18) {// Black, Gold |
754 | background.setRgb(0x00,0x00,0x00); | 754 | background.setRgb(0x00,0x00,0x00); |
755 | foreground.setRgb(255,215,0); | 755 | foreground.setRgb(255,215,0); |
756 | cfg.writeEntry("Schema","18"); | 756 | cfg.writeEntry("Schema","18"); |
757 | colorMenu->setItemChecked(-18,TRUE); | 757 | colorMenu->setItemChecked(-18,TRUE); |
758 | } | 758 | } |
759 | #ifdef QT_QWS_OPIE | 759 | #ifdef QT_QWS_OPIE |
760 | if(iD==-19) { | 760 | if(iD==-19) { |
761 | // Custom | 761 | // Custom |
762 | qDebug("do custom"); | 762 | qDebug("do custom"); |
763 | if(fromMenu) { | 763 | if(fromMenu) { |
764 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 764 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
765 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 765 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
766 | SLOT(changeForegroundColor(const QColor&))); | 766 | SLOT(changeForegroundColor(const QColor&))); |
767 | penColorPopupMenu->exec(); | 767 | penColorPopupMenu->exec(); |
768 | } | 768 | } |
769 | cfg.writeEntry("Schema","19"); | 769 | cfg.writeEntry("Schema","19"); |
770 | if(!fromMenu) { | 770 | if(!fromMenu) { |
771 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 771 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
772 | background.setNamedColor(cfg.readEntry("background","")); | 772 | background.setNamedColor(cfg.readEntry("background","")); |
773 | } | 773 | } |
774 | fromMenu=FALSE; | 774 | fromMenu=FALSE; |
775 | colorMenu->setItemChecked(-19,TRUE); | 775 | colorMenu->setItemChecked(-19,TRUE); |
776 | } | 776 | } |
777 | #endif | 777 | #endif |
778 | for (i = 0; i < TABLE_COLORS; i++) { | 778 | for (i = 0; i < TABLE_COLORS; i++) { |
779 | if(i==0 || i == 10) { | 779 | if(i==0 || i == 10) { |
780 | m_table[i].color = foreground; | 780 | m_table[i].color = foreground; |
781 | } | 781 | } |
782 | else if(i==1 || i == 11) { | 782 | else if(i==1 || i == 11) { |
783 | m_table[i].color = background; m_table[i].transparent=0; | 783 | m_table[i].color = background; m_table[i].transparent=0; |
784 | } | 784 | } |
785 | else | 785 | else |
786 | m_table[i].color = defaultCt[i].color; | 786 | m_table[i].color = defaultCt[i].color; |
787 | } | 787 | } |
788 | } | 788 | } |
789 | lastSelectedMenu = iD; | 789 | lastSelectedMenu = iD; |
790 | te->setColorTable(m_table); | 790 | te->setColorTable(m_table); |
791 | update(); | 791 | update(); |
792 | 792 | ||
793 | } | 793 | } |
794 | 794 | ||
795 | void Konsole::configMenuSelected(int iD) | 795 | void Konsole::configMenuSelected(int iD) |
796 | { | 796 | { |
797 | // QString temp; | 797 | // QString temp; |
798 | // qDebug( temp.sprintf("configmenu %d",iD)); | 798 | // qDebug( temp.sprintf("configmenu %d",iD)); |
799 | TEWidget* te = getTe(); | 799 | TEWidget* te = getTe(); |
800 | Config cfg("Konsole"); | 800 | Config cfg("Konsole"); |
801 | cfg.setGroup("Menubar"); | 801 | cfg.setGroup("Menubar"); |
802 | int i,j; | 802 | int i,j; |
803 | #ifdef QT_QWS_OPIE | 803 | #ifdef QT_QWS_OPIE |
804 | i=-29;j=-30; | 804 | i=-29;j=-30; |
805 | #else | 805 | #else |
806 | i=-28;j=-29; | 806 | i=-28;j=-29; |
807 | #endif | 807 | #endif |
808 | 808 | ||
809 | if(iD == -4) { | 809 | if(iD == -4) { |
810 | cfg.setGroup("Tabs"); | 810 | cfg.setGroup("Tabs"); |
811 | QString tmp=cfg.readEntry("Position","Bottom"); | 811 | QString tmp=cfg.readEntry("Position","Bottom"); |
812 | 812 | ||
813 | if(tmp=="Top") { | 813 | if(tmp=="Top") { |
814 | tab->setTabPosition(QTabWidget::Bottom); | 814 | tab->setTabPosition(QTabWidget::Bottom); |
815 | configMenu->changeItem( iD,"Tabs on Top"); | 815 | configMenu->changeItem( iD, tr("Tabs on Top")); |
816 | cfg.writeEntry("Position","Bottom"); | 816 | cfg.writeEntry("Position","Bottom"); |
817 | } else { | 817 | } else { |
818 | tab->setTabPosition(QTabWidget::Top); | 818 | tab->setTabPosition(QTabWidget::Top); |
819 | configMenu->changeItem( iD,"Tabs on Bottom"); | 819 | configMenu->changeItem( iD, tr("Tabs on Bottom")); |
820 | cfg.writeEntry("Position","Top"); | 820 | cfg.writeEntry("Position","Top"); |
821 | } | 821 | } |
822 | } | 822 | } |
823 | if(iD == i) { | 823 | if(iD == i) { |
824 | cfg.setGroup("ScrollBar"); | 824 | cfg.setGroup("ScrollBar"); |
825 | bool b=cfg.readBoolEntry("HorzScroll",0); | 825 | bool b=cfg.readBoolEntry("HorzScroll",0); |
826 | b=!b; | 826 | b=!b; |
827 | cfg.writeEntry("HorzScroll", b ); | 827 | cfg.writeEntry("HorzScroll", b ); |
828 | cfg.write(); | 828 | cfg.write(); |
829 | doWrap(); | 829 | doWrap(); |
830 | if(cfg.readNumEntry("Position",2) == 0) { | 830 | if(cfg.readNumEntry("Position",2) == 0) { |
831 | te->setScrollbarLocation(1); | 831 | te->setScrollbarLocation(1); |
832 | } else { | 832 | } else { |
833 | te->setScrollbarLocation(0); | 833 | te->setScrollbarLocation(0); |
834 | } | 834 | } |
835 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 835 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
836 | } | 836 | } |
837 | if(iD == j) { | 837 | if(iD == j) { |
838 | cfg.setGroup("Menubar"); | 838 | cfg.setGroup("Menubar"); |
839 | bool b=cfg.readBoolEntry("useBeep",0); | 839 | bool b=cfg.readBoolEntry("useBeep",0); |
840 | b=!b; | 840 | b=!b; |
841 | cfg.writeEntry("useBeep", b ); | 841 | cfg.writeEntry("useBeep", b ); |
842 | cfg.write(); | 842 | cfg.write(); |
843 | configMenu->setItemChecked(j,b); | 843 | configMenu->setItemChecked(j,b); |
844 | te->useBeep=b; | 844 | te->useBeep=b; |
845 | } | 845 | } |
846 | } | 846 | } |
847 | 847 | ||
848 | void Konsole::changeCommand(const QString &text, int c) | 848 | void Konsole::changeCommand(const QString &text, int c) |
849 | { | 849 | { |
850 | Config cfg("Konsole"); | 850 | Config cfg("Konsole"); |
851 | cfg.setGroup("Commands"); | 851 | cfg.setGroup("Commands"); |
852 | if(commonCmds[c] != text) { | 852 | if(commonCmds[c] != text) { |
853 | cfg.writeEntry(QString::number(c),text); | 853 | cfg.writeEntry(QString::number(c),text); |
854 | commonCombo->clearEdit(); | 854 | commonCombo->clearEdit(); |
855 | commonCombo->setCurrentItem(c); | 855 | commonCombo->setCurrentItem(c); |
856 | } | 856 | } |
857 | } | 857 | } |
858 | 858 | ||
859 | void Konsole::setColor() | 859 | void Konsole::setColor() |
860 | { | 860 | { |
861 | Config cfg("Konsole"); | 861 | Config cfg("Konsole"); |
862 | cfg.setGroup("Colors"); | 862 | cfg.setGroup("Colors"); |
863 | int scheme = cfg.readNumEntry("Schema",1); | 863 | int scheme = cfg.readNumEntry("Schema",1); |
864 | if(scheme != 1) colorMenuSelected( -scheme); | 864 | if(scheme != 1) colorMenuSelected( -scheme); |
865 | } | 865 | } |
866 | 866 | ||
867 | void Konsole::scrollMenuSelected(int index) | 867 | void Konsole::scrollMenuSelected(int index) |
868 | { | 868 | { |
869 | qDebug( "scrollbar menu %d",index); | 869 | qDebug( "scrollbar menu %d",index); |
870 | TEWidget* te = getTe(); | 870 | TEWidget* te = getTe(); |
871 | Config cfg("Konsole"); | 871 | Config cfg("Konsole"); |
872 | cfg.setGroup("ScrollBar"); | 872 | cfg.setGroup("ScrollBar"); |
873 | int i,j,k; | 873 | int i,j,k; |
874 | #ifdef QT_QWS_OPIE | 874 | #ifdef QT_QWS_OPIE |
875 | i=-25;j=-26;k=-27; | 875 | i=-25;j=-26;k=-27; |
876 | #else | 876 | #else |
877 | i=-24;j=-25;k=-26; | 877 | i=-24;j=-25;k=-26; |
878 | #endif | 878 | #endif |
879 | if(index == i) { | 879 | if(index == i) { |
880 | 880 | ||
881 | te->setScrollbarLocation(0); | 881 | te->setScrollbarLocation(0); |
882 | cfg.writeEntry("Position",0); | 882 | cfg.writeEntry("Position",0); |
883 | } else if(index == j) { | 883 | } else if(index == j) { |
884 | 884 | ||
885 | te->setScrollbarLocation(1); | 885 | te->setScrollbarLocation(1); |
886 | cfg.writeEntry("Position",1); | 886 | cfg.writeEntry("Position",1); |
887 | } else if(index == k) { | 887 | } else if(index == k) { |
888 | 888 | ||
889 | te->setScrollbarLocation(2); | 889 | te->setScrollbarLocation(2); |
890 | cfg.writeEntry("Position",2); | 890 | cfg.writeEntry("Position",2); |
891 | } | 891 | } |
892 | 892 | ||
893 | // case -29: { | 893 | // case -29: { |
894 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 894 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
895 | // cfg.writeEntry("HorzScroll", !b ); | 895 | // cfg.writeEntry("HorzScroll", !b ); |
896 | // cfg.write(); | 896 | // cfg.write(); |
897 | // if(cfg.readNumEntry("Position",2) == 0) { | 897 | // if(cfg.readNumEntry("Position",2) == 0) { |
898 | // te->setScrollbarLocation(1); | 898 | // te->setScrollbarLocation(1); |
899 | // te->setWrapAt(0); | 899 | // te->setWrapAt(0); |
900 | // } else { | 900 | // } else { |
901 | // te->setScrollbarLocation(0); | 901 | // te->setScrollbarLocation(0); |
902 | // te->setWrapAt(120); | 902 | // te->setWrapAt(120); |
903 | // } | 903 | // } |
904 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 904 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
905 | // } | 905 | // } |
906 | // break; | 906 | // break; |
907 | } | 907 | } |
908 | 908 | ||
909 | void Konsole::editCommandListMenuSelected(int iD) | 909 | void Konsole::editCommandListMenuSelected(int iD) |
910 | { | 910 | { |
911 | // QString temp; | 911 | // QString temp; |
912 | // qDebug( temp.sprintf("edit command list %d",iD)); | 912 | // qDebug( temp.sprintf("edit command list %d",iD)); |
913 | TEWidget* te = getTe(); | 913 | TEWidget* te = getTe(); |
914 | Config cfg("Konsole"); | 914 | Config cfg("Konsole"); |
915 | cfg.setGroup("Menubar"); | 915 | cfg.setGroup("Menubar"); |
916 | if( iD == -3) { | 916 | if( iD == -3) { |
917 | if(!secondToolBar->isHidden()) { | 917 | if(!secondToolBar->isHidden()) { |
918 | secondToolBar->hide(); | 918 | secondToolBar->hide(); |
919 | configMenu->changeItem( iD,tr( "Show Command List" )); | 919 | configMenu->changeItem( iD,tr( "Show Command List" )); |
920 | cfg.writeEntry("Hidden","TRUE"); | 920 | cfg.writeEntry("Hidden","TRUE"); |
921 | configMenu->setItemEnabled(-23 ,FALSE); | 921 | configMenu->setItemEnabled(-23 ,FALSE); |
922 | } else { | 922 | } else { |
923 | secondToolBar->show(); | 923 | secondToolBar->show(); |
924 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 924 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
925 | cfg.writeEntry("Hidden","FALSE"); | 925 | cfg.writeEntry("Hidden","FALSE"); |
926 | configMenu->setItemEnabled(-23 ,TRUE); | 926 | configMenu->setItemEnabled(-23 ,TRUE); |
927 | 927 | ||
928 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 928 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
929 | configMenu->setItemChecked(-23,TRUE); | 929 | configMenu->setItemChecked(-23,TRUE); |
930 | commonCombo->setEditable( TRUE ); | 930 | commonCombo->setEditable( TRUE ); |
931 | } else { | 931 | } else { |
932 | configMenu->setItemChecked(-23,FALSE); | 932 | configMenu->setItemChecked(-23,FALSE); |
933 | commonCombo->setEditable( FALSE ); | 933 | commonCombo->setEditable( FALSE ); |
934 | } | 934 | } |
935 | } | 935 | } |
936 | } | 936 | } |
937 | if( iD == -23) { | 937 | if( iD == -23) { |
938 | cfg.setGroup("Commands"); | 938 | cfg.setGroup("Commands"); |
939 | // qDebug("enableCommandEdit"); | 939 | // qDebug("enableCommandEdit"); |
940 | if( !configMenu->isItemChecked(iD) ) { | 940 | if( !configMenu->isItemChecked(iD) ) { |
941 | commonCombo->setEditable( TRUE ); | 941 | commonCombo->setEditable( TRUE ); |
942 | configMenu->setItemChecked(iD,TRUE); | 942 | configMenu->setItemChecked(iD,TRUE); |
943 | commonCombo->setCurrentItem(0); | 943 | commonCombo->setCurrentItem(0); |
944 | cfg.writeEntry("EditEnabled","TRUE"); | 944 | cfg.writeEntry("EditEnabled","TRUE"); |
945 | } else { | 945 | } else { |
946 | commonCombo->setEditable( FALSE ); | 946 | commonCombo->setEditable( FALSE ); |
947 | configMenu->setItemChecked(iD,FALSE); | 947 | configMenu->setItemChecked(iD,FALSE); |