summaryrefslogtreecommitdiff
path: root/core
Unidiff
Diffstat (limited to 'core') (more/less context) (show whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEHistory.h0
-rw-r--r--core/apps/embeddedkonsole/TEScreen.h8
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp3
-rw-r--r--core/apps/embeddedkonsole/TEmulation.h1
-rw-r--r--core/apps/embeddedkonsole/konsole.cpp68
-rw-r--r--core/apps/embeddedkonsole/konsole.h1
6 files changed, 62 insertions, 19 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
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
@@ -119,56 +119,62 @@ public: // these are all `Screen' operations
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
@@ -179,48 +185,50 @@ private: // helper
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;
202 208
209 int horzCursor;
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
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
@@ -311,48 +311,49 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
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;
335vcolumns = 0;
335 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()
@@ -1382,26 +1383,24 @@ void TEWidget::drop_menu_activated(int item)
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
@@ -21,48 +21,49 @@
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;
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
@@ -337,89 +337,93 @@ void Konsole::init(const char* _pgm, QStrList & _args)
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);
@@ -587,48 +591,49 @@ void Konsole::doneSession(TESession*, int )
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++;
615 doWrap();
611 setColor(); 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 }
@@ -752,121 +757,136 @@ void Konsole::colorMenuSelected(int iD)
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 );
@@ -950,24 +970,38 @@ void Konsole::changeForegroundColor(const QColor &color) {
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
@@ -60,48 +60,49 @@ private 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;