summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEHistory.h6
-rw-r--r--core/apps/embeddedkonsole/TEScreen.h14
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp5
-rw-r--r--core/apps/embeddedkonsole/TEmulation.h7
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp90
-rw-r--r--core/apps/embeddedkonsole/konsole.h1
6 files changed, 83 insertions, 40 deletions
diff --git a/core/apps/embeddedkonsole/TEHistory.h b/core/apps/embeddedkonsole/TEHistory.h
index 8339ec6..11eb150 100644
--- a/core/apps/embeddedkonsole/TEHistory.h
+++ b/core/apps/embeddedkonsole/TEHistory.h
@@ -1,64 +1,64 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [TEHistory.H] History Buffer */ 3/* [TEHistory.H] History Buffer */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12 /* */ 12/* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14 /* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18 18
19#ifndef TEHISTORY_H 19#ifndef TEHISTORY_H
20#define TEHISTORY_H 20#define TEHISTORY_H
21 21
22#include "TECommon.h" 22#include "TECommon.h"
23 23
24/* 24/*
25 An extendable tmpfile(1) based buffer. 25 An extendable tmpfile(1) based buffer.
26*/ 26*/
27class HistoryBuffer 27class HistoryBuffer
28{ 28{
29public: 29public:
30 HistoryBuffer(); 30 HistoryBuffer();
31 ~HistoryBuffer(); 31 ~HistoryBuffer();
32 32
33public: 33public:
34 void setScroll(bool on); 34 void setScroll(bool on);
35 bool hasScroll(); 35 bool hasScroll();
36 36
37public: 37public:
38 void add(const unsigned char* bytes, int len); 38 void add(const unsigned char* bytes, int len);
39 void get(unsigned char* bytes, int len, int loc); 39 void get(unsigned char* bytes, int len, int loc);
40 int len(); 40 int len();
41 41
42private: 42private:
43 int ion; 43 int ion;
44 int length; 44 int length;
45}; 45};
46 46
47class HistoryScroll 47class HistoryScroll
48{ 48{
49public: 49public:
50 HistoryScroll(); 50 HistoryScroll();
51 ~HistoryScroll(); 51 ~HistoryScroll();
52 52
53public: 53public:
54 void setScroll(bool on); 54 void setScroll(bool on);
55 bool hasScroll(); 55 bool hasScroll();
56 56
57public: // access to history 57public: // access to history
58 int getLines(); 58 int getLines();
59 int getLineLen(int lineno); 59 int getLineLen(int lineno);
60 void getCells(int lineno, int colno, int count, ca res[]); 60 void getCells(int lineno, int colno, int count, ca res[]);
61 61
62public: // backward compatibility (obsolete) 62public: // backward compatibility (obsolete)
63 ca getCell(int lineno, int colno) { ca res; getCells(lineno,colno,1,&res); return res; } 63 ca getCell(int lineno, int colno) { ca res; getCells(lineno,colno,1,&res); return res; }
64 64
diff --git a/core/apps/embeddedkonsole/TEScreen.h b/core/apps/embeddedkonsole/TEScreen.h
index ba47ee5..a28f7c5 100644
--- a/core/apps/embeddedkonsole/TEScreen.h
+++ b/core/apps/embeddedkonsole/TEScreen.h
@@ -1,64 +1,64 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [te_screen.h] Screen Data Type */ 3/* [te_screen.h] Screen Data Type */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12 /* */ 12/* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14 /* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18 18
19#ifndef TESCREEN_H 19#ifndef TESCREEN_H
20#define TESCREEN_H 20#define TESCREEN_H
21 21
22/*! \file 22/*! \file
23*/ 23*/
24 24
25#include "TECommon.h" 25#include "TECommon.h"
26#include "TEHistory.h" 26#include "TEHistory.h"
27 27
28#define MODE_Origin 0 28#define MODE_Origin 0
29#define MODE_Wrap 1 29#define MODE_Wrap 1
30#define MODE_Insert 2 30#define MODE_Insert 2
31#define MODE_Screen 3 31#define MODE_Screen 3
32#define MODE_Cursor 4 32#define MODE_Cursor 4
33#define MODE_NewLine 5 33#define MODE_NewLine 5
34#define MODES_SCREEN 6 34#define MODES_SCREEN 6
35 35
36/*! 36/*!
37*/ 37*/
38struct ScreenParm 38struct ScreenParm
39{ 39{
40 int mode[MODES_SCREEN]; 40 int mode[MODES_SCREEN];
41}; 41};
42 42
43 43
44class TEScreen 44class TEScreen
45{ 45{
46public: 46public:
47 TEScreen(int lines, int columns); 47 TEScreen(int lines, int columns);
48 ~TEScreen(); 48 ~TEScreen();
49 49
50public: // these are all `Screen' operations 50public: // these are all `Screen' operations
51 // 51 //
52 // VT100/2 Operations ------------------ 52 // VT100/2 Operations ------------------
53 // 53 //
54 // Cursor Movement 54 // Cursor Movement
55 // 55 //
56 void cursorUp (int n); 56 void cursorUp (int n);
57 void cursorDown (int n); 57 void cursorDown (int n);
58 void cursorLeft (int n); 58 void cursorLeft (int n);
59 void cursorRight (int n); 59 void cursorRight (int n);
60 void setCursorY (int y); 60 void setCursorY (int y);
61 void setCursorX (int x); 61 void setCursorX (int x);
62 void setCursorYX (int y, int x); 62 void setCursorYX (int y, int x);
63 void setMargins (int t, int b); 63 void setMargins (int t, int b);
64 // 64 //
@@ -95,155 +95,163 @@ public: // these are all `Screen' operations
95 void restoreCursor(); 95 void restoreCursor();
96 // 96 //
97 // ------------------------------------- 97 // -------------------------------------
98 // 98 //
99 void clearEntireScreen(); 99 void clearEntireScreen();
100 void clearToEndOfScreen(); 100 void clearToEndOfScreen();
101 void clearToBeginOfScreen(); 101 void clearToBeginOfScreen();
102 // 102 //
103 void clearEntireLine(); 103 void clearEntireLine();
104 void clearToEndOfLine(); 104 void clearToEndOfLine();
105 void clearToBeginOfLine(); 105 void clearToBeginOfLine();
106 // 106 //
107 void helpAlign (); 107 void helpAlign ();
108 // 108 //
109 // ------------------------------------- 109 // -------------------------------------
110 // 110 //
111 void setRendition (int rendition); 111 void setRendition (int rendition);
112 void resetRendition(int rendition); 112 void resetRendition(int rendition);
113 void setForeColor (int fgcolor); 113 void setForeColor (int fgcolor);
114 void setBackColor (int bgcolor); 114 void setBackColor (int bgcolor);
115 // 115 //
116 void setDefaultRendition(); 116 void setDefaultRendition();
117 void setForeColorToDefault(); 117 void setForeColorToDefault();
118 void setBackColorToDefault(); 118 void setBackColorToDefault();
119 // 119 //
120 // ------------------------------------- 120 // -------------------------------------
121 // 121 //
122 BOOL getMode (int n); 122 BOOL getMode (int n);
123 // 123 //
124 // only for report cursor position 124 // only for report cursor position
125 // 125 //
126 int getCursorX(); 126 int getCursorX();
127 int getCursorY(); 127 int getCursorY();
128 // 128 //
129 // ------------------------------------- 129 // -------------------------------------
130 // 130 //
131 void clear(); 131 void clear();
132 void home(); 132 void home();
133 void reset(); 133 void reset();
134 // 134 //
135 void ShowCharacter(unsigned short c); 135 void ShowCharacter(unsigned short c);
136 // 136 //
137 void resizeImage(int new_lines, int new_columns); 137 void resizeImage(int new_lines, int new_columns);
138 // 138 //
139 ca* getCookedImage(); 139 ca* getCookedImage();
140 140
141 /*! return the number of lines. */ 141 /*! return the number of lines. */
142 int getLines() { return lines; } 142 int getLines() { return lines; }
143
143 /*! return the number of columns. */ 144 /*! return the number of columns. */
144 int getColumns() { return columns; } 145 int getColumns() { return columns; }
145 146
146 /*! set the position of the history cursor. */ 147 /*! set the position of the history cursor. */
147 void setHistCursor(int cursor); 148 void setHistCursor(int cursor);
148 /*! return the position of the history cursor. */ 149 /*! return the position of the history cursor. */
149 int getHistCursor(); 150 int getHistCursor();
150 151
152 /*! set the position of the horizontal cursor. */
153 void setHorzCursor(int cursor);
154 /*! return the position of the horizontal cursor. */
155 int getHorzCursor();
156
151 int getHistLines (); 157 int getHistLines ();
152 void setScroll(bool on); 158 void setScroll(bool on);
153 bool hasScroll(); 159 bool hasScroll();
154 160
155 // 161 //
156 // Selection 162 // Selection
157 // 163 //
158 void setSelBeginXY(const int x, const int y); 164 void setSelBeginXY(const int x, const int y);
159 void setSelExtentXY(const int x, const int y); 165 void setSelExtentXY(const int x, const int y);
160 void clearSelection(); 166 void clearSelection();
161 QString getSelText(const BOOL preserve_line_breaks); 167 QString getSelText(const BOOL preserve_line_breaks);
162 168
163 void checkSelection(int from, int to); 169 void checkSelection(int from, int to);
164 170
165private: // helper 171private: // helper
166 172
167 void clearImage(int loca, int loce, char c); 173 void clearImage(int loca, int loce, char c);
168 void moveImage(int dst, int loca, int loce); 174 void moveImage(int dst, int loca, int loce);
169 175
170 void scrollUp(int from, int i); 176 void scrollUp(int from, int i);
171 void scrollDown(int from, int i); 177 void scrollDown(int from, int i);
172 178
173 void addHistLine(); 179 void addHistLine();
174 180
175 void initTabStops(); 181 void initTabStops();
176 182
177 void effectiveRendition(); 183 void effectiveRendition();
178 void reverseRendition(ca* p); 184 void reverseRendition(ca* p);
179 185
180private: 186private:
181 187
182 /* 188 /*
183 The state of the screen is more complex as one would 189 The state of the screen is more complex as one would
184 expect first. The screem does really do part of the 190 expect first. The screem does really do part of the
185 emulation providing state informations in form of modes, 191 emulation providing state informations in form of modes,
186 margins, tabulators, cursor etc. 192 margins, tabulators, cursor etc.
187 193
188 Even more unexpected are variables to save and restore 194 Even more unexpected are variables to save and restore
189 parts of the state. 195 parts of the state.
190 */ 196 */
191 197
192 // screen image ---------------- 198 // screen image ----------------
193 199
194 int lines; 200 int lines;
195 int columns; 201 int columns;
196 ca *image; // [lines][columns] 202 ca *image; // [lines][columns]
197 203
198 // history buffer --------------- 204 // history buffer ---------------
199 205
200 int histCursor; // display position relative to start of the history buffer 206 int histCursor; // display position relative to start of the history buffer
201 HistoryScroll hist; 207 HistoryScroll hist;
208
209 int horzCursor;
202 210
203 // cursor location 211 // cursor location
204 212
205 int cuX; 213 int cuX;
206 int cuY; 214 int cuY;
207 215
208 // cursor color and rendition info 216 // cursor color and rendition info
209 217
210 UINT8 cu_fg; // foreground 218 UINT8 cu_fg; // foreground
211 UINT8 cu_bg; // background 219 UINT8 cu_bg; // background
212 UINT8 cu_re; // rendition 220 UINT8 cu_re; // rendition
213 221
214 // margins ---------------- 222 // margins ----------------
215 223
216 int tmargin; // top margin 224 int tmargin; // top margin
217 int bmargin; // bottom margin 225 int bmargin; // bottom margin
218 226
219 // states ---------------- 227 // states ----------------
220 228
221 ScreenParm currParm; 229 ScreenParm currParm;
222 230
223 // ---------------------------- 231 // ----------------------------
224 232
225 bool* tabstops; 233 bool* tabstops;
226 234
227 // selection ------------------- 235 // selection -------------------
228 236
229 int sel_begin; // The first location selected. 237 int sel_begin; // The first location selected.
230 int sel_TL; // TopLeft Location. 238 int sel_TL; // TopLeft Location.
231 int sel_BR; // Bottom Right Location. 239 int sel_BR; // Bottom Right Location.
232 240
233 // effective colors and rendition ------------ 241 // effective colors and rendition ------------
234 242
235 UINT8 ef_fg; // These are derived from 243 UINT8 ef_fg; // These are derived from
236 UINT8 ef_bg; // the cu_* variables above 244 UINT8 ef_bg; // the cu_* variables above
237 UINT8 ef_re; // to speed up operation 245 UINT8 ef_re; // to speed up operation
238 246
239 // 247 //
240 // save cursor, rendition & states ------------ 248 // save cursor, rendition & states ------------
241 // 249 //
242 250
243 // cursor location 251 // cursor location
244 252
245 int sa_cuX; 253 int sa_cuX;
246 int sa_cuY; 254 int sa_cuY;
247 255
248 // rendition info 256 // rendition info
249 257
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index c10c7a8..60021f4 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -287,97 +287,98 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
287#ifndef QT_NO_CLIPBOARD 287#ifndef QT_NO_CLIPBOARD
288 cb = QApplication::clipboard(); 288 cb = QApplication::clipboard();
289 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 289 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
290 this, SLOT(onClearSelection()) ); 290 this, SLOT(onClearSelection()) );
291#endif 291#endif
292 292
293 scrollbar = new QScrollBar(this); 293 scrollbar = new QScrollBar(this);
294 scrollbar->setCursor( arrowCursor ); 294 scrollbar->setCursor( arrowCursor );
295 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 295 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
296 296
297 hScrollbar = new QScrollBar(this); 297 hScrollbar = new QScrollBar(this);
298 hScrollbar->setCursor( arrowCursor ); 298 hScrollbar->setCursor( arrowCursor );
299 hScrollbar->setOrientation(QScrollBar::Horizontal); 299 hScrollbar->setOrientation(QScrollBar::Horizontal);
300 hScrollbar->setMaximumHeight(16); 300 hScrollbar->setMaximumHeight(16);
301 301
302 connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int))); 302 connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int)));
303 303
304 Config cfg("Konsole"); 304 Config cfg("Konsole");
305 cfg.setGroup("ScrollBar"); 305 cfg.setGroup("ScrollBar");
306 switch( cfg.readNumEntry("Position",2)){ 306 switch( cfg.readNumEntry("Position",2)){
307 case 0: 307 case 0:
308 scrollLoc = SCRNONE; 308 scrollLoc = SCRNONE;
309 break; 309 break;
310 case 1: 310 case 1:
311 scrollLoc = SCRLEFT; 311 scrollLoc = SCRLEFT;
312 break; 312 break;
313 case 2: 313 case 2:
314 scrollLoc = SCRRIGHT; 314 scrollLoc = SCRRIGHT;
315 break; 315 break;
316 }; 316 };
317 317
318 useHorzScroll=cfg.readBoolEntry("HorzScroll",0); 318 useHorzScroll=cfg.readBoolEntry("HorzScroll",0);
319 319
320 blinkT = new QTimer(this); 320 blinkT = new QTimer(this);
321 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 321 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
322 // blinking = FALSE; 322 // blinking = FALSE;
323 blinking = TRUE; 323 blinking = TRUE;
324 324
325 resizing = FALSE; 325 resizing = FALSE;
326 actSel = 0; 326 actSel = 0;
327 image = 0; 327 image = 0;
328 lines = 1; 328 lines = 1;
329 columns = 1; 329 columns = 1;
330 font_w = 1; 330 font_w = 1;
331 font_h = 1; 331 font_h = 1;
332 font_a = 1; 332 font_a = 1;
333 word_selection_mode = FALSE; 333 word_selection_mode = FALSE;
334 hposition = 0; 334 hposition = 0;
335 335vcolumns = 0;
336
336 setMouseMarks(TRUE); 337 setMouseMarks(TRUE);
337 setVTFont( QFont("fixed") ); 338 setVTFont( QFont("fixed") );
338 setColorTable(base_color_table); // init color table 339 setColorTable(base_color_table); // init color table
339 340
340 qApp->installEventFilter( this ); //FIXME: see below 341 qApp->installEventFilter( this ); //FIXME: see below
341// KCursor::setAutoHideCursor( this, true ); 342// KCursor::setAutoHideCursor( this, true );
342 343
343 // Init DnD //////////////////////////////////////////////////////////////// 344 // Init DnD ////////////////////////////////////////////////////////////////
344 currentSession = NULL; 345 currentSession = NULL;
345// setAcceptDrops(true); // attempt 346// setAcceptDrops(true); // attempt
346// m_drop = new QPopupMenu(this); 347// m_drop = new QPopupMenu(this);
347// m_drop->insertItem( QString("Paste"), 0); 348// m_drop->insertItem( QString("Paste"), 0);
348// m_drop->insertItem( QString("cd"), 1); 349// m_drop->insertItem( QString("cd"), 1);
349// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); 350// connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int)));
350 351
351 // we need focus so that the auto-hide cursor feature works 352 // we need focus so that the auto-hide cursor feature works
352 setFocus(); 353 setFocus();
353 setFocusPolicy( WheelFocus ); 354 setFocusPolicy( WheelFocus );
354} 355}
355 356
356//FIXME: make proper destructor 357//FIXME: make proper destructor
357// Here's a start (David) 358// Here's a start (David)
358TEWidget::~TEWidget() 359TEWidget::~TEWidget()
359{ 360{
360 qApp->removeEventFilter( this ); 361 qApp->removeEventFilter( this );
361 if (image) free(image); 362 if (image) free(image);
362} 363}
363 364
364/* ------------------------------------------------------------------------- */ 365/* ------------------------------------------------------------------------- */
365/* */ 366/* */
366/* Display Operations */ 367/* Display Operations */
367/* */ 368/* */
368/* ------------------------------------------------------------------------- */ 369/* ------------------------------------------------------------------------- */
369 370
370/*! 371/*!
371 attributed string draw primitive 372 attributed string draw primitive
372*/ 373*/
373 374
374void TEWidget::drawAttrStr(QPainter &paint, QRect rect, 375void TEWidget::drawAttrStr(QPainter &paint, QRect rect,
375 QString& str, ca attr, BOOL pm, BOOL clear) 376 QString& str, ca attr, BOOL pm, BOOL clear)
376{ 377{
377 if (pm && color_table[attr.b].transparent) 378 if (pm && color_table[attr.b].transparent)
378 { 379 {
379 paint.setBackgroundMode( TransparentMode ); 380 paint.setBackgroundMode( TransparentMode );
380 if (clear) erase(rect); 381 if (clear) erase(rect);
381 } 382 }
382 else 383 else
383 { 384 {
@@ -1358,50 +1359,48 @@ void TEWidget::dropEvent(QDropEvent* event)
1358// kdDebug() << "Drop:" << dropText.local8Bit() << "\n"; 1359// kdDebug() << "Drop:" << dropText.local8Bit() << "\n";
1359 if (currentSession) { 1360 if (currentSession) {
1360 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1361 currentSession->getEmulation()->sendString(dropText.local8Bit());
1361 } 1362 }
1362 // Paste it 1363 // Paste it
1363 } 1364 }
1364} 1365}
1365#endif 1366#endif
1366 1367
1367 1368
1368void TEWidget::drop_menu_activated(int item) 1369void TEWidget::drop_menu_activated(int item)
1369{ 1370{
1370#ifndef QT_NO_DRAGANDDROP 1371#ifndef QT_NO_DRAGANDDROP
1371 switch (item) 1372 switch (item)
1372 { 1373 {
1373 case 0: // paste 1374 case 0: // paste
1374 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1375 currentSession->getEmulation()->sendString(dropText.local8Bit());
1375// KWM::activate((Window)this->winId()); 1376// KWM::activate((Window)this->winId());
1376 break; 1377 break;
1377 case 1: // cd ... 1378 case 1: // cd ...
1378 currentSession->getEmulation()->sendString("cd "); 1379 currentSession->getEmulation()->sendString("cd ");
1379 struct stat statbuf; 1380 struct stat statbuf;
1380 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 ) 1381 if ( ::stat( QFile::encodeName( dropText ), &statbuf ) == 0 )
1381 { 1382 {
1382 if ( !S_ISDIR(statbuf.st_mode) ) 1383 if ( !S_ISDIR(statbuf.st_mode) )
1383 { 1384 {
1384/* 1385/*
1385 KURL url; 1386 KURL url;
1386 url.setPath( dropText ); 1387 url.setPath( dropText );
1387 dropText = url.directory( true, false ); // remove filename 1388 dropText = url.directory( true, false ); // remove filename
1388*/ 1389*/
1389 } 1390 }
1390 } 1391 }
1391 dropText.replace(QRegExp(" "), "\\ "); // escape spaces 1392 dropText.replace(QRegExp(" "), "\\ "); // escape spaces
1392 currentSession->getEmulation()->sendString(dropText.local8Bit()); 1393 currentSession->getEmulation()->sendString(dropText.local8Bit());
1393 currentSession->getEmulation()->sendString("\n"); 1394 currentSession->getEmulation()->sendString("\n");
1394// KWM::activate((Window)this->winId()); 1395// KWM::activate((Window)this->winId());
1395 break; 1396 break;
1396 } 1397 }
1397#endif 1398#endif
1398} 1399}
1399 1400
1400void TEWidget::setWrapAt(int columns) 1401void TEWidget::setWrapAt(int columns)
1401{ 1402{
1402 vcolumns = columns; 1403 vcolumns = columns;
1403 propagateSize(); 1404 propagateSize();
1404 update(); 1405 update();
1405} 1406}
1406
1407
diff --git a/core/apps/embeddedkonsole/TEmulation.h b/core/apps/embeddedkonsole/TEmulation.h
index ec15e7a..bf43f11 100644
--- a/core/apps/embeddedkonsole/TEmulation.h
+++ b/core/apps/embeddedkonsole/TEmulation.h
@@ -1,92 +1,93 @@
1/* -------------------------------------------------------------------------- */ 1/* -------------------------------------------------------------------------- */
2/* */ 2/* */
3/* [emulation.h] Fundamental Terminal Emulation */ 3/* [emulation.h] Fundamental Terminal Emulation */
4/* */ 4/* */
5/* -------------------------------------------------------------------------- */ 5/* -------------------------------------------------------------------------- */
6/* */ 6/* */
7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ 7/* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */
8/* */ 8/* */
9/* This file is part of Konsole - an X terminal for KDE */ 9/* This file is part of Konsole - an X terminal for KDE */
10/* */ 10/* */
11/* -------------------------------------------------------------------------- */ 11/* -------------------------------------------------------------------------- */
12 /* */ 12/* */
13/* Ported Konsole to Qt/Embedded */ 13/* Ported Konsole to Qt/Embedded */
14 /* */ 14/* */
15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ 15/* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */
16 /* */ 16/* */
17/* -------------------------------------------------------------------------- */ 17/* -------------------------------------------------------------------------- */
18 18
19#ifndef EMULATION_H 19#ifndef EMULATION_H
20#define EMULATION_H 20#define EMULATION_H
21 21
22#include "TEWidget.h" 22#include "TEWidget.h"
23#include "TEScreen.h" 23#include "TEScreen.h"
24#include <qtimer.h> 24#include <qtimer.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <qtextcodec.h> 26#include <qtextcodec.h>
27#include "keytrans.h" 27#include "keytrans.h"
28 28
29class TEmulation : public QObject 29class TEmulation : public QObject
30{ Q_OBJECT 30{ Q_OBJECT
31 31
32public: 32public:
33 33
34 TEmulation(TEWidget* gui); 34 TEmulation(TEWidget* gui);
35 ~TEmulation(); 35 ~TEmulation();
36 36
37public: 37public:
38 virtual void setHistory(bool on); 38 virtual void setHistory(bool on);
39 virtual bool history(); 39 virtual bool history();
40 40
41public slots: // signals incoming from TEWidget 41public slots: // signals incoming from TEWidget
42 42
43 virtual void onImageSizeChange(int lines, int columns); 43 virtual void onImageSizeChange(int lines, int columns);
44 virtual void onHistoryCursorChange(int cursor); 44 virtual void onHistoryCursorChange(int cursor);
45 virtual void onHorzCursorChange(int cursor);
45 virtual void onKeyPress(QKeyEvent*); 46 virtual void onKeyPress(QKeyEvent*);
46 47
47 virtual void clearSelection(); 48 virtual void clearSelection();
48 virtual void onSelectionBegin(const int x, const int y); 49 virtual void onSelectionBegin(const int x, const int y);
49 virtual void onSelectionExtend(const int x, const int y); 50 virtual void onSelectionExtend(const int x, const int y);
50 virtual void setSelection(const BOOL preserve_line_breaks); 51 virtual void setSelection(const BOOL preserve_line_breaks);
51 52
52public slots: // signals incoming from data source 53public slots: // signals incoming from data source
53 54
54 void onRcvBlock(const char* txt,int len); 55 void onRcvBlock(const char* txt,int len);
55 56
56signals: 57signals:
57 58
58 void sndBlock(const char* txt,int len); 59 void sndBlock(const char* txt,int len);
59 void ImageSizeChanged(int lines, int columns); 60 void ImageSizeChanged(int lines, int columns);
60 void changeColumns(int columns); 61 void changeColumns(int columns);
61 void changeTitle(int arg, const char* str); 62 void changeTitle(int arg, const char* str);
62 63
63public: 64public:
64 65
65 virtual void onRcvChar(int); 66 virtual void onRcvChar(int);
66 67
67 virtual void setMode (int) = 0; 68 virtual void setMode (int) = 0;
68 virtual void resetMode(int) = 0; 69 virtual void resetMode(int) = 0;
69 70
70 virtual void sendString(const char*) = 0; 71 virtual void sendString(const char*) = 0;
71 72
72 virtual void setConnect(bool r); 73 virtual void setConnect(bool r);
73 void setColumns(int columns); 74 void setColumns(int columns);
74 75
75 void setKeytrans(int no); 76 void setKeytrans(int no);
76 void setKeytrans(const char * no); 77 void setKeytrans(const char * no);
77 78
78protected: 79protected:
79 80
80 TEWidget* gui; 81 TEWidget* gui;
81 TEScreen* scr; // referes to one `screen' 82 TEScreen* scr; // referes to one `screen'
82 TEScreen* screen[2]; // 0 = primary, 1 = alternate 83 TEScreen* screen[2]; // 0 = primary, 1 = alternate
83 void setScreen(int n); // set `scr' to `screen[n]' 84 void setScreen(int n); // set `scr' to `screen[n]'
84 85
85 bool connected; // communicate with widget 86 bool connected; // communicate with widget
86 87
87 void setCodec(int c); // codec number, 0 = locale, 1=utf8 88 void setCodec(int c); // codec number, 0 = locale, 1=utf8
88 89
89 QTextCodec* codec; 90 QTextCodec* codec;
90 QTextCodec* localeCodec; 91 QTextCodec* localeCodec;
91 QTextDecoder* decoder; 92 QTextDecoder* decoder;
92 93
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp
index 3c87ad4..16db0ea 100644
--- a/core/apps/embeddedkonsole/konsole.cpp
+++ b/core/apps/embeddedkonsole/konsole.cpp
@@ -313,137 +313,141 @@ void Konsole::init(const char* _pgm, QStrList & _args)
313 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 ); 313 a = new QAction( tr("Enter"), Resource::loadPixmap( "konsole/enter" ), QString::null, 0, this, 0 );
314 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar ); 314 connect( a, SIGNAL( activated() ), this, SLOT( hitEnter() ) ); a->addTo( toolbar );
315 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 ); 315 a = new QAction( tr("Space"), Resource::loadPixmap( "konsole/space" ), QString::null, 0, this, 0 );
316 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar ); 316 connect( a, SIGNAL( activated() ), this, SLOT( hitSpace() ) ); a->addTo( toolbar );
317 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 ); 317 a = new QAction( tr("Tab"), Resource::loadPixmap( "konsole/tab" ), QString::null, 0, this, 0 );
318 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar ); 318 connect( a, SIGNAL( activated() ), this, SLOT( hitTab() ) ); a->addTo( toolbar );
319 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 ); 319 a = new QAction( tr("Up"), Resource::loadPixmap( "konsole/up" ), QString::null, 0, this, 0 );
320 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 320 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
321 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 ); 321 a = new QAction( tr("Down"), Resource::loadPixmap( "konsole/down" ), QString::null, 0, this, 0 );
322 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 322 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
323 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 ); 323 a = new QAction( tr("Paste"), Resource::loadPixmap( "paste" ), QString::null, 0, this, 0 );
324 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar ); 324 connect( a, SIGNAL( activated() ), this, SLOT( hitPaste() ) ); a->addTo( toolbar );
325/* 325/*
326 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 ); 326 a = new QAction( tr("Up"), Resource::loadPixmap( "up" ), QString::null, 0, this, 0 );
327 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar ); 327 connect( a, SIGNAL( activated() ), this, SLOT( hitUp() ) ); a->addTo( toolbar );
328 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 ); 328 a = new QAction( tr("Down"), Resource::loadPixmap( "down" ), QString::null, 0, this, 0 );
329 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar ); 329 connect( a, SIGNAL( activated() ), this, SLOT( hitDown() ) ); a->addTo( toolbar );
330*/ 330*/
331 331
332 secondToolBar = new QPEToolBar( this ); 332 secondToolBar = new QPEToolBar( this );
333 secondToolBar->setHorizontalStretchable( TRUE ); 333 secondToolBar->setHorizontalStretchable( TRUE );
334 334
335 commonCombo = new QComboBox( secondToolBar ); 335 commonCombo = new QComboBox( secondToolBar );
336 commonCombo->setMaximumWidth(236); 336 commonCombo->setMaximumWidth(236);
337 337
338 editCommandListMenu->insertItem( tr( "Quick Edit" ) ); 338 editCommandListMenu->insertItem( tr( "Quick Edit" ) );
339 if( listHidden) { 339 if( listHidden) {
340 secondToolBar->hide(); 340 secondToolBar->hide();
341 editCommandListMenu->setItemEnabled(-23 ,FALSE); 341 editCommandListMenu->setItemEnabled(-23 ,FALSE);
342 } 342 }
343 editCommandListMenu->insertItem(tr( "Edit" ) ); 343 editCommandListMenu->insertItem(tr( "Edit" ) );
344 344
345 cfg.setGroup("Commands"); 345 cfg.setGroup("Commands");
346 commonCombo->setInsertionPolicy(QComboBox::AtCurrent); 346 commonCombo->setInsertionPolicy(QComboBox::AtCurrent);
347 347
348 initCommandList(); 348 initCommandList();
349// for (int i = 0; commonCmds[i] != NULL; i++) { 349// for (int i = 0; commonCmds[i] != NULL; i++) {
350// commonCombo->insertItem( commonCmds[i], i ); 350// commonCombo->insertItem( commonCmds[i], i );
351// tmp = cfg.readEntry( QString::number(i),""); 351// tmp = cfg.readEntry( QString::number(i),"");
352// if(tmp != "") 352// if(tmp != "")
353// commonCombo->changeItem( tmp,i ); 353// commonCombo->changeItem( tmp,i );
354// } 354// }
355 355
356 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); 356 connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) ));
357 357
358 scrollMenu->insertItem(tr( "None" )); 358 scrollMenu->insertItem(tr( "None" ));
359 scrollMenu->insertItem(tr( "Left" )); 359 scrollMenu->insertItem(tr( "Left" ));
360 scrollMenu->insertItem(tr( "Right" )); 360 scrollMenu->insertItem(tr( "Right" ));
361 scrollMenu->insertSeparator(4); 361// scrollMenu->insertSeparator(4);
362 scrollMenu->insertItem(tr( "Horizontal" )); 362// scrollMenu->insertItem(tr( "Horizontal" ));
363 363
364 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu); 364 configMenu->insertItem(tr( "ScrollBar" ),scrollMenu);
365
366 configMenu->insertItem(tr( "Wrap" ));
367
365//scrollMenuSelected(-29); 368//scrollMenuSelected(-29);
366// cfg.setGroup("ScrollBar"); 369// cfg.setGroup("ScrollBar");
367// if(cfg.readBoolEntry("HorzScroll",0)) { 370// if(cfg.readBoolEntry("HorzScroll",0)) {
368// if(cfg.readNumEntry("Position",2) == 0) 371// if(cfg.readNumEntry("Position",2) == 0)
369// te->setScrollbarLocation(1); 372// te->setScrollbarLocation(1);
370// else 373// else
371// te->setScrollbarLocation(0); 374// te->setScrollbarLocation(0);
372// te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 375// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
373// te->setWrapAt(120); 376// te->setWrapAt(120);
374// } 377// }
375 // create applications ///////////////////////////////////////////////////// 378 // create applications /////////////////////////////////////////////////////
376 setCentralWidget(tab); 379 setCentralWidget(tab);
377 380
378 // load keymaps //////////////////////////////////////////////////////////// 381 // load keymaps ////////////////////////////////////////////////////////////
379 KeyTrans::loadAll(); 382 KeyTrans::loadAll();
380 for (int i = 0; i < KeyTrans::count(); i++) 383 for (int i = 0; i < KeyTrans::count(); i++)
381 { KeyTrans* s = KeyTrans::find(i); 384 { KeyTrans* s = KeyTrans::find(i);
382 assert( s ); 385 assert( s );
383 } 386 }
384 387
385 se_pgm = _pgm; 388 se_pgm = _pgm;
386 se_args = _args; 389 se_args = _args;
387 se_args.prepend("--login"); 390 se_args.prepend("--login");
388parseCommandLine(); 391parseCommandLine();
389 // read and apply default values /////////////////////////////////////////// 392 // read and apply default values ///////////////////////////////////////////
390 resize(321, 321); // Dummy. 393 resize(321, 321); // Dummy.
391 QSize currentSize = size(); 394 QSize currentSize = size();
392 if (currentSize != size()) 395 if (currentSize != size())
393 defaultSize = size(); 396 defaultSize = size();
394} 397}
395 398
396void Konsole::show() 399void Konsole::show()
397{ 400{
398 if ( !nsessions ) { 401 if ( !nsessions ) {
399 newSession(); 402 newSession();
400 } 403 }
401 QMainWindow::show(); 404 QMainWindow::show();
405
402} 406}
403 407
404void Konsole::initSession(const char*, QStrList &) 408void Konsole::initSession(const char*, QStrList &)
405{ 409{
406 QMainWindow::show(); 410 QMainWindow::show();
407} 411}
408 412
409Konsole::~Konsole() 413Konsole::~Konsole()
410{ 414{
411 while (nsessions > 0) { 415 while (nsessions > 0) {
412 doneSession(getTe()->currentSession, 0); 416 doneSession(getTe()->currentSession, 0);
413 } 417 }
414 418
415 Config cfg("Konsole"); 419 Config cfg("Konsole");
416 cfg.setGroup("Konsole"); 420 cfg.setGroup("Konsole");
417 cfg.writeEntry("FontID", cfont); 421 cfg.writeEntry("FontID", cfont);
418} 422}
419 423
420void Konsole::fontChanged(int f) 424void Konsole::fontChanged(int f)
421{ 425{
422 VTFont* font = fonts.at(f); 426 VTFont* font = fonts.at(f);
423 if (font != 0) { 427 if (font != 0) {
424 for(uint i = 0; i < fonts.count(); i++) { 428 for(uint i = 0; i < fonts.count(); i++) {
425 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); 429 fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE);
426 } 430 }
427 431
428 cfont = f; 432 cfont = f;
429 433
430 TEWidget* te = getTe(); 434 TEWidget* te = getTe();
431 if (te != 0) { 435 if (te != 0) {
432 te->setVTFont(font->getFont()); 436 te->setVTFont(font->getFont());
433 } 437 }
434 } 438 }
435} 439}
436 440
437 441
438void Konsole::enterCommand(int c) 442void Konsole::enterCommand(int c)
439{ 443{
440 TEWidget* te = getTe(); 444 TEWidget* te = getTe();
441 if (te != 0) { 445 if (te != 0) {
442 if(!commonCombo->editable()) { 446 if(!commonCombo->editable()) {
443 QString text = commonCombo->text(c); //commonCmds[c]; 447 QString text = commonCombo->text(c); //commonCmds[c];
444 te->emitText(text); 448 te->emitText(text);
445 } else { 449 } else {
446 changeCommand( commonCombo->text(c), c); 450 changeCommand( commonCombo->text(c), c);
447 } 451 }
448 } 452 }
449} 453}
@@ -553,107 +557,108 @@ void Konsole::setFont(int fontno)
553 if ( !f.exactMatch() && fontno != 0) 557 if ( !f.exactMatch() && fontno != 0)
554 { 558 {
555 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]); 559 QString msg = i18n("Font `%1' not found.\nCheck README.linux.console for help.").arg(fonts[fontno]);
556 QMessageBox(this, msg); 560 QMessageBox(this, msg);
557 return; 561 return;
558 } 562 }
559 if (se) se->setFontNo(fontno); 563 if (se) se->setFontNo(fontno);
560 te->setVTFont(f); 564 te->setVTFont(f);
561 n_font = fontno; 565 n_font = fontno;
562} 566}
563*/ 567*/
564 568
565// --| color selection |------------------------------------------------------- 569// --| color selection |-------------------------------------------------------
566 570
567void Konsole::changeColumns(int columns) 571void Konsole::changeColumns(int columns)
568{ 572{
569 qDebug("change columns"); 573 qDebug("change columns");
570 TEWidget* te = getTe(); 574 TEWidget* te = getTe();
571 if (te != 0) { 575 if (te != 0) {
572 setColLin(columns,te->Lines()); 576 setColLin(columns,te->Lines());
573 te->update(); 577 te->update();
574 } 578 }
575} 579}
576 580
577//FIXME: If a child dies during session swap, 581//FIXME: If a child dies during session swap,
578// this routine might be called before 582// this routine might be called before
579// session swap is completed. 583// session swap is completed.
580 584
581void Konsole::doneSession(TESession*, int ) 585void Konsole::doneSession(TESession*, int )
582{ 586{
583 TEWidget *te = getTe(); 587 TEWidget *te = getTe();
584 if (te != 0) { 588 if (te != 0) {
585 te->currentSession->setConnect(FALSE); 589 te->currentSession->setConnect(FALSE);
586 tab->removeTab(te); 590 tab->removeTab(te);
587 delete te->currentSession; 591 delete te->currentSession;
588 delete te; 592 delete te;
589 nsessions--; 593 nsessions--;
590 } 594 }
591 595
592 if (nsessions == 0) { 596 if (nsessions == 0) {
593 close(); 597 close();
594 } 598 }
595} 599}
596 600
597void Konsole::newSession() { 601void Konsole::newSession() {
598 if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory? 602 if(nsessions < 15) { // seems to be something weird about 16 tabs on the Zaurus.... memory?
599 TEWidget* te = new TEWidget(tab); 603 TEWidget* te = new TEWidget(tab);
600// te->setBackgroundMode(PaletteBase); //we want transparent!! 604// te->setBackgroundMode(PaletteBase); //we want transparent!!
601 te->setVTFont(fonts.at(cfont)->getFont()); 605 te->setVTFont(fonts.at(cfont)->getFont());
602 tab->addTab(te); 606 tab->addTab(te);
603 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); 607 TESession* se = new TESession(this, te, se_pgm, se_args, "xterm");
604 te->currentSession = se; 608 te->currentSession = se;
605 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) ); 609 connect( se, SIGNAL(done(TESession*,int)), this, SLOT(doneSession(TESession*,int)) );
606 se->run(); 610 se->run();
607 se->setConnect(TRUE); 611 se->setConnect(TRUE);
608 se->setHistory(b_scroll); 612 se->setHistory(b_scroll);
609 tab->setCurrentPage(nsessions); 613 tab->setCurrentPage(nsessions);
610 nsessions++; 614 nsessions++;
611 setColor(); 615 doWrap();
616 setColor();
612 } 617 }
613} 618}
614 619
615TEWidget* Konsole::getTe() { 620TEWidget* Konsole::getTe() {
616 if (nsessions) { 621 if (nsessions) {
617 return (TEWidget *) tab->currentPage(); 622 return (TEWidget *) tab->currentPage();
618 } else { 623 } else {
619 return 0; 624 return 0;
620 } 625 }
621} 626}
622 627
623void Konsole::switchSession(QWidget* w) { 628void Konsole::switchSession(QWidget* w) {
624 TEWidget* te = (TEWidget *) w; 629 TEWidget* te = (TEWidget *) w;
625 630
626 QFont teFnt = te->getVTFont(); 631 QFont teFnt = te->getVTFont();
627 for(uint i = 0; i < fonts.count(); i++) { 632 for(uint i = 0; i < fonts.count(); i++) {
628 VTFont *fnt = fonts.at(i); 633 VTFont *fnt = fonts.at(i);
629 bool cf = fnt->getFont() == teFnt; 634 bool cf = fnt->getFont() == teFnt;
630 fontList->setItemChecked(i, cf); 635 fontList->setItemChecked(i, cf);
631 if (cf) { 636 if (cf) {
632 cfont = i; 637 cfont = i;
633 } 638 }
634 } 639 }
635} 640}
636 641
637void Konsole::colorMenuIsSelected(int iD) { 642void Konsole::colorMenuIsSelected(int iD) {
638 fromMenu = TRUE; 643 fromMenu = TRUE;
639 colorMenuSelected(iD); 644 colorMenuSelected(iD);
640} 645}
641 646
642/// ------------------------------- some new stuff by L.J. Potter 647/// ------------------------------- some new stuff by L.J. Potter
643void Konsole::colorMenuSelected(int iD) 648void Konsole::colorMenuSelected(int iD)
644{ // this is NOT pretty, elegant or anything else besides functional 649{ // this is NOT pretty, elegant or anything else besides functional
645// QString temp; 650// QString temp;
646// qDebug( temp.sprintf("colormenu %d", iD)); 651// qDebug( temp.sprintf("colormenu %d", iD));
647 TEWidget* te = getTe(); 652 TEWidget* te = getTe();
648 Config cfg("Konsole"); 653 Config cfg("Konsole");
649 cfg.setGroup("Colors"); 654 cfg.setGroup("Colors");
650// QColor foreground; 655// QColor foreground;
651// QColor background; 656// QColor background;
652 colorMenu->setItemChecked(lastSelectedMenu,FALSE); 657 colorMenu->setItemChecked(lastSelectedMenu,FALSE);
653 ColorEntry m_table[TABLE_COLORS]; 658 ColorEntry m_table[TABLE_COLORS];
654 const ColorEntry * defaultCt=te->getdefaultColorTable(); 659 const ColorEntry * defaultCt=te->getdefaultColorTable();
655 /////////// fore back 660 /////////// fore back
656 int i; 661 int i;
657 if(iD==-9) { // default default 662 if(iD==-9) { // default default
658 for (i = 0; i < TABLE_COLORS; i++) { 663 for (i = 0; i < TABLE_COLORS; i++) {
659 m_table[i].color = defaultCt[i].color; 664 m_table[i].color = defaultCt[i].color;
@@ -728,169 +733,184 @@ void Konsole::colorMenuSelected(int iD)
728 if(iD==-17) {// Black, Blue 733 if(iD==-17) {// Black, Blue
729 background.setRgb(0x00,0x00,0x00); 734 background.setRgb(0x00,0x00,0x00);
730 foreground.setRgb(0x18,0xB2,0xB2); 735 foreground.setRgb(0x18,0xB2,0xB2);
731 cfg.writeEntry("Schema","17"); 736 cfg.writeEntry("Schema","17");
732 colorMenu->setItemChecked(-17,TRUE); 737 colorMenu->setItemChecked(-17,TRUE);
733 } 738 }
734 if(iD==-18) {// Black, Gold 739 if(iD==-18) {// Black, Gold
735 background.setRgb(0x00,0x00,0x00); 740 background.setRgb(0x00,0x00,0x00);
736 foreground.setRgb(255,215,0); 741 foreground.setRgb(255,215,0);
737 cfg.writeEntry("Schema","18"); 742 cfg.writeEntry("Schema","18");
738 colorMenu->setItemChecked(-18,TRUE); 743 colorMenu->setItemChecked(-18,TRUE);
739 } 744 }
740 if(iD==-19) {// Custom 745 if(iD==-19) {// Custom
741 qDebug("do custom"); 746 qDebug("do custom");
742 if(fromMenu) { 747 if(fromMenu) {
743 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color"); 748 ColorPopupMenu* penColorPopupMenu = new ColorPopupMenu(Qt::black, this, "foreground color");
744 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this, 749 connect(penColorPopupMenu, SIGNAL(colorSelected(const QColor&)), this,
745 SLOT(changeForegroundColor(const QColor&))); 750 SLOT(changeForegroundColor(const QColor&)));
746 penColorPopupMenu->exec(); 751 penColorPopupMenu->exec();
747 } 752 }
748 cfg.writeEntry("Schema","19"); 753 cfg.writeEntry("Schema","19");
749 if(!fromMenu) { 754 if(!fromMenu) {
750 foreground.setNamedColor(cfg.readEntry("foreground","")); 755 foreground.setNamedColor(cfg.readEntry("foreground",""));
751 background.setNamedColor(cfg.readEntry("background","")); 756 background.setNamedColor(cfg.readEntry("background",""));
752 } 757 }
753 fromMenu=FALSE; 758 fromMenu=FALSE;
754 colorMenu->setItemChecked(-19,TRUE); 759 colorMenu->setItemChecked(-19,TRUE);
755 } 760 }
756 761
757 for (i = 0; i < TABLE_COLORS; i++) { 762 for (i = 0; i < TABLE_COLORS; i++) {
758 if(i==0 || i == 10) { 763 if(i==0 || i == 10) {
759 m_table[i].color = foreground; 764 m_table[i].color = foreground;
760 } 765 }
761 else if(i==1 || i == 11) { 766 else if(i==1 || i == 11) {
762 m_table[i].color = background; m_table[i].transparent=0; 767 m_table[i].color = background; m_table[i].transparent=0;
763 } 768 }
764 else 769 else
765 m_table[i].color = defaultCt[i].color; 770 m_table[i].color = defaultCt[i].color;
766 } 771 }
767 } 772 }
768 lastSelectedMenu = iD; 773 lastSelectedMenu = iD;
769 te->setColorTable(m_table); 774 te->setColorTable(m_table);
770 update(); 775 update();
771 776
772} 777}
773 778
774void Konsole::configMenuSelected(int iD) 779void Konsole::configMenuSelected(int iD)
775{ 780{
776// QString temp; 781 QString temp;
777// qDebug( temp.sprintf("configmenu %d",iD)); 782 qDebug( temp.sprintf("configmenu %d",iD));
778 TEWidget* te = getTe(); 783 TEWidget* te = getTe();
779 Config cfg("Konsole"); 784 Config cfg("Konsole");
780 cfg.setGroup("Menubar"); 785 cfg.setGroup("Menubar");
781 if( iD == -4) { 786 if( iD == -4) {
782 cfg.setGroup("Tabs"); 787 cfg.setGroup("Tabs");
783 QString tmp=cfg.readEntry("Position","Bottom"); 788 QString tmp=cfg.readEntry("Position","Bottom");
784 789
785 if(tmp=="Top") { 790 if(tmp=="Top") {
786 tab->setTabPosition(QTabWidget::Bottom); 791 tab->setTabPosition(QTabWidget::Bottom);
787 configMenu->changeItem( iD,"Tabs on Top"); 792 configMenu->changeItem( iD,"Tabs on Top");
788 cfg.writeEntry("Position","Bottom"); 793 cfg.writeEntry("Position","Bottom");
789 } else { 794 } else {
790 tab->setTabPosition(QTabWidget::Top); 795 tab->setTabPosition(QTabWidget::Top);
791 configMenu->changeItem( iD,"Tabs on Bottom"); 796 configMenu->changeItem( iD,"Tabs on Bottom");
792 cfg.writeEntry("Position","Top"); 797 cfg.writeEntry("Position","Top");
793 } 798 }
794 } 799 }
800 if( iD == -29) {
801 cfg.setGroup("ScrollBar");
802 bool b=cfg.readBoolEntry("HorzScroll",0);
803 b=!b;
804 cfg.writeEntry("HorzScroll", b );
805 cfg.write();
806 doWrap();
807 if(cfg.readNumEntry("Position",2) == 0) {
808 te->setScrollbarLocation(1);
809 } else {
810 te->setScrollbarLocation(0);
811 }
812 te->setScrollbarLocation( cfg.readNumEntry("Position",2));
813 }
795} 814}
796 815
797void Konsole::changeCommand(const QString &text, int c) 816void Konsole::changeCommand(const QString &text, int c)
798{ 817{
799 Config cfg("Konsole"); 818 Config cfg("Konsole");
800 cfg.setGroup("Commands"); 819 cfg.setGroup("Commands");
801 if(commonCmds[c] != text) { 820 if(commonCmds[c] != text) {
802 cfg.writeEntry(QString::number(c),text); 821 cfg.writeEntry(QString::number(c),text);
803 commonCombo->clearEdit(); 822 commonCombo->clearEdit();
804 commonCombo->setCurrentItem(c); 823 commonCombo->setCurrentItem(c);
805 } 824 }
806} 825}
807 826
808void Konsole::setColor() 827void Konsole::setColor()
809{ 828{
810 Config cfg("Konsole"); 829 Config cfg("Konsole");
811 cfg.setGroup("Colors"); 830 cfg.setGroup("Colors");
812 int scheme = cfg.readNumEntry("Schema",1); 831 int scheme = cfg.readNumEntry("Schema",1);
813 if(scheme != 1) colorMenuSelected( -scheme); 832 if(scheme != 1) colorMenuSelected( -scheme);
814} 833}
815 834
816void Konsole::scrollMenuSelected(int index) 835void Konsole::scrollMenuSelected(int index)
817{ 836{
818 qDebug( "scrollbar menu %d",index); 837 qDebug( "scrollbar menu %d",index);
819 TEWidget* te = getTe(); 838 TEWidget* te = getTe();
820 Config cfg("Konsole"); 839 Config cfg("Konsole");
821 cfg.setGroup("ScrollBar"); 840 cfg.setGroup("ScrollBar");
822 switch( index){ 841 switch( index){
823 case -25: 842 case -25:
824 te->setScrollbarLocation(0); 843 te->setScrollbarLocation(0);
825 cfg.writeEntry("Position",0); 844 cfg.writeEntry("Position",0);
826 break; 845 break;
827 case -26: 846 case -26:
828 te->setScrollbarLocation(1); 847 te->setScrollbarLocation(1);
829 cfg.writeEntry("Position",1); 848 cfg.writeEntry("Position",1);
830 break; 849 break;
831 case -27: 850 case -27:
832 te->setScrollbarLocation(2); 851 te->setScrollbarLocation(2);
833 cfg.writeEntry("Position",2); 852 cfg.writeEntry("Position",2);
834 break; 853 break;
835 case -29: { 854// case -29: {
836 bool b=cfg.readBoolEntry("HorzScroll",0); 855// bool b=cfg.readBoolEntry("HorzScroll",0);
837 cfg.writeEntry("HorzScroll", !b ); 856// cfg.writeEntry("HorzScroll", !b );
838 cfg.write(); 857// cfg.write();
839 if(cfg.readNumEntry("Position",2) == 0) 858// if(cfg.readNumEntry("Position",2) == 0) {
840 te->setScrollbarLocation(1); 859// te->setScrollbarLocation(1);
841 else 860// te->setWrapAt(0);
842 te->setScrollbarLocation(0); 861// } else {
843 te->setScrollbarLocation( cfg.readNumEntry("Position",2)); 862// te->setScrollbarLocation(0);
844 te->setWrapAt(120); 863// te->setWrapAt(120);
845 } 864// }
846 break; 865// te->setScrollbarLocation( cfg.readNumEntry("Position",2));
866// }
867// break;
847 }; 868 };
848
849} 869}
850 870
851void Konsole::editCommandListMenuSelected(int iD) 871void Konsole::editCommandListMenuSelected(int iD)
852{ 872{
853// QString temp; 873// QString temp;
854// qDebug( temp.sprintf("edit command list %d",iD)); 874// qDebug( temp.sprintf("edit command list %d",iD));
855 TEWidget* te = getTe(); 875 TEWidget* te = getTe();
856 Config cfg("Konsole"); 876 Config cfg("Konsole");
857 cfg.setGroup("Menubar"); 877 cfg.setGroup("Menubar");
858 if( iD == -3) { 878 if( iD == -3) {
859 if(!secondToolBar->isHidden()) { 879 if(!secondToolBar->isHidden()) {
860 secondToolBar->hide(); 880 secondToolBar->hide();
861 configMenu->changeItem( iD,tr( "Show Command List" )); 881 configMenu->changeItem( iD,tr( "Show Command List" ));
862 cfg.writeEntry("Hidden","TRUE"); 882 cfg.writeEntry("Hidden","TRUE");
863 configMenu->setItemEnabled(-23 ,FALSE); 883 configMenu->setItemEnabled(-23 ,FALSE);
864 } else { 884 } else {
865 secondToolBar->show(); 885 secondToolBar->show();
866 configMenu->changeItem( iD,tr( "Hide Command List" )); 886 configMenu->changeItem( iD,tr( "Hide Command List" ));
867 cfg.writeEntry("Hidden","FALSE"); 887 cfg.writeEntry("Hidden","FALSE");
868 configMenu->setItemEnabled(-23 ,TRUE); 888 configMenu->setItemEnabled(-23 ,TRUE);
869 889
870 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") { 890 if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") {
871 configMenu->setItemChecked(-23,TRUE); 891 configMenu->setItemChecked(-23,TRUE);
872 commonCombo->setEditable( TRUE ); 892 commonCombo->setEditable( TRUE );
873 } else { 893 } else {
874 configMenu->setItemChecked(-23,FALSE); 894 configMenu->setItemChecked(-23,FALSE);
875 commonCombo->setEditable( FALSE ); 895 commonCombo->setEditable( FALSE );
876 } 896 }
877 } 897 }
878 } 898 }
879 if( iD == -23) { 899 if( iD == -23) {
880 cfg.setGroup("Commands"); 900 cfg.setGroup("Commands");
881// qDebug("enableCommandEdit"); 901// qDebug("enableCommandEdit");
882 if( !configMenu->isItemChecked(iD) ) { 902 if( !configMenu->isItemChecked(iD) ) {
883 commonCombo->setEditable( TRUE ); 903 commonCombo->setEditable( TRUE );
884 configMenu->setItemChecked(iD,TRUE); 904 configMenu->setItemChecked(iD,TRUE);
885 commonCombo->setCurrentItem(0); 905 commonCombo->setCurrentItem(0);
886 cfg.writeEntry("EditEnabled","TRUE"); 906 cfg.writeEntry("EditEnabled","TRUE");
887 } else { 907 } else {
888 commonCombo->setEditable( FALSE ); 908 commonCombo->setEditable( FALSE );
889 configMenu->setItemChecked(iD,FALSE); 909 configMenu->setItemChecked(iD,FALSE);
890 cfg.writeEntry("EditEnabled","FALSE"); 910 cfg.writeEntry("EditEnabled","FALSE");
891 commonCombo->setFocusPolicy(QWidget::NoFocus); 911 commonCombo->setFocusPolicy(QWidget::NoFocus);
892 te->setFocus(); 912 te->setFocus();
893 } 913 }
894 } 914 }
895 if(iD == -24) { 915 if(iD == -24) {
896 // "edit commands" 916 // "edit commands"
@@ -926,48 +946,62 @@ void Konsole::parseCommandLine() {
926 QString cmd; 946 QString cmd;
927 // newSession(); 947 // newSession();
928 for (int i=1;i< qApp->argc();i++) { 948 for (int i=1;i< qApp->argc();i++) {
929 if( QString(qApp->argv()[i]) == "-e") { 949 if( QString(qApp->argv()[i]) == "-e") {
930 i++; 950 i++;
931 for ( int j=i;j< qApp->argc();j++) { 951 for ( int j=i;j< qApp->argc();j++) {
932 cmd+=QString(qApp->argv()[j])+" "; 952 cmd+=QString(qApp->argv()[j])+" ";
933 } 953 }
934 cmd.stripWhiteSpace(); 954 cmd.stripWhiteSpace();
935 system(cmd.latin1()); 955 system(cmd.latin1());
936 exit(0);//close(); 956 exit(0);//close();
937 } // end -e switch 957 } // end -e switch
938 } 958 }
939 startUp++; 959 startUp++;
940} 960}
941 961
942void Konsole::changeForegroundColor(const QColor &color) { 962void Konsole::changeForegroundColor(const QColor &color) {
943 Config cfg("Konsole"); 963 Config cfg("Konsole");
944 cfg.setGroup("Colors"); 964 cfg.setGroup("Colors");
945 int r, g, b; 965 int r, g, b;
946 color.rgb(&r,&g,&b); 966 color.rgb(&r,&g,&b);
947 foreground.setRgb(r,g,b); 967 foreground.setRgb(r,g,b);
948// QString colors; 968// QString colors;
949// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); 969// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
950 cfg.writeEntry("foreground",color.name()); 970 cfg.writeEntry("foreground",color.name());
951 cfg.write(); 971 cfg.write();
952 972
953qDebug("do other dialog"); 973qDebug("do other dialog");
954 ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color"); 974 ColorPopupMenu* penColorPopupMenu2 = new ColorPopupMenu(Qt::black, this,"background color");
955 connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, 975 connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this,
956 SLOT(changeBackgroundColor(const QColor&))); 976 SLOT(changeBackgroundColor(const QColor&)));
957 penColorPopupMenu2->exec(); 977 penColorPopupMenu2->exec();
958 978
959} 979}
960 980
961void Konsole::changeBackgroundColor(const QColor &color) { 981void Konsole::changeBackgroundColor(const QColor &color) {
962 982
963 qDebug("Change background"); 983 qDebug("Change background");
964 Config cfg("Konsole"); 984 Config cfg("Konsole");
965 cfg.setGroup("Colors"); 985 cfg.setGroup("Colors");
966 int r, g, b; 986 int r, g, b;
967 color.rgb(&r,&g,&b); 987 color.rgb(&r,&g,&b);
968 background.setRgb(r,g,b); 988 background.setRgb(r,g,b);
969// QString colors; 989// QString colors;
970// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue); 990// colors.sprintf("%d,%d,%d"color.red,color.green,color.blue);
971 cfg.writeEntry("background",color.name()); 991 cfg.writeEntry("background",color.name());
972 cfg.write(); 992 cfg.write();
973} 993}
994
995void Konsole::doWrap() {
996 Config cfg("Konsole");
997 cfg.setGroup("ScrollBar");
998 TEWidget* te = getTe();
999 if( !cfg.readBoolEntry("HorzScroll",0)) {
1000 te->setWrapAt(0);
1001 configMenu->setItemChecked(-29,FALSE);
1002 } else {
1003 te->setWrapAt(90);
1004// te->setWrapAt(120);
1005 configMenu->setItemChecked(-29,TRUE);
1006 }
1007}
diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h
index 0bf3fb3..4938159 100644
--- a/core/apps/embeddedkonsole/konsole.h
+++ b/core/apps/embeddedkonsole/konsole.h
@@ -36,96 +36,97 @@
36 36
37#include "MyPty.h" 37#include "MyPty.h"
38#include "TEWidget.h" 38#include "TEWidget.h"
39#include "TEmuVt102.h" 39#include "TEmuVt102.h"
40#include "session.h" 40#include "session.h"
41 41
42class EKNumTabWidget; 42class EKNumTabWidget;
43 43
44class Konsole : public QMainWindow 44class Konsole : public QMainWindow
45{ 45{
46Q_OBJECT 46Q_OBJECT
47 47
48public: 48public:
49 49
50 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); 50 Konsole(QWidget* parent = 0, const char* name = 0, WFlags fl = 0);
51 Konsole(const char * name, const char* pgm, QStrList & _args, int histon); 51 Konsole(const char * name, const char* pgm, QStrList & _args, int histon);
52 ~Konsole(); 52 ~Konsole();
53 void setColLin(int columns, int lines); 53 void setColLin(int columns, int lines);
54 QPEToolBar *secondToolBar; 54 QPEToolBar *secondToolBar;
55 void show(); 55 void show();
56 void setColor(); 56 void setColor();
57 int lastSelectedMenu; 57 int lastSelectedMenu;
58 int startUp; 58 int startUp;
59private slots: 59private slots:
60 void setDocument(const QString &); 60 void setDocument(const QString &);
61 void doneSession(TESession*,int); 61 void doneSession(TESession*,int);
62 void changeColumns(int); 62 void changeColumns(int);
63 void fontChanged(int); 63 void fontChanged(int);
64 void configMenuSelected(int ); 64 void configMenuSelected(int );
65 void colorMenuSelected(int); 65 void colorMenuSelected(int);
66 void colorMenuIsSelected(int); 66 void colorMenuIsSelected(int);
67 void enterCommand(int); 67 void enterCommand(int);
68 void hitEnter(); 68 void hitEnter();
69 void hitSpace(); 69 void hitSpace();
70 void hitTab(); 70 void hitTab();
71 void hitPaste(); 71 void hitPaste();
72 void hitUp(); 72 void hitUp();
73 void hitDown(); 73 void hitDown();
74 void switchSession(QWidget *); 74 void switchSession(QWidget *);
75 void newSession(); 75 void newSession();
76 void changeCommand(const QString &, int); 76 void changeCommand(const QString &, int);
77 void initCommandList(); 77 void initCommandList();
78 void scrollMenuSelected(int); 78 void scrollMenuSelected(int);
79 void editCommandListMenuSelected(int); 79 void editCommandListMenuSelected(int);
80 void parseCommandLine(); 80 void parseCommandLine();
81 void changeForegroundColor(const QColor &); 81 void changeForegroundColor(const QColor &);
82 void changeBackgroundColor(const QColor &); 82 void changeBackgroundColor(const QColor &);
83private: 83private:
84 void doWrap();
84 void init(const char* _pgm, QStrList & _args); 85 void init(const char* _pgm, QStrList & _args);
85 void initSession(const char* _pgm, QStrList & _args); 86 void initSession(const char* _pgm, QStrList & _args);
86 void runSession(TESession* s); 87 void runSession(TESession* s);
87 void setColorPixmaps(); 88 void setColorPixmaps();
88 void setHistory(bool); 89 void setHistory(bool);
89 QSize calcSize(int columns, int lines); 90 QSize calcSize(int columns, int lines);
90 TEWidget* getTe(); 91 TEWidget* getTe();
91 QStringList commands; 92 QStringList commands;
92 QLabel * msgLabel; 93 QLabel * msgLabel;
93 QColor foreground, background; 94 QColor foreground, background;
94bool fromMenu; 95bool fromMenu;
95private: 96private:
96 class VTFont 97 class VTFont
97 { 98 {
98 public: 99 public:
99 VTFont(QString name, QFont& font) 100 VTFont(QString name, QFont& font)
100 { 101 {
101 this->name = name; 102 this->name = name;
102 this->font = font; 103 this->font = font;
103 } 104 }
104 105
105 QFont& getFont() 106 QFont& getFont()
106 { 107 {
107 return font; 108 return font;
108 } 109 }
109 110
110 QString getName() 111 QString getName()
111 { 112 {
112 return name; 113 return name;
113 } 114 }
114 115
115 private: 116 private:
116 QString name; 117 QString name;
117 QFont font; 118 QFont font;
118 }; 119 };
119 120
120 EKNumTabWidget* tab; 121 EKNumTabWidget* tab;
121 int nsessions; 122 int nsessions;
122 QList<VTFont> fonts; 123 QList<VTFont> fonts;
123 int cfont; 124 int cfont;
124 QCString se_pgm; 125 QCString se_pgm;
125 QStrList se_args; 126 QStrList se_args;
126 127
127 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu; 128 QPopupMenu *fontList,*configMenu,*colorMenu,*scrollMenu,*editCommandListMenu;
128 QComboBox *commonCombo; 129 QComboBox *commonCombo;
129 // history scrolling I think 130 // history scrolling I think
130 bool b_scroll; 131 bool b_scroll;
131 132