summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-02-25 11:27:48 (UTC)
committer mickeyl <mickeyl>2004-02-25 11:27:48 (UTC)
commit25e87d9ccc92b7a4c12518532576f55b11726b26 (patch) (unidiff)
tree39c21854f8b6845736126a05f2cc89e552484881
parent50aef52b265bc8c8e5e5c6a871affe94142d74fb (diff)
downloadopie-25e87d9ccc92b7a4c12518532576f55b11726b26.zip
opie-25e87d9ccc92b7a4c12518532576f55b11726b26.tar.gz
opie-25e87d9ccc92b7a4c12518532576f55b11726b26.tar.bz2
fix most of zecke's comments. Someone should look into the open issues though
(see mail to opie-devel)
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/MyPty.cpp7
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp21
-rw-r--r--core/apps/embeddedkonsole/konsole.h6
-rw-r--r--core/apps/embeddedkonsole/session.h2
4 files changed, 17 insertions, 19 deletions
diff --git a/core/apps/embeddedkonsole/MyPty.cpp b/core/apps/embeddedkonsole/MyPty.cpp
index e7d8274..5a8519a 100644
--- a/core/apps/embeddedkonsole/MyPty.cpp
+++ b/core/apps/embeddedkonsole/MyPty.cpp
@@ -58,49 +58,48 @@
58 58
59 Another technic are UNIX 98 PTY's. These are supported also, and prefered 59 Another technic are UNIX 98 PTY's. These are supported also, and prefered
60 over the (obsolete) predecessor. 60 over the (obsolete) predecessor.
61 61
62 There's a sinister ioctl(2), signal(2) and job control stuff 62 There's a sinister ioctl(2), signal(2) and job control stuff
63 nessesary to make everything work as it should. 63 nessesary to make everything work as it should.
64*/ 64*/
65 65
66 66
67#include <qfileinfo.h> 67#include <qfileinfo.h>
68#include <qapplication.h> 68#include <qapplication.h>
69#include <qsocketnotifier.h> 69#include <qsocketnotifier.h>
70#include <qstring.h> 70#include <qstring.h>
71 71
72#include <stdlib.h> 72#include <stdlib.h>
73#include <stdio.h> 73#include <stdio.h>
74#include <signal.h> 74#include <signal.h>
75#include <fcntl.h> 75#include <fcntl.h>
76#include <unistd.h> 76#include <unistd.h>
77#include <termios.h> 77#include <termios.h>
78#include <sys/types.h> 78#include <sys/types.h>
79#include <sys/ioctl.h> 79#include <sys/ioctl.h>
80#include <sys/wait.h> 80#include <sys/wait.h>
81 81
82#undef HAVE_OPENPTY
83#ifdef HAVE_OPENPTY 82#ifdef HAVE_OPENPTY
84#include <pty.h> 83#include <pty.h>
85#endif 84#endif
86 85
87#include "MyPty.h" 86#include "MyPty.h"
88 87
89 88
90#undef VERBOSE_DEBUG 89#undef VERBOSE_DEBUG
91 90
92 91
93/* -------------------------------------------------------------------------- */ 92/* -------------------------------------------------------------------------- */
94 93
95/*! 94/*!
96 Informs the client program about the 95 Informs the client program about the
97 actual size of the window. 96 actual size of the window.
98*/ 97*/
99 98
100void MyPty::setSize(int lines, int columns) 99void MyPty::setSize(int lines, int columns)
101{ 100{
102 struct winsize wsize; 101 struct winsize wsize;
103 wsize.ws_row = (unsigned short)lines; 102 wsize.ws_row = (unsigned short)lines;
104 wsize.ws_col = (unsigned short)columns; 103 wsize.ws_col = (unsigned short)columns;
105 if(fd < 0) return; 104 if(fd < 0) return;
106 ioctl(fd,TIOCSWINSZ,(char *)&wsize); 105 ioctl(fd,TIOCSWINSZ,(char *)&wsize);
@@ -239,52 +238,52 @@ MyPty::MyPty() : cpid(0)
239 238
240/*! 239/*!
241 Destructor. 240 Destructor.
242 Note that the related client program is not killed 241 Note that the related client program is not killed
243 (yet) when a instance is deleted. 242 (yet) when a instance is deleted.
244*/ 243*/
245MyPty::~MyPty() 244MyPty::~MyPty()
246{ 245{
247 donePty(); 246 donePty();
248} 247}
249 248
250 249
251/*! sends len bytes through the line */ 250/*! sends len bytes through the line */
252void MyPty::send_bytes(const char* s, int len) 251void MyPty::send_bytes(const char* s, int len)
253{ 252{
254 253
255#ifdef VERBOSE_DEBUG 254#ifdef VERBOSE_DEBUG
256 // verbose debug 255 // verbose debug
257 printf("sending bytes:\n"); 256 printf("sending bytes:\n");
258 for (int i = 0; i < len; i++) 257 for (int i = 0; i < len; i++)
259 printf("%c", s[i]); 258 printf("%c", s[i]);
260 printf("\n"); 259 printf("\n");
261#endif 260#endif
262 261
263 ::write(fd, s, len); 262 ::write(fd, s, len);
264} 263}
265 264
266/*! indicates that a block of data is received */ 265/*! indicates that a block of data is received */
267void MyPty::readPty() 266void MyPty::readPty()
268{ 267{
269 char buf[4096]; 268 char buf[4096];
270 269
271 int len = ::read( fd, buf, 4096 ); 270 int len = ::read( fd, buf, 4096 );
272 271
273 if (len == -1) 272 if (len == -1)
274 donePty(); 273 donePty();
275 274
276 if (len < 0) 275 if (len < 0)
277 return; 276 return;
278 277
279 emit block_in(buf,len); 278 emit block_in(buf,len);
280 279
281#ifdef VERBOSE_DEBUG 280#ifdef VERBOSE_DEBUG
282 // verbose debug 281 // verbose debug
283 printf("read bytes:\n"); 282 printf("read bytes:\n");
284 for (int i = 0; i < len; i++) 283 for (int i = 0; i < len; i++)
285 printf("%c", buf[i]); 284 printf("%c", buf[i]);
286 printf("\n"); 285 printf("\n");
287#endif 286#endif
288 287
289} 288}
290 289
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
@@ -1,48 +1,47 @@
1 1
2/* ---------------------------------------------------------------------- */ 2/* ---------------------------------------------------------------------- */
3/* */ 3/* */
4/* [main.C] Konsole */ 4/* [main.C] Konsole */
5/* */ 5/* */
6/* ---------------------------------------------------------------------- */ 6/* ---------------------------------------------------------------------- */
7/* */ 7/* */
8/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 8/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
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//#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>
37#include <qobjectlist.h> 36#include <qobjectlist.h>
38#include <qtoolbutton.h> 37#include <qtoolbutton.h>
39#include <qtoolbar.h> 38#include <qtoolbar.h>
40#include <qpushbutton.h> 39#include <qpushbutton.h>
41#include <qfontdialog.h> 40#include <qfontdialog.h>
42#include <qglobal.h> 41#include <qglobal.h>
43#include <qpainter.h> 42#include <qpainter.h>
44#include <qmenubar.h> 43#include <qmenubar.h>
45#include <qmessagebox.h> 44#include <qmessagebox.h>
46#include <qaction.h> 45#include <qaction.h>
47#include <qapplication.h> 46#include <qapplication.h>
48#include <qfontmetrics.h> 47#include <qfontmetrics.h>
@@ -348,50 +347,50 @@ static void sig_handler(int x)
348 347
349void Konsole::init(const char* _pgm, QStrList & _args) 348void Konsole::init(const char* _pgm, QStrList & _args)
350{ 349{
351 350
352#if 0 351#if 0
353 for(int i=1; i<=31; i++) 352 for(int i=1; i<=31; i++)
354 { 353 {
355 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV 354 if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV
356 && i != SIGINT && i != SIGILL && i != SIGTERM 355 && i != SIGINT && i != SIGILL && i != SIGTERM
357 && i != SIGBUS) 356 && i != SIGBUS)
358 signal(i,sig_handler); 357 signal(i,sig_handler);
359 } 358 }
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
386 // this code causes repeated access to all the font files 385 // this code causes repeated access to all the font files
387 // which does slow down startup 386 // which does slow down startup
388 QFontDatabase fontDB; 387 QFontDatabase fontDB;
389 QStringList familyNames; 388 QStringList familyNames;
390 familyNames = fontDB.families( FALSE ); 389 familyNames = fontDB.families( FALSE );
391 QString s; 390 QString s;
392 int fontIndex = 0; 391 int fontIndex = 0;
393 int familyNum = 0; 392 int familyNum = 0;
394 fontList = new QPopupMenu( this ); 393 fontList = new QPopupMenu( this );
395 394
396 for(uint j = 0; j < (uint)familyNames.count(); j++) 395 for(uint j = 0; j < (uint)familyNames.count(); j++)
397 { 396 {
@@ -556,49 +555,49 @@ void Konsole::init(const char* _pgm, QStrList & _args)
556 555
557 cm_bw = colorMenu->insertItem(tr( "Black on White")); 556 cm_bw = colorMenu->insertItem(tr( "Black on White"));
558 cm_wb = colorMenu->insertItem(tr( "White on Black")); 557 cm_wb = colorMenu->insertItem(tr( "White on Black"));
559 cm_gb = colorMenu->insertItem(tr( "Green on Black")); 558 cm_gb = colorMenu->insertItem(tr( "Green on Black"));
560 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent")); 559 // cm_bt = colorMenu->insertItem(tr( "Black on Transparent"));
561 cm_br = colorMenu->insertItem(tr( "Black on Pink")); 560 cm_br = colorMenu->insertItem(tr( "Black on Pink"));
562 cm_rb = colorMenu->insertItem(tr( "Pink on Black")); 561 cm_rb = colorMenu->insertItem(tr( "Pink on Black"));
563 cm_gy = colorMenu->insertItem(tr( "Green on Yellow")); 562 cm_gy = colorMenu->insertItem(tr( "Green on Yellow"));
564 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta")); 563 cm_bm = colorMenu->insertItem(tr( "Blue on Magenta"));
565 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue")); 564 cm_mb = colorMenu->insertItem(tr( "Magenta on Blue"));
566 cm_cw = colorMenu->insertItem(tr( "Cyan on White")); 565 cm_cw = colorMenu->insertItem(tr( "Cyan on White"));
567 cm_wc = colorMenu->insertItem(tr( "White on Cyan")); 566 cm_wc = colorMenu->insertItem(tr( "White on Cyan"));
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 );
593 menuBar->insertItem( tr("Sessions"), sessionList ); 592 menuBar->insertItem( tr("Sessions"), sessionList );
594 593
595 toolBar = new QToolBar( this ); 594 toolBar = new QToolBar( this );
596 595
597 QAction *a; 596 QAction *a;
598 597
599 // Button Commands 598 // Button Commands
600 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 ); 599 a = new QAction( tr("New"), Resource::loadPixmap( "konsole/Terminal" ), QString::null, 0, this, 0 );
601 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) ); 600 connect( a, SIGNAL( activated() ), this, SLOT( newSession() ) );
602 a->addTo( toolBar ); 601 a->addTo( toolBar );
603 602
604 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 ); 603 a = new QAction( tr("Full Screen"), Resource::loadPixmap( "fullscreen" ), QString::null, 0, this, 0 );
@@ -858,49 +857,49 @@ void Konsole::changeFontSize(int delta)
858 && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum()) 857 && fonts.at(i-1)->getFamilyNum() == fonts.at(i)->getFamilyNum())
859 { 858 {
860 setFont(i-1); 859 setFont(i-1);
861 printf("font %d\n", i-1); 860 printf("font %d\n", i-1);
862 return; 861 return;
863 } 862 }
864 } 863 }
865 } 864 }
866 int fsize = fonts.at(i)->getSize(); 865 int fsize = fonts.at(i)->getSize();
867 printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest); 866 printf("%d size=%d fsize=%d closest=%d\n", i, size, fsize, closest);
868 if ((delta > 0 && fsize > size && fsize < closest) 867 if ((delta > 0 && fsize > size && fsize < closest)
869 || (delta < 0 && fsize < size && fsize > closest)) 868 || (delta < 0 && fsize < size && fsize > closest))
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);
895 } 894 }
896 for(uint i = 0; i < fonts.count(); i++) 895 for(uint i = 0; i < fonts.count(); i++)
897 { 896 {
898 if (fonts.at(i)->getSize() == size) 897 if (fonts.at(i)->getSize() == size)
899 { 898 {
900 return(i); 899 return(i);
901 } 900 }
902 } 901 }
903 return(-1); 902 return(-1);
904} 903}
905 904
906void Konsole::setFont(int f) 905void Konsole::setFont(int f)
@@ -1138,91 +1137,91 @@ void Konsole::doneSession(TEWidget* te, int )
1138 // i, tab->currentPage(), sess->currentSession); 1137 // i, tab->currentPage(), sess->currentSession);
1139 // if (tab->currentPage() == sess->currentSession) { 1138 // if (tab->currentPage() == sess->currentSession) {
1140 // printf("found session %d\n", i); 1139 // printf("found session %d\n", i);
1141 // te = tab->currentPage(); 1140 // te = tab->currentPage();
1142 // break; 1141 // break;
1143 // } 1142 // }
1144 // } 1143 // }
1145 // tab->setCurrentPage(currentPage); 1144 // tab->setCurrentPage(currentPage);
1146 // } 1145 // }
1147 if (te != 0) 1146 if (te != 0)
1148 { 1147 {
1149 te->currentSession->setConnect(FALSE); 1148 te->currentSession->setConnect(FALSE);
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
1179 // FIXME use more defaults from config file 1178 // FIXME use more defaults from config file
1180 te->useBeep=cfg.readBoolEntry("useBeep",0); 1179 te->useBeep=cfg.readBoolEntry("useBeep",0);
1181 1180
1182 // te->setBackgroundMode(PaletteBase); //we want transparent!! 1181 // te->setBackgroundMode(PaletteBase); //we want transparent!!
1183 1182
1184 cfg.setGroup("Font"); 1183 cfg.setGroup("Font");
1185 QString sn = "Session" + QString::number(nsessions+1); 1184 QString sn = "Session" + QString::number(nsessions+1);
1186 printf("read font session %s\n", sn.latin1()); 1185 printf("read font session %s\n", sn.latin1());
1187 QString fontName = cfg.readEntry("FontName"+sn, 1186 QString fontName = cfg.readEntry("FontName"+sn,
1188 cfg.readEntry("FontName", 1187 cfg.readEntry("FontName",
1189 fonts.at(cfont)->getFamily())); 1188 fonts.at(cfont)->getFamily()));
1190 int fontSize = cfg.readNumEntry("FontSize"+sn, 1189 int fontSize = cfg.readNumEntry("FontSize"+sn,
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();
1217 setColor(nsessions-1); 1216 setColor(nsessions-1);
1218 } 1217 }
1219} 1218}
1220 1219
1221TEWidget* Konsole::getTe() 1220TEWidget* Konsole::getTe()
1222{ 1221{
1223 if (nsessions) 1222 if (nsessions)
1224 { 1223 {
1225 return (TEWidget *) tab->currentPage(); 1224 return (TEWidget *) tab->currentPage();
1226 } 1225 }
1227 else 1226 else
1228 { 1227 {
@@ -1288,53 +1287,53 @@ void Konsole::changeSession(int delta)
1288 1287
1289void Konsole::switchSession(QWidget* w) 1288void Konsole::switchSession(QWidget* w)
1290{ 1289{
1291 TEWidget* te = (TEWidget *) w; 1290 TEWidget* te = (TEWidget *) w;
1292 QFont teFnt = te->getVTFont(); 1291 QFont teFnt = te->getVTFont();
1293 int familyNum = -1; 1292 int familyNum = -1;
1294 1293
1295 for(uint i = 0; i < fonts.count(); i++) 1294 for(uint i = 0; i < fonts.count(); i++)
1296 { 1295 {
1297 VTFont *fnt = fonts.at(i); 1296 VTFont *fnt = fonts.at(i);
1298 bool cf = fnt->getFont() == teFnt; 1297 bool cf = fnt->getFont() == teFnt;
1299 fontList->setItemChecked(i, cf); 1298 fontList->setItemChecked(i, cf);
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{
1329 static QSize normalsize; 1328 static QSize normalsize;
1330 static bool listHidden; 1329 static bool listHidden;
1331 1330
1332 if (b == fullscreen) 1331 if (b == fullscreen)
1333 { 1332 {
1334 return; 1333 return;
1335 } 1334 }
1336 1335
1337 fullscreen = b; 1336 fullscreen = b;
1338 1337
1339 if ( b ) 1338 if ( b )
1340 { 1339 {
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h
index 37babbb..e163cb8 100644
--- a/core/apps/embeddedkonsole/konsole.h
+++ b/core/apps/embeddedkonsole/konsole.h
@@ -52,100 +52,100 @@ public:
52 return QString::fromLatin1("embeddedkonsole"); 52 return QString::fromLatin1("embeddedkonsole");
53 } 53 }
54 54
55 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 55 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
56 Konsole(const char * name, const char* pgm, QStrList & _args, int histon); 56 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
57 ~Konsole(); 57 ~Konsole();
58 void setColLin(int columns, int lines); 58 void setColLin(int columns, int lines);
59 QToolBar *secondToolBar; 59 QToolBar *secondToolBar;
60 void show(); 60 void show();
61 void setColor(int); 61 void setColor(int);
62 int lastSelectedMenu; 62 int lastSelectedMenu;
63 int startUp; 63 int startUp;
64 64
65public slots: 65public slots:
66 void changeFontSize(int); 66 void changeFontSize(int);
67 void toggleFullScreen(); 67 void toggleFullScreen();
68 void setFullScreen(bool); 68 void setFullScreen(bool);
69 void changeSession(int); 69 void changeSession(int);
70 void cycleZoom(); 70 void cycleZoom();
71 void newSession(); 71 void newSession();
72 72
73private slots: 73private slots:
74 void setDocument(const QString &); 74 void setDocument(const QString &);
75 void doneSession(TEWidget*,int); 75 void doneSession(TEWidget*,int);
76 void changeTitle(TEWidget*,QString); 76 void changeTitle(TEWidget*, const QString&);
77 void changeColumns(int); 77 void changeColumns(int);
78 void setFont(int); 78 void setFont(int);
79 // void fontChanged(int); 79 // void fontChanged(int);
80 void configMenuSelected(int ); 80 void configMenuSelected(int );
81 void colorMenuSelected(int); 81 void colorMenuSelected(int);
82 void colorMenuIsSelected(int); 82 void colorMenuIsSelected(int);
83 void tabMenuSelected(int); 83 void tabMenuSelected(int);
84 void sessionListSelected(int); 84 void sessionListSelected(int);
85 85
86 void enterCommand(int); 86 void enterCommand(int);
87 void hitEnter(); 87 void hitEnter();
88 void hitSpace(); 88 void hitSpace();
89 void hitTab(); 89 void hitTab();
90 void hitPaste(); 90 void hitPaste();
91 void hitUp(); 91 void hitUp();
92 void hitDown(); 92 void hitDown();
93 void switchSession(QWidget *); 93 void switchSession(QWidget *);
94 void changeCommand(const QString &, int); 94 void changeCommand(const QString &, int);
95 void initCommandList(); 95 void initCommandList();
96 void scrollMenuSelected(int); 96 void scrollMenuSelected(int);
97 void editCommandListMenuSelected(int); 97 void editCommandListMenuSelected(int);
98 void parseCommandLine(); 98 void parseCommandLine();
99 void changeForegroundColor(const QColor &); 99 void changeForegroundColor(const QColor &);
100 void changeBackgroundColor(const QColor &); 100 void changeBackgroundColor(const QColor &);
101 101
102 void historyDialog(); 102 void historyDialog();
103 void fullscreenTimeout(); 103 void fullscreenTimeout();
104 104
105private: 105private:
106 void doWrap(); 106 void doWrap();
107 void init(const char* _pgm, QStrList & _args); 107 void init(const char* _pgm, QStrList & _args);
108 void initSession(const char* _pgm, QStrList & _args); 108 void initSession(const char* _pgm, QStrList & _args);
109 void runSession(TESession* s); 109 void runSession(TESession* s);
110 void setColorPixmaps(); 110 void setColorPixmaps();
111 void setHistory(bool); 111 void setHistory(bool);
112 void setColors(QColor foreground, QColor background); 112 void setColors(QColor foreground, QColor background);
113 int findFont(QString name, int size, bool exact = false); 113 int findFont(const QString& name, int size, bool exact = false);
114 QSize calcSize(int columns, int lines); 114 QSize calcSize(int columns, int lines);
115 TEWidget* getTe(); 115 TEWidget* getTe();
116 QStringList commands; 116 QStringList commands;
117 QLabel * msgLabel; 117 QLabel * msgLabel;
118 QColor foreground, background; 118 QColor foreground, background;
119 bool fromMenu; 119 bool fromMenu;
120 120
121 bool fullscreen; 121 bool fullscreen;
122 122
123private: 123private:
124 class VTFont 124 class VTFont
125 { 125 {
126 public: 126 public:
127 VTFont(QString name, QFont& font, QString family, int familyNum, int size) 127 VTFont(const QString& name, QFont& font, const QString& family, int familyNum, int size)
128 { 128 {
129 this->name = name; 129 this->name = name;
130 this->font = font; 130 this->font = font;
131 this->family = family; 131 this->family = family;
132 this->size = size; 132 this->size = size;
133 this->familyNum = familyNum; 133 this->familyNum = familyNum;
134 } 134 }
135 135
136 QFont& getFont() 136 QFont& getFont()
137 { 137 {
138 return font; 138 return font;
139 } 139 }
140 QString getName() 140 QString getName()
141 { 141 {
142 return name; 142 return name;
143 } 143 }
144 int getSize() 144 int getSize()
145 { 145 {
146 return(size); 146 return(size);
147 } 147 }
148 QString getFamily() 148 QString getFamily()
149 { 149 {
150 return(family); 150 return(family);
151 } 151 }
diff --git a/core/apps/embeddedkonsole/session.h b/core/apps/embeddedkonsole/session.h
index f399e96..a4b33e2 100644
--- a/core/apps/embeddedkonsole/session.h
+++ b/core/apps/embeddedkonsole/session.h
@@ -47,48 +47,48 @@ public:
47 47
48 int schemaNo(); 48 int schemaNo();
49 int fontNo(); 49 int fontNo();
50 const char* emuName(); 50 const char* emuName();
51 const QString& Title(); 51 const QString& Title();
52 bool history(); 52 bool history();
53 int keymap(); 53 int keymap();
54 54
55 void setHistory(bool on); 55 void setHistory(bool on);
56 void setSchemaNo(int sn); 56 void setSchemaNo(int sn);
57 void setKeymapNo(int kn); 57 void setKeymapNo(int kn);
58 void setFontNo(int fn); 58 void setFontNo(int fn);
59 void kill(int signal); 59 void kill(int signal);
60 60
61public slots: 61public slots:
62 62
63 void run(); 63 void run();
64 void done(int status); 64 void done(int status);
65 void terminate(); 65 void terminate();
66 void changeTitle(int, const QString& title); 66 void changeTitle(int, const QString& title);
67 67
68signals: 68signals:
69 69
70 void done(TEWidget*, int); 70 void done(TEWidget*, int);
71 void changeTitle(TEWidget*, QString); 71 void changeTitle(TEWidget*, const QString&);
72 72
73private: 73private:
74 74
75 // TEPty* sh; 75 // TEPty* sh;
76 MyPty* sh; 76 MyPty* sh;
77 TEWidget* te; 77 TEWidget* te;
78 TEmulation* em; 78 TEmulation* em;
79 79
80 //FIXME: using the indices here 80 //FIXME: using the indices here
81 // is propably very bad. We should 81 // is propably very bad. We should
82 // use a persistent reference instead. 82 // use a persistent reference instead.
83 int schema_no; 83 int schema_no;
84 int font_no; 84 int font_no;
85 int keymap_no; 85 int keymap_no;
86 QString title; 86 QString title;
87 87
88 const char* pgm; 88 const char* pgm;
89 QStrList args; 89 QStrList args;
90 90
91 QCString term; 91 QCString term;
92}; 92};
93 93
94#endif 94#endif