author | llornkcor <llornkcor> | 2003-03-23 14:11:45 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-03-23 14:11:45 (UTC) |
commit | 013194659dde417767c62ab2fe18b09ea21558eb (patch) (unidiff) | |
tree | d282509b6d143163857efc2504bba11606f2d44b | |
parent | b827dc4fa5b3e1758e627b40de25b68b25e912de (diff) | |
download | opie-013194659dde417767c62ab2fe18b09ea21558eb.zip opie-013194659dde417767c62ab2fe18b09ea21558eb.tar.gz opie-013194659dde417767c62ab2fe18b09ea21558eb.tar.bz2 |
workaround for column size change when reset command is executed
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index eda3135..9c1167b 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -396,391 +396,391 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
396 | 396 | ||
397 | // load keymaps //////////////////////////////////////////////////////////// | 397 | // load keymaps //////////////////////////////////////////////////////////// |
398 | KeyTrans::loadAll(); | 398 | KeyTrans::loadAll(); |
399 | for (int i = 0; i < KeyTrans::count(); i++) | 399 | for (int i = 0; i < KeyTrans::count(); i++) |
400 | { KeyTrans* s = KeyTrans::find(i); | 400 | { KeyTrans* s = KeyTrans::find(i); |
401 | assert( s ); | 401 | assert( s ); |
402 | } | 402 | } |
403 | 403 | ||
404 | se_pgm = _pgm; | 404 | se_pgm = _pgm; |
405 | se_args = _args; | 405 | se_args = _args; |
406 | se_args.prepend("--login"); | 406 | se_args.prepend("--login"); |
407 | parseCommandLine(); | 407 | parseCommandLine(); |
408 | // read and apply default values /////////////////////////////////////////// | 408 | // read and apply default values /////////////////////////////////////////// |
409 | resize(321, 321); // Dummy. | 409 | resize(321, 321); // Dummy. |
410 | QSize currentSize = size(); | 410 | QSize currentSize = size(); |
411 | if (currentSize != size()) | 411 | if (currentSize != size()) |
412 | defaultSize = size(); | 412 | defaultSize = size(); |
413 | } | 413 | } |
414 | 414 | ||
415 | void Konsole::show() | 415 | void Konsole::show() |
416 | { | 416 | { |
417 | if ( !nsessions ) { | 417 | if ( !nsessions ) { |
418 | newSession(); | 418 | newSession(); |
419 | } | 419 | } |
420 | QMainWindow::show(); | 420 | QMainWindow::show(); |
421 | 421 | ||
422 | } | 422 | } |
423 | 423 | ||
424 | void Konsole::initSession(const char*, QStrList &) | 424 | void Konsole::initSession(const char*, QStrList &) |
425 | { | 425 | { |
426 | QMainWindow::show(); | 426 | QMainWindow::show(); |
427 | } | 427 | } |
428 | 428 | ||
429 | Konsole::~Konsole() | 429 | Konsole::~Konsole() |
430 | { | 430 | { |
431 | while (nsessions > 0) { | 431 | while (nsessions > 0) { |
432 | doneSession(getTe()->currentSession, 0); | 432 | doneSession(getTe()->currentSession, 0); |
433 | } | 433 | } |
434 | 434 | ||
435 | Config cfg("Konsole"); | 435 | Config cfg("Konsole"); |
436 | cfg.setGroup("Konsole"); | 436 | cfg.setGroup("Konsole"); |
437 | cfg.writeEntry("FontID", cfont); | 437 | cfg.writeEntry("FontID", cfont); |
438 | } | 438 | } |
439 | 439 | ||
440 | void Konsole::fontChanged(int f) | 440 | void Konsole::fontChanged(int f) |
441 | { | 441 | { |
442 | VTFont* font = fonts.at(f); | 442 | VTFont* font = fonts.at(f); |
443 | if (font != 0) { | 443 | if (font != 0) { |
444 | for(uint i = 0; i < fonts.count(); i++) { | 444 | for(uint i = 0; i < fonts.count(); i++) { |
445 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 445 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
446 | } | 446 | } |
447 | 447 | ||
448 | cfont = f; | 448 | cfont = f; |
449 | 449 | ||
450 | TEWidget* te = getTe(); | 450 | TEWidget* te = getTe(); |
451 | if (te != 0) { | 451 | if (te != 0) { |
452 | te->setVTFont(font->getFont()); | 452 | te->setVTFont(font->getFont()); |
453 | } | 453 | } |
454 | } | 454 | } |
455 | } | 455 | } |
456 | 456 | ||
457 | 457 | ||
458 | void Konsole::enterCommand(int c) | 458 | void Konsole::enterCommand(int c) |
459 | { | 459 | { |
460 | TEWidget* te = getTe(); | 460 | TEWidget* te = getTe(); |
461 | if (te != 0) { | 461 | if (te != 0) { |
462 | if(!commonCombo->editable()) { | 462 | if(!commonCombo->editable()) { |
463 | QString text = commonCombo->text(c); //commonCmds[c]; | 463 | QString text = commonCombo->text(c); //commonCmds[c]; |
464 | te->emitText(text); | 464 | te->emitText(text); |
465 | } else { | 465 | } else { |
466 | changeCommand( commonCombo->text(c), c); | 466 | changeCommand( commonCombo->text(c), c); |
467 | } | 467 | } |
468 | } | 468 | } |
469 | } | 469 | } |
470 | 470 | ||
471 | void Konsole::hitEnter() | 471 | void Konsole::hitEnter() |
472 | { | 472 | { |
473 | TEWidget* te = getTe(); | 473 | TEWidget* te = getTe(); |
474 | if (te != 0) { | 474 | if (te != 0) { |
475 | te->emitText(QString("\r")); | 475 | te->emitText(QString("\r")); |
476 | } | 476 | } |
477 | } | 477 | } |
478 | 478 | ||
479 | void Konsole::hitSpace() | 479 | void Konsole::hitSpace() |
480 | { | 480 | { |
481 | TEWidget* te = getTe(); | 481 | TEWidget* te = getTe(); |
482 | if (te != 0) { | 482 | if (te != 0) { |
483 | te->emitText(QString(" ")); | 483 | te->emitText(QString(" ")); |
484 | } | 484 | } |
485 | } | 485 | } |
486 | 486 | ||
487 | void Konsole::hitTab() | 487 | void Konsole::hitTab() |
488 | { | 488 | { |
489 | TEWidget* te = getTe(); | 489 | TEWidget* te = getTe(); |
490 | if (te != 0) { | 490 | if (te != 0) { |
491 | te->emitText(QString("\t")); | 491 | te->emitText(QString("\t")); |
492 | } | 492 | } |
493 | } | 493 | } |
494 | 494 | ||
495 | void Konsole::hitPaste() | 495 | void Konsole::hitPaste() |
496 | { | 496 | { |
497 | TEWidget* te = getTe(); | 497 | TEWidget* te = getTe(); |
498 | if (te != 0) { | 498 | if (te != 0) { |
499 | te->pasteClipboard(); | 499 | te->pasteClipboard(); |
500 | } | 500 | } |
501 | } | 501 | } |
502 | 502 | ||
503 | void Konsole::hitUp() | 503 | void Konsole::hitUp() |
504 | { | 504 | { |
505 | TEWidget* te = getTe(); | 505 | TEWidget* te = getTe(); |
506 | if (te != 0) { | 506 | if (te != 0) { |
507 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); | 507 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); |
508 | QApplication::sendEvent( te, &ke ); | 508 | QApplication::sendEvent( te, &ke ); |
509 | } | 509 | } |
510 | } | 510 | } |
511 | 511 | ||
512 | void Konsole::hitDown() | 512 | void Konsole::hitDown() |
513 | { | 513 | { |
514 | TEWidget* te = getTe(); | 514 | TEWidget* te = getTe(); |
515 | if (te != 0) { | 515 | if (te != 0) { |
516 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); | 516 | QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); |
517 | QApplication::sendEvent( te, &ke ); | 517 | QApplication::sendEvent( te, &ke ); |
518 | } | 518 | } |
519 | } | 519 | } |
520 | 520 | ||
521 | /** | 521 | /** |
522 | This function calculates the size of the external widget | 522 | This function calculates the size of the external widget |
523 | needed for the internal widget to be | 523 | needed for the internal widget to be |
524 | */ | 524 | */ |
525 | QSize Konsole::calcSize(int columns, int lines) { | 525 | QSize Konsole::calcSize(int columns, int lines) { |
526 | TEWidget* te = getTe(); | 526 | TEWidget* te = getTe(); |
527 | if (te != 0) { | 527 | if (te != 0) { |
528 | QSize size = te->calcSize(columns, lines); | 528 | QSize size = te->calcSize(columns, lines); |
529 | return size; | 529 | return size; |
530 | } else { | 530 | } else { |
531 | QSize size; | 531 | QSize size; |
532 | return size; | 532 | return size; |
533 | } | 533 | } |
534 | } | 534 | } |
535 | 535 | ||
536 | /** | 536 | /** |
537 | sets application window to a size based on columns X lines of the te | 537 | sets application window to a size based on columns X lines of the te |
538 | guest widget. Call with (0,0) for setting default size. | 538 | guest widget. Call with (0,0) for setting default size. |
539 | */ | 539 | */ |
540 | 540 | ||
541 | void Konsole::setColLin(int columns, int lines) | 541 | void Konsole::setColLin(int columns, int lines) |
542 | { | 542 | { |
543 | qDebug("konsole::setColLin:: Columns %d", columns); | 543 | qDebug("konsole::setColLin:: Columns %d", columns); |
544 | 544 | ||
545 | if ((columns==0) || (lines==0)) | 545 | if ((columns==0) || (lines==0)) |
546 | { | 546 | { |
547 | if (defaultSize.isEmpty()) // not in config file : set default value | 547 | if (defaultSize.isEmpty()) // not in config file : set default value |
548 | { | 548 | { |
549 | defaultSize = calcSize(80,24); | 549 | defaultSize = calcSize(80,24); |
550 | // notifySize(24,80); // set menu items (strange arg order !) | 550 | // notifySize(24,80); // set menu items (strange arg order !) |
551 | } | 551 | } |
552 | resize(defaultSize); | 552 | resize(defaultSize); |
553 | } else { | 553 | } else { |
554 | resize(calcSize(columns, lines)); | 554 | resize(calcSize(columns, lines)); |
555 | // notifySize(lines,columns); // set menu items (strange arg order !) | 555 | // notifySize(lines,columns); // set menu items (strange arg order !) |
556 | } | 556 | } |
557 | } | 557 | } |
558 | 558 | ||
559 | /* | 559 | /* |
560 | void Konsole::setFont(int fontno) | 560 | void Konsole::setFont(int fontno) |
561 | { | 561 | { |
562 | QFont f; | 562 | QFont f; |
563 | if (fontno == 0) | 563 | if (fontno == 0) |
564 | f = defaultFont = QFont( "Helvetica", 12 ); | 564 | f = defaultFont = QFont( "Helvetica", 12 ); |
565 | else | 565 | else |
566 | if (fonts[fontno][0] == '-') | 566 | if (fonts[fontno][0] == '-') |
567 | f.setRawName( fonts[fontno] ); | 567 | f.setRawName( fonts[fontno] ); |
568 | else | 568 | else |
569 | { | 569 | { |
570 | f.setFamily(fonts[fontno]); | 570 | f.setFamily(fonts[fontno]); |
571 | f.setRawMode( TRUE ); | 571 | f.setRawMode( TRUE ); |
572 | } | 572 | } |
573 | if ( !f.exactMatch() && fontno != 0) | 573 | if ( !f.exactMatch() && fontno != 0) |
574 | { | 574 | { |
575 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); | 575 | QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); |
576 | QMessageBox(this, msg); | 576 | QMessageBox(this, msg); |
577 | return; | 577 | return; |
578 | } | 578 | } |
579 | if (se) se->setFontNo(fontno); | 579 | if (se) se->setFontNo(fontno); |
580 | te->setVTFont(f); | 580 | te->setVTFont(f); |
581 | n_font = fontno; | 581 | n_font = fontno; |
582 | } | 582 | } |
583 | */ | 583 | */ |
584 | 584 | ||
585 | // --| color selection |------------------------------------------------------- | 585 | // --| color selection |------------------------------------------------------- |
586 | 586 | ||
587 | void Konsole::changeColumns(int columns) | 587 | void Konsole::changeColumns(int columns) |
588 | { | 588 | { //FIXME this seems to cause silliness when reset command is executed |
589 | qDebug("change columns"); | 589 | // qDebug("change columns"); |
590 | TEWidget* te = getTe(); | 590 | // TEWidget* te = getTe(); |
591 | if (te != 0) { | 591 | // if (te != 0) { |
592 | setColLin(columns,te->Lines()); | 592 | // setColLin(columns,te->Lines()); |
593 | te->update(); | 593 | // te->update(); |
594 | } | 594 | // } |
595 | } | 595 | } |
596 | 596 | ||
597 | //FIXME: If a child dies during session swap, | 597 | //FIXME: If a child dies during session swap, |
598 | // this routine might be called before | 598 | // this routine might be called before |
599 | // session swap is completed. | 599 | // session swap is completed. |
600 | 600 | ||
601 | void Konsole::doneSession(TESession*, int ) | 601 | void Konsole::doneSession(TESession*, int ) |
602 | { | 602 | { |
603 | TEWidget *te = getTe(); | 603 | TEWidget *te = getTe(); |
604 | if (te != 0) { | 604 | if (te != 0) { |
605 | te->currentSession->setConnect(FALSE); | 605 | te->currentSession->setConnect(FALSE); |
606 | tab->removeTab(te); | 606 | tab->removeTab(te); |
607 | delete te->currentSession; | 607 | delete te->currentSession; |
608 | delete te; | 608 | delete te; |
609 | nsessions--; | 609 | nsessions--; |
610 | } | 610 | } |
611 | 611 | ||
612 | if (nsessions == 0) { | 612 | if (nsessions == 0) { |
613 | close(); | 613 | close(); |
614 | } | 614 | } |
615 | } | 615 | } |
616 | 616 | ||
617 | void Konsole::newSession() { | 617 | void Konsole::newSession() { |
618 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 618 | if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
619 | TEWidget* te = new TEWidget(tab); | 619 | TEWidget* te = new TEWidget(tab); |
620 | Config c("Konsole"); | 620 | Config c("Konsole"); |
621 | c.setGroup("Menubar"); | 621 | c.setGroup("Menubar"); |
622 | te->useBeep=c.readBoolEntry("useBeep",0); | 622 | te->useBeep=c.readBoolEntry("useBeep",0); |
623 | 623 | ||
624 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 624 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
625 | te->setVTFont(fonts.at(cfont)->getFont()); | 625 | te->setVTFont(fonts.at(cfont)->getFont()); |
626 | tab->addTab(te); | 626 | tab->addTab(te); |
627 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 627 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
628 | te->currentSession = se; | 628 | te->currentSession = se; |
629 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); | 629 | connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); |
630 | se->run(); | 630 | se->run(); |
631 | se->setConnect(TRUE); | 631 | se->setConnect(TRUE); |
632 | se->setHistory(b_scroll); | 632 | se->setHistory(b_scroll); |
633 | tab->setCurrentPage(nsessions); | 633 | tab->setCurrentPage(nsessions); |
634 | nsessions++; | 634 | nsessions++; |
635 | doWrap(); | 635 | doWrap(); |
636 | setColor(); | 636 | setColor(); |
637 | } | 637 | } |
638 | } | 638 | } |
639 | 639 | ||
640 | TEWidget* Konsole::getTe() { | 640 | TEWidget* Konsole::getTe() { |
641 | if (nsessions) { | 641 | if (nsessions) { |
642 | return (TEWidget *) tab->currentPage(); | 642 | return (TEWidget *) tab->currentPage(); |
643 | } else { | 643 | } else { |
644 | return 0; | 644 | return 0; |
645 | } | 645 | } |
646 | } | 646 | } |
647 | 647 | ||
648 | void Konsole::switchSession(QWidget* w) { | 648 | void Konsole::switchSession(QWidget* w) { |
649 | TEWidget* te = (TEWidget *) w; | 649 | TEWidget* te = (TEWidget *) w; |
650 | 650 | ||
651 | QFont teFnt = te->getVTFont(); | 651 | QFont teFnt = te->getVTFont(); |
652 | for(uint i = 0; i < fonts.count(); i++) { | 652 | for(uint i = 0; i < fonts.count(); i++) { |
653 | VTFont *fnt = fonts.at(i); | 653 | VTFont *fnt = fonts.at(i); |
654 | bool cf = fnt->getFont() == teFnt; | 654 | bool cf = fnt->getFont() == teFnt; |
655 | fontList->setItemChecked(i, cf); | 655 | fontList->setItemChecked(i, cf); |
656 | if (cf) { | 656 | if (cf) { |
657 | cfont = i; | 657 | cfont = i; |
658 | } | 658 | } |
659 | } | 659 | } |
660 | } | 660 | } |
661 | 661 | ||
662 | void Konsole::colorMenuIsSelected(int iD) { | 662 | void Konsole::colorMenuIsSelected(int iD) { |
663 | fromMenu = TRUE; | 663 | fromMenu = TRUE; |
664 | colorMenuSelected(iD); | 664 | colorMenuSelected(iD); |
665 | } | 665 | } |
666 | 666 | ||
667 | /// ------------------------------- some new stuff by L.J. Potter | 667 | /// ------------------------------- some new stuff by L.J. Potter |
668 | void Konsole::colorMenuSelected(int iD) | 668 | void Konsole::colorMenuSelected(int iD) |
669 | { // this is NOT pretty, elegant or anything else besides functional | 669 | { // this is NOT pretty, elegant or anything else besides functional |
670 | // QString temp; | 670 | // QString temp; |
671 | // qDebug( temp.sprintf("colormenu %d", iD)); | 671 | // qDebug( temp.sprintf("colormenu %d", iD)); |
672 | 672 | ||
673 | TEWidget* te = getTe(); | 673 | TEWidget* te = getTe(); |
674 | Config cfg("Konsole"); | 674 | Config cfg("Konsole"); |
675 | cfg.setGroup("Colors"); | 675 | cfg.setGroup("Colors"); |
676 | // QColor foreground; | 676 | // QColor foreground; |
677 | // QColor background; | 677 | // QColor background; |
678 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); | 678 | colorMenu->setItemChecked(lastSelectedMenu,FALSE); |
679 | ColorEntry m_table[TABLE_COLORS]; | 679 | ColorEntry m_table[TABLE_COLORS]; |
680 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 680 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
681 | /////////// fore back | 681 | /////////// fore back |
682 | int i; | 682 | int i; |
683 | if(iD==-9) { // default default | 683 | if(iD==-9) { // default default |
684 | for (i = 0; i < TABLE_COLORS; i++) { | 684 | for (i = 0; i < TABLE_COLORS; i++) { |
685 | m_table[i].color = defaultCt[i].color; | 685 | m_table[i].color = defaultCt[i].color; |
686 | if(i==1 || i == 11) | 686 | if(i==1 || i == 11) |
687 | m_table[i].transparent=1; | 687 | m_table[i].transparent=1; |
688 | cfg.writeEntry("Schema","9"); | 688 | cfg.writeEntry("Schema","9"); |
689 | colorMenu->setItemChecked(-9,TRUE); | 689 | colorMenu->setItemChecked(-9,TRUE); |
690 | } | 690 | } |
691 | } else { | 691 | } else { |
692 | if(iD==-6) { // green black | 692 | if(iD==-6) { // green black |
693 | foreground.setRgb(0x18,255,0x18); | 693 | foreground.setRgb(0x18,255,0x18); |
694 | background.setRgb(0x00,0x00,0x00); | 694 | background.setRgb(0x00,0x00,0x00); |
695 | cfg.writeEntry("Schema","6"); | 695 | cfg.writeEntry("Schema","6"); |
696 | colorMenu->setItemChecked(-6,TRUE); | 696 | colorMenu->setItemChecked(-6,TRUE); |
697 | } | 697 | } |
698 | if(iD==-7) { // black white | 698 | if(iD==-7) { // black white |
699 | foreground.setRgb(0x00,0x00,0x00); | 699 | foreground.setRgb(0x00,0x00,0x00); |
700 | background.setRgb(0xFF,0xFF,0xFF); | 700 | background.setRgb(0xFF,0xFF,0xFF); |
701 | cfg.writeEntry("Schema","7"); | 701 | cfg.writeEntry("Schema","7"); |
702 | colorMenu->setItemChecked(-7,TRUE); | 702 | colorMenu->setItemChecked(-7,TRUE); |
703 | } | 703 | } |
704 | if(iD==-8) { // white black | 704 | if(iD==-8) { // white black |
705 | foreground.setRgb(0xFF,0xFF,0xFF); | 705 | foreground.setRgb(0xFF,0xFF,0xFF); |
706 | background.setRgb(0x00,0x00,0x00); | 706 | background.setRgb(0x00,0x00,0x00); |
707 | cfg.writeEntry("Schema","8"); | 707 | cfg.writeEntry("Schema","8"); |
708 | colorMenu->setItemChecked(-8,TRUE); | 708 | colorMenu->setItemChecked(-8,TRUE); |
709 | } | 709 | } |
710 | if(iD==-10) {// Black, Red | 710 | if(iD==-10) {// Black, Red |
711 | foreground.setRgb(0x00,0x00,0x00); | 711 | foreground.setRgb(0x00,0x00,0x00); |
712 | background.setRgb(0xB2,0x18,0x18); | 712 | background.setRgb(0xB2,0x18,0x18); |
713 | cfg.writeEntry("Schema","10"); | 713 | cfg.writeEntry("Schema","10"); |
714 | colorMenu->setItemChecked(-10,TRUE); | 714 | colorMenu->setItemChecked(-10,TRUE); |
715 | } | 715 | } |
716 | if(iD==-11) {// Red, Black | 716 | if(iD==-11) {// Red, Black |
717 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 | 717 | foreground.setRgb(230,31,31); //0xB2,0x18,0x18 |
718 | background.setRgb(0x00,0x00,0x00); | 718 | background.setRgb(0x00,0x00,0x00); |
719 | cfg.writeEntry("Schema","11"); | 719 | cfg.writeEntry("Schema","11"); |
720 | colorMenu->setItemChecked(-11,TRUE); | 720 | colorMenu->setItemChecked(-11,TRUE); |
721 | } | 721 | } |
722 | if(iD==-12) {// Green, Yellow - is ugly | 722 | if(iD==-12) {// Green, Yellow - is ugly |
723 | // foreground.setRgb(0x18,0xB2,0x18); | 723 | // foreground.setRgb(0x18,0xB2,0x18); |
724 | foreground.setRgb(36,139,10); | 724 | foreground.setRgb(36,139,10); |
725 | // background.setRgb(0xB2,0x68,0x18); | 725 | // background.setRgb(0xB2,0x68,0x18); |
726 | background.setRgb(255,255,0); | 726 | background.setRgb(255,255,0); |
727 | cfg.writeEntry("Schema","12"); | 727 | cfg.writeEntry("Schema","12"); |
728 | colorMenu->setItemChecked(-12,TRUE); | 728 | colorMenu->setItemChecked(-12,TRUE); |
729 | } | 729 | } |
730 | if(iD==-13) {// Blue, Magenta | 730 | if(iD==-13) {// Blue, Magenta |
731 | foreground.setRgb(0x18,0xB2,0xB2); | 731 | foreground.setRgb(0x18,0xB2,0xB2); |
732 | background.setRgb(0x18,0x18,0xB2); | 732 | background.setRgb(0x18,0x18,0xB2); |
733 | cfg.writeEntry("Schema","13"); | 733 | cfg.writeEntry("Schema","13"); |
734 | colorMenu->setItemChecked(-13,TRUE); | 734 | colorMenu->setItemChecked(-13,TRUE); |
735 | } | 735 | } |
736 | if(iD==-14) {// Magenta, Blue | 736 | if(iD==-14) {// Magenta, Blue |
737 | foreground.setRgb(0x18,0x18,0xB2); | 737 | foreground.setRgb(0x18,0x18,0xB2); |
738 | background.setRgb(0x18,0xB2,0xB2); | 738 | background.setRgb(0x18,0xB2,0xB2); |
739 | cfg.writeEntry("Schema","14"); | 739 | cfg.writeEntry("Schema","14"); |
740 | colorMenu->setItemChecked(-14,TRUE); | 740 | colorMenu->setItemChecked(-14,TRUE); |
741 | } | 741 | } |
742 | if(iD==-15) {// Cyan, White | 742 | if(iD==-15) {// Cyan, White |
743 | foreground.setRgb(0x18,0xB2,0xB2); | 743 | foreground.setRgb(0x18,0xB2,0xB2); |
744 | background.setRgb(0xFF,0xFF,0xFF); | 744 | background.setRgb(0xFF,0xFF,0xFF); |
745 | cfg.writeEntry("Schema","15"); | 745 | cfg.writeEntry("Schema","15"); |
746 | colorMenu->setItemChecked(-15,TRUE); | 746 | colorMenu->setItemChecked(-15,TRUE); |
747 | } | 747 | } |
748 | if(iD==-16) {// White, Cyan | 748 | if(iD==-16) {// White, Cyan |
749 | background.setRgb(0x18,0xB2,0xB2); | 749 | background.setRgb(0x18,0xB2,0xB2); |
750 | foreground.setRgb(0xFF,0xFF,0xFF); | 750 | foreground.setRgb(0xFF,0xFF,0xFF); |
751 | cfg.writeEntry("Schema","16"); | 751 | cfg.writeEntry("Schema","16"); |
752 | colorMenu->setItemChecked(-16,TRUE); | 752 | colorMenu->setItemChecked(-16,TRUE); |
753 | } | 753 | } |
754 | if(iD==-17) {// Black, Blue | 754 | if(iD==-17) {// Black, Blue |
755 | background.setRgb(0x00,0x00,0x00); | 755 | background.setRgb(0x00,0x00,0x00); |
756 | foreground.setRgb(0x18,0xB2,0xB2); | 756 | foreground.setRgb(0x18,0xB2,0xB2); |
757 | cfg.writeEntry("Schema","17"); | 757 | cfg.writeEntry("Schema","17"); |
758 | colorMenu->setItemChecked(-17,TRUE); | 758 | colorMenu->setItemChecked(-17,TRUE); |
759 | } | 759 | } |
760 | if(iD==-18) {// Black, Gold | 760 | if(iD==-18) {// Black, Gold |
761 | background.setRgb(0x00,0x00,0x00); | 761 | background.setRgb(0x00,0x00,0x00); |
762 | foreground.setRgb(255,215,0); | 762 | foreground.setRgb(255,215,0); |
763 | cfg.writeEntry("Schema","18"); | 763 | cfg.writeEntry("Schema","18"); |
764 | colorMenu->setItemChecked(-18,TRUE); | 764 | colorMenu->setItemChecked(-18,TRUE); |
765 | } | 765 | } |
766 | #ifdef QT_QWS_OPIE | 766 | #ifdef QT_QWS_OPIE |
767 | if(iD==-19) { | 767 | if(iD==-19) { |
768 | // Custom | 768 | // Custom |
769 | qDebug("do custom"); | 769 | qDebug("do custom"); |
770 | if(fromMenu) { | 770 | if(fromMenu) { |
771 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); | 771 | ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); |
772 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, | 772 | connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, |
773 | SLOT(changeForegroundColor(const QColor&))); | 773 | SLOT(changeForegroundColor(const QColor&))); |
774 | penColorPopupMenu->exec(); | 774 | penColorPopupMenu->exec(); |
775 | } | 775 | } |
776 | cfg.writeEntry("Schema","19"); | 776 | cfg.writeEntry("Schema","19"); |
777 | if(!fromMenu) { | 777 | if(!fromMenu) { |
778 | foreground.setNamedColor(cfg.readEntry("foreground","")); | 778 | foreground.setNamedColor(cfg.readEntry("foreground","")); |
779 | background.setNamedColor(cfg.readEntry("background","")); | 779 | background.setNamedColor(cfg.readEntry("background","")); |
780 | } | 780 | } |
781 | fromMenu=FALSE; | 781 | fromMenu=FALSE; |
782 | colorMenu->setItemChecked(-19,TRUE); | 782 | colorMenu->setItemChecked(-19,TRUE); |
783 | } | 783 | } |
784 | #endif | 784 | #endif |
785 | for (i = 0; i < TABLE_COLORS; i++) { | 785 | for (i = 0; i < TABLE_COLORS; i++) { |
786 | if(i==0 || i == 10) { | 786 | if(i==0 || i == 10) { |