-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 16ff4df..f13d0c9 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -193,225 +193,225 @@ void Konsole::initCommandList() if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) commonCombo->insertItem((cfg.readEntry( QString::number(i),""))); } } } void Konsole::init(const char* _pgm, QStrList & _args) { b_scroll = TRUE; // histon; n_keytab = 0; n_render = 0; startUp=0; setCaption( tr("Terminal") ); setIcon( Resource::loadPixmap( "konsole" ) ); Config cfg("Konsole"); cfg.setGroup("Konsole"); QString tmp; // initialize the list of allowed fonts /////////////////////////////////// cfont = cfg.readNumEntry("FontID", 1); QFont f = QFont("Micro", 4, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Micro"), f)); f = QFont("Fixed", 7, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Small Fixed"), f)); f = QFont("Fixed", 12, QFont::Normal); f.setFixedPitch(TRUE); fonts.append(new VTFont(tr("Medium Fixed"), f)); // create terminal emulation framework //////////////////////////////////// nsessions = 0; tab = new EKNumTabWidget(this); connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); // create terminal toolbar //////////////////////////////////////////////// setToolBarsMovable( FALSE ); QPEToolBar *menuToolBar = new QPEToolBar( this ); menuToolBar->setHorizontalStretchable( TRUE ); QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); fontList = new QPopupMenu( this ); for(uint i = 0; i < fonts.count(); i++) { VTFont *fnt = fonts.at(i); fontList->insertItem(fnt->getName(), i); } fontChanged(cfont); configMenu = new QPopupMenu( this); 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") { - editCommandListMenu->insertItem("Show command list"); + editCommandListMenu->insertItem( tr( "Show command list" )); listHidden=TRUE; } else { - editCommandListMenu->insertItem("Hide command list"); + editCommandListMenu->insertItem( tr( "Hide command list" )); listHidden=FALSE; } cfg.setGroup("Tabs"); tmp=cfg.readEntry("Position","Bottom"); if(tmp=="Top") { tab->setTabPosition(QTabWidget::Top); - configMenu->insertItem("Tabs on Bottom"); + configMenu->insertItem( tr( "Tabs on Bottom" ) ); } else { tab->setTabPosition(QTabWidget::Bottom); configMenu->insertItem("Tabs on Top"); } configMenu->insertSeparator(2); - colorMenu->insertItem("Green on Black"); - colorMenu->insertItem("Black on White"); - colorMenu->insertItem("White on Black"); - colorMenu->insertItem("Black on Transparent"); - colorMenu->insertItem("Black on Red"); - colorMenu->insertItem("Red on Black"); - colorMenu->insertItem("Green on Yellow"); - colorMenu->insertItem("Blue on Magenta"); - colorMenu->insertItem("Magenta on Blue"); - colorMenu->insertItem("Cyan on White"); - colorMenu->insertItem("White on Cyan"); - colorMenu->insertItem("Blue on Black"); - colorMenu->insertItem("Amber on Black"); - configMenu->insertItem("Colors",colorMenu); + colorMenu->insertItem(tr( "Green on Black")); + colorMenu->insertItem(tr( "Black on White")); + colorMenu->insertItem(tr( "White on Black")); + colorMenu->insertItem(tr( "Black on Transparent")); + colorMenu->insertItem(tr( "Black on Red")); + colorMenu->insertItem(tr( "Red on Black")); + colorMenu->insertItem(tr( "Green on Yellow")); + colorMenu->insertItem(tr( "Blue on Magenta")); + colorMenu->insertItem(tr( "Magenta on Blue")); + colorMenu->insertItem(tr( "Cyan on White")); + colorMenu->insertItem(tr( "White on Cyan")); + colorMenu->insertItem(tr( "Blue on Black")); + colorMenu->insertItem(tr( "Amber on Black")); + configMenu->insertItem(tr( "Colors") ,colorMenu); connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 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 ); QPEToolBar *toolbar = new QPEToolBar( this ); QAction *a; // Button Commands a = new QAction( tr("New"), Resource::loadPixmap( "konsole" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); a->addTo( toolbar ); a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); /* a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); */ secondToolBar = new QPEToolBar( this ); secondToolBar->setHorizontalStretchable( TRUE ); commonCombo = new QComboBox( secondToolBar ); commonCombo->setMaximumWidth(236); - editCommandListMenu->insertItem( "Quick Edit"); + editCommandListMenu->insertItem( tr( "Quick Edit" ) ); if( listHidden) { secondToolBar->hide(); editCommandListMenu->setItemEnabled(-22 ,FALSE); } - editCommandListMenu->insertItem( "Edit"); + editCommandListMenu->insertItem(tr( "Edit" ) ); cfg.setGroup("Commands"); commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 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) )); - scrollMenu->insertItem("None"); - scrollMenu->insertItem("Left"); - scrollMenu->insertItem("Right"); - configMenu->insertItem("ScrollBar",scrollMenu); + scrollMenu->insertItem(tr( "None" )); + scrollMenu->insertItem(tr( "Left" )); + scrollMenu->insertItem(tr( "Right" )); + configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); // create applications ///////////////////////////////////////////////////// setCentralWidget(tab); // load keymaps //////////////////////////////////////////////////////////// KeyTrans::loadAll(); for (int i = 0; i < KeyTrans::count(); i++) { KeyTrans* s = KeyTrans::find(i); assert( s ); } se_pgm = _pgm; se_args = _args; parseCommandLine(); // read and apply default values /////////////////////////////////////////// resize(321, 321); // Dummy. QSize currentSize = size(); if (currentSize != size()) defaultSize = size(); } void Konsole::show() { if ( !nsessions ) { newSession(); } QMainWindow::show(); } void Konsole::initSession(const char*, QStrList &) { QMainWindow::show(); } Konsole::~Konsole() { while (nsessions > 0) { doneSession(getTe()->currentSession, 0); } Config cfg("Konsole"); cfg.setGroup("Konsole"); cfg.writeEntry("FontID", cfont); } void Konsole::fontChanged(int f) { VTFont* font = fonts.at(f); if (font != 0) { for(uint i = 0; i < fonts.count(); i++) { fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); } cfont = f; TEWidget* te = getTe(); if (te != 0) { te->setVTFont(font->getFont()); } } } @@ -741,134 +741,134 @@ void Konsole::configMenuSelected(int iD) tab->setTabPosition(QTabWidget::Bottom); configMenu->changeItem( iD,"Tabs on Top"); cfg.writeEntry("Position","Bottom"); } else { tab->setTabPosition(QTabWidget::Top); configMenu->changeItem( iD,"Tabs on Bottom"); cfg.writeEntry("Position","Top"); } } } void Konsole::changeCommand(const QString &text, int c) { Config cfg("Konsole"); cfg.setGroup("Commands"); if(commonCmds[c] != text) { cfg.writeEntry(QString::number(c),text); commonCombo->clearEdit(); commonCombo->setCurrentItem(c); } } void Konsole::setColor() { Config cfg("Konsole"); cfg.setGroup("Colors"); int scheme = cfg.readNumEntry("Schema",1); if(scheme != 1) colorMenuSelected( -scheme); } 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 -24: te->setScrollbarLocation(0); cfg.writeEntry("Position",0); break; case -25: te->setScrollbarLocation(1); cfg.writeEntry("Position",1); break; case -26: te->setScrollbarLocation(2); cfg.writeEntry("Position",2); break; }; } 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"); + configMenu->changeItem( iD,tr( "Show Command List" )); cfg.writeEntry("Hidden","TRUE"); configMenu->setItemEnabled(-22 ,FALSE); } else { secondToolBar->show(); - configMenu->changeItem( iD,"Hide Command List"); + configMenu->changeItem( iD,tr( "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(); } } // $QPEDIR/bin/qcop QPE/Application/embeddedkonsole 'setDocument(QString)' 'ssh -V' void Konsole::setDocument( const QString &cmd) { newSession(); TEWidget* te = getTe(); if(cmd.find("-e", 0, TRUE) != -1) { QString cmd2; cmd2=cmd.right(cmd.length()-3)+" &"; system(cmd2.latin1()); if(startUp <= 1 && nsessions < 2) { doneSession(getTe()->currentSession, 0); exit(0); } else doneSession(getTe()->currentSession, 0); } else { if (te != 0) { te->emitText(cmd+"\r"); } } startUp++; } void Konsole::parseCommandLine() { QString cmd; // newSession(); for (int i=1;i< qApp->argc();i++) { if( QString(qApp->argv()[i]) == "-e") { i++; |