summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/konsole.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/konsole.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index b8f009d..1c613a9 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -12,25 +12,24 @@
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//#define QT_QWS_OPIE
25 24
26#include <stdlib.h> 25#include <stdlib.h>
27 26
28#ifdef QT_QWS_OPIE 27#ifdef QT_QWS_OPIE
29#include <opie2/ocolorpopupmenu.h> 28#include <opie2/ocolorpopupmenu.h>
30#endif 29#endif
31 30
32#include <qpe/resource.h> 31#include <qpe/resource.h>
33 32
34#include <qdir.h> 33#include <qdir.h>
35#include <qevent.h> 34#include <qevent.h>
36#include <qdragobject.h> 35#include <qdragobject.h>
@@ -360,26 +359,26 @@ void Konsole::init(const char* _pgm, QStrList & _args)
360#endif 359#endif
361 signal(SIGSTOP, sig_handler); 360 signal(SIGSTOP, sig_handler);
362 signal(SIGCONT, sig_handler); 361 signal(SIGCONT, sig_handler);
363 signal(SIGTSTP, sig_handler); 362 signal(SIGTSTP, sig_handler);
364 363
365 b_scroll = TRUE; // histon; 364 b_scroll = TRUE; // histon;
366 n_keytab = 0; 365 n_keytab = 0;
367 n_render = 0; 366 n_render = 0;
368 startUp=0; 367 startUp=0;
369 fromMenu = FALSE; 368 fromMenu = FALSE;
370 fullscreen = false; 369 fullscreen = false;
371 370
372 setCaption( "Konsole" ); 371 setCaption( tr( "Konsole" ) );
373 setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); 372 setIcon( Resource::loadPixmap( "konsole/Terminal" ) );
374 373
375 Config cfg( "Konsole" ); 374 Config cfg( "Konsole" );
376 cfg.setGroup("Font"); 375 cfg.setGroup("Font");
377 QString tmp; 376 QString tmp;
378 377
379 // initialize the list of allowed fonts /////////////////////////////////// 378 // initialize the list of allowed fonts ///////////////////////////////////
380 379
381 QString cfgFontName = cfg.readEntry("FontName","Lcfont"); 380 QString cfgFontName = cfg.readEntry("FontName","Lcfont");
382 int cfgFontSize = cfg.readNumEntry("FontSize",18); 381 int cfgFontSize = cfg.readNumEntry("FontSize",18);
383 382
384 cfont = -1; 383 cfont = -1;
385 384
@@ -568,25 +567,25 @@ void Konsole::init(const char* _pgm, QStrList & _args)
568 cm_bb = colorMenu->insertItem(tr( "Blue on Black")); 567 cm_bb = colorMenu->insertItem(tr( "Blue on Black"));
569 cm_ab = colorMenu->insertItem(tr( "Amber on Black")); 568 cm_ab = colorMenu->insertItem(tr( "Amber on Black"));
570 cm_default = colorMenu->insertItem(tr("default")); 569 cm_default = colorMenu->insertItem(tr("default"));
571 570
572#ifdef QT_QWS_OPIE 571#ifdef QT_QWS_OPIE
573 572
574 colorMenu->insertItem(tr( "Custom")); 573 colorMenu->insertItem(tr( "Custom"));
575#endif 574#endif
576 575
577 configMenu->insertItem(tr( "Colors") ,colorMenu); 576 configMenu->insertItem(tr( "Colors") ,colorMenu);
578 577
579 sessionList = new QPopupMenu(this); 578 sessionList = new QPopupMenu(this);
580 sessionList-> insertItem ( Resource::loadPixmap ( "qkonsole/qkonsole" ), tr( "new session" ), this, 579 sessionList-> insertItem ( Resource::loadPixmap ( "konsole/Terminal" ), tr( "new session" ), this,
581 SLOT(newSession()) ); 580 SLOT(newSession()) );
582 581
583 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); 582 // connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) ));
584 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); 583 connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) ));
585 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) )); 584 connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuIsSelected(int) ));
586 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) )); 585 connect( tabMenu, SIGNAL( activated(int) ), this, SLOT( tabMenuSelected(int) ));
587 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); 586 connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int)));
588 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int))); 587 connect( editCommandListMenu,SIGNAL(activated(int)),this,SLOT(editCommandListMenuSelected(int)));
589 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) ); 588 connect( sessionList, SIGNAL(activated(int)), this, SLOT( sessionListSelected(int) ) );
590 589
591 menuBar->insertItem( tr("View"), configMenu ); 590 menuBar->insertItem( tr("View"), configMenu );
592 menuBar->insertItem( tr("Fonts"), fontList ); 591 menuBar->insertItem( tr("Fonts"), fontList );
@@ -870,25 +869,25 @@ void Konsole::changeFontSize(int delta)
870 { 869 {
871 closest = fsize; 870 closest = fsize;
872 closest_font = i; 871 closest_font = i;
873 } 872 }
874 } 873 }
875 if (closest_font >= 0) 874 if (closest_font >= 0)
876 { 875 {
877 printf("font closest %d (%d)\n", closest_font, closest); 876 printf("font closest %d (%d)\n", closest_font, closest);
878 setFont(closest_font); 877 setFont(closest_font);
879 } 878 }
880} 879}
881 880
882int Konsole::findFont(QString name, int size, bool exactMatch) 881int Konsole::findFont(const QString& name, int size, bool exactMatch)
883{ 882{
884 for(uint i = 0; i < fonts.count(); i++) 883 for(uint i = 0; i < fonts.count(); i++)
885 { 884 {
886 if (fonts.at(i)->getName() == name 885 if (fonts.at(i)->getName() == name
887 && fonts.at(i)->getSize() == size) 886 && fonts.at(i)->getSize() == size)
888 { 887 {
889 return(i); 888 return(i);
890 } 889 }
891 } 890 }
892 if (exactMatch) 891 if (exactMatch)
893 { 892 {
894 return(-1); 893 return(-1);
@@ -1150,29 +1149,29 @@ void Konsole::doneSession(TEWidget* te, int )
1150 tab->removeTab(te); 1149 tab->removeTab(te);
1151 delete te->currentSession; 1150 delete te->currentSession;
1152 delete te; 1151 delete te;
1153 sessionList->removeItem(nsessions); 1152 sessionList->removeItem(nsessions);
1154 nsessions--; 1153 nsessions--;
1155 } 1154 }
1156 if (nsessions == 0) 1155 if (nsessions == 0)
1157 { 1156 {
1158 close(); 1157 close();
1159 } 1158 }
1160} 1159}
1161 1160
1162void Konsole::changeTitle(TEWidget* te, QString newTitle ) 1161void Konsole::changeTitle(TEWidget* te, const QString& newTitle )
1163{ 1162{
1164 if (te == getTe()) 1163 if (te == getTe())
1165 { 1164 {
1166 setCaption(newTitle + " - QKonsole"); 1165 setCaption( newTitle + " - " + tr( "Konsole " ) );
1167 } 1166 }
1168} 1167}
1169 1168
1170 1169
1171void Konsole::newSession() 1170void Konsole::newSession()
1172{ 1171{
1173 if(nsessions < 15) 1172 if(nsessions < 15)
1174 { // seems to be something weird about 16 tabs on the Zaurus.... memory? 1173 { // seems to be something weird about 16 tabs on the Zaurus.... memory?
1175 TEWidget* te = new TEWidget(tab); 1174 TEWidget* te = new TEWidget(tab);
1176 Config cfg( "Konsole" ); 1175 Config cfg( "Konsole" );
1177 cfg.setGroup("Menubar"); 1176 cfg.setGroup("Menubar");
1178 1177
@@ -1191,26 +1190,26 @@ void Konsole::newSession()
1191 cfg.readNumEntry("FontSize", 1190 cfg.readNumEntry("FontSize",
1192 fonts.at(cfont)->getSize())); 1191 fonts.at(cfont)->getSize()));
1193 cfont = findFont(fontName, fontSize, false); 1192 cfont = findFont(fontName, fontSize, false);
1194 printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); 1193 printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont);
1195 if (cfont < 0) 1194 if (cfont < 0)
1196 cfont = 0; 1195 cfont = 0;
1197 te->setVTFont(fonts.at(cfont)->getFont()); 1196 te->setVTFont(fonts.at(cfont)->getFont());
1198 1197
1199 tab->addTab(te); 1198 tab->addTab(te);
1200 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); 1199 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
1201 te->currentSession = se; 1200 te->currentSession = se;
1202 connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); 1201 connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) );
1203 connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, 1202 connect( se, SIGNAL(changeTitle(TEWidget*,const QString&)), this,
1204 SLOT(changeTitle(TEWidget*,QString)) ); 1203 SLOT(changeTitle(TEWidget*,const QString&)) );
1205 connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); 1204 connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int)));
1206 connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); 1205 connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int)));
1207 connect(te, SIGNAL(newSession()), this, SLOT(newSession())); 1206 connect(te, SIGNAL(newSession()), this, SLOT(newSession()));
1208 connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); 1207 connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen()));
1209 connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); 1208 connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool)));
1210 se->run(); 1209 se->run();
1211 se->setConnect(TRUE); 1210 se->setConnect(TRUE);
1212 se->setHistory(b_scroll); 1211 se->setHistory(b_scroll);
1213 nsessions++; 1212 nsessions++;
1214 sessionList->insertItem(QString::number(nsessions), nsessions); 1213 sessionList->insertItem(QString::number(nsessions), nsessions);
1215 sessionListSelected(nsessions); 1214 sessionListSelected(nsessions);
1216 doWrap(); 1215 doWrap();
@@ -1300,29 +1299,29 @@ void Konsole::switchSession(QWidget* w)
1300 if (cf) 1299 if (cf)
1301 { 1300 {
1302 cfont = i; 1301 cfont = i;
1303 familyNum = fnt->getFamilyNum(); 1302 familyNum = fnt->getFamilyNum();
1304 } 1303 }
1305 } 1304 }
1306 for(int i = 0; i < (int)fontList->count(); i++) 1305 for(int i = 0; i < (int)fontList->count(); i++)
1307 { 1306 {
1308 fontList->setItemChecked(i + 1000, i == familyNum); 1307 fontList->setItemChecked(i + 1000, i == familyNum);
1309 } 1308 }
1310 if (! te->currentSession->Title().isEmpty() ) 1309 if (! te->currentSession->Title().isEmpty() )
1311 { 1310 {
1312 setCaption(te->currentSession->Title() + " - QKonsole"); 1311 setCaption( te->currentSession->Title() + " - " + tr( "Konsole" ) );
1313 } 1312 }
1314 else 1313 else
1315 { 1314 {
1316 setCaption( "Konsole" ); 1315 setCaption( tr( "Konsole" ) );
1317 } 1316 }
1318 // colorMenuSelected(te->color_menu_item); 1317 // colorMenuSelected(te->color_menu_item);
1319} 1318}
1320 1319
1321 1320
1322void Konsole::toggleFullScreen() 1321void Konsole::toggleFullScreen()
1323{ 1322{
1324 setFullScreen(! fullscreen); 1323 setFullScreen(! fullscreen);
1325} 1324}
1326 1325
1327void Konsole::setFullScreen ( bool b ) 1326void Konsole::setFullScreen ( bool b )
1328{ 1327{