author | kergoth <kergoth> | 2002-02-01 16:50:44 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-02-01 16:50:44 (UTC) |
commit | 4ffeffe4e91867dca42c02ddc5521d4182cabbb6 (patch) (unidiff) | |
tree | af230edd81ebf47d090478d3048f459b1e685582 | |
parent | 07ec85f797cad04431df30855a81b88f06fe27d3 (diff) | |
download | opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.zip opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.tar.gz opie-4ffeffe4e91867dca42c02ddc5521d4182cabbb6.tar.bz2 |
Per ljp, uncommented line 680.
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 1102ef3..f3f0c29 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -296,467 +296,467 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
296 | commonCombo = new QComboBox( secondToolBar ); | 296 | commonCombo = new QComboBox( secondToolBar ); |
297 | 297 | ||
298 | if( listHidden) | 298 | if( listHidden) |
299 | secondToolBar->hide(); | 299 | secondToolBar->hide(); |
300 | configMenu->insertItem( "Edit Command List"); | 300 | configMenu->insertItem( "Edit Command List"); |
301 | 301 | ||
302 | cfg.setGroup("Commands"); | 302 | cfg.setGroup("Commands"); |
303 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 303 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
304 | 304 | ||
305 | for (int i = 0; commonCmds[i] != NULL; i++) { | 305 | for (int i = 0; commonCmds[i] != NULL; i++) { |
306 | commonCombo->insertItem( commonCmds[i], i ); | 306 | commonCombo->insertItem( commonCmds[i], i ); |
307 | tmp = cfg.readEntry( QString::number(i),""); | 307 | tmp = cfg.readEntry( QString::number(i),""); |
308 | if(tmp != "") | 308 | if(tmp != "") |
309 | commonCombo->changeItem( tmp,i ); | 309 | commonCombo->changeItem( tmp,i ); |
310 | } | 310 | } |
311 | 311 | ||
312 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 312 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
313 | 313 | ||
314 | // create applications ///////////////////////////////////////////////////// | 314 | // create applications ///////////////////////////////////////////////////// |
315 | setCentralWidget(tab); | 315 | setCentralWidget(tab); |
316 | 316 | ||
317 | // load keymaps //////////////////////////////////////////////////////////// | 317 | // load keymaps //////////////////////////////////////////////////////////// |
318 | KeyTrans::loadAll(); | 318 | KeyTrans::loadAll(); |
319 | for (int i = 0; i < KeyTrans::count(); i++) | 319 | for (int i = 0; i < KeyTrans::count(); i++) |
320 | { KeyTrans* s = KeyTrans::find(i); | 320 | { KeyTrans* s = KeyTrans::find(i); |
321 | assert( s ); | 321 | assert( s ); |
322 | } | 322 | } |
323 | 323 | ||
324 | se_pgm = _pgm; | 324 | se_pgm = _pgm; |
325 | se_args = _args; | 325 | se_args = _args; |
326 | 326 | ||
327 | // read and apply default values /////////////////////////////////////////// | 327 | // read and apply default values /////////////////////////////////////////// |
328 | resize(321, 321); // Dummy. | 328 | resize(321, 321); // Dummy. |
329 | QSize currentSize = size(); | 329 | QSize currentSize = size(); |
330 | if (currentSize != size()) | 330 | if (currentSize != size()) |
331 | defaultSize = size(); | 331 | defaultSize = size(); |
332 | 332 | ||
333 | } | 333 | } |
334 | 334 | ||
335 | void Konsole::show() | 335 | void Konsole::show() |
336 | { | 336 | { |
337 | if ( !nsessions ) { | 337 | if ( !nsessions ) { |
338 | newSession(); | 338 | newSession(); |
339 | } | 339 | } |
340 | QMainWindow::show(); | 340 | QMainWindow::show(); |
341 | } | 341 | } |
342 | 342 | ||
343 | void Konsole::initSession(const char*, QStrList &) | 343 | void Konsole::initSession(const char*, QStrList &) |
344 | { | 344 | { |
345 | QMainWindow::show(); | 345 | QMainWindow::show(); |
346 | } | 346 | } |
347 | 347 | ||
348 | Konsole::~Konsole() | 348 | Konsole::~Konsole() |
349 | { | 349 | { |
350 | while (nsessions > 0) { | 350 | while (nsessions > 0) { |
351 | doneSession(getTe()->currentSession, 0); | 351 | doneSession(getTe()->currentSession, 0); |
352 | } | 352 | } |
353 | 353 | ||
354 | Config cfg("Konsole"); | 354 | Config cfg("Konsole"); |
355 | cfg.setGroup("Konsole"); | 355 | cfg.setGroup("Konsole"); |
356 | cfg.writeEntry("FontID", cfont); | 356 | cfg.writeEntry("FontID", cfont); |
357 | } | 357 | } |
358 | 358 | ||
359 | void Konsole::fontChanged(int f) | 359 | void Konsole::fontChanged(int f) |
360 | { | 360 | { |
361 | VTFont* font = fonts.at(f); | 361 | VTFont* font = fonts.at(f); |
362 | if (font != 0) { | 362 | if (font != 0) { |
363 | for(uint i = 0; i < fonts.count(); i++) { | 363 | for(uint i = 0; i < fonts.count(); i++) { |
364 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 364 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
365 | } | 365 | } |
366 | 366 | ||
367 | cfont = f; | 367 | cfont = f; |
368 | 368 | ||
369 | TEWidget* te = getTe(); | 369 | TEWidget* te = getTe(); |
370 | if (te != 0) { | 370 | if (te != 0) { |
371 | te->setVTFont(font->getFont()); | 371 | te->setVTFont(font->getFont()); |
372 | } | 372 | } |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | 376 | ||
377 | void Konsole::enterCommand(int c) | 377 | void Konsole::enterCommand(int c) |
378 | { | 378 | { |
379 | TEWidget* te = getTe(); | 379 | TEWidget* te = getTe(); |
380 | if (te != 0) { | 380 | if (te != 0) { |
381 | if(!commonCombo->editable()) { | 381 | if(!commonCombo->editable()) { |
382 | QString text = commonCombo->text(c); //commonCmds[c]; | 382 | QString text = commonCombo->text(c); //commonCmds[c]; |
383 | te->emitText(text); | 383 | te->emitText(text); |
384 | } else { | 384 | } else { |
385 | changeCommand( commonCombo->text(c), c); | 385 | changeCommand( commonCombo->text(c), c); |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | void Konsole::hitEnter() | 390 | void Konsole::hitEnter() |
391 | { | 391 | { |
392 | TEWidget* te = getTe(); | 392 | TEWidget* te = getTe(); |
393 | if (te != 0) { | 393 | if (te != 0) { |
394 | te->emitText(QString("\r")); | 394 | te->emitText(QString("\r")); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | 397 | ||
398 | void Konsole::hitSpace() | 398 | void Konsole::hitSpace() |
399 | { | 399 | { |
400 | TEWidget* te = getTe(); | 400 | TEWidget* te = getTe(); |
401 | if (te != 0) { | 401 | if (te != 0) { |
402 | te->emitText(QString(" ")); | 402 | te->emitText(QString(" ")); |
403 | } | 403 | } |
404 | } | 404 | } |
405 | 405 | ||
406 | void Konsole::hitTab() | 406 | void Konsole::hitTab() |
407 | { | 407 | { |
408 | TEWidget* te = getTe(); | 408 | TEWidget* te = getTe(); |
409 | if (te != 0) { | 409 | if (te != 0) { |
410 | te->emitText(QString("\t")); | 410 | te->emitText(QString("\t")); |
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | void Konsole::hitPaste() | 414 | void Konsole::hitPaste() |
415 | { | 415 | { |
416 | TEWidget* te = getTe(); | 416 | TEWidget* te = getTe(); |
417 | if (te != 0) { | 417 | if (te != 0) { |
418 | te->pasteClipboard(); | 418 | te->pasteClipboard(); |
419 | } | 419 | } |
420 | } | 420 | } |
421 | 421 | ||
422 | void Konsole::hitUp() | 422 | void Konsole::hitUp() |
423 | { | 423 | { |
424 | TEWidget* te = getTe(); | 424 | TEWidget* te = getTe(); |
425 | if (te != 0) { | 425 | if (te != 0) { |
426 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); | 426 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); |
427 | QApplication::sendEvent( te, &ke ); | 427 | QApplication::sendEvent( te, &ke ); |
428 | } | 428 | } |
429 | } | 429 | } |
430 | 430 | ||
431 | void Konsole::hitDown() | 431 | void Konsole::hitDown() |
432 | { | 432 | { |
433 | TEWidget* te = getTe(); | 433 | TEWidget* te = getTe(); |
434 | if (te != 0) { | 434 | if (te != 0) { |
435 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); | 435 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); |
436 | QApplication::sendEvent( te, &ke ); | 436 | QApplication::sendEvent( te, &ke ); |
437 | } | 437 | } |
438 | } | 438 | } |
439 | 439 | ||
440 | /** | 440 | /** |
441 | This function calculates the size of the external widget | 441 | This function calculates the size of the external widget |
442 | needed for the internal widget to be | 442 | needed for the internal widget to be |
443 | */ | 443 | */ |
444 | QSize Konsole::calcSize(int columns, int lines) { | 444 | QSize Konsole::calcSize(int columns, int lines) { |
445 | TEWidget* te = getTe(); | 445 | TEWidget* te = getTe(); |
446 | if (te != 0) { | 446 | if (te != 0) { |
447 | QSize size = te->calcSize(columns, lines); | 447 | QSize size = te->calcSize(columns, lines); |
448 | return size; | 448 | return size; |
449 | } else { | 449 | } else { |
450 | QSize size; | 450 | QSize size; |
451 | return size; | 451 | return size; |
452 | } | 452 | } |
453 | } | 453 | } |
454 | 454 | ||
455 | /** | 455 | /** |
456 | sets application window to a size based on columns X lines of the te | 456 | sets application window to a size based on columns X lines of the te |
457 | guest widget. Call with (0,0) for setting default size. | 457 | guest widget. Call with (0,0) for setting default size. |
458 | */ | 458 | */ |
459 | 459 | ||
460 | void Konsole::setColLin(int columns, int lines) | 460 | void Konsole::setColLin(int columns, int lines) |
461 | { | 461 | { |
462 | if ((columns==0) || (lines==0)) | 462 | if ((columns==0) || (lines==0)) |
463 | { | 463 | { |
464 | if (defaultSize.isEmpty()) // not in config file : set default value | 464 | if (defaultSize.isEmpty()) // not in config file : set default value |
465 | { | 465 | { |
466 | defaultSize = calcSize(80,24); | 466 | defaultSize = calcSize(80,24); |
467 | // notifySize(24,80); // set menu items (strange arg order !) | 467 | // notifySize(24,80); // set menu items (strange arg order !) |
468 | } | 468 | } |
469 | resize(defaultSize); | 469 | resize(defaultSize); |
470 | } else { | 470 | } else { |
471 | resize(calcSize(columns, lines)); | 471 | resize(calcSize(columns, lines)); |
472 | // notifySize(lines,columns); // set menu items (strange arg order !) | 472 | // notifySize(lines,columns); // set menu items (strange arg order !) |
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | /* | 476 | /* |
477 | void Konsole::setFont(int fontno) | 477 | void Konsole::setFont(int fontno) |
478 | { | 478 | { |
479 | QFont f; | 479 | QFont f; |
480 | if (fontno == 0) | 480 | if (fontno == 0) |
481 | f = defaultFont = QFont( "Helvetica", 12 ); | 481 | f = defaultFont = QFont( "Helvetica", 12 ); |
482 | else | 482 | else |
483 | if (fonts[fontno][0] == '-') | 483 | if (fonts[fontno][0] == '-') |
484 | f.setRawName( fonts[fontno] ); | 484 | f.setRawName( fonts[fontno] ); |
485 | else | 485 | else |
486 | { | 486 | { |
487 | f.setFamily(fonts[fontno]); | 487 | f.setFamily(fonts[fontno]); |
488 | f.setRawMode( TRUE ); | 488 | f.setRawMode( TRUE ); |
489 | } | 489 | } |
490 | if ( !f.exactMatch() && fontno != 0) | 490 | if ( !f.exactMatch() && fontno != 0) |
491 | { | 491 | { |
492 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 492 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
493 | QMessageBox(this, msg); | 493 | QMessageBox(this, msg); |
494 | return; | 494 | return; |
495 | } | 495 | } |
496 | if (se) se->setFontNo(fontno); | 496 | if (se) se->setFontNo(fontno); |
497 | te->setVTFont(f); | 497 | te->setVTFont(f); |
498 | n_font = fontno; | 498 | n_font = fontno; |
499 | } | 499 | } |
500 | */ | 500 | */ |
501 | 501 | ||
502 | // --| color selection |------------------------------------------------------- | 502 | // --| color selection |------------------------------------------------------- |
503 | 503 | ||
504 | void Konsole::changeColumns(int columns) | 504 | void Konsole::changeColumns(int columns) |
505 | { | 505 | { |
506 | TEWidget* te = getTe(); | 506 | TEWidget* te = getTe(); |
507 | if (te != 0) { | 507 | if (te != 0) { |
508 | setColLin(columns,te->Lines()); | 508 | setColLin(columns,te->Lines()); |
509 | te->update(); | 509 | te->update(); |
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | //FIXME: If a child dies during session swap, | 513 | //FIXME: If a child dies during session swap, |
514 | // this routine might be called before | 514 | // this routine might be called before |
515 | // session swap is completed. | 515 | // session swap is completed. |
516 | 516 | ||
517 | void Konsole::doneSession(TESession*, int ) | 517 | void Konsole::doneSession(TESession*, int ) |
518 | { | 518 | { |
519 | TEWidget *te = getTe(); | 519 | TEWidget *te = getTe(); |
520 | if (te != 0) { | 520 | if (te != 0) { |
521 | te->currentSession->setConnect(FALSE); | 521 | te->currentSession->setConnect(FALSE); |
522 | tab->removeTab(te); | 522 | tab->removeTab(te); |
523 | delete te->currentSession; | 523 | delete te->currentSession; |
524 | delete te; | 524 | delete te; |
525 | nsessions--; | 525 | nsessions--; |
526 | } | 526 | } |
527 | 527 | ||
528 | if (nsessions == 0) { | 528 | if (nsessions == 0) { |
529 | close(); | 529 | close(); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | 532 | ||
533 | void Konsole::newSession() { | 533 | void Konsole::newSession() { |
534 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 534 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
535 | TEWidget* te = new TEWidget(tab); | 535 | TEWidget* te = new TEWidget(tab); |
536 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 536 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
537 | te->setVTFont(fonts.at(cfont)->getFont()); | 537 | te->setVTFont(fonts.at(cfont)->getFont()); |
538 | tab->addTab(te); | 538 | tab->addTab(te); |
539 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 539 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
540 | te->currentSession = se; | 540 | te->currentSession = se; |
541 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 541 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
542 | se->run(); | 542 | se->run(); |
543 | se->setConnect(TRUE); | 543 | se->setConnect(TRUE); |
544 | se->setHistory(b_scroll); | 544 | se->setHistory(b_scroll); |
545 | tab->setCurrentPage(nsessions); | 545 | tab->setCurrentPage(nsessions); |
546 | nsessions++; | 546 | nsessions++; |
547 | setColor(); | 547 | setColor(); |
548 | } | 548 | } |
549 | } | 549 | } |
550 | 550 | ||
551 | TEWidget* Konsole::getTe() { | 551 | TEWidget* Konsole::getTe() { |
552 | if (nsessions) { | 552 | if (nsessions) { |
553 | return (TEWidget *) tab->currentPage(); | 553 | return (TEWidget *) tab->currentPage(); |
554 | } else { | 554 | } else { |
555 | return 0; | 555 | return 0; |
556 | } | 556 | } |
557 | } | 557 | } |
558 | 558 | ||
559 | void Konsole::switchSession(QWidget* w) { | 559 | void Konsole::switchSession(QWidget* w) { |
560 | TEWidget* te = (TEWidget *) w; | 560 | TEWidget* te = (TEWidget *) w; |
561 | 561 | ||
562 | QFont teFnt = te->getVTFont(); | 562 | QFont teFnt = te->getVTFont(); |
563 | for(uint i = 0; i < fonts.count(); i++) { | 563 | for(uint i = 0; i < fonts.count(); i++) { |
564 | VTFont *fnt = fonts.at(i); | 564 | VTFont *fnt = fonts.at(i); |
565 | bool cf = fnt->getFont() == teFnt; | 565 | bool cf = fnt->getFont() == teFnt; |
566 | fontList->setItemChecked(i, cf); | 566 | fontList->setItemChecked(i, cf); |
567 | if (cf) { | 567 | if (cf) { |
568 | cfont = i; | 568 | cfont = i; |
569 | } | 569 | } |
570 | } | 570 | } |
571 | } | 571 | } |
572 | 572 | ||
573 | /// ------------------------------- some new stuff by L.J. Potter | 573 | /// ------------------------------- some new stuff by L.J. Potter |
574 | void Konsole::colorMenuSelected(int iD) | 574 | void Konsole::colorMenuSelected(int iD) |
575 | { // this is NOT pretty, elegant or anything else besides functional | 575 | { // this is NOT pretty, elegant or anything else besides functional |
576 | // QString temp; | 576 | // QString temp; |
577 | // temp.sprintf("%d", iD); | 577 | // temp.sprintf("%d", iD); |
578 | // qDebug(temp); | 578 | // qDebug(temp); |
579 | TEWidget* te = getTe(); | 579 | TEWidget* te = getTe(); |
580 | Config cfg("Konsole"); | 580 | Config cfg("Konsole"); |
581 | cfg.setGroup("Colors"); | 581 | cfg.setGroup("Colors"); |
582 | QColor foreground; | 582 | QColor foreground; |
583 | QColor background; | 583 | QColor background; |
584 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 584 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
585 | ColorEntry m_table[TABLE_COLORS]; | 585 | ColorEntry m_table[TABLE_COLORS]; |
586 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 586 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
587 | /////////// fore back | 587 | /////////// fore back |
588 | int i; | 588 | int i; |
589 | if(iD==-8) { // default default | 589 | if(iD==-8) { // default default |
590 | for (i = 0; i < TABLE_COLORS; i++) { | 590 | for (i = 0; i < TABLE_COLORS; i++) { |
591 | m_table[i].color = defaultCt[i].color; | 591 | m_table[i].color = defaultCt[i].color; |
592 | if(i==1 || i == 11) | 592 | if(i==1 || i == 11) |
593 | m_table[i].transparent=1; | 593 | m_table[i].transparent=1; |
594 | cfg.writeEntry("Schema","8"); | 594 | cfg.writeEntry("Schema","8"); |
595 | colorMenu->setItemChecked(-8,TRUE); | 595 | colorMenu->setItemChecked(-8,TRUE); |
596 | } | 596 | } |
597 | } else { | 597 | } else { |
598 | if(iD==-5) { // green black | 598 | if(iD==-5) { // green black |
599 | foreground.setRgb(0x18,255,0x18); | 599 | foreground.setRgb(0x18,255,0x18); |
600 | background.setRgb(0x00,0x00,0x00); | 600 | background.setRgb(0x00,0x00,0x00); |
601 | cfg.writeEntry("Schema","5"); | 601 | cfg.writeEntry("Schema","5"); |
602 | colorMenu->setItemChecked(-5,TRUE); | 602 | colorMenu->setItemChecked(-5,TRUE); |
603 | } | 603 | } |
604 | if(iD==-6) { // black white | 604 | if(iD==-6) { // black white |
605 | foreground.setRgb(0x00,0x00,0x00); | 605 | foreground.setRgb(0x00,0x00,0x00); |
606 | background.setRgb(0xFF,0xFF,0xFF); | 606 | background.setRgb(0xFF,0xFF,0xFF); |
607 | cfg.writeEntry("Schema","6"); | 607 | cfg.writeEntry("Schema","6"); |
608 | colorMenu->setItemChecked(-6,TRUE); | 608 | colorMenu->setItemChecked(-6,TRUE); |
609 | } | 609 | } |
610 | if(iD==-7) { // white black | 610 | if(iD==-7) { // white black |
611 | foreground.setRgb(0xFF,0xFF,0xFF); | 611 | foreground.setRgb(0xFF,0xFF,0xFF); |
612 | background.setRgb(0x00,0x00,0x00); | 612 | background.setRgb(0x00,0x00,0x00); |
613 | cfg.writeEntry("Schema","7"); | 613 | cfg.writeEntry("Schema","7"); |
614 | colorMenu->setItemChecked(-7,TRUE); | 614 | colorMenu->setItemChecked(-7,TRUE); |
615 | } | 615 | } |
616 | if(iD==-9) {// Black, Red | 616 | if(iD==-9) {// Black, Red |
617 | foreground.setRgb(0x00,0x00,0x00); | 617 | foreground.setRgb(0x00,0x00,0x00); |
618 | background.setRgb(0xB2,0x18,0x18); | 618 | background.setRgb(0xB2,0x18,0x18); |
619 | cfg.writeEntry("Schema","9"); | 619 | cfg.writeEntry("Schema","9"); |
620 | colorMenu->setItemChecked(-9,TRUE); | 620 | colorMenu->setItemChecked(-9,TRUE); |
621 | } | 621 | } |
622 | if(iD==-10) {// Red, Black | 622 | if(iD==-10) {// Red, Black |
623 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 623 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
624 | background.setRgb(0x00,0x00,0x00); | 624 | background.setRgb(0x00,0x00,0x00); |
625 | cfg.writeEntry("Schema","10"); | 625 | cfg.writeEntry("Schema","10"); |
626 | colorMenu->setItemChecked(-10,TRUE); | 626 | colorMenu->setItemChecked(-10,TRUE); |
627 | } | 627 | } |
628 | if(iD==-11) {// Green, Yellow - is ugly | 628 | if(iD==-11) {// Green, Yellow - is ugly |
629 | // foreground.setRgb(0x18,0xB2,0x18); | 629 | // foreground.setRgb(0x18,0xB2,0x18); |
630 | foreground.setRgb(36,139,10); | 630 | foreground.setRgb(36,139,10); |
631 | // background.setRgb(0xB2,0x68,0x18); | 631 | // background.setRgb(0xB2,0x68,0x18); |
632 | background.setRgb(255,255,0); | 632 | background.setRgb(255,255,0); |
633 | cfg.writeEntry("Schema","11"); | 633 | cfg.writeEntry("Schema","11"); |
634 | colorMenu->setItemChecked(-11,TRUE); | 634 | colorMenu->setItemChecked(-11,TRUE); |
635 | } | 635 | } |
636 | if(iD==-12) {// Blue, Magenta | 636 | if(iD==-12) {// Blue, Magenta |
637 | foreground.setRgb(0x18,0xB2,0xB2); | 637 | foreground.setRgb(0x18,0xB2,0xB2); |
638 | background.setRgb(0x18,0x18,0xB2); | 638 | background.setRgb(0x18,0x18,0xB2); |
639 | cfg.writeEntry("Schema","12"); | 639 | cfg.writeEntry("Schema","12"); |
640 | colorMenu->setItemChecked(-12,TRUE); | 640 | colorMenu->setItemChecked(-12,TRUE); |
641 | } | 641 | } |
642 | if(iD==-13) {// Magenta, Blue | 642 | if(iD==-13) {// Magenta, Blue |
643 | foreground.setRgb(0x18,0x18,0xB2); | 643 | foreground.setRgb(0x18,0x18,0xB2); |
644 | background.setRgb(0x18,0xB2,0xB2); | 644 | background.setRgb(0x18,0xB2,0xB2); |
645 | cfg.writeEntry("Schema","13"); | 645 | cfg.writeEntry("Schema","13"); |
646 | colorMenu->setItemChecked(-13,TRUE); | 646 | colorMenu->setItemChecked(-13,TRUE); |
647 | } | 647 | } |
648 | if(iD==-14) {// Cyan, White | 648 | if(iD==-14) {// Cyan, White |
649 | foreground.setRgb(0x18,0xB2,0xB2); | 649 | foreground.setRgb(0x18,0xB2,0xB2); |
650 | background.setRgb(0xFF,0xFF,0xFF); | 650 | background.setRgb(0xFF,0xFF,0xFF); |
651 | cfg.writeEntry("Schema","14"); | 651 | cfg.writeEntry("Schema","14"); |
652 | colorMenu->setItemChecked(-14,TRUE); | 652 | colorMenu->setItemChecked(-14,TRUE); |
653 | } | 653 | } |
654 | if(iD==-15) {// White, Cyan | 654 | if(iD==-15) {// White, Cyan |
655 | background.setRgb(0x18,0xB2,0xB2); | 655 | background.setRgb(0x18,0xB2,0xB2); |
656 | foreground.setRgb(0xFF,0xFF,0xFF); | 656 | foreground.setRgb(0xFF,0xFF,0xFF); |
657 | cfg.writeEntry("Schema","15"); | 657 | cfg.writeEntry("Schema","15"); |
658 | colorMenu->setItemChecked(-15,TRUE); | 658 | colorMenu->setItemChecked(-15,TRUE); |
659 | } | 659 | } |
660 | if(iD==-16) {// Black, Blue | 660 | if(iD==-16) {// Black, Blue |
661 | background.setRgb(0x00,0x00,0x00); | 661 | background.setRgb(0x00,0x00,0x00); |
662 | foreground.setRgb(0x18,0xB2,0xB2); | 662 | foreground.setRgb(0x18,0xB2,0xB2); |
663 | cfg.writeEntry("Schema","16"); | 663 | cfg.writeEntry("Schema","16"); |
664 | colorMenu->setItemChecked(-16,TRUE); | 664 | colorMenu->setItemChecked(-16,TRUE); |
665 | } | 665 | } |
666 | 666 | ||
667 | for (i = 0; i < TABLE_COLORS; i++) { | 667 | for (i = 0; i < TABLE_COLORS; i++) { |
668 | if(i==0 || i == 10) { | 668 | if(i==0 || i == 10) { |
669 | m_table[i].color = foreground; | 669 | m_table[i].color = foreground; |
670 | } | 670 | } |
671 | else if(i==1 || i == 11) { | 671 | else if(i==1 || i == 11) { |
672 | m_table[i].color = background; m_table[i].transparent=0; | 672 | m_table[i].color = background; m_table[i].transparent=0; |
673 | } | 673 | } |
674 | else | 674 | else |
675 | m_table[i].color = defaultCt[i].color; | 675 | m_table[i].color = defaultCt[i].color; |
676 | } | 676 | } |
677 | } | 677 | } |
678 | lastSelectedMenu = iD; | 678 | lastSelectedMenu = iD; |
679 | te->setColorTable(m_table); | 679 | te->setColorTable(m_table); |
680 | // update(); | 680 | update(); |
681 | } | 681 | } |
682 | 682 | ||
683 | void Konsole::configMenuSelected(int iD) | 683 | void Konsole::configMenuSelected(int iD) |
684 | { | 684 | { |
685 | // QString temp; | 685 | // QString temp; |
686 | // temp.sprintf("%d",iD); | 686 | // temp.sprintf("%d",iD); |
687 | // qDebug(temp); | 687 | // qDebug(temp); |
688 | TEWidget* te = getTe(); | 688 | TEWidget* te = getTe(); |
689 | Config cfg("Konsole"); | 689 | Config cfg("Konsole"); |
690 | cfg.setGroup("Menubar"); | 690 | cfg.setGroup("Menubar"); |
691 | if( iD == -2) { | 691 | if( iD == -2) { |
692 | if(!secondToolBar->isHidden()) { | 692 | if(!secondToolBar->isHidden()) { |
693 | secondToolBar->hide(); | 693 | secondToolBar->hide(); |
694 | configMenu->changeItem( iD,"Show Command List"); | 694 | configMenu->changeItem( iD,"Show Command List"); |
695 | cfg.writeEntry("Hidden","TRUE"); | 695 | cfg.writeEntry("Hidden","TRUE"); |
696 | configMenu->setItemEnabled(-20 ,FALSE); | 696 | configMenu->setItemEnabled(-20 ,FALSE); |
697 | } else { | 697 | } else { |
698 | secondToolBar->show(); | 698 | secondToolBar->show(); |
699 | configMenu->changeItem( iD,"Hide Command List"); | 699 | configMenu->changeItem( iD,"Hide Command List"); |
700 | cfg.writeEntry("Hidden","FALSE"); | 700 | cfg.writeEntry("Hidden","FALSE"); |
701 | configMenu->setItemEnabled(-20 ,TRUE); | 701 | configMenu->setItemEnabled(-20 ,TRUE); |
702 | 702 | ||
703 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 703 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
704 | configMenu->setItemChecked(-16,TRUE); | 704 | configMenu->setItemChecked(-16,TRUE); |
705 | commonCombo->setEditable( TRUE ); | 705 | commonCombo->setEditable( TRUE ); |
706 | } else { | 706 | } else { |
707 | configMenu->setItemChecked(-20,FALSE); | 707 | configMenu->setItemChecked(-20,FALSE); |
708 | commonCombo->setEditable( FALSE ); | 708 | commonCombo->setEditable( FALSE ); |
709 | } | 709 | } |
710 | } | 710 | } |
711 | } | 711 | } |
712 | if( iD == -3) { | 712 | if( iD == -3) { |
713 | cfg.setGroup("Tabs"); | 713 | cfg.setGroup("Tabs"); |
714 | QString tmp=cfg.readEntry("Position","Top"); | 714 | QString tmp=cfg.readEntry("Position","Top"); |
715 | 715 | ||
716 | if(tmp=="Top") { | 716 | if(tmp=="Top") { |
717 | tab->setTabPosition(QTabWidget::Bottom); | 717 | tab->setTabPosition(QTabWidget::Bottom); |
718 | configMenu->changeItem( iD,"Tabs on Top"); | 718 | configMenu->changeItem( iD,"Tabs on Top"); |
719 | cfg.writeEntry("Position","Bottom"); | 719 | cfg.writeEntry("Position","Bottom"); |
720 | } else { | 720 | } else { |
721 | tab->setTabPosition(QTabWidget::Top); | 721 | tab->setTabPosition(QTabWidget::Top); |
722 | configMenu->changeItem( iD,"Tabs on Bottom"); | 722 | configMenu->changeItem( iD,"Tabs on Bottom"); |
723 | cfg.writeEntry("Position","Top"); | 723 | cfg.writeEntry("Position","Top"); |
724 | } | 724 | } |
725 | } | 725 | } |
726 | if( iD == -20) { | 726 | if( iD == -20) { |
727 | cfg.setGroup("Commands"); | 727 | cfg.setGroup("Commands"); |
728 | // qDebug("enableCommandEdit"); | 728 | // qDebug("enableCommandEdit"); |
729 | if( !configMenu->isItemChecked(iD) ) { | 729 | if( !configMenu->isItemChecked(iD) ) { |
730 | commonCombo->setEditable( TRUE ); | 730 | commonCombo->setEditable( TRUE ); |
731 | configMenu->setItemChecked(iD,TRUE); | 731 | configMenu->setItemChecked(iD,TRUE); |
732 | commonCombo->setCurrentItem(0); | 732 | commonCombo->setCurrentItem(0); |
733 | cfg.writeEntry("EditEnabled","TRUE"); | 733 | cfg.writeEntry("EditEnabled","TRUE"); |
734 | } else { | 734 | } else { |
735 | commonCombo->setEditable( FALSE ); | 735 | commonCombo->setEditable( FALSE ); |
736 | configMenu->setItemChecked(iD,FALSE); | 736 | configMenu->setItemChecked(iD,FALSE); |
737 | cfg.writeEntry("EditEnabled","FALSE"); | 737 | cfg.writeEntry("EditEnabled","FALSE"); |
738 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 738 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
739 | te->setFocus(); | 739 | te->setFocus(); |
740 | } | 740 | } |
741 | } | 741 | } |
742 | } | 742 | } |
743 | 743 | ||
744 | void Konsole::changeCommand(const QString &text, int c) | 744 | void Konsole::changeCommand(const QString &text, int c) |
745 | { | 745 | { |
746 | Config cfg("Konsole"); | 746 | Config cfg("Konsole"); |
747 | cfg.setGroup("Commands"); | 747 | cfg.setGroup("Commands"); |
748 | if(commonCmds[c] != text) { | 748 | if(commonCmds[c] != text) { |
749 | cfg.writeEntry(QString::number(c),text); | 749 | cfg.writeEntry(QString::number(c),text); |
750 | commonCombo->clearEdit(); | 750 | commonCombo->clearEdit(); |
751 | commonCombo->setCurrentItem(c); | 751 | commonCombo->setCurrentItem(c); |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | void Konsole::setColor() | 755 | void Konsole::setColor() |
756 | { | 756 | { |
757 | Config cfg("Konsole"); | 757 | Config cfg("Konsole"); |
758 | cfg.setGroup("Colors"); | 758 | cfg.setGroup("Colors"); |
759 | int scheme = cfg.readNumEntry("Schema",1); | 759 | int scheme = cfg.readNumEntry("Schema",1); |
760 | if(scheme != 1) colorMenuSelected( -scheme); | 760 | if(scheme != 1) colorMenuSelected( -scheme); |
761 | 761 | ||
762 | } | 762 | } |