-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 3f6e0b4..b0d28fc 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -221,68 +221,68 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
221 | f = QFont("Fixed", 7, QFont::Normal); | 221 | f = QFont("Fixed", 7, QFont::Normal); |
222 | f.setFixedPitch(TRUE); | 222 | f.setFixedPitch(TRUE); |
223 | fonts.append(new VTFont(tr("Small Fixed"), f)); | 223 | fonts.append(new VTFont(tr("Small Fixed"), f)); |
224 | 224 | ||
225 | f = QFont("Fixed", 12, QFont::Normal); | 225 | f = QFont("Fixed", 12, QFont::Normal); |
226 | f.setFixedPitch(TRUE); | 226 | f.setFixedPitch(TRUE); |
227 | fonts.append(new VTFont(tr("Medium Fixed"), f)); | 227 | fonts.append(new VTFont(tr("Medium Fixed"), f)); |
228 | 228 | ||
229 | // create terminal emulation framework //////////////////////////////////// | 229 | // create terminal emulation framework //////////////////////////////////// |
230 | nsessions = 0; | 230 | nsessions = 0; |
231 | 231 | ||
232 | tab = new EKNumTabWidget(this); | 232 | tab = new EKNumTabWidget(this); |
233 | 233 | ||
234 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); | 234 | connect(tab, SIGNAL(currentChanged(QWidget*)), this, SLOT(switchSession(QWidget*))); |
235 | 235 | ||
236 | // create terminal toolbar //////////////////////////////////////////////// | 236 | // create terminal toolbar //////////////////////////////////////////////// |
237 | setToolBarsMovable( FALSE ); | 237 | setToolBarsMovable( FALSE ); |
238 | QPEToolBar *menuToolBar = new QPEToolBar( this ); | 238 | QPEToolBar *menuToolBar = new QPEToolBar( this ); |
239 | menuToolBar->setHorizontalStretchable( TRUE ); | 239 | menuToolBar->setHorizontalStretchable( TRUE ); |
240 | 240 | ||
241 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); | 241 | QPEMenuBar *menuBar = new QPEMenuBar( menuToolBar ); |
242 | 242 | ||
243 | fontList = new QPopupMenu( this ); | 243 | fontList = new QPopupMenu( this ); |
244 | for(uint i = 0; i < fonts.count(); i++) { | 244 | for(uint i = 0; i < fonts.count(); i++) { |
245 | VTFont *fnt = fonts.at(i); | 245 | VTFont *fnt = fonts.at(i); |
246 | fontList->insertItem(fnt->getName(), i); | 246 | fontList->insertItem(fnt->getName(), i); |
247 | } | 247 | } |
248 | fontChanged(cfont); | 248 | fontChanged(cfont); |
249 | 249 | ||
250 | configMenu = new QPopupMenu( this); | 250 | configMenu = new QPopupMenu( this); |
251 | colorMenu = new QPopupMenu( this); | 251 | colorMenu = new QPopupMenu( this); |
252 | scrollMenu = new QPopupMenu( this); | 252 | scrollMenu = new QPopupMenu( this); |
253 | editCommandListMenu = new QPopupMenu( this); | 253 | editCommandListMenu = new QPopupMenu( this); |
254 | 254 | ||
255 | configMenu->insertItem("Command List",editCommandListMenu); | 255 | configMenu->insertItem("Command List",editCommandListMenu); |
256 | 256 | ||
257 | bool listHidden; | 257 | bool listHidden; |
258 | cfg.setGroup("Menubar"); | 258 | cfg.setGroup("Menubar"); |
259 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { | 259 | if( cfg.readEntry("Hidden","FALSE") == "TRUE") { |
260 | editCommandListMenu->insertItem( tr( "Show command list" )); | 260 | editCommandListMenu->insertItem( tr( "Show command list" )); |
261 | listHidden=TRUE; | 261 | listHidden=TRUE; |
262 | } else { | 262 | } else { |
263 | editCommandListMenu->insertItem( tr( "Hide command list" )); | 263 | editCommandListMenu->insertItem( tr( "Hide command list" )); |
264 | listHidden=FALSE; | 264 | listHidden=FALSE; |
265 | } | 265 | } |
266 | 266 | ||
267 | cfg.setGroup("Tabs"); | 267 | cfg.setGroup("Tabs"); |
268 | tmp=cfg.readEntry("Position","Bottom"); | 268 | tmp=cfg.readEntry("Position","Bottom"); |
269 | if(tmp=="Top") { | 269 | if(tmp=="Top") { |
270 | tab->setTabPosition(QTabWidget::Top); | 270 | tab->setTabPosition(QTabWidget::Top); |
271 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); | 271 | configMenu->insertItem( tr( "Tabs on Bottom" ) ); |
272 | } else { | 272 | } else { |
273 | tab->setTabPosition(QTabWidget::Bottom); | 273 | tab->setTabPosition(QTabWidget::Bottom); |
274 | configMenu->insertItem("Tabs on Top"); | 274 | configMenu->insertItem("Tabs on Top"); |
275 | } | 275 | } |
276 | configMenu->insertSeparator(2); | 276 | configMenu->insertSeparator(2); |
277 | 277 | ||
278 | colorMenu->insertItem(tr( "Green on Black")); | 278 | colorMenu->insertItem(tr( "Green on Black")); |
279 | colorMenu->insertItem(tr( "Black on White")); | 279 | colorMenu->insertItem(tr( "Black on White")); |
280 | colorMenu->insertItem(tr( "White on Black")); | 280 | colorMenu->insertItem(tr( "White on Black")); |
281 | colorMenu->insertItem(tr( "Black on Transparent")); | 281 | colorMenu->insertItem(tr( "Black on Transparent")); |
282 | colorMenu->insertItem(tr( "Black on Red")); | 282 | colorMenu->insertItem(tr( "Black on Red")); |
283 | colorMenu->insertItem(tr( "Red on Black")); | 283 | colorMenu->insertItem(tr( "Red on Black")); |
284 | colorMenu->insertItem(tr( "Green on Yellow")); | 284 | colorMenu->insertItem(tr( "Green on Yellow")); |
285 | colorMenu->insertItem(tr( "Blue on Magenta")); | 285 | colorMenu->insertItem(tr( "Blue on Magenta")); |
286 | colorMenu->insertItem(tr( "Magenta on Blue")); | 286 | colorMenu->insertItem(tr( "Magenta on Blue")); |
287 | colorMenu->insertItem(tr( "Cyan on White")); | 287 | colorMenu->insertItem(tr( "Cyan on White")); |
288 | colorMenu->insertItem(tr( "White on Cyan")); | 288 | colorMenu->insertItem(tr( "White on Cyan")); |
@@ -310,80 +310,80 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
310 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); | 310 | a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); |
311 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); | 311 | connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); |
312 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); | 312 | a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); |
313 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); | 313 | connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); |
314 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); | 314 | a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); |
315 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 315 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
316 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); | 316 | a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); |
317 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 317 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
318 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); | 318 | a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); |
319 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); | 319 | connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); |
320 | /* | 320 | /* |
321 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); | 321 | a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); |
322 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); | 322 | connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); |
323 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); | 323 | a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); |
324 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); | 324 | connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); |
325 | */ | 325 | */ |
326 | 326 | ||
327 | secondToolBar = new QPEToolBar( this ); | 327 | secondToolBar = new QPEToolBar( this ); |
328 | secondToolBar->setHorizontalStretchable( TRUE ); | 328 | secondToolBar->setHorizontalStretchable( TRUE ); |
329 | 329 | ||
330 | commonCombo = new QComboBox( secondToolBar ); | 330 | commonCombo = new QComboBox( secondToolBar ); |
331 | commonCombo->setMaximumWidth(236); | 331 | commonCombo->setMaximumWidth(236); |
332 | 332 | ||
333 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); | 333 | editCommandListMenu->insertItem( tr( "Quick Edit" ) ); |
334 | if( listHidden) { | 334 | if( listHidden) { |
335 | secondToolBar->hide(); | 335 | secondToolBar->hide(); |
336 | editCommandListMenu->setItemEnabled(-22 ,FALSE); | 336 | editCommandListMenu->setItemEnabled(-22 ,FALSE); |
337 | } | 337 | } |
338 | editCommandListMenu->insertItem(tr( "Edit" ) ); | 338 | editCommandListMenu->insertItem(tr( "Edit" ) ); |
339 | 339 | ||
340 | cfg.setGroup("Commands"); | 340 | cfg.setGroup("Commands"); |
341 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 341 | commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
342 | 342 | ||
343 | initCommandList(); | 343 | initCommandList(); |
344 | // for (int i = 0; commonCmds[i] != NULL; i++) { | 344 | // for (int i = 0; commonCmds[i] != NULL; i++) { |
345 | // commonCombo->insertItem( commonCmds[i], i ); | 345 | // commonCombo->insertItem( commonCmds[i], i ); |
346 | // tmp = cfg.readEntry( QString::number(i),""); | 346 | // tmp = cfg.readEntry( QString::number(i),""); |
347 | // if(tmp != "") | 347 | // if(tmp != "") |
348 | // commonCombo->changeItem( tmp,i ); | 348 | // commonCombo->changeItem( tmp,i ); |
349 | // } | 349 | // } |
350 | 350 | ||
351 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); | 351 | connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); |
352 | 352 | ||
353 | scrollMenu->insertItem(tr( "None" )); | 353 | scrollMenu->insertItem(tr( "None" )); |
354 | scrollMenu->insertItem(tr( "Left" )); | 354 | scrollMenu->insertItem(tr( "Left" )); |
355 | scrollMenu->insertItem(tr( "Right" )); | 355 | scrollMenu->insertItem(tr( "Right" )); |
356 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); | 356 | configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); |
357 | 357 | ||
358 | // create applications ///////////////////////////////////////////////////// | 358 | // create applications ///////////////////////////////////////////////////// |
359 | setCentralWidget(tab); | 359 | setCentralWidget(tab); |
360 | 360 | ||
361 | // load keymaps //////////////////////////////////////////////////////////// | 361 | // load keymaps //////////////////////////////////////////////////////////// |
362 | KeyTrans::loadAll(); | 362 | KeyTrans::loadAll(); |
363 | for (int i = 0; i < KeyTrans::count(); i++) | 363 | for (int i = 0; i < KeyTrans::count(); i++) |
364 | { KeyTrans* s = KeyTrans::find(i); | 364 | { KeyTrans* s = KeyTrans::find(i); |
365 | assert( s ); | 365 | assert( s ); |
366 | } | 366 | } |
367 | 367 | ||
368 | se_pgm = _pgm; | 368 | se_pgm = _pgm; |
369 | se_args = _args; | 369 | se_args = _args; |
370 | 370 | ||
371 | parseCommandLine(); | 371 | parseCommandLine(); |
372 | // read and apply default values /////////////////////////////////////////// | 372 | // read and apply default values /////////////////////////////////////////// |
373 | resize(321, 321); // Dummy. | 373 | resize(321, 321); // Dummy. |
374 | QSize currentSize = size(); | 374 | QSize currentSize = size(); |
375 | if (currentSize != size()) | 375 | if (currentSize != size()) |
376 | defaultSize = size(); | 376 | defaultSize = size(); |
377 | } | 377 | } |
378 | 378 | ||
379 | void Konsole::show() | 379 | void Konsole::show() |
380 | { | 380 | { |
381 | if ( !nsessions ) { | 381 | if ( !nsessions ) { |
382 | newSession(); | 382 | newSession(); |
383 | } | 383 | } |
384 | QMainWindow::show(); | 384 | QMainWindow::show(); |
385 | } | 385 | } |
386 | 386 | ||
387 | void Konsole::initSession(const char*, QStrList &) | 387 | void Konsole::initSession(const char*, QStrList &) |
388 | { | 388 | { |
389 | QMainWindow::show(); | 389 | QMainWindow::show(); |
@@ -748,80 +748,80 @@ void Konsole::configMenuSelected(int iD) | |||
748 | tab->setTabPosition(QTabWidget::Top); | 748 | tab->setTabPosition(QTabWidget::Top); |
749 | configMenu->changeItem( iD,"Tabs on Bottom"); | 749 | configMenu->changeItem( iD,"Tabs on Bottom"); |
750 | cfg.writeEntry("Position","Top"); | 750 | cfg.writeEntry("Position","Top"); |
751 | } | 751 | } |
752 | } | 752 | } |
753 | } | 753 | } |
754 | 754 | ||
755 | void Konsole::changeCommand(const QString &text, int c) | 755 | void Konsole::changeCommand(const QString &text, int c) |
756 | { | 756 | { |
757 | Config cfg("Konsole"); | 757 | Config cfg("Konsole"); |
758 | cfg.setGroup("Commands"); | 758 | cfg.setGroup("Commands"); |
759 | if(commonCmds[c] != text) { | 759 | if(commonCmds[c] != text) { |
760 | cfg.writeEntry(QString::number(c),text); | 760 | cfg.writeEntry(QString::number(c),text); |
761 | commonCombo->clearEdit(); | 761 | commonCombo->clearEdit(); |
762 | commonCombo->setCurrentItem(c); | 762 | commonCombo->setCurrentItem(c); |
763 | } | 763 | } |
764 | } | 764 | } |
765 | 765 | ||
766 | void Konsole::setColor() | 766 | void Konsole::setColor() |
767 | { | 767 | { |
768 | Config cfg("Konsole"); | 768 | Config cfg("Konsole"); |
769 | cfg.setGroup("Colors"); | 769 | cfg.setGroup("Colors"); |
770 | int scheme = cfg.readNumEntry("Schema",1); | 770 | int scheme = cfg.readNumEntry("Schema",1); |
771 | if(scheme != 1) colorMenuSelected( -scheme); | 771 | if(scheme != 1) colorMenuSelected( -scheme); |
772 | } | 772 | } |
773 | 773 | ||
774 | void Konsole::scrollMenuSelected(int index) | 774 | void Konsole::scrollMenuSelected(int index) |
775 | { | 775 | { |
776 | // QString temp; | 776 | // QString temp; |
777 | // qDebug( temp.sprintf("scrollbar menu %d",index)); | 777 | // qDebug( temp.sprintf("scrollbar menu %d",index)); |
778 | TEWidget* te = getTe(); | 778 | TEWidget* te = getTe(); |
779 | Config cfg("Konsole"); | 779 | Config cfg("Konsole"); |
780 | cfg.setGroup("Scrollbar"); | 780 | cfg.setGroup("ScrollBar"); |
781 | switch( index){ | 781 | switch( index){ |
782 | case -24: | 782 | case -24: |
783 | te->setScrollbarLocation(0); | 783 | te->setScrollbarLocation(0); |
784 | cfg.writeEntry("Position",0); | 784 | cfg.writeEntry("Position",0); |
785 | break; | 785 | break; |
786 | case -25: | 786 | case -25: |
787 | te->setScrollbarLocation(1); | 787 | te->setScrollbarLocation(1); |
788 | cfg.writeEntry("Position",1); | 788 | cfg.writeEntry("Position",1); |
789 | break; | 789 | break; |
790 | case -26: | 790 | case -26: |
791 | te->setScrollbarLocation(2); | 791 | te->setScrollbarLocation(2); |
792 | cfg.writeEntry("Position",2); | 792 | cfg.writeEntry("Position",2); |
793 | break; | 793 | break; |
794 | }; | 794 | }; |
795 | 795 | ||
796 | } | 796 | } |
797 | 797 | ||
798 | void Konsole::editCommandListMenuSelected(int iD) | 798 | void Konsole::editCommandListMenuSelected(int iD) |
799 | { | 799 | { |
800 | // QString temp; | 800 | // QString temp; |
801 | // qDebug( temp.sprintf("edit command list %d",iD)); | 801 | // qDebug( temp.sprintf("edit command list %d",iD)); |
802 | TEWidget* te = getTe(); | 802 | TEWidget* te = getTe(); |
803 | Config cfg("Konsole"); | 803 | Config cfg("Konsole"); |
804 | cfg.setGroup("Menubar"); | 804 | cfg.setGroup("Menubar"); |
805 | if( iD == -3) { | 805 | if( iD == -3) { |
806 | if(!secondToolBar->isHidden()) { | 806 | if(!secondToolBar->isHidden()) { |
807 | secondToolBar->hide(); | 807 | secondToolBar->hide(); |
808 | configMenu->changeItem( iD,tr( "Show Command List" )); | 808 | configMenu->changeItem( iD,tr( "Show Command List" )); |
809 | cfg.writeEntry("Hidden","TRUE"); | 809 | cfg.writeEntry("Hidden","TRUE"); |
810 | configMenu->setItemEnabled(-22 ,FALSE); | 810 | configMenu->setItemEnabled(-22 ,FALSE); |
811 | } else { | 811 | } else { |
812 | secondToolBar->show(); | 812 | secondToolBar->show(); |
813 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 813 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
814 | cfg.writeEntry("Hidden","FALSE"); | 814 | cfg.writeEntry("Hidden","FALSE"); |
815 | configMenu->setItemEnabled(-22 ,TRUE); | 815 | configMenu->setItemEnabled(-22 ,TRUE); |
816 | 816 | ||
817 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { | 817 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { |
818 | configMenu->setItemChecked(-22,TRUE); | 818 | configMenu->setItemChecked(-22,TRUE); |
819 | commonCombo->setEditable( TRUE ); | 819 | commonCombo->setEditable( TRUE ); |
820 | } else { | 820 | } else { |
821 | configMenu->setItemChecked(-22,FALSE); | 821 | configMenu->setItemChecked(-22,FALSE); |
822 | commonCombo->setEditable( FALSE ); | 822 | commonCombo->setEditable( FALSE ); |
823 | } | 823 | } |
824 | } | 824 | } |
825 | } | 825 | } |
826 | if( iD == -22) { | 826 | if( iD == -22) { |
827 | cfg.setGroup("Commands"); | 827 | cfg.setGroup("Commands"); |