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.cpp37
1 files changed, 23 insertions, 14 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index de00494..7f3ea65 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -9,53 +9,53 @@
9/* */ 9/* */
10/* This file is part of Konsole, an X terminal. */ 10/* This file is part of Konsole, an X terminal. */
11/* */ 11/* */
12/* The material contained in here more or less directly orginates from */ 12/* The material contained in here more or less directly orginates from */
13/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ 13/* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */
14/* */ 14/* */
15/* ---------------------------------------------------------------------- */ 15/* ---------------------------------------------------------------------- */
16/* */ 16/* */
17/* Ported Konsole to Qt/Embedded */ 17/* Ported Konsole to Qt/Embedded */
18/* */ 18/* */
19/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 19/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
20/* */ 20/* */
21/* -------------------------------------------------------------------------- */ 21/* -------------------------------------------------------------------------- */
22// enhancements added by L.J. Potter <ljp@llornkcor.com> 22// enhancements added by L.J. Potter <ljp@llornkcor.com>
23// enhancements added by Phillip Kuhn 23// enhancements added by Phillip Kuhn
24 24
25#include <stdlib.h> 25#include <stdlib.h>
26#include <sys/types.h> 26#include <sys/types.h>
27#include <pwd.h> 27#include <pwd.h>
28#include <unistd.h> 28#include <unistd.h>
29 29
30#ifdef QT_QWS_OPIE 30#ifdef QT_QWS_OPIE
31#include <opie2/ocolorpopupmenu.h> 31#include <opie2/ocolorpopupmenu.h>
32#include <opie2/odebug.h> 32#include <opie2/odebug.h>
33#include <opie2/oresource.h>
34
33using namespace Opie; 35using namespace Opie;
34#endif 36#endif
35 37
36#include <qpe/resource.h>
37
38#include <qmenubar.h> 38#include <qmenubar.h>
39#include <qtabbar.h> 39#include <qtabbar.h>
40#include <qpe/config.h> 40#include <qpe/config.h>
41#include <qfontdatabase.h> 41#include <qfontdatabase.h>
42#include <qfile.h> 42#include <qfile.h>
43#include <qspinbox.h> 43#include <qspinbox.h>
44#include <qlayout.h> 44#include <qlayout.h>
45 45
46#include <sys/wait.h> 46#include <sys/wait.h>
47#include <stdio.h> 47#include <stdio.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <assert.h> 49#include <assert.h>
50 50
51#include "konsole.h" 51#include "konsole.h"
52#include "commandeditdialog.h" 52#include "commandeditdialog.h"
53 53
54class EKNumTabBar : public QTabBar 54class EKNumTabBar : public QTabBar
55{ 55{
56public: 56public:
57 EKNumTabBar(QWidget *parent = 0, const char *name = 0) : 57 EKNumTabBar(QWidget *parent = 0, const char *name = 0) :
58 QTabBar(parent, name) 58 QTabBar(parent, name)
59 {} 59 {}
60 60
61 // QList<QTab> *getTabList() { return(tabList()); } 61 // QList<QTab> *getTabList() { return(tabList()); }
@@ -355,49 +355,49 @@ static void sig_handler(int x)
355void Konsole::init(const char* _pgm, QStrList & _args) 355void Konsole::init(const char* _pgm, QStrList & _args)
356{ 356{
357 357
358#if 0 358#if 0
359 for(int i=1; i<=31; i++) 359 for(int i=1; i<=31; i++)
360 { 360 {
361 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV 361 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
362 && i != SIGINT && i != SIGILL && i != SIGTERM 362 && i != SIGINT && i != SIGILL && i != SIGTERM
363 && i != SIGBUS) 363 && i != SIGBUS)
364 signal(i,sig_handler); 364 signal(i,sig_handler);
365 } 365 }
366#endif 366#endif
367 signal(SIGSTOP, sig_handler); 367 signal(SIGSTOP, sig_handler);
368 signal(SIGCONT, sig_handler); 368 signal(SIGCONT, sig_handler);
369 signal(SIGTSTP, sig_handler); 369 signal(SIGTSTP, sig_handler);
370 370
371 b_scroll = TRUE; // histon; 371 b_scroll = TRUE; // histon;
372 n_keytab = 0; 372 n_keytab = 0;
373 n_render = 0; 373 n_render = 0;
374 startUp=0; 374 startUp=0;
375 fromMenu = FALSE; 375 fromMenu = FALSE;
376 fullscreen = false; 376 fullscreen = false;
377 377
378 setCaption( tr( "Konsole" ) ); 378 setCaption( tr( "Konsole" ) );
379 setIcon( Resource::loadPixmap( "konsole/Terminal" ) ); 379 setIcon( Opie::Core::OResource::loadPixmap( "konsole/Terminal", Opie::Core::OResource::SmallIcon ) );
380 380
381 Config cfg( "Konsole" ); 381 Config cfg( "Konsole" );
382 cfg.setGroup("Font"); 382 cfg.setGroup("Font");
383 QString tmp; 383 QString tmp;
384 384
385 // initialize the list of allowed fonts /////////////////////////////////// 385 // initialize the list of allowed fonts ///////////////////////////////////
386 386
387 QString cfgFontName = cfg.readEntry("FontName","Lcfont"); 387 QString cfgFontName = cfg.readEntry("FontName","Lcfont");
388 int cfgFontSize = cfg.readNumEntry("FontSize",18); 388 int cfgFontSize = cfg.readNumEntry("FontSize",18);
389 389
390 cfont = -1; 390 cfont = -1;
391 391
392 // this code causes repeated access to all the font files 392 // this code causes repeated access to all the font files
393 // which does slow down startup 393 // which does slow down startup
394 QFontDatabase fontDB; 394 QFontDatabase fontDB;
395 QStringList familyNames; 395 QStringList familyNames;
396 familyNames = fontDB.families( FALSE ); 396 familyNames = fontDB.families( FALSE );
397 QString s; 397 QString s;
398 int fontIndex = 0; 398 int fontIndex = 0;
399 int familyNum = 0; 399 int familyNum = 0;
400 fontList = new QPopupMenu( this ); 400 fontList = new QPopupMenu( this );
401 401
402 for(uint j = 0; j < (uint)familyNames.count(); j++) 402 for(uint j = 0; j < (uint)familyNames.count(); j++)
403 { 403 {
@@ -549,93 +549,102 @@ void Konsole::init(const char* _pgm, QStrList & _args)
549 549
550 cm_bw = colorMenu->insertItem(tr( "Black on White")); 550 cm_bw = colorMenu->insertItem(tr( "Black on White"));
551 cm_wb = colorMenu->insertItem(tr( "White on Black")); 551 cm_wb = colorMenu->insertItem(tr( "White on Black"));
552 cm_gb = colorMenu->insertItem(tr( "Green on Black")); 552 cm_gb = colorMenu->insertItem(tr( "Green on Black"));
553 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); 553 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
554 cm_br = colorMenu->insertItem(tr( "Black on Pink")); 554 cm_br = colorMenu->insertItem(tr( "Black on Pink"));
555 cm_rb = colorMenu->insertItem(tr( "Pink on Black")); 555 cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
556 cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); 556 cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
557 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); 557 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
558 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); 558 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));
559 cm_cw = colorMenu->insertItem(tr( "Cyan on White")); 559 cm_cw = colorMenu->insertItem(tr( "Cyan on White"));
560 cm_wc = colorMenu->insertItem(tr( "White on Cyan")); 560 cm_wc = colorMenu->insertItem(tr( "White on Cyan"));
561 cm_bb = colorMenu->insertItem(tr( "Blue on Black")); 561 cm_bb = colorMenu->insertItem(tr( "Blue on Black"));
562 cm_ab = colorMenu->insertItem(tr( "Amber on Black")); 562 cm_ab = colorMenu->insertItem(tr( "Amber on Black"));
563 cm_default = colorMenu->insertItem(tr("default")); 563 cm_default = colorMenu->insertItem(tr("default"));
564 564
565#ifdef QT_QWS_OPIE 565#ifdef QT_QWS_OPIE
566 566
567 colorMenu->insertItem(tr( "Custom")); 567 colorMenu->insertItem(tr( "Custom"));
568#endif 568#endif
569 569
570 configMenu->insertItem(tr( "Colors") ,colorMenu); 570 configMenu->insertItem(tr( "Colors") ,colorMenu);
571 571
572 sessionList = new QPopupMenu(this); 572 sessionList = new QPopupMenu(this);
573 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this, 573 sessionList-> insertItem ( Opie::Core::OResource::loadPixmap( "konsole/Terminal", Opie::Core::OResource::SmallIcon ),
574 SLOT(newSession()) ); 574 tr( "new session" ), this, SLOT(newSession()) );
575 575
576 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 576 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
577 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 577 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
578 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); 578 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
579 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); 579 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) ));
580 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 580 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
581 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 581 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
582 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); 582 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) );
583 583
584 menuBar->insertItem( tr("View"), configMenu ); 584 menuBar->insertItem( tr("View"), configMenu );
585 menuBar->insertItem( tr("Fonts"), fontList ); 585 menuBar->insertItem( tr("Fonts"), fontList );
586 menuBar->insertItem( tr("Sessions"), sessionList ); 586 menuBar->insertItem( tr("Sessions"), sessionList );
587 587
588 toolBar = new QToolBar( this ); 588 toolBar = new QToolBar( this );
589 589
590 QAction *a; 590 QAction *a;
591 591
592 // Button Commands 592 // Button Commands
593 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/konsole" ), QString::null, 0, this, 0 ); 593 a = new QAction( tr("New"), Opie::Core::OResource::loadPixmap( "konsole/konsole", Opie::Core::OResource::SmallIcon ),
594 QString::null, 0, this, 0 );
594 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 595 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
595 a->addTo( toolBar ); 596 a->addTo( toolBar );
596 597
597 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); 598 a = new QAction( tr("Full Screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ),
599 QString::null, 0, this, 0 );
598 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) ); 600 connect( a, SIGNAL( activated() ), this, SLOT( toggleFullScreen() ) );
599 a->addTo( toolBar ); 601 a->addTo( toolBar );
600 602
601 a = new QAction( tr("Zoom"), Resource::loadPixmap( "zoom" ), QString::null, 0, this, 0 ); 603 a = new QAction( tr("Zoom"), Opie::Core::OResource::loadPixmap( "zoom", Opie::Core::OResource::SmallIcon ),
604 QString::null, 0, this, 0 );
602 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) ); 605 connect( a, SIGNAL( activated() ), this, SLOT( cycleZoom() ) );
603 a->addTo( toolBar ); 606 a->addTo( toolBar );
604 607
605 608
606 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 609 a = new QAction( tr("Enter"), Opie::Core::OResource::loadPixmap( "konsole/enter", Opie::Core::OResource::SmallIcon ),
610 QString::null, 0, this, 0 );
607 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar ); 611 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolBar );
608 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 612 a = new QAction( tr("Space"), Opie::Core::OResource::loadPixmap( "konsole/space", Opie::Core::OResource::SmallIcon ),
613 QString::null, 0, this, 0 );
609 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar ); 614 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolBar );
610 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 615 a = new QAction( tr("Tab"), Opie::Core::OResource::loadPixmap( "konsole/tab", Opie::Core::OResource::SmallIcon ),
616 QString::null, 0, this, 0 );
611 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar ); 617 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolBar );
612 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 618 a = new QAction( tr("Up"), Opie::Core::OResource::loadPixmap( "konsole/up", Opie::Core::OResource::SmallIcon ),
619 QString::null, 0, this, 0 );
613 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar ); 620 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolBar );
614 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 621 a = new QAction( tr("Down"), Opie::Core::OResource::loadPixmap( "konsole/down", Opie::Core::OResource::SmallIcon ),
622 QString::null, 0, this, 0 );
615 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar ); 623 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolBar );
616 624
617 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 625 a = new QAction( tr("Paste"), Opie::Core::OResource::loadPixmap( "paste", Opie::Core::OResource::SmallIcon ),
626 QString::null, 0, this, 0 );
618 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); 627 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) );
619 a->addTo( toolBar ); 628 a->addTo( toolBar );
620 629
621 secondToolBar = new QToolBar( this ); 630 secondToolBar = new QToolBar( this );
622 secondToolBar->setHorizontalStretchable( TRUE ); 631 secondToolBar->setHorizontalStretchable( TRUE );
623 632
624 commonCombo = new QComboBox( secondToolBar ); 633 commonCombo = new QComboBox( secondToolBar );
625 // commonCombo->setMaximumWidth(236); 634 // commonCombo->setMaximumWidth(236);
626 635
627 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 636 ec_quick = editCommandListMenu->insertItem( tr( "Quick Edit" ) );
628 if( listHidden) 637 if( listHidden)
629 { 638 {
630 secondToolBar->hide(); 639 secondToolBar->hide();
631 editCommandListMenu->setItemEnabled(ec_quick ,FALSE); 640 editCommandListMenu->setItemEnabled(ec_quick ,FALSE);
632 } 641 }
633 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) ); 642 ec_edit = editCommandListMenu->insertItem(tr( "Edit..." ) );
634 643
635 cfg.setGroup("Commands"); 644 cfg.setGroup("Commands");
636 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 645 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
637 646
638 initCommandList(); 647 initCommandList();
639 // for (int i = 0; commonCmds[i] != NULL; i++) { 648 // for (int i = 0; commonCmds[i] != NULL; i++) {
640 // commonCombo->insertItem( commonCmds[i], i ); 649 // commonCombo->insertItem( commonCmds[i], i );
641 // tmp = cfg.readEntry( QString::number(i),""); 650 // tmp = cfg.readEntry( QString::number(i),"");