summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index e2d4886..23c12f8 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -214,96 +214,97 @@ void Konsole::init(const char* _pgm, QStrList & _args)
214 menuToolBar->setHorizontalStretchable( TRUE ); 214 menuToolBar->setHorizontalStretchable( TRUE );
215 215
216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
217 217
218 fontList = new QPopupMenu( this ); 218 fontList = new QPopupMenu( this );
219 for(uint i = 0; i < fonts.count(); i++) { 219 for(uint i = 0; i < fonts.count(); i++) {
220 VTFont *fnt = fonts.at(i); 220 VTFont *fnt = fonts.at(i);
221 fontList->insertItem(fnt->getName(), i); 221 fontList->insertItem(fnt->getName(), i);
222 } 222 }
223 fontChanged(cfont); 223 fontChanged(cfont);
224 224
225 configMenu = new QPopupMenu( this); 225 configMenu = new QPopupMenu( this);
226 colorMenu = new QPopupMenu( this); 226 colorMenu = new QPopupMenu( this);
227 scrollMenu = new QPopupMenu( this); 227 scrollMenu = new QPopupMenu( this);
228 228
229 bool listHidden; 229 bool listHidden;
230 cfg.setGroup("Menubar"); 230 cfg.setGroup("Menubar");
231 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 231 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
232 configMenu->insertItem("Show command list"); 232 configMenu->insertItem("Show command list");
233 listHidden=TRUE; 233 listHidden=TRUE;
234 } else { 234 } else {
235 configMenu->insertItem("Hide command list"); 235 configMenu->insertItem("Hide command list");
236 listHidden=FALSE; 236 listHidden=FALSE;
237 } 237 }
238 238
239 cfg.setGroup("Tabs"); 239 cfg.setGroup("Tabs");
240 tmp=cfg.readEntry("Position","Bottom"); 240 tmp=cfg.readEntry("Position","Bottom");
241 if(tmp=="Top") { 241 if(tmp=="Top") {
242 tab->setTabPosition(QTabWidget::Top); 242 tab->setTabPosition(QTabWidget::Top);
243 configMenu->insertItem("Tabs on Bottom"); 243 configMenu->insertItem("Tabs on Bottom");
244 } else { 244 } else {
245 tab->setTabPosition(QTabWidget::Bottom); 245 tab->setTabPosition(QTabWidget::Bottom);
246 configMenu->insertItem("Tabs on Top"); 246 configMenu->insertItem("Tabs on Top");
247 } 247 }
248 configMenu->insertSeparator(2); 248 configMenu->insertSeparator(2);
249 249
250 colorMenu->insertItem("Green on Black"); 250 colorMenu->insertItem("Green on Black");
251 colorMenu->insertItem("Black on White"); 251 colorMenu->insertItem("Black on White");
252 colorMenu->insertItem("White on Black"); 252 colorMenu->insertItem("White on Black");
253 colorMenu->insertItem("Black on Transparent"); 253 colorMenu->insertItem("Black on Transparent");
254 colorMenu->insertItem("Black on Red"); 254 colorMenu->insertItem("Black on Red");
255 colorMenu->insertItem("Red on Black"); 255 colorMenu->insertItem("Red on Black");
256 colorMenu->insertItem("Green on Yellow"); 256 colorMenu->insertItem("Green on Yellow");
257 colorMenu->insertItem("Blue on Magenta"); 257 colorMenu->insertItem("Blue on Magenta");
258 colorMenu->insertItem("Magenta on Blue"); 258 colorMenu->insertItem("Magenta on Blue");
259 colorMenu->insertItem("Cyan on White"); 259 colorMenu->insertItem("Cyan on White");
260 colorMenu->insertItem("White on Cyan"); 260 colorMenu->insertItem("White on Cyan");
261 colorMenu->insertItem("Blue on Black"); 261 colorMenu->insertItem("Blue on Black");
262 colorMenu->insertItem("Amber on Black");
262 configMenu->insertItem("Colors",colorMenu); 263 configMenu->insertItem("Colors",colorMenu);
263 264
264 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 265 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
265 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 266 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
266 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 267 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
267 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 268 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
268 269
269 menuBar->insertItem( tr("Font"), fontList ); 270 menuBar->insertItem( tr("Font"), fontList );
270 menuBar->insertItem( tr("Options"), configMenu ); 271 menuBar->insertItem( tr("Options"), configMenu );
271 272
272 QPEToolBar *toolbar = new QPEToolBar( this ); 273 QPEToolBar *toolbar = new QPEToolBar( this );
273 274
274 QAction *a; 275 QAction *a;
275 276
276 // Button Commands 277 // Button Commands
277 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 278 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
278 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 279 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
279 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 280 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
280 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 281 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
281 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 282 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
282 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 283 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
283 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 284 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
284 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 285 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
285 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 286 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
286 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 287 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
287 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 288 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
288 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 289 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
289 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 290 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
290 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 291 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
291/* 292/*
292 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 293 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
293 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 294 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
294 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 295 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
295 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 296 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
296*/ 297*/
297 298
298 secondToolBar = new QPEToolBar( this ); 299 secondToolBar = new QPEToolBar( this );
299 secondToolBar->setHorizontalStretchable( TRUE ); 300 secondToolBar->setHorizontalStretchable( TRUE );
300 301
301 commonCombo = new QComboBox( secondToolBar ); 302 commonCombo = new QComboBox( secondToolBar );
302 commonCombo->setMaximumWidth(236); 303 commonCombo->setMaximumWidth(236);
303 configMenu->insertItem( "Edit Command List"); 304 configMenu->insertItem( "Edit Command List");
304 if( listHidden) { 305 if( listHidden) {
305 secondToolBar->hide(); 306 secondToolBar->hide();
306 configMenu->setItemEnabled(-20 ,FALSE); 307 configMenu->setItemEnabled(-20 ,FALSE);
307 } 308 }
308 309
309 cfg.setGroup("Commands"); 310 cfg.setGroup("Commands");
@@ -629,166 +630,171 @@ void Konsole::colorMenuSelected(int iD)
629 background.setRgb(0xB2,0x18,0x18); 630 background.setRgb(0xB2,0x18,0x18);
630 cfg.writeEntry("Schema","9"); 631 cfg.writeEntry("Schema","9");
631 colorMenu->setItemChecked(-9,TRUE); 632 colorMenu->setItemChecked(-9,TRUE);
632 } 633 }
633 if(iD==-10) {// Red, Black 634 if(iD==-10) {// Red, Black
634 foreground.setRgb(230,31,31); //0xB2,0x18,0x18 635 foreground.setRgb(230,31,31); //0xB2,0x18,0x18
635 background.setRgb(0x00,0x00,0x00); 636 background.setRgb(0x00,0x00,0x00);
636 cfg.writeEntry("Schema","10"); 637 cfg.writeEntry("Schema","10");
637 colorMenu->setItemChecked(-10,TRUE); 638 colorMenu->setItemChecked(-10,TRUE);
638 } 639 }
639 if(iD==-11) {// Green, Yellow - is ugly 640 if(iD==-11) {// Green, Yellow - is ugly
640// foreground.setRgb(0x18,0xB2,0x18); 641// foreground.setRgb(0x18,0xB2,0x18);
641 foreground.setRgb(36,139,10); 642 foreground.setRgb(36,139,10);
642// background.setRgb(0xB2,0x68,0x18); 643// background.setRgb(0xB2,0x68,0x18);
643 background.setRgb(255,255,0); 644 background.setRgb(255,255,0);
644 cfg.writeEntry("Schema","11"); 645 cfg.writeEntry("Schema","11");
645 colorMenu->setItemChecked(-11,TRUE); 646 colorMenu->setItemChecked(-11,TRUE);
646 } 647 }
647 if(iD==-12) {// Blue, Magenta 648 if(iD==-12) {// Blue, Magenta
648 foreground.setRgb(0x18,0xB2,0xB2); 649 foreground.setRgb(0x18,0xB2,0xB2);
649 background.setRgb(0x18,0x18,0xB2); 650 background.setRgb(0x18,0x18,0xB2);
650 cfg.writeEntry("Schema","12"); 651 cfg.writeEntry("Schema","12");
651 colorMenu->setItemChecked(-12,TRUE); 652 colorMenu->setItemChecked(-12,TRUE);
652 } 653 }
653 if(iD==-13) {// Magenta, Blue 654 if(iD==-13) {// Magenta, Blue
654 foreground.setRgb(0x18,0x18,0xB2); 655 foreground.setRgb(0x18,0x18,0xB2);
655 background.setRgb(0x18,0xB2,0xB2); 656 background.setRgb(0x18,0xB2,0xB2);
656 cfg.writeEntry("Schema","13"); 657 cfg.writeEntry("Schema","13");
657 colorMenu->setItemChecked(-13,TRUE); 658 colorMenu->setItemChecked(-13,TRUE);
658 } 659 }
659 if(iD==-14) {// Cyan, White 660 if(iD==-14) {// Cyan, White
660 foreground.setRgb(0x18,0xB2,0xB2); 661 foreground.setRgb(0x18,0xB2,0xB2);
661 background.setRgb(0xFF,0xFF,0xFF); 662 background.setRgb(0xFF,0xFF,0xFF);
662 cfg.writeEntry("Schema","14"); 663 cfg.writeEntry("Schema","14");
663 colorMenu->setItemChecked(-14,TRUE); 664 colorMenu->setItemChecked(-14,TRUE);
664 } 665 }
665 if(iD==-15) {// White, Cyan 666 if(iD==-15) {// White, Cyan
666 background.setRgb(0x18,0xB2,0xB2); 667 background.setRgb(0x18,0xB2,0xB2);
667 foreground.setRgb(0xFF,0xFF,0xFF); 668 foreground.setRgb(0xFF,0xFF,0xFF);
668 cfg.writeEntry("Schema","15"); 669 cfg.writeEntry("Schema","15");
669 colorMenu->setItemChecked(-15,TRUE); 670 colorMenu->setItemChecked(-15,TRUE);
670 } 671 }
671 if(iD==-16) {// Black, Blue 672 if(iD==-16) {// Black, Blue
672 background.setRgb(0x00,0x00,0x00); 673 background.setRgb(0x00,0x00,0x00);
673 foreground.setRgb(0x18,0xB2,0xB2); 674 foreground.setRgb(0x18,0xB2,0xB2);
674 cfg.writeEntry("Schema","16"); 675 cfg.writeEntry("Schema","16");
675 colorMenu->setItemChecked(-16,TRUE); 676 colorMenu->setItemChecked(-16,TRUE);
676 } 677 }
678 if(iD==-17) {// Black, Gold
679 background.setRgb(0x00,0x00,0x00);
680 foreground.setRgb(255,215,0);
681 cfg.writeEntry("Schema","17");
682 colorMenu->setItemChecked(-17,TRUE);
683 }
677 684
678 for (i = 0; i < TABLE_COLORS; i++) { 685 for (i = 0; i < TABLE_COLORS; i++) {
679 if(i==0 || i == 10) { 686 if(i==0 || i == 10) {
680 m_table[i].color = foreground; 687 m_table[i].color = foreground;
681 } 688 }
682 else if(i==1 || i == 11) { 689 else if(i==1 || i == 11) {
683 m_table[i].color = background; m_table[i].transparent=0; 690 m_table[i].color = background; m_table[i].transparent=0;
684 } 691 }
685 else 692 else
686 m_table[i].color = defaultCt[i].color; 693 m_table[i].color = defaultCt[i].color;
687 } 694 }
688 } 695 }
689 lastSelectedMenu = iD; 696 lastSelectedMenu = iD;
690 te->setColorTable(m_table); 697 te->setColorTable(m_table);
691 update(); 698 update();
692} 699}
693 700
694void Konsole::configMenuSelected(int iD) 701void Konsole::configMenuSelected(int iD)
695{ 702{
696 QString temp; 703 QString temp;
697 qDebug( temp.sprintf("%d",iD)); 704 qDebug( temp.sprintf("%d",iD));
698 TEWidget* te = getTe(); 705 TEWidget* te = getTe();
699 Config cfg("Konsole"); 706 Config cfg("Konsole");
700 cfg.setGroup("Menubar"); 707 cfg.setGroup("Menubar");
701 if( iD == -2) { 708 if( iD == -2) {
702 if(!secondToolBar->isHidden()) { 709 if(!secondToolBar->isHidden()) {
703 secondToolBar->hide(); 710 secondToolBar->hide();
704 configMenu->changeItem( iD,"Show Command List"); 711 configMenu->changeItem( iD,"Show Command List");
705 cfg.writeEntry("Hidden","TRUE"); 712 cfg.writeEntry("Hidden","TRUE");
706 configMenu->setItemEnabled(-20 ,FALSE); 713 configMenu->setItemEnabled(-20 ,FALSE);
707 } else { 714 } else {
708 secondToolBar->show(); 715 secondToolBar->show();
709 configMenu->changeItem( iD,"Hide Command List"); 716 configMenu->changeItem( iD,"Hide Command List");
710 cfg.writeEntry("Hidden","FALSE"); 717 cfg.writeEntry("Hidden","FALSE");
711 configMenu->setItemEnabled(-20 ,TRUE); 718 configMenu->setItemEnabled(-20 ,TRUE);
712 719
713 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 720 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
714 configMenu->setItemChecked(-20,TRUE); 721 configMenu->setItemChecked(-20,TRUE);
715 commonCombo->setEditable( TRUE ); 722 commonCombo->setEditable( TRUE );
716 } else { 723 } else {
717 configMenu->setItemChecked(-20,FALSE); 724 configMenu->setItemChecked(-20,FALSE);
718 commonCombo->setEditable( FALSE ); 725 commonCombo->setEditable( FALSE );
719 } 726 }
720 } 727 }
721 } 728 }
722 if( iD == -3) { 729 if( iD == -3) {
723 cfg.setGroup("Tabs"); 730 cfg.setGroup("Tabs");
724 QString tmp=cfg.readEntry("Position","Top"); 731 QString tmp=cfg.readEntry("Position","Top");
725 732
726 if(tmp=="Top") { 733 if(tmp=="Top") {
727 tab->setTabPosition(QTabWidget::Bottom); 734 tab->setTabPosition(QTabWidget::Bottom);
728 configMenu->changeItem( iD,"Tabs on Top"); 735 configMenu->changeItem( iD,"Tabs on Top");
729 cfg.writeEntry("Position","Bottom"); 736 cfg.writeEntry("Position","Bottom");
730 } else { 737 } else {
731 tab->setTabPosition(QTabWidget::Top); 738 tab->setTabPosition(QTabWidget::Top);
732 configMenu->changeItem( iD,"Tabs on Bottom"); 739 configMenu->changeItem( iD,"Tabs on Bottom");
733 cfg.writeEntry("Position","Top"); 740 cfg.writeEntry("Position","Top");
734 } 741 }
735 } 742 }
736 if( iD == -20) { 743 if( iD == -20) {
737 cfg.setGroup("Commands"); 744 cfg.setGroup("Commands");
738// qDebug("enableCommandEdit"); 745// qDebug("enableCommandEdit");
739 if( !configMenu->isItemChecked(iD) ) { 746 if( !configMenu->isItemChecked(iD) ) {
740 commonCombo->setEditable( TRUE ); 747 commonCombo->setEditable( TRUE );
741 configMenu->setItemChecked(iD,TRUE); 748 configMenu->setItemChecked(iD,TRUE);
742 commonCombo->setCurrentItem(0); 749 commonCombo->setCurrentItem(0);
743 cfg.writeEntry("EditEnabled","TRUE"); 750 cfg.writeEntry("EditEnabled","TRUE");
744 } else { 751 } else {
745 commonCombo->setEditable( FALSE ); 752 commonCombo->setEditable( FALSE );
746 configMenu->setItemChecked(iD,FALSE); 753 configMenu->setItemChecked(iD,FALSE);
747 cfg.writeEntry("EditEnabled","FALSE"); 754 cfg.writeEntry("EditEnabled","FALSE");
748 commonCombo->setFocusPolicy(QWidget::NoFocus); 755 commonCombo->setFocusPolicy(QWidget::NoFocus);
749 te->setFocus(); 756 te->setFocus();
750 } 757 }
751 } 758 }
752} 759}
753 760
754void Konsole::changeCommand(const QString &text, int c) 761void Konsole::changeCommand(const QString &text, int c)
755{ 762{
756 Config cfg("Konsole"); 763 Config cfg("Konsole");
757 cfg.setGroup("Commands"); 764 cfg.setGroup("Commands");
758 if(commonCmds[c] != text) { 765 if(commonCmds[c] != text) {
759 cfg.writeEntry(QString::number(c),text); 766 cfg.writeEntry(QString::number(c),text);
760 commonCombo->clearEdit(); 767 commonCombo->clearEdit();
761 commonCombo->setCurrentItem(c); 768 commonCombo->setCurrentItem(c);
762 } 769 }
763} 770}
764 771
765void Konsole::setColor() 772void Konsole::setColor()
766{ 773{
767 Config cfg("Konsole"); 774 Config cfg("Konsole");
768 cfg.setGroup("Colors"); 775 cfg.setGroup("Colors");
769 int scheme = cfg.readNumEntry("Schema",1); 776 int scheme = cfg.readNumEntry("Schema",1);
770 if(scheme != 1) colorMenuSelected( -scheme); 777 if(scheme != 1) colorMenuSelected( -scheme);
771
772} 778}
773 779
774void Konsole::scrollMenuSelected(int index) 780void Konsole::scrollMenuSelected(int index)
775{ 781{
776 TEWidget* te = getTe(); 782 TEWidget* te = getTe();
777Config cfg("Konsole"); 783 Config cfg("Konsole");
778 cfg.setGroup("Scrollbar"); 784 cfg.setGroup("Scrollbar");
779 switch( index){ 785 switch( index){
780 case -21: 786 case -21:
781 te->setScrollbarLocation(0); 787 te->setScrollbarLocation(0);
782 cfg.writeEntry("Position",0); 788 cfg.writeEntry("Position",0);
783 break; 789 break;
784 case -22: 790 case -22:
785 te->setScrollbarLocation(1); 791 te->setScrollbarLocation(1);
786 cfg.writeEntry("Position",1); 792 cfg.writeEntry("Position",1);
787 break; 793 break;
788 case -23: 794 case -23:
789 te->setScrollbarLocation(2); 795 te->setScrollbarLocation(2);
790 cfg.writeEntry("Position",2); 796 cfg.writeEntry("Position",2);
791 break; 797 break;
792 }; 798 };
793 799
794} 800}