author | llornkcor <llornkcor> | 2002-02-03 18:23:27 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-03 18:23:27 (UTC) |
commit | 09c3eed0c594f4c93157faf5269ef4d975a310ca (patch) (side-by-side diff) | |
tree | 9034282b1376e00baadc4405d1c24c1067d6bcb9 /core/apps/embeddedkonsole/konsole.cpp | |
parent | bbbccc44398fc92dcbb148def8d30f2e78f71aa5 (diff) | |
download | opie-09c3eed0c594f4c93157faf5269ef4d975a310ca.zip opie-09c3eed0c594f4c93157faf5269ef4d975a310ca.tar.gz opie-09c3eed0c594f4c93157faf5269ef4d975a310ca.tar.bz2 |
merged in Marks commandlist edit dialog
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 274 |
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 @@ -52,4 +52,5 @@ #include "konsole.h" #include "keytrans.h" +#include "commandeditdialog.h" class EKNumTabBar : public QTabBar { @@ -176,4 +177,24 @@ Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) } +void Konsole::initCommandList() +{ +// qDebug("Konsole::initCommandList"); + Config cfg("Konsole"); + cfg.setGroup("Commands"); + commonCombo->setInsertionPolicy(QComboBox::AtCurrent); + commonCombo->clear(); + if (cfg.readEntry("Commands Set","FALSE") == "FALSE") { + for (int i = 0; commonCmds[i] != NULL; i++) { + commonCombo->insertItem(commonCmds[i],i); + } + } else { + for (int i = 0; i < 100; i++) { + if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) + commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); + } + } + +} + void Konsole::init(const char* _pgm, QStrList & _args) { @@ -226,12 +247,15 @@ void Konsole::init(const char* _pgm, QStrList & _args) colorMenu = new QPopupMenu( this); scrollMenu = new QPopupMenu( this); + editCommandListMenu = new QPopupMenu( this); + + configMenu->insertItem("Command List",editCommandListMenu); bool listHidden; cfg.setGroup("Menubar"); if( cfg.readEntry("Hidden","FALSE") == "TRUE") { - configMenu->insertItem("Show command list"); + editCommandListMenu->insertItem("Show command list"); listHidden=TRUE; } else { - configMenu->insertItem("Hide command list"); + editCommandListMenu->insertItem("Hide command list"); listHidden=FALSE; } @@ -267,5 +291,5 @@ void Konsole::init(const char* _pgm, QStrList & _args) connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); - + connect(editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); @@ -302,19 +326,22 @@ void Konsole::init(const char* _pgm, QStrList & _args) commonCombo = new QComboBox( secondToolBar ); commonCombo->setMaximumWidth(236); - configMenu->insertItem( "Edit Command List"); + + editCommandListMenu->insertItem( "Quick Edit"); if( listHidden) { secondToolBar->hide(); - configMenu->setItemEnabled(-20 ,FALSE); + editCommandListMenu->setItemEnabled(-22 ,FALSE); } + editCommandListMenu->insertItem( "Edit"); cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); - - for (int i = 0; commonCmds[i] != NULL; i++) { - commonCombo->insertItem( commonCmds[i], i ); - tmp = cfg.readEntry( QString::number(i),""); - if(tmp != "") - commonCombo->changeItem( tmp,i ); - } + + initCommandList(); +// for (int i = 0; commonCmds[i] != NULL; i++) { +// commonCombo->insertItem( commonCmds[i], i ); +// tmp = cfg.readEntry( QString::number(i),""); +// if(tmp != "") +// commonCombo->changeItem( tmp,i ); +// } connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); @@ -587,6 +614,6 @@ void Konsole::switchSession(QWidget* w) { void Konsole::colorMenuSelected(int iD) { // this is NOT pretty, elegant or anything else besides functional -// QString temp; -// qDebug( temp.sprintf("%d", iD)); +// QString temp; +// qDebug( temp.sprintf("colormenu %d", iD)); TEWidget* te = getTe(); Config cfg("Konsole"); @@ -599,87 +626,87 @@ void Konsole::colorMenuSelected(int iD) /////////// fore back int i; - if(iD==-8) { // default default + if(iD==-9) { // default default for (i = 0; i < TABLE_COLORS; i++) { m_table[i].color = defaultCt[i].color; if(i==1 || i == 11) m_table[i].transparent=1; - cfg.writeEntry("Schema","8"); - colorMenu->setItemChecked(-8,TRUE); + cfg.writeEntry("Schema","98"); + colorMenu->setItemChecked(-9,TRUE); } } else { - if(iD==-5) { // green black + if(iD==-6) { // green black foreground.setRgb(0x18,255,0x18); background.setRgb(0x00,0x00,0x00); - cfg.writeEntry("Schema","5"); - colorMenu->setItemChecked(-5,TRUE); + cfg.writeEntry("Schema","6"); + colorMenu->setItemChecked(-6,TRUE); } - if(iD==-6) { // black white + if(iD==-7) { // black white foreground.setRgb(0x00,0x00,0x00); background.setRgb(0xFF,0xFF,0xFF); - cfg.writeEntry("Schema","6"); - colorMenu->setItemChecked(-6,TRUE); + cfg.writeEntry("Schema","7"); + colorMenu->setItemChecked(-7,TRUE); } - if(iD==-7) { // white black + if(iD==-8) { // white black foreground.setRgb(0xFF,0xFF,0xFF); background.setRgb(0x00,0x00,0x00); - cfg.writeEntry("Schema","7"); - colorMenu->setItemChecked(-7,TRUE); + cfg.writeEntry("Schema","8"); + colorMenu->setItemChecked(-8,TRUE); } - if(iD==-9) {// Black, Red + if(iD==-10) {// Black, Red foreground.setRgb(0x00,0x00,0x00); background.setRgb(0xB2,0x18,0x18); - cfg.writeEntry("Schema","9"); - colorMenu->setItemChecked(-9,TRUE); + cfg.writeEntry("Schema","10"); + colorMenu->setItemChecked(-10,TRUE); } - if(iD==-10) {// Red, Black + if(iD==-11) {// Red, Black foreground.setRgb(230,31,31); //0xB2,0x18,0x18 background.setRgb(0x00,0x00,0x00); - cfg.writeEntry("Schema","10"); - colorMenu->setItemChecked(-10,TRUE); + cfg.writeEntry("Schema","11"); + colorMenu->setItemChecked(-11,TRUE); } - if(iD==-11) {// Green, Yellow - is ugly + if(iD==-12) {// Green, Yellow - is ugly // foreground.setRgb(0x18,0xB2,0x18); foreground.setRgb(36,139,10); // background.setRgb(0xB2,0x68,0x18); background.setRgb(255,255,0); - cfg.writeEntry("Schema","11"); - colorMenu->setItemChecked(-11,TRUE); - } - if(iD==-12) {// Blue, Magenta - foreground.setRgb(0x18,0xB2,0xB2); - background.setRgb(0x18,0x18,0xB2); cfg.writeEntry("Schema","12"); colorMenu->setItemChecked(-12,TRUE); } - if(iD==-13) {// Magenta, Blue - foreground.setRgb(0x18,0x18,0xB2); - background.setRgb(0x18,0xB2,0xB2); + if(iD==-13) {// Blue, Magenta + foreground.setRgb(0x18,0xB2,0xB2); + background.setRgb(0x18,0x18,0xB2); cfg.writeEntry("Schema","13"); colorMenu->setItemChecked(-13,TRUE); } - if(iD==-14) {// Cyan, White - foreground.setRgb(0x18,0xB2,0xB2); - background.setRgb(0xFF,0xFF,0xFF); + if(iD==-14) {// Magenta, Blue + foreground.setRgb(0x18,0x18,0xB2); + background.setRgb(0x18,0xB2,0xB2); cfg.writeEntry("Schema","14"); colorMenu->setItemChecked(-14,TRUE); } - if(iD==-15) {// White, Cyan - background.setRgb(0x18,0xB2,0xB2); - foreground.setRgb(0xFF,0xFF,0xFF); + if(iD==-15) {// Cyan, White + foreground.setRgb(0x18,0xB2,0xB2); + background.setRgb(0xFF,0xFF,0xFF); cfg.writeEntry("Schema","15"); colorMenu->setItemChecked(-15,TRUE); } - if(iD==-16) {// Black, Blue - background.setRgb(0x00,0x00,0x00); - foreground.setRgb(0x18,0xB2,0xB2); + if(iD==-16) {// White, Cyan + background.setRgb(0x18,0xB2,0xB2); + foreground.setRgb(0xFF,0xFF,0xFF); cfg.writeEntry("Schema","16"); colorMenu->setItemChecked(-16,TRUE); } - if(iD==-17) {// Black, Gold + if(iD==-17) {// Black, Blue background.setRgb(0x00,0x00,0x00); - foreground.setRgb(255,215,0); + foreground.setRgb(0x18,0xB2,0xB2); cfg.writeEntry("Schema","17"); colorMenu->setItemChecked(-17,TRUE); } + if(iD==-18) {// Black, Gold + background.setRgb(0x00,0x00,0x00); + foreground.setRgb(255,215,0); + cfg.writeEntry("Schema","18"); + colorMenu->setItemChecked(-18,TRUE); + } for (i = 0; i < TABLE_COLORS; i++) { @@ -701,31 +728,31 @@ void Konsole::colorMenuSelected(int iD) void Konsole::configMenuSelected(int iD) { - QString temp; - qDebug( temp.sprintf("%d",iD)); + QString temp; + qDebug( temp.sprintf("configmenu %d",iD)); TEWidget* te = getTe(); Config cfg("Konsole"); cfg.setGroup("Menubar"); - if( iD == -2) { - if(!secondToolBar->isHidden()) { - secondToolBar->hide(); - configMenu->changeItem( iD,"Show Command List"); - cfg.writeEntry("Hidden","TRUE"); - configMenu->setItemEnabled(-20 ,FALSE); - } else { - secondToolBar->show(); - configMenu->changeItem( iD,"Hide Command List"); - cfg.writeEntry("Hidden","FALSE"); - configMenu->setItemEnabled(-20 ,TRUE); - - if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { - configMenu->setItemChecked(-20,TRUE); - commonCombo->setEditable( TRUE ); - } else { - configMenu->setItemChecked(-20,FALSE); - commonCombo->setEditable( FALSE ); - } - } - } - if( iD == -3) { +// if( iD == -2) { +// if(!secondToolBar->isHidden()) { +// secondToolBar->hide(); +// configMenu->changeItem( iD,"Show Command List"); +// cfg.writeEntry("Hidden","TRUE"); +// configMenu->setItemEnabled(-20 ,FALSE); +// } else { +// secondToolBar->show(); +// configMenu->changeItem( iD,"Hide Command List"); +// cfg.writeEntry("Hidden","FALSE"); +// configMenu->setItemEnabled(-20 ,TRUE); + +// if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { +// configMenu->setItemChecked(-20,TRUE); +// commonCombo->setEditable( TRUE ); +// } else { +// configMenu->setItemChecked(-20,FALSE); +// commonCombo->setEditable( FALSE ); +// } +// } +// } + if( iD == -4) { cfg.setGroup("Tabs"); QString tmp=cfg.readEntry("Position","Top"); @@ -741,20 +768,20 @@ void Konsole::configMenuSelected(int iD) } } - if( iD == -20) { - cfg.setGroup("Commands"); -// qDebug("enableCommandEdit"); - if( !configMenu->isItemChecked(iD) ) { - commonCombo->setEditable( TRUE ); - configMenu->setItemChecked(iD,TRUE); - commonCombo->setCurrentItem(0); - cfg.writeEntry("EditEnabled","TRUE"); - } else { - commonCombo->setEditable( FALSE ); - configMenu->setItemChecked(iD,FALSE); - cfg.writeEntry("EditEnabled","FALSE"); - commonCombo->setFocusPolicy(QWidget::NoFocus); - te->setFocus(); - } - } +// if( iD == -20) { +// cfg.setGroup("Commands"); +// // qDebug("enableCommandEdit"); +// if( !configMenu->isItemChecked(iD) ) { +// commonCombo->setEditable( TRUE ); +// configMenu->setItemChecked(iD,TRUE); +// commonCombo->setCurrentItem(0); +// cfg.writeEntry("EditEnabled","TRUE"); +// } else { +// commonCombo->setEditable( FALSE ); +// configMenu->setItemChecked(iD,FALSE); +// cfg.writeEntry("EditEnabled","FALSE"); +// commonCombo->setFocusPolicy(QWidget::NoFocus); +// te->setFocus(); +// } +// } } @@ -780,17 +807,19 @@ void Konsole::setColor() void Konsole::scrollMenuSelected(int index) { +// QString temp; +// qDebug( temp.sprintf("scrollbar menu %d",index)); TEWidget* te = getTe(); Config cfg("Konsole"); cfg.setGroup("Scrollbar"); switch( index){ - case -21: + case -24: te->setScrollbarLocation(0); cfg.writeEntry("Position",0); break; - case -22: + case -25: te->setScrollbarLocation(1); cfg.writeEntry("Position",1); break; - case -23: + case -26: te->setScrollbarLocation(2); cfg.writeEntry("Position",2); @@ -799,2 +828,55 @@ void Konsole::scrollMenuSelected(int index) } + +void Konsole::editCommandListMenuSelected(int iD) +{ +// QString temp; +// qDebug( temp.sprintf("edit command list %d",iD)); + TEWidget* te = getTe(); + Config cfg("Konsole"); + cfg.setGroup("Menubar"); + if( iD == -3) { + if(!secondToolBar->isHidden()) { + secondToolBar->hide(); + configMenu->changeItem( iD,"Show Command List"); + cfg.writeEntry("Hidden","TRUE"); + configMenu->setItemEnabled(-22 ,FALSE); + } else { + secondToolBar->show(); + configMenu->changeItem( iD,"Hide Command List"); + cfg.writeEntry("Hidden","FALSE"); + configMenu->setItemEnabled(-22 ,TRUE); + + if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { + configMenu->setItemChecked(-22,TRUE); + commonCombo->setEditable( TRUE ); + } else { + configMenu->setItemChecked(-22,FALSE); + commonCombo->setEditable( FALSE ); + } + } + } + if( iD == -22) { + cfg.setGroup("Commands"); +// qDebug("enableCommandEdit"); + if( !configMenu->isItemChecked(iD) ) { + commonCombo->setEditable( TRUE ); + configMenu->setItemChecked(iD,TRUE); + commonCombo->setCurrentItem(0); + cfg.writeEntry("EditEnabled","TRUE"); + } else { + commonCombo->setEditable( FALSE ); + configMenu->setItemChecked(iD,FALSE); + cfg.writeEntry("EditEnabled","FALSE"); + commonCombo->setFocusPolicy(QWidget::NoFocus); + te->setFocus(); + } + } + if(iD == -23) { + // "edit commands" + CommandEditDialog *m = new CommandEditDialog(this); + connect(m,SIGNAL(commandsEdited()),this,SLOT(initCommandList())); + m->showMaximized(); + } + +} |