summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp274
1 files changed, 178 insertions, 96 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 23c12f8..bc5a766 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -42,24 +42,25 @@
42#include <qtabbar.h> 42#include <qtabbar.h>
43#include <qpe/config.h> 43#include <qpe/config.h>
44#include <qstringlist.h> 44#include <qstringlist.h>
45#include <qpalette.h> 45#include <qpalette.h>
46 46
47#include <sys/wait.h> 47#include <sys/wait.h>
48#include <stdio.h> 48#include <stdio.h>
49#include <stdlib.h> 49#include <stdlib.h>
50#include <assert.h> 50#include <assert.h>
51 51
52#include "konsole.h" 52#include "konsole.h"
53#include "keytrans.h" 53#include "keytrans.h"
54#include "commandeditdialog.h"
54 55
55class EKNumTabBar : public QTabBar { 56class EKNumTabBar : public QTabBar {
56public: 57public:
57 void numberTabs() 58 void numberTabs()
58 { 59 {
59 // Yes, it really is this messy. QTabWidget needs functions 60 // Yes, it really is this messy. QTabWidget needs functions
60 // that provide acces to tabs in a sequential way. 61 // that provide acces to tabs in a sequential way.
61 int m=INT_MIN; 62 int m=INT_MIN;
62 for (int i=0; i<count(); i++) { 63 for (int i=0; i<count(); i++) {
63 QTab* left=0; 64 QTab* left=0;
64 QListIterator<QTab> it(*tabList()); 65 QListIterator<QTab> it(*tabList());
65 int x=INT_MAX; 66 int x=INT_MAX;
@@ -166,24 +167,44 @@ Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) :
166 QMainWindow(parent, name, fl) 167 QMainWindow(parent, name, fl)
167{ 168{
168 QStrList args; 169 QStrList args;
169 init("/bin/sh",args); 170 init("/bin/sh",args);
170} 171}
171 172
172Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) 173Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int)
173 : QMainWindow(0, name) 174 : QMainWindow(0, name)
174{ 175{
175 init(_pgm,_args); 176 init(_pgm,_args);
176} 177}
177 178
179void Konsole::initCommandList()
180{
181// qDebug("Konsole::initCommandList");
182 Config cfg("Konsole");
183 cfg.setGroup("Commands");
184 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
185 commonCombo->clear();
186 if (cfg.readEntry("Commands Set","FALSE") == "FALSE") {
187 for (int i = 0; commonCmds[i] != NULL; i++) {
188 commonCombo->insertItem(commonCmds[i],i);
189 }
190 } else {
191 for (int i = 0; i < 100; i++) {
192 if (!(cfg.readEntry( QString::number(i),"")).isEmpty())
193 commonCombo->insertItem((cfg.readEntry( QString::number(i),"")));
194 }
195 }
196
197}
198
178void Konsole::init(const char* _pgm, QStrList & _args) 199void Konsole::init(const char* _pgm, QStrList & _args)
179{ 200{
180 b_scroll = TRUE; // histon; 201 b_scroll = TRUE; // histon;
181 n_keytab = 0; 202 n_keytab = 0;
182 n_render = 0; 203 n_render = 0;
183 204
184 setCaption( tr("Terminal") ); 205 setCaption( tr("Terminal") );
185 setIcon( Resource::loadPixmap( "konsole" ) ); 206 setIcon( Resource::loadPixmap( "konsole" ) );
186 207
187 Config cfg("Konsole"); 208 Config cfg("Konsole");
188 cfg.setGroup("Konsole"); 209 cfg.setGroup("Konsole");
189 QString tmp; 210 QString tmp;
@@ -216,32 +237,35 @@ void Konsole::init(const char* _pgm, QStrList & _args)
216 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); 237 QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar );
217 238
218 fontList = new QPopupMenu( this ); 239 fontList = new QPopupMenu( this );
219 for(uint i = 0; i < fonts.count(); i++) { 240 for(uint i = 0; i < fonts.count(); i++) {
220 VTFont *fnt = fonts.at(i); 241 VTFont *fnt = fonts.at(i);
221 fontList->insertItem(fnt->getName(), i); 242 fontList->insertItem(fnt->getName(), i);
222 } 243 }
223 fontChanged(cfont); 244 fontChanged(cfont);
224 245
225 configMenu = new QPopupMenu( this); 246 configMenu = new QPopupMenu( this);
226 colorMenu = new QPopupMenu( this); 247 colorMenu = new QPopupMenu( this);
227 scrollMenu = new QPopupMenu( this); 248 scrollMenu = new QPopupMenu( this);
249 editCommandListMenu = new QPopupMenu( this);
250
251 configMenu->insertItem("Command List",editCommandListMenu);
228 252
229 bool listHidden; 253 bool listHidden;
230 cfg.setGroup("Menubar"); 254 cfg.setGroup("Menubar");
231 if( cfg.readEntry("Hidden","FALSE") == "TRUE") { 255 if( cfg.readEntry("Hidden","FALSE") == "TRUE") {
232 configMenu->insertItem("Show command list"); 256 editCommandListMenu->insertItem("Show command list");
233 listHidden=TRUE; 257 listHidden=TRUE;
234 } else { 258 } else {
235 configMenu->insertItem("Hide command list"); 259 editCommandListMenu->insertItem("Hide command list");
236 listHidden=FALSE; 260 listHidden=FALSE;
237 } 261 }
238 262
239 cfg.setGroup("Tabs"); 263 cfg.setGroup("Tabs");
240 tmp=cfg.readEntry("Position","Bottom"); 264 tmp=cfg.readEntry("Position","Bottom");
241 if(tmp=="Top") { 265 if(tmp=="Top") {
242 tab->setTabPosition(QTabWidget::Top); 266 tab->setTabPosition(QTabWidget::Top);
243 configMenu->insertItem("Tabs on Bottom"); 267 configMenu->insertItem("Tabs on Bottom");
244 } else { 268 } else {
245 tab->setTabPosition(QTabWidget::Bottom); 269 tab->setTabPosition(QTabWidget::Bottom);
246 configMenu->insertItem("Tabs on Top"); 270 configMenu->insertItem("Tabs on Top");
247 } 271 }
@@ -257,25 +281,25 @@ void Konsole::init(const char* _pgm, QStrList & _args)
257 colorMenu->insertItem("Blue on Magenta"); 281 colorMenu->insertItem("Blue on Magenta");
258 colorMenu->insertItem("Magenta on Blue"); 282 colorMenu->insertItem("Magenta on Blue");
259 colorMenu->insertItem("Cyan on White"); 283 colorMenu->insertItem("Cyan on White");
260 colorMenu->insertItem("White on Cyan"); 284 colorMenu->insertItem("White on Cyan");
261 colorMenu->insertItem("Blue on Black"); 285 colorMenu->insertItem("Blue on Black");
262 colorMenu->insertItem("Amber on Black"); 286 colorMenu->insertItem("Amber on Black");
263 configMenu->insertItem("Colors",colorMenu); 287 configMenu->insertItem("Colors",colorMenu);
264 288
265 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 289 connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
266 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 290 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
267 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); 291 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) ));
268 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 292 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
269 293 connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
270 menuBar->insertItem( tr("Font"), fontList ); 294 menuBar->insertItem( tr("Font"), fontList );
271 menuBar->insertItem( tr("Options"), configMenu ); 295 menuBar->insertItem( tr("Options"), configMenu );
272 296
273 QPEToolBar *toolbar = new QPEToolBar( this ); 297 QPEToolBar *toolbar = new QPEToolBar( this );
274 298
275 QAction *a; 299 QAction *a;
276 300
277 // Button Commands 301 // Button Commands
278 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); 302 a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 );
279 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); 303 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar );
280 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 304 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
281 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 305 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
@@ -292,39 +316,42 @@ void Konsole::init(const char* _pgm, QStrList & _args)
292/* 316/*
293 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 317 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
294 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 318 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
295 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 319 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
296 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 320 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
297*/ 321*/
298 322
299 secondToolBar = new QPEToolBar( this ); 323 secondToolBar = new QPEToolBar( this );
300 secondToolBar->setHorizontalStretchable( TRUE ); 324 secondToolBar->setHorizontalStretchable( TRUE );
301 325
302 commonCombo = new QComboBox( secondToolBar ); 326 commonCombo = new QComboBox( secondToolBar );
303 commonCombo->setMaximumWidth(236); 327 commonCombo->setMaximumWidth(236);
304 configMenu->insertItem( "Edit Command List"); 328
329 editCommandListMenu->insertItem( "Quick Edit");
305 if( listHidden) { 330 if( listHidden) {
306 secondToolBar->hide(); 331 secondToolBar->hide();
307 configMenu->setItemEnabled(-20 ,FALSE); 332 editCommandListMenu->setItemEnabled(-22 ,FALSE);
308 } 333 }
334 editCommandListMenu->insertItem( "Edit");
309 335
310 cfg.setGroup("Commands"); 336 cfg.setGroup("Commands");
311 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 337 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
312 338
313 for (int i = 0; commonCmds[i] != NULL; i++) { 339 initCommandList();
314 commonCombo->insertItem( commonCmds[i], i ); 340// for (int i = 0; commonCmds[i] != NULL; i++) {
315 tmp = cfg.readEntry( QString::number(i),""); 341// commonCombo->insertItem( commonCmds[i], i );
316 if(tmp != "") 342// tmp = cfg.readEntry( QString::number(i),"");
317 commonCombo->changeItem( tmp,i ); 343// if(tmp != "")
318 } 344// commonCombo->changeItem( tmp,i );
345// }
319 346
320 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 347 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
321 348
322 scrollMenu->insertItem("None"); 349 scrollMenu->insertItem("None");
323 scrollMenu->insertItem("Left"); 350 scrollMenu->insertItem("Left");
324 scrollMenu->insertItem("Right"); 351 scrollMenu->insertItem("Right");
325 configMenu->insertItem("ScrollBar",scrollMenu); 352 configMenu->insertItem("ScrollBar",scrollMenu);
326 353
327 // create applications ///////////////////////////////////////////////////// 354 // create applications /////////////////////////////////////////////////////
328 setCentralWidget(tab); 355 setCentralWidget(tab);
329 356
330 // load keymaps //////////////////////////////////////////////////////////// 357 // load keymaps ////////////////////////////////////////////////////////////
@@ -577,224 +604,279 @@ void Konsole::switchSession(QWidget* w) {
577 VTFont *fnt = fonts.at(i); 604 VTFont *fnt = fonts.at(i);
578 bool cf = fnt->getFont() == teFnt; 605 bool cf = fnt->getFont() == teFnt;
579 fontList->setItemChecked(i, cf); 606 fontList->setItemChecked(i, cf);
580 if (cf) { 607 if (cf) {
581 cfont = i; 608 cfont = i;
582 } 609 }
583 } 610 }
584} 611}
585 612
586/// ------------------------------- some new stuff by L.J. Potter 613/// ------------------------------- some new stuff by L.J. Potter
587void Konsole::colorMenuSelected(int iD) 614void Konsole::colorMenuSelected(int iD)
588{ // this is NOT pretty, elegant or anything else besides functional 615{ // this is NOT pretty, elegant or anything else besides functional
589// QString temp; 616// QString temp;
590// qDebug( temp.sprintf("%d", iD)); 617// qDebug( temp.sprintf("colormenu %d", iD));
591 TEWidget* te = getTe(); 618 TEWidget* te = getTe();
592 Config cfg("Konsole"); 619 Config cfg("Konsole");
593 cfg.setGroup("Colors"); 620 cfg.setGroup("Colors");
594 QColor foreground; 621 QColor foreground;
595 QColor background; 622 QColor background;
596 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 623 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
597 ColorEntry m_table[TABLE_COLORS]; 624 ColorEntry m_table[TABLE_COLORS];
598 const ColorEntry * defaultCt=te->getdefaultColorTable(); 625 const ColorEntry * defaultCt=te->getdefaultColorTable();
599 /////////// fore back 626 /////////// fore back
600 int i; 627 int i;
601 if(iD==-8) { // default default 628 if(iD==-9) { // default default
602 for (i = 0; i < TABLE_COLORS; i++) { 629 for (i = 0; i < TABLE_COLORS; i++) {
603 m_table[i].color = defaultCt[i].color; 630 m_table[i].color = defaultCt[i].color;
604 if(i==1 || i == 11) 631 if(i==1 || i == 11)
605 m_table[i].transparent=1; 632 m_table[i].transparent=1;
606 cfg.writeEntry("Schema","8"); 633 cfg.writeEntry("Schema","98");
607 colorMenu->setItemChecked(-8,TRUE); 634 colorMenu->setItemChecked(-9,TRUE);
608 } 635 }
609 } else { 636 } else {
610 if(iD==-5) { // green black 637 if(iD==-6) { // green black
611 foreground.setRgb(0x18,255,0x18); 638 foreground.setRgb(0x18,255,0x18);
612 background.setRgb(0x00,0x00,0x00); 639 background.setRgb(0x00,0x00,0x00);
613 cfg.writeEntry("Schema","5"); 640 cfg.writeEntry("Schema","6");
614 colorMenu->setItemChecked(-5,TRUE); 641 colorMenu->setItemChecked(-6,TRUE);
615 } 642 }
616 if(iD==-6) { // black white 643 if(iD==-7) { // black white
617 foreground.setRgb(0x00,0x00,0x00); 644 foreground.setRgb(0x00,0x00,0x00);
618 background.setRgb(0xFF,0xFF,0xFF); 645 background.setRgb(0xFF,0xFF,0xFF);
619 cfg.writeEntry("Schema","6"); 646 cfg.writeEntry("Schema","7");
620 colorMenu->setItemChecked(-6,TRUE); 647 colorMenu->setItemChecked(-7,TRUE);
621 } 648 }
622 if(iD==-7) { // white black 649 if(iD==-8) { // white black
623 foreground.setRgb(0xFF,0xFF,0xFF); 650 foreground.setRgb(0xFF,0xFF,0xFF);
624 background.setRgb(0x00,0x00,0x00); 651 background.setRgb(0x00,0x00,0x00);
625 cfg.writeEntry("Schema","7"); 652 cfg.writeEntry("Schema","8");
626 colorMenu->setItemChecked(-7,TRUE); 653 colorMenu->setItemChecked(-8,TRUE);
627 } 654 }
628 if(iD==-9) {// Black, Red 655 if(iD==-10) {// Black, Red
629 foreground.setRgb(0x00,0x00,0x00); 656 foreground.setRgb(0x00,0x00,0x00);
630 background.setRgb(0xB2,0x18,0x18); 657 background.setRgb(0xB2,0x18,0x18);
631 cfg.writeEntry("Schema","9"); 658 cfg.writeEntry("Schema","10");
632 colorMenu->setItemChecked(-9,TRUE); 659 colorMenu->setItemChecked(-10,TRUE);
633 } 660 }
634 if(iD==-10) {// Red, Black 661 if(iD==-11) {// Red, Black
635 foreground.setRgb(230,31,31); //0xB2,0x18,0x18 662 foreground.setRgb(230,31,31); //0xB2,0x18,0x18
636 background.setRgb(0x00,0x00,0x00); 663 background.setRgb(0x00,0x00,0x00);
637 cfg.writeEntry("Schema","10"); 664 cfg.writeEntry("Schema","11");
638 colorMenu->setItemChecked(-10,TRUE); 665 colorMenu->setItemChecked(-11,TRUE);
639 } 666 }
640 if(iD==-11) {// Green, Yellow - is ugly 667 if(iD==-12) {// Green, Yellow - is ugly
641// foreground.setRgb(0x18,0xB2,0x18); 668// foreground.setRgb(0x18,0xB2,0x18);
642 foreground.setRgb(36,139,10); 669 foreground.setRgb(36,139,10);
643// background.setRgb(0xB2,0x68,0x18); 670// background.setRgb(0xB2,0x68,0x18);
644 background.setRgb(255,255,0); 671 background.setRgb(255,255,0);
645 cfg.writeEntry("Schema","11");
646 colorMenu->setItemChecked(-11,TRUE);
647 }
648 if(iD==-12) {// Blue, Magenta
649 foreground.setRgb(0x18,0xB2,0xB2);
650 background.setRgb(0x18,0x18,0xB2);
651 cfg.writeEntry("Schema","12"); 672 cfg.writeEntry("Schema","12");
652 colorMenu->setItemChecked(-12,TRUE); 673 colorMenu->setItemChecked(-12,TRUE);
653 } 674 }
654 if(iD==-13) {// Magenta, Blue 675 if(iD==-13) {// Blue, Magenta
655 foreground.setRgb(0x18,0x18,0xB2); 676 foreground.setRgb(0x18,0xB2,0xB2);
656 background.setRgb(0x18,0xB2,0xB2); 677 background.setRgb(0x18,0x18,0xB2);
657 cfg.writeEntry("Schema","13"); 678 cfg.writeEntry("Schema","13");
658 colorMenu->setItemChecked(-13,TRUE); 679 colorMenu->setItemChecked(-13,TRUE);
659 } 680 }
660 if(iD==-14) {// Cyan, White 681 if(iD==-14) {// Magenta, Blue
661 foreground.setRgb(0x18,0xB2,0xB2); 682 foreground.setRgb(0x18,0x18,0xB2);
662 background.setRgb(0xFF,0xFF,0xFF); 683 background.setRgb(0x18,0xB2,0xB2);
663 cfg.writeEntry("Schema","14"); 684 cfg.writeEntry("Schema","14");
664 colorMenu->setItemChecked(-14,TRUE); 685 colorMenu->setItemChecked(-14,TRUE);
665 } 686 }
666 if(iD==-15) {// White, Cyan 687 if(iD==-15) {// Cyan, White
667 background.setRgb(0x18,0xB2,0xB2); 688 foreground.setRgb(0x18,0xB2,0xB2);
668 foreground.setRgb(0xFF,0xFF,0xFF); 689 background.setRgb(0xFF,0xFF,0xFF);
669 cfg.writeEntry("Schema","15"); 690 cfg.writeEntry("Schema","15");
670 colorMenu->setItemChecked(-15,TRUE); 691 colorMenu->setItemChecked(-15,TRUE);
671 } 692 }
672 if(iD==-16) {// Black, Blue 693 if(iD==-16) {// White, Cyan
673 background.setRgb(0x00,0x00,0x00); 694 background.setRgb(0x18,0xB2,0xB2);
674 foreground.setRgb(0x18,0xB2,0xB2); 695 foreground.setRgb(0xFF,0xFF,0xFF);
675 cfg.writeEntry("Schema","16"); 696 cfg.writeEntry("Schema","16");
676 colorMenu->setItemChecked(-16,TRUE); 697 colorMenu->setItemChecked(-16,TRUE);
677 } 698 }
678 if(iD==-17) {// Black, Gold 699 if(iD==-17) {// Black, Blue
679 background.setRgb(0x00,0x00,0x00); 700 background.setRgb(0x00,0x00,0x00);
680 foreground.setRgb(255,215,0); 701 foreground.setRgb(0x18,0xB2,0xB2);
681 cfg.writeEntry("Schema","17"); 702 cfg.writeEntry("Schema","17");
682 colorMenu->setItemChecked(-17,TRUE); 703 colorMenu->setItemChecked(-17,TRUE);
683 } 704 }
705 if(iD==-18) {// Black, Gold
706 background.setRgb(0x00,0x00,0x00);
707 foreground.setRgb(255,215,0);
708 cfg.writeEntry("Schema","18");
709 colorMenu->setItemChecked(-18,TRUE);
710 }
684 711
685 for (i = 0; i < TABLE_COLORS; i++) { 712 for (i = 0; i < TABLE_COLORS; i++) {
686 if(i==0 || i == 10) { 713 if(i==0 || i == 10) {
687 m_table[i].color = foreground; 714 m_table[i].color = foreground;
688 } 715 }
689 else if(i==1 || i == 11) { 716 else if(i==1 || i == 11) {
690 m_table[i].color = background; m_table[i].transparent=0; 717 m_table[i].color = background; m_table[i].transparent=0;
691 } 718 }
692 else 719 else
693 m_table[i].color = defaultCt[i].color; 720 m_table[i].color = defaultCt[i].color;
694 } 721 }
695 } 722 }
696 lastSelectedMenu = iD; 723 lastSelectedMenu = iD;
697 te->setColorTable(m_table); 724 te->setColorTable(m_table);
698 update(); 725 update();
699} 726}
700 727
701void Konsole::configMenuSelected(int iD) 728void Konsole::configMenuSelected(int iD)
702{ 729{
703 QString temp; 730 QString temp;
704 qDebug( temp.sprintf("%d",iD)); 731 qDebug( temp.sprintf("configmenu %d",iD));
705 TEWidget* te = getTe(); 732 TEWidget* te = getTe();
706 Config cfg("Konsole"); 733 Config cfg("Konsole");
707 cfg.setGroup("Menubar"); 734 cfg.setGroup("Menubar");
708 if( iD == -2) { 735// if( iD == -2) {
709 if(!secondToolBar->isHidden()) { 736// if(!secondToolBar->isHidden()) {
710 secondToolBar->hide(); 737// secondToolBar->hide();
711 configMenu->changeItem( iD,"Show Command List"); 738// configMenu->changeItem( iD,"Show Command List");
712 cfg.writeEntry("Hidden","TRUE"); 739// cfg.writeEntry("Hidden","TRUE");
713 configMenu->setItemEnabled(-20 ,FALSE); 740// configMenu->setItemEnabled(-20 ,FALSE);
714 } else { 741// } else {
715 secondToolBar->show(); 742// secondToolBar->show();
716 configMenu->changeItem( iD,"Hide Command List"); 743// configMenu->changeItem( iD,"Hide Command List");
717 cfg.writeEntry("Hidden","FALSE"); 744// cfg.writeEntry("Hidden","FALSE");
718 configMenu->setItemEnabled(-20 ,TRUE); 745// configMenu->setItemEnabled(-20 ,TRUE);
719 746
720 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 747// if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
721 configMenu->setItemChecked(-20,TRUE); 748// configMenu->setItemChecked(-20,TRUE);
722 commonCombo->setEditable( TRUE ); 749// commonCombo->setEditable( TRUE );
723 } else { 750// } else {
724 configMenu->setItemChecked(-20,FALSE); 751// configMenu->setItemChecked(-20,FALSE);
725 commonCombo->setEditable( FALSE ); 752// commonCombo->setEditable( FALSE );
726 } 753// }
727 } 754// }
728 } 755// }
729 if( iD == -3) { 756 if( iD == -4) {
730 cfg.setGroup("Tabs"); 757 cfg.setGroup("Tabs");
731 QString tmp=cfg.readEntry("Position","Top"); 758 QString tmp=cfg.readEntry("Position","Top");
732 759
733 if(tmp=="Top") { 760 if(tmp=="Top") {
734 tab->setTabPosition(QTabWidget::Bottom); 761 tab->setTabPosition(QTabWidget::Bottom);
735 configMenu->changeItem( iD,"Tabs on Top"); 762 configMenu->changeItem( iD,"Tabs on Top");
736 cfg.writeEntry("Position","Bottom"); 763 cfg.writeEntry("Position","Bottom");
737 } else { 764 } else {
738 tab->setTabPosition(QTabWidget::Top); 765 tab->setTabPosition(QTabWidget::Top);
739 configMenu->changeItem( iD,"Tabs on Bottom"); 766 configMenu->changeItem( iD,"Tabs on Bottom");
740 cfg.writeEntry("Position","Top"); 767 cfg.writeEntry("Position","Top");
741 } 768 }
742 } 769 }
743 if( iD == -20) { 770// if( iD == -20) {
744 cfg.setGroup("Commands"); 771// cfg.setGroup("Commands");
745// qDebug("enableCommandEdit"); 772// // qDebug("enableCommandEdit");
746 if( !configMenu->isItemChecked(iD) ) { 773// if( !configMenu->isItemChecked(iD) ) {
747 commonCombo->setEditable( TRUE ); 774// commonCombo->setEditable( TRUE );
748 configMenu->setItemChecked(iD,TRUE); 775// configMenu->setItemChecked(iD,TRUE);
749 commonCombo->setCurrentItem(0); 776// commonCombo->setCurrentItem(0);
750 cfg.writeEntry("EditEnabled","TRUE"); 777// cfg.writeEntry("EditEnabled","TRUE");
751 } else { 778// } else {
752 commonCombo->setEditable( FALSE ); 779// commonCombo->setEditable( FALSE );
753 configMenu->setItemChecked(iD,FALSE); 780// configMenu->setItemChecked(iD,FALSE);
754 cfg.writeEntry("EditEnabled","FALSE"); 781// cfg.writeEntry("EditEnabled","FALSE");
755 commonCombo->setFocusPolicy(QWidget::NoFocus); 782// commonCombo->setFocusPolicy(QWidget::NoFocus);
756 te->setFocus(); 783// te->setFocus();
757 } 784// }
758 } 785// }
759} 786}
760 787
761void Konsole::changeCommand(const QString &text, int c) 788void Konsole::changeCommand(const QString &text, int c)
762{ 789{
763 Config cfg("Konsole"); 790 Config cfg("Konsole");
764 cfg.setGroup("Commands"); 791 cfg.setGroup("Commands");
765 if(commonCmds[c] != text) { 792 if(commonCmds[c] != text) {
766 cfg.writeEntry(QString::number(c),text); 793 cfg.writeEntry(QString::number(c),text);
767 commonCombo->clearEdit(); 794 commonCombo->clearEdit();
768 commonCombo->setCurrentItem(c); 795 commonCombo->setCurrentItem(c);
769 } 796 }
770} 797}
771 798
772void Konsole::setColor() 799void Konsole::setColor()
773{ 800{
774 Config cfg("Konsole"); 801 Config cfg("Konsole");
775 cfg.setGroup("Colors"); 802 cfg.setGroup("Colors");
776 int scheme = cfg.readNumEntry("Schema",1); 803 int scheme = cfg.readNumEntry("Schema",1);
777 if(scheme != 1) colorMenuSelected( -scheme); 804 if(scheme != 1) colorMenuSelected( -scheme);
778} 805}
779 806
780void Konsole::scrollMenuSelected(int index) 807void Konsole::scrollMenuSelected(int index)
781{ 808{
809// QString temp;
810// qDebug( temp.sprintf("scrollbar menu %d",index));
782 TEWidget* te = getTe(); 811 TEWidget* te = getTe();
783 Config cfg("Konsole"); 812 Config cfg("Konsole");
784 cfg.setGroup("Scrollbar"); 813 cfg.setGroup("Scrollbar");
785 switch( index){ 814 switch( index){
786 case -21: 815 case -24:
787 te->setScrollbarLocation(0); 816 te->setScrollbarLocation(0);
788 cfg.writeEntry("Position",0); 817 cfg.writeEntry("Position",0);
789 break; 818 break;
790 case -22: 819 case -25:
791 te->setScrollbarLocation(1); 820 te->setScrollbarLocation(1);
792 cfg.writeEntry("Position",1); 821 cfg.writeEntry("Position",1);
793 break; 822 break;
794 case -23: 823 case -26:
795 te->setScrollbarLocation(2); 824 te->setScrollbarLocation(2);
796 cfg.writeEntry("Position",2); 825 cfg.writeEntry("Position",2);
797 break; 826 break;
798 }; 827 };
799 828
800} 829}
830
831void Konsole::editCommandListMenuSelected(int iD)
832{
833// QString temp;
834// qDebug( temp.sprintf("edit command list %d",iD));
835 TEWidget* te = getTe();
836 Config cfg("Konsole");
837 cfg.setGroup("Menubar");
838 if( iD == -3) {
839 if(!secondToolBar->isHidden()) {
840 secondToolBar->hide();
841 configMenu->changeItem( iD,"Show Command List");
842 cfg.writeEntry("Hidden","TRUE");
843 configMenu->setItemEnabled(-22 ,FALSE);
844 } else {
845 secondToolBar->show();
846 configMenu->changeItem( iD,"Hide Command List");
847 cfg.writeEntry("Hidden","FALSE");
848 configMenu->setItemEnabled(-22 ,TRUE);
849
850 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
851 configMenu->setItemChecked(-22,TRUE);
852 commonCombo->setEditable( TRUE );
853 } else {
854 configMenu->setItemChecked(-22,FALSE);
855 commonCombo->setEditable( FALSE );
856 }
857 }
858 }
859 if( iD == -22) {
860 cfg.setGroup("Commands");
861// qDebug("enableCommandEdit");
862 if( !configMenu->isItemChecked(iD) ) {
863 commonCombo->setEditable( TRUE );
864 configMenu->setItemChecked(iD,TRUE);
865 commonCombo->setCurrentItem(0);
866 cfg.writeEntry("EditEnabled","TRUE");
867 } else {
868 commonCombo->setEditable( FALSE );
869 configMenu->setItemChecked(iD,FALSE);
870 cfg.writeEntry("EditEnabled","FALSE");
871 commonCombo->setFocusPolicy(QWidget::NoFocus);
872 te->setFocus();
873 }
874 }
875 if(iD == -23) {
876 // "edit commands"
877 CommandEditDialog *m = new CommandEditDialog(this);
878 connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList()));
879 m->showMaximized();
880 }
881
882}