summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-12-05 18:36:11 (UTC)
committer llornkcor <llornkcor>2002-12-05 18:36:11 (UTC)
commit05757f4914d19f9c392be1e60e5ec972027886bf (patch) (unidiff)
tree0096190bb2cf832d90ca93968952b9eccf3d3149
parent418fd5dab5503755aa1783d404576252684d4a96 (diff)
downloadopie-05757f4914d19f9c392be1e60e5ec972027886bf.zip
opie-05757f4914d19f9c392be1e60e5ec972027886bf.tar.gz
opie-05757f4914d19f9c392be1e60e5ec972027886bf.tar.bz2
fix beep so all sessions are the same
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 9be4674..275a9a8 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -363,517 +363,515 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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 379
380 configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0)); 380 configMenu->setItemChecked(jut, cfg.readBoolEntry("useBeep",0));
381 381
382 382
383//scrollMenuSelected(-29); 383//scrollMenuSelected(-29);
384// cfg.setGroup("ScrollBar"); 384// cfg.setGroup("ScrollBar");
385// if(cfg.readBoolEntry("HorzScroll",0)) { 385// if(cfg.readBoolEntry("HorzScroll",0)) {
386// if(cfg.readNumEntry("Position",2) == 0) 386// if(cfg.readNumEntry("Position",2) == 0)
387// te->setScrollbarLocation(1); 387// te->setScrollbarLocation(1);
388// else 388// else
389// te->setScrollbarLocation(0); 389// te->setScrollbarLocation(0);
390// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 390// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
391// te->setWrapAt(120); 391// te->setWrapAt(120);
392// } 392// }
393 // create applications ///////////////////////////////////////////////////// 393 // create applications /////////////////////////////////////////////////////
394 setCentralWidget(tab); 394 setCentralWidget(tab);
395 395
396 // load keymaps //////////////////////////////////////////////////////////// 396 // load keymaps ////////////////////////////////////////////////////////////
397 KeyTrans::loadAll(); 397 KeyTrans::loadAll();
398 for (int i = 0; i < KeyTrans::count(); i++) 398 for (int i = 0; i < KeyTrans::count(); i++)
399 { KeyTrans* s = KeyTrans::find(i); 399 { KeyTrans* s = KeyTrans::find(i);
400 assert( s ); 400 assert( s );
401 } 401 }
402 402
403 se_pgm = _pgm; 403 se_pgm = _pgm;
404 se_args = _args; 404 se_args = _args;
405 se_args.prepend("--login"); 405 se_args.prepend("--login");
406parseCommandLine(); 406parseCommandLine();
407 // read and apply default values /////////////////////////////////////////// 407 // read and apply default values ///////////////////////////////////////////
408 resize(321, 321); // Dummy. 408 resize(321, 321); // Dummy.
409 QSize currentSize = size(); 409 QSize currentSize = size();
410 if (currentSize != size()) 410 if (currentSize != size())
411 defaultSize = size(); 411 defaultSize = size();
412} 412}
413 413
414void Konsole::show() 414void Konsole::show()
415{ 415{
416 if ( !nsessions ) { 416 if ( !nsessions ) {
417 newSession(); 417 newSession();
418 } 418 }
419 QMainWindow::show(); 419 QMainWindow::show();
420 420
421} 421}
422 422
423void Konsole::initSession(const char*, QStrList &) 423void Konsole::initSession(const char*, QStrList &)
424{ 424{
425 QMainWindow::show(); 425 QMainWindow::show();
426} 426}
427 427
428Konsole::~Konsole() 428Konsole::~Konsole()
429{ 429{
430 while (nsessions > 0) { 430 while (nsessions > 0) {
431 doneSession(getTe()->currentSession, 0); 431 doneSession(getTe()->currentSession, 0);
432 } 432 }
433 433
434 Config cfg("Konsole"); 434 Config cfg("Konsole");
435 cfg.setGroup("Konsole"); 435 cfg.setGroup("Konsole");
436 cfg.writeEntry("FontID", cfont); 436 cfg.writeEntry("FontID", cfont);
437} 437}
438 438
439void Konsole::fontChanged(int f) 439void Konsole::fontChanged(int f)
440{ 440{
441 VTFont* font = fonts.at(f); 441 VTFont* font = fonts.at(f);
442 if (font != 0) { 442 if (font != 0) {
443 for(uint i = 0; i < fonts.count(); i++) { 443 for(uint i = 0; i < fonts.count(); i++) {
444 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 444 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
445 } 445 }
446 446
447 cfont = f; 447 cfont = f;
448 448
449 TEWidget* te = getTe(); 449 TEWidget* te = getTe();
450 if (te != 0) { 450 if (te != 0) {
451 te->setVTFont(font->getFont()); 451 te->setVTFont(font->getFont());
452 } 452 }
453 } 453 }
454} 454}
455 455
456 456
457void Konsole::enterCommand(int c) 457void Konsole::enterCommand(int c)
458{ 458{
459 TEWidget* te = getTe(); 459 TEWidget* te = getTe();
460 if (te != 0) { 460 if (te != 0) {
461 if(!commonCombo->editable()) { 461 if(!commonCombo->editable()) {
462 QString text = commonCombo->text(c); //commonCmds[c]; 462 QString text = commonCombo->text(c); //commonCmds[c];
463 te->emitText(text); 463 te->emitText(text);
464 } else { 464 } else {
465 changeCommand( commonCombo->text(c), c); 465 changeCommand( commonCombo->text(c), c);
466 } 466 }
467 } 467 }
468} 468}
469 469
470void Konsole::hitEnter() 470void Konsole::hitEnter()
471{ 471{
472 TEWidget* te = getTe(); 472 TEWidget* te = getTe();
473 if (te != 0) { 473 if (te != 0) {
474 te->emitText(QString("\r")); 474 te->emitText(QString("\r"));
475 } 475 }
476} 476}
477 477
478void Konsole::hitSpace() 478void Konsole::hitSpace()
479{ 479{
480 TEWidget* te = getTe(); 480 TEWidget* te = getTe();
481 if (te != 0) { 481 if (te != 0) {
482 te->emitText(QString(" ")); 482 te->emitText(QString(" "));
483 } 483 }
484} 484}
485 485
486void Konsole::hitTab() 486void Konsole::hitTab()
487{ 487{
488 TEWidget* te = getTe(); 488 TEWidget* te = getTe();
489 if (te != 0) { 489 if (te != 0) {
490 te->emitText(QString("\t")); 490 te->emitText(QString("\t"));
491 } 491 }
492} 492}
493 493
494void Konsole::hitPaste() 494void Konsole::hitPaste()
495{ 495{
496 TEWidget* te = getTe(); 496 TEWidget* te = getTe();
497 if (te != 0) { 497 if (te != 0) {
498 te->pasteClipboard(); 498 te->pasteClipboard();
499 } 499 }
500} 500}
501 501
502void Konsole::hitUp() 502void Konsole::hitUp()
503{ 503{
504 TEWidget* te = getTe(); 504 TEWidget* te = getTe();
505 if (te != 0) { 505 if (te != 0) {
506 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0); 506 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Up, 0, 0);
507 QApplication::sendEvent( te, &ke ); 507 QApplication::sendEvent( te, &ke );
508 } 508 }
509} 509}
510 510
511void Konsole::hitDown() 511void Konsole::hitDown()
512{ 512{
513 TEWidget* te = getTe(); 513 TEWidget* te = getTe();
514 if (te != 0) { 514 if (te != 0) {
515 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0); 515 QKeyEvent ke( QKeyEvent::KeyPress, Qt::Key_Down, 0, 0);
516 QApplication::sendEvent( te, &ke ); 516 QApplication::sendEvent( te, &ke );
517 } 517 }
518} 518}
519 519
520/** 520/**
521 This function calculates the size of the external widget 521 This function calculates the size of the external widget
522 needed for the internal widget to be 522 needed for the internal widget to be
523 */ 523 */
524QSize Konsole::calcSize(int columns, int lines) { 524QSize Konsole::calcSize(int columns, int lines) {
525 TEWidget* te = getTe(); 525 TEWidget* te = getTe();
526 if (te != 0) { 526 if (te != 0) {
527 QSize size = te->calcSize(columns, lines); 527 QSize size = te->calcSize(columns, lines);
528 return size; 528 return size;
529 } else { 529 } else {
530 QSize size; 530 QSize size;
531 return size; 531 return size;
532 } 532 }
533} 533}
534 534
535/** 535/**
536 sets application window to a size based on columns X lines of the te 536 sets application window to a size based on columns X lines of the te
537 guest widget. Call with (0,0) for setting default size. 537 guest widget. Call with (0,0) for setting default size.
538*/ 538*/
539 539
540void Konsole::setColLin(int columns, int lines) 540void Konsole::setColLin(int columns, int lines)
541{ 541{
542 qDebug("konsole::setColLin:: Columns %d", columns); 542 qDebug("konsole::setColLin:: Columns %d", columns);
543 543
544 if ((columns==0) || (lines==0)) 544 if ((columns==0) || (lines==0))
545 { 545 {
546 if (defaultSize.isEmpty()) // not in config file : set default value 546 if (defaultSize.isEmpty()) // not in config file : set default value
547 { 547 {
548 defaultSize = calcSize(80,24); 548 defaultSize = calcSize(80,24);
549 // notifySize(24,80); // set menu items (strange arg order !) 549 // notifySize(24,80); // set menu items (strange arg order !)
550 } 550 }
551 resize(defaultSize); 551 resize(defaultSize);
552 } else { 552 } else {
553 resize(calcSize(columns, lines)); 553 resize(calcSize(columns, lines));
554 // notifySize(lines,columns); // set menu items (strange arg order !) 554 // notifySize(lines,columns); // set menu items (strange arg order !)
555 } 555 }
556} 556}
557 557
558/* 558/*
559void Konsole::setFont(int fontno) 559void Konsole::setFont(int fontno)
560{ 560{
561 QFont f; 561 QFont f;
562 if (fontno == 0) 562 if (fontno == 0)
563 f = defaultFont = QFont( "Helvetica", 12 ); 563 f = defaultFont = QFont( "Helvetica", 12 );
564 else 564 else
565 if (fonts[fontno][0] == '-') 565 if (fonts[fontno][0] == '-')
566 f.setRawName( fonts[fontno] ); 566 f.setRawName( fonts[fontno] );
567 else 567 else
568 { 568 {
569 f.setFamily(fonts[fontno]); 569 f.setFamily(fonts[fontno]);
570 f.setRawMode( TRUE ); 570 f.setRawMode( TRUE );
571 } 571 }
572 if ( !f.exactMatch() && fontno != 0) 572 if ( !f.exactMatch() && fontno != 0)
573 { 573 {
574 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); 574 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]);
575 QMessageBox(this, msg); 575 QMessageBox(this, msg);
576 return; 576 return;
577 } 577 }
578 if (se) se->setFontNo(fontno); 578 if (se) se->setFontNo(fontno);
579 te->setVTFont(f); 579 te->setVTFont(f);
580 n_font = fontno; 580 n_font = fontno;
581} 581}
582*/ 582*/
583 583
584// --| color selection |------------------------------------------------------- 584// --| color selection |-------------------------------------------------------
585 585
586void Konsole::changeColumns(int columns) 586void Konsole::changeColumns(int columns)
587{ 587{
588 qDebug("change columns"); 588 qDebug("change columns");
589 TEWidget* te = getTe(); 589 TEWidget* te = getTe();
590 if (te != 0) { 590 if (te != 0) {
591 setColLin(columns,te->Lines()); 591 setColLin(columns,te->Lines());
592 te->update(); 592 te->update();
593 } 593 }
594} 594}
595 595
596//FIXME: If a child dies during session swap, 596//FIXME: If a child dies during session swap,
597// this routine might be called before 597// this routine might be called before
598// session swap is completed. 598// session swap is completed.
599 599
600void Konsole::doneSession(TESession*, int ) 600void Konsole::doneSession(TESession*, int )
601{ 601{
602 TEWidget *te = getTe(); 602 TEWidget *te = getTe();
603 if (te != 0) { 603 if (te != 0) {
604 te->currentSession->setConnect(FALSE); 604 te->currentSession->setConnect(FALSE);
605 tab->removeTab(te); 605 tab->removeTab(te);
606 delete te->currentSession; 606 delete te->currentSession;
607 delete te; 607 delete te;
608 nsessions--; 608 nsessions--;
609 } 609 }
610 610
611 if (nsessions == 0) { 611 if (nsessions == 0) {
612 close(); 612 close();
613 } 613 }
614} 614}
615 615
616void Konsole::newSession() { 616void Konsole::newSession() {
617 if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? 617 if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory?
618 TEWidget* te = new TEWidget(tab); 618 TEWidget* te = new TEWidget(tab);
619 if(nsessions == 0) { //set this the first time only 619 Config c("Konsole");
620 Config c("Konsole"); 620 c.setGroup("Menubar");
621 c.setGroup("Menubar"); 621 te->useBeep=c.readBoolEntry("useBeep",0);
622 te->useBeep=c.readBoolEntry("useBeep",0);
623 }
624 622
625// te->setBackgroundMode(PaletteBase); //we want transparent!! 623// te->setBackgroundMode(PaletteBase); //we want transparent!!
626 te->setVTFont(fonts.at(cfont)->getFont()); 624 te->setVTFont(fonts.at(cfont)->getFont());
627 tab->addTab(te); 625 tab->addTab(te);
628 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); 626 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
629 te->currentSession = se; 627 te->currentSession = se;
630 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); 628 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) );
631 se->run(); 629 se->run();
632 se->setConnect(TRUE); 630 se->setConnect(TRUE);
633 se->setHistory(b_scroll); 631 se->setHistory(b_scroll);
634 tab->setCurrentPage(nsessions); 632 tab->setCurrentPage(nsessions);
635 nsessions++; 633 nsessions++;
636 doWrap(); 634 doWrap();
637 setColor(); 635 setColor();
638 } 636 }
639} 637}
640 638
641TEWidget* Konsole::getTe() { 639TEWidget* Konsole::getTe() {
642 if (nsessions) { 640 if (nsessions) {
643 return (TEWidget *) tab->currentPage(); 641 return (TEWidget *) tab->currentPage();
644 } else { 642 } else {
645 return 0; 643 return 0;
646 } 644 }
647} 645}
648 646
649void Konsole::switchSession(QWidget* w) { 647void Konsole::switchSession(QWidget* w) {
650 TEWidget* te = (TEWidget *) w; 648 TEWidget* te = (TEWidget *) w;
651 649
652 QFont teFnt = te->getVTFont(); 650 QFont teFnt = te->getVTFont();
653 for(uint i = 0; i < fonts.count(); i++) { 651 for(uint i = 0; i < fonts.count(); i++) {
654 VTFont *fnt = fonts.at(i); 652 VTFont *fnt = fonts.at(i);
655 bool cf = fnt->getFont() == teFnt; 653 bool cf = fnt->getFont() == teFnt;
656 fontList->setItemChecked(i, cf); 654 fontList->setItemChecked(i, cf);
657 if (cf) { 655 if (cf) {
658 cfont = i; 656 cfont = i;
659 } 657 }
660 } 658 }
661} 659}
662 660
663void Konsole::colorMenuIsSelected(int iD) { 661void Konsole::colorMenuIsSelected(int iD) {
664 fromMenu = TRUE; 662 fromMenu = TRUE;
665 colorMenuSelected(iD); 663 colorMenuSelected(iD);
666} 664}
667 665
668/// ------------------------------- some new stuff by L.J. Potter 666/// ------------------------------- some new stuff by L.J. Potter
669void Konsole::colorMenuSelected(int iD) 667void Konsole::colorMenuSelected(int iD)
670{ // this is NOT pretty, elegant or anything else besides functional 668{ // this is NOT pretty, elegant or anything else besides functional
671// QString temp; 669// QString temp;
672// qDebug( temp.sprintf("colormenu %d", iD)); 670// qDebug( temp.sprintf("colormenu %d", iD));
673 TEWidget* te = getTe(); 671 TEWidget* te = getTe();
674 Config cfg("Konsole"); 672 Config cfg("Konsole");
675 cfg.setGroup("Colors"); 673 cfg.setGroup("Colors");
676// QColor foreground; 674// QColor foreground;
677// QColor background; 675// QColor background;
678 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 676 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
679 ColorEntry m_table[TABLE_COLORS]; 677 ColorEntry m_table[TABLE_COLORS];
680 const ColorEntry * defaultCt=te->getdefaultColorTable(); 678 const ColorEntry * defaultCt=te->getdefaultColorTable();
681 /////////// fore back 679 /////////// fore back
682 int i; 680 int i;
683 if(iD==-9) { // default default 681 if(iD==-9) { // default default
684 for (i = 0; i < TABLE_COLORS; i++) { 682 for (i = 0; i < TABLE_COLORS; i++) {
685 m_table[i].color = defaultCt[i].color; 683 m_table[i].color = defaultCt[i].color;
686 if(i==1 || i == 11) 684 if(i==1 || i == 11)
687 m_table[i].transparent=1; 685 m_table[i].transparent=1;
688 cfg.writeEntry("Schema","9"); 686 cfg.writeEntry("Schema","9");
689 colorMenu->setItemChecked(-9,TRUE); 687 colorMenu->setItemChecked(-9,TRUE);
690 } 688 }
691 } else { 689 } else {
692 if(iD==-6) { // green black 690 if(iD==-6) { // green black
693 foreground.setRgb(0x18,255,0x18); 691 foreground.setRgb(0x18,255,0x18);
694 background.setRgb(0x00,0x00,0x00); 692 background.setRgb(0x00,0x00,0x00);
695 cfg.writeEntry("Schema","6"); 693 cfg.writeEntry("Schema","6");
696 colorMenu->setItemChecked(-6,TRUE); 694 colorMenu->setItemChecked(-6,TRUE);
697 } 695 }
698 if(iD==-7) { // black white 696 if(iD==-7) { // black white
699 foreground.setRgb(0x00,0x00,0x00); 697 foreground.setRgb(0x00,0x00,0x00);
700 background.setRgb(0xFF,0xFF,0xFF); 698 background.setRgb(0xFF,0xFF,0xFF);
701 cfg.writeEntry("Schema","7"); 699 cfg.writeEntry("Schema","7");
702 colorMenu->setItemChecked(-7,TRUE); 700 colorMenu->setItemChecked(-7,TRUE);
703 } 701 }
704 if(iD==-8) { // white black 702 if(iD==-8) { // white black
705 foreground.setRgb(0xFF,0xFF,0xFF); 703 foreground.setRgb(0xFF,0xFF,0xFF);
706 background.setRgb(0x00,0x00,0x00); 704 background.setRgb(0x00,0x00,0x00);
707 cfg.writeEntry("Schema","8"); 705 cfg.writeEntry("Schema","8");
708 colorMenu->setItemChecked(-8,TRUE); 706 colorMenu->setItemChecked(-8,TRUE);
709 } 707 }
710 if(iD==-10) {// Black, Red 708 if(iD==-10) {// Black, Red
711 foreground.setRgb(0x00,0x00,0x00); 709 foreground.setRgb(0x00,0x00,0x00);
712 background.setRgb(0xB2,0x18,0x18); 710 background.setRgb(0xB2,0x18,0x18);
713 cfg.writeEntry("Schema","10"); 711 cfg.writeEntry("Schema","10");
714 colorMenu->setItemChecked(-10,TRUE); 712 colorMenu->setItemChecked(-10,TRUE);
715 } 713 }
716 if(iD==-11) {// Red, Black 714 if(iD==-11) {// Red, Black
717 foreground.setRgb(230,31,31); //0xB2,0x18,0x18 715 foreground.setRgb(230,31,31); //0xB2,0x18,0x18
718 background.setRgb(0x00,0x00,0x00); 716 background.setRgb(0x00,0x00,0x00);
719 cfg.writeEntry("Schema","11"); 717 cfg.writeEntry("Schema","11");
720 colorMenu->setItemChecked(-11,TRUE); 718 colorMenu->setItemChecked(-11,TRUE);
721 } 719 }
722 if(iD==-12) {// Green, Yellow - is ugly 720 if(iD==-12) {// Green, Yellow - is ugly
723// foreground.setRgb(0x18,0xB2,0x18); 721// foreground.setRgb(0x18,0xB2,0x18);
724 foreground.setRgb(36,139,10); 722 foreground.setRgb(36,139,10);
725// background.setRgb(0xB2,0x68,0x18); 723// background.setRgb(0xB2,0x68,0x18);
726 background.setRgb(255,255,0); 724 background.setRgb(255,255,0);
727 cfg.writeEntry("Schema","12"); 725 cfg.writeEntry("Schema","12");
728 colorMenu->setItemChecked(-12,TRUE); 726 colorMenu->setItemChecked(-12,TRUE);
729 } 727 }
730 if(iD==-13) {// Blue, Magenta 728 if(iD==-13) {// Blue, Magenta
731 foreground.setRgb(0x18,0xB2,0xB2); 729 foreground.setRgb(0x18,0xB2,0xB2);
732 background.setRgb(0x18,0x18,0xB2); 730 background.setRgb(0x18,0x18,0xB2);
733 cfg.writeEntry("Schema","13"); 731 cfg.writeEntry("Schema","13");
734 colorMenu->setItemChecked(-13,TRUE); 732 colorMenu->setItemChecked(-13,TRUE);
735 } 733 }
736 if(iD==-14) {// Magenta, Blue 734 if(iD==-14) {// Magenta, Blue
737 foreground.setRgb(0x18,0x18,0xB2); 735 foreground.setRgb(0x18,0x18,0xB2);
738 background.setRgb(0x18,0xB2,0xB2); 736 background.setRgb(0x18,0xB2,0xB2);
739 cfg.writeEntry("Schema","14"); 737 cfg.writeEntry("Schema","14");
740 colorMenu->setItemChecked(-14,TRUE); 738 colorMenu->setItemChecked(-14,TRUE);
741 } 739 }
742 if(iD==-15) {// Cyan, White 740 if(iD==-15) {// Cyan, White
743 foreground.setRgb(0x18,0xB2,0xB2); 741 foreground.setRgb(0x18,0xB2,0xB2);
744 background.setRgb(0xFF,0xFF,0xFF); 742 background.setRgb(0xFF,0xFF,0xFF);
745 cfg.writeEntry("Schema","15"); 743 cfg.writeEntry("Schema","15");
746 colorMenu->setItemChecked(-15,TRUE); 744 colorMenu->setItemChecked(-15,TRUE);
747 } 745 }
748 if(iD==-16) {// White, Cyan 746 if(iD==-16) {// White, Cyan
749 background.setRgb(0x18,0xB2,0xB2); 747 background.setRgb(0x18,0xB2,0xB2);
750 foreground.setRgb(0xFF,0xFF,0xFF); 748 foreground.setRgb(0xFF,0xFF,0xFF);
751 cfg.writeEntry("Schema","16"); 749 cfg.writeEntry("Schema","16");
752 colorMenu->setItemChecked(-16,TRUE); 750 colorMenu->setItemChecked(-16,TRUE);
753 } 751 }
754 if(iD==-17) {// Black, Blue 752 if(iD==-17) {// Black, Blue
755 background.setRgb(0x00,0x00,0x00); 753 background.setRgb(0x00,0x00,0x00);
756 foreground.setRgb(0x18,0xB2,0xB2); 754 foreground.setRgb(0x18,0xB2,0xB2);
757 cfg.writeEntry("Schema","17"); 755 cfg.writeEntry("Schema","17");
758 colorMenu->setItemChecked(-17,TRUE); 756 colorMenu->setItemChecked(-17,TRUE);
759 } 757 }
760 if(iD==-18) {// Black, Gold 758 if(iD==-18) {// Black, Gold
761 background.setRgb(0x00,0x00,0x00); 759 background.setRgb(0x00,0x00,0x00);
762 foreground.setRgb(255,215,0); 760 foreground.setRgb(255,215,0);
763 cfg.writeEntry("Schema","18"); 761 cfg.writeEntry("Schema","18");
764 colorMenu->setItemChecked(-18,TRUE); 762 colorMenu->setItemChecked(-18,TRUE);
765 } 763 }
766#ifdef QT_QWS_OPIE 764#ifdef QT_QWS_OPIE
767 if(iD==-19) { 765 if(iD==-19) {
768// Custom 766// Custom
769 qDebug("do custom"); 767 qDebug("do custom");
770 if(fromMenu) { 768 if(fromMenu) {
771 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); 769 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
772 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, 770 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
773 SLOT(changeForegroundColor(const QColor&))); 771 SLOT(changeForegroundColor(const QColor&)));
774 penColorPopupMenu->exec(); 772 penColorPopupMenu->exec();
775 } 773 }
776 cfg.writeEntry("Schema","19"); 774 cfg.writeEntry("Schema","19");
777 if(!fromMenu) { 775 if(!fromMenu) {
778 foreground.setNamedColor(cfg.readEntry("foreground","")); 776 foreground.setNamedColor(cfg.readEntry("foreground",""));
779 background.setNamedColor(cfg.readEntry("background","")); 777 background.setNamedColor(cfg.readEntry("background",""));
780 } 778 }
781 fromMenu=FALSE; 779 fromMenu=FALSE;
782 colorMenu->setItemChecked(-19,TRUE); 780 colorMenu->setItemChecked(-19,TRUE);
783 } 781 }
784#endif 782#endif
785 for (i = 0; i < TABLE_COLORS; i++) { 783 for (i = 0; i < TABLE_COLORS; i++) {
786 if(i==0 || i == 10) { 784 if(i==0 || i == 10) {
787 m_table[i].color = foreground; 785 m_table[i].color = foreground;
788 } 786 }
789 else if(i==1 || i == 11) { 787 else if(i==1 || i == 11) {
790 m_table[i].color = background; m_table[i].transparent=0; 788 m_table[i].color = background; m_table[i].transparent=0;
791 } 789 }
792 else 790 else
793 m_table[i].color = defaultCt[i].color; 791 m_table[i].color = defaultCt[i].color;
794 } 792 }
795 } 793 }
796 lastSelectedMenu = iD; 794 lastSelectedMenu = iD;
797 te->setColorTable(m_table); 795 te->setColorTable(m_table);
798 update(); 796 update();
799 797
800} 798}
801 799
802void Konsole::configMenuSelected(int iD) 800void Konsole::configMenuSelected(int iD)
803{ 801{
804// QString temp; 802// QString temp;
805// qDebug( temp.sprintf("configmenu %d",iD)); 803// qDebug( temp.sprintf("configmenu %d",iD));
806 TEWidget* te = getTe(); 804 TEWidget* te = getTe();
807 Config cfg("Konsole"); 805 Config cfg("Konsole");
808 cfg.setGroup("Menubar"); 806 cfg.setGroup("Menubar");
809 int i,j; 807 int i,j;
810#ifdef QT_QWS_OPIE 808#ifdef QT_QWS_OPIE
811 i=-29;j=-30; 809 i=-29;j=-30;
812#else 810#else
813 i=-28;j=-29; 811 i=-28;j=-29;
814#endif 812#endif
815 813
816 if(iD == -4) { 814 if(iD == -4) {
817 cfg.setGroup("Tabs"); 815 cfg.setGroup("Tabs");
818 QString tmp=cfg.readEntry("Position","Bottom"); 816 QString tmp=cfg.readEntry("Position","Bottom");
819 817
820 if(tmp=="Top") { 818 if(tmp=="Top") {
821 tab->setTabPosition(QTabWidget::Bottom); 819 tab->setTabPosition(QTabWidget::Bottom);
822 configMenu->changeItem( iD, tr("Tabs on Top")); 820 configMenu->changeItem( iD, tr("Tabs on Top"));
823 cfg.writeEntry("Position","Bottom"); 821 cfg.writeEntry("Position","Bottom");
824 } else { 822 } else {
825 tab->setTabPosition(QTabWidget::Top); 823 tab->setTabPosition(QTabWidget::Top);
826 configMenu->changeItem( iD, tr("Tabs on Bottom")); 824 configMenu->changeItem( iD, tr("Tabs on Bottom"));
827 cfg.writeEntry("Position","Top"); 825 cfg.writeEntry("Position","Top");
828 } 826 }
829 } 827 }
830 if(iD == i) { 828 if(iD == i) {
831 cfg.setGroup("ScrollBar"); 829 cfg.setGroup("ScrollBar");
832 bool b=cfg.readBoolEntry("HorzScroll",0); 830 bool b=cfg.readBoolEntry("HorzScroll",0);
833 b=!b; 831 b=!b;
834 cfg.writeEntry("HorzScroll", b ); 832 cfg.writeEntry("HorzScroll", b );
835 cfg.write(); 833 cfg.write();
836 doWrap(); 834 doWrap();
837 if(cfg.readNumEntry("Position",2) == 0) { 835 if(cfg.readNumEntry("Position",2) == 0) {
838 te->setScrollbarLocation(1); 836 te->setScrollbarLocation(1);
839 } else { 837 } else {
840 te->setScrollbarLocation(0); 838 te->setScrollbarLocation(0);
841 } 839 }
842 te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 840 te->setScrollbarLocation( cfg.readNumEntry("Position",2));
843 } 841 }
844 if(iD == j) { 842 if(iD == j) {
845 cfg.setGroup("Menubar"); 843 cfg.setGroup("Menubar");
846 bool b=cfg.readBoolEntry("useBeep",0); 844 bool b=cfg.readBoolEntry("useBeep",0);
847 b=!b; 845 b=!b;
848 cfg.writeEntry("useBeep", b ); 846 cfg.writeEntry("useBeep", b );
849 cfg.write(); 847 cfg.write();
850 configMenu->setItemChecked(j,b); 848 configMenu->setItemChecked(j,b);
851 te->useBeep=b; 849 te->useBeep=b;
852 } 850 }
853} 851}
854 852
855void Konsole::changeCommand(const QString &text, int c) 853void Konsole::changeCommand(const QString &text, int c)
856{ 854{
857 Config cfg("Konsole"); 855 Config cfg("Konsole");
858 cfg.setGroup("Commands"); 856 cfg.setGroup("Commands");
859 if(commonCmds[c] != text) { 857 if(commonCmds[c] != text) {
860 cfg.writeEntry(QString::number(c),text); 858 cfg.writeEntry(QString::number(c),text);
861 commonCombo->clearEdit(); 859 commonCombo->clearEdit();
862 commonCombo->setCurrentItem(c); 860 commonCombo->setCurrentItem(c);
863 } 861 }
864} 862}
865 863
866void Konsole::setColor() 864void Konsole::setColor()
867{ 865{
868 Config cfg("Konsole"); 866 Config cfg("Konsole");
869 cfg.setGroup("Colors"); 867 cfg.setGroup("Colors");
870 int scheme = cfg.readNumEntry("Schema",1); 868 int scheme = cfg.readNumEntry("Schema",1);
871 if(scheme != 1) colorMenuSelected( -scheme); 869 if(scheme != 1) colorMenuSelected( -scheme);
872} 870}
873 871
874void Konsole::scrollMenuSelected(int index) 872void Konsole::scrollMenuSelected(int index)
875{ 873{
876 qDebug( "scrollbar menu %d",index); 874 qDebug( "scrollbar menu %d",index);
877 TEWidget* te = getTe(); 875 TEWidget* te = getTe();
878 Config cfg("Konsole"); 876 Config cfg("Konsole");
879 cfg.setGroup("ScrollBar"); 877 cfg.setGroup("ScrollBar");