-rw-r--r-- | core/apps/embeddedkonsole/TEHistory.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEScreen.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/TEWidget.cpp | 4 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/commandeditdialog.cpp | 2 | ||||
-rw-r--r-- | core/apps/embeddedkonsole/konsole.cpp | 31 |
5 files changed, 21 insertions, 20 deletions
diff --git a/core/apps/embeddedkonsole/TEHistory.cpp b/core/apps/embeddedkonsole/TEHistory.cpp index 504cd13..2417af1 100644 --- a/core/apps/embeddedkonsole/TEHistory.cpp +++ b/core/apps/embeddedkonsole/TEHistory.cpp | |||
@@ -45,97 +45,97 @@ | |||
45 | */ | 45 | */ |
46 | 46 | ||
47 | 47 | ||
48 | HistoryScroll::HistoryScroll() | 48 | HistoryScroll::HistoryScroll() |
49 | { | 49 | { |
50 | m_lines = NULL; | 50 | m_lines = NULL; |
51 | m_max_lines = 0; | 51 | m_max_lines = 0; |
52 | m_cells = NULL; | 52 | m_cells = NULL; |
53 | m_max_cells = 0; | 53 | m_max_cells = 0; |
54 | m_num_lines = 0; | 54 | m_num_lines = 0; |
55 | m_first_line = 0; | 55 | m_first_line = 0; |
56 | m_last_cell = 0; | 56 | m_last_cell = 0; |
57 | m_start_line = 0; | 57 | m_start_line = 0; |
58 | } | 58 | } |
59 | 59 | ||
60 | HistoryScroll::~HistoryScroll() | 60 | HistoryScroll::~HistoryScroll() |
61 | { | 61 | { |
62 | setSize(0,0); | 62 | setSize(0,0); |
63 | } | 63 | } |
64 | 64 | ||
65 | void HistoryScroll::setSize(int lines, int cells) | 65 | void HistoryScroll::setSize(int lines, int cells) |
66 | { | 66 | { |
67 | // could try to preserve the existing data... | 67 | // could try to preserve the existing data... |
68 | // printf("setSize(%d,%d)\n", lines, cells); | 68 | // printf("setSize(%d,%d)\n", lines, cells); |
69 | if (m_lines) { | 69 | if (m_lines) { |
70 | delete m_lines; | 70 | delete m_lines; |
71 | m_lines = NULL; | 71 | m_lines = NULL; |
72 | } | 72 | } |
73 | if (m_cells) { | 73 | if (m_cells) { |
74 | delete m_cells; | 74 | delete m_cells; |
75 | m_cells = NULL; | 75 | m_cells = NULL; |
76 | } | 76 | } |
77 | m_max_lines = m_max_cells = 0; | 77 | m_max_lines = m_max_cells = 0; |
78 | if (lines > 0 && cells > 0) { | 78 | if (lines > 0 && cells > 0) { |
79 | m_max_lines = lines; | 79 | m_max_lines = lines; |
80 | m_lines = new int[m_max_lines]; | 80 | m_lines = new int[m_max_lines]; |
81 | m_lines[0] = 0; | 81 | m_lines[0] = 0; |
82 | m_max_cells = cells; | 82 | m_max_cells = cells; |
83 | m_cells = new ca[m_max_cells]; | 83 | m_cells = new ca[m_max_cells]; |
84 | } | 84 | } |
85 | m_first_line = 0; | 85 | m_first_line = 0; |
86 | m_num_lines = 0; | 86 | m_num_lines = 0; |
87 | m_last_cell = 0; | 87 | m_last_cell = 0; |
88 | m_start_line = 0; | 88 | m_start_line = 0; |
89 | } | 89 | } |
90 | 90 | ||
91 | void HistoryScroll::setScroll(bool on) | 91 | void HistoryScroll::setScroll(bool on) |
92 | { | 92 | { |
93 | Config cfg("Qkonsole"); | 93 | Config cfg( "Konsole" ); |
94 | cfg.setGroup("History"); | 94 | cfg.setGroup("History"); |
95 | // printf("setScroll(%d)\n", on); | 95 | // printf("setScroll(%d)\n", on); |
96 | if (on) { | 96 | if (on) { |
97 | int lines = cfg.readNumEntry("history_lines",300); | 97 | int lines = cfg.readNumEntry("history_lines",300); |
98 | int avg_line = cfg.readNumEntry("avg_line_length",60); | 98 | int avg_line = cfg.readNumEntry("avg_line_length",60); |
99 | int cells = lines * avg_line; | 99 | int cells = lines * avg_line; |
100 | setSize(lines,cells); | 100 | setSize(lines,cells); |
101 | } else { | 101 | } else { |
102 | setSize(0,0); | 102 | setSize(0,0); |
103 | } | 103 | } |
104 | } | 104 | } |
105 | 105 | ||
106 | bool HistoryScroll::hasScroll() | 106 | bool HistoryScroll::hasScroll() |
107 | { | 107 | { |
108 | return (m_max_lines > 0); | 108 | return (m_max_lines > 0); |
109 | } | 109 | } |
110 | 110 | ||
111 | int HistoryScroll::getLines() | 111 | int HistoryScroll::getLines() |
112 | { | 112 | { |
113 | return(m_num_lines); | 113 | return(m_num_lines); |
114 | } | 114 | } |
115 | 115 | ||
116 | int HistoryScroll::getLineLen(int lineno) | 116 | int HistoryScroll::getLineLen(int lineno) |
117 | { | 117 | { |
118 | if (!hasScroll()) return 0; | 118 | if (!hasScroll()) return 0; |
119 | if (lineno >= m_num_lines) { | 119 | if (lineno >= m_num_lines) { |
120 | // printf("getLineLen(%d) out of range %d\n", lineno, m_num_lines); | 120 | // printf("getLineLen(%d) out of range %d\n", lineno, m_num_lines); |
121 | return(0); | 121 | return(0); |
122 | } | 122 | } |
123 | int len = startOfLine(lineno+1) - startOfLine(lineno); | 123 | int len = startOfLine(lineno+1) - startOfLine(lineno); |
124 | if (len < 0) { | 124 | if (len < 0) { |
125 | len += m_max_cells; | 125 | len += m_max_cells; |
126 | } | 126 | } |
127 | // printf("getLineLen(%d) = %d\n", lineno, len); | 127 | // printf("getLineLen(%d) = %d\n", lineno, len); |
128 | return(len); | 128 | return(len); |
129 | } | 129 | } |
130 | 130 | ||
131 | int HistoryScroll::startOfLine(int lineno) | 131 | int HistoryScroll::startOfLine(int lineno) |
132 | { | 132 | { |
133 | // printf("startOfLine(%d) =", lineno); | 133 | // printf("startOfLine(%d) =", lineno); |
134 | if (!hasScroll()) return 0; | 134 | if (!hasScroll()) return 0; |
135 | assert(lineno >= 0 && lineno <= m_num_lines); | 135 | assert(lineno >= 0 && lineno <= m_num_lines); |
136 | if (lineno < m_num_lines) { | 136 | if (lineno < m_num_lines) { |
137 | int index = lineno + m_first_line; | 137 | int index = lineno + m_first_line; |
138 | if (index >= m_max_lines) | 138 | if (index >= m_max_lines) |
139 | index -= m_max_lines; | 139 | index -= m_max_lines; |
140 | // printf("%d\n", m_lines[index]); | 140 | // printf("%d\n", m_lines[index]); |
141 | return(m_lines[index]); | 141 | return(m_lines[index]); |
diff --git a/core/apps/embeddedkonsole/TEScreen.cpp b/core/apps/embeddedkonsole/TEScreen.cpp index 4ebc28e..3dbcec2 100644 --- a/core/apps/embeddedkonsole/TEScreen.cpp +++ b/core/apps/embeddedkonsole/TEScreen.cpp | |||
@@ -517,97 +517,97 @@ ca* TEScreen::getCookedImage() | |||
517 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) | 517 | for (y = 0; (y < lines) && (y < (hist.getLines()-histCursor)); y++) |
518 | { | 518 | { |
519 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); | 519 | int len = QMIN(columns,hist.getLineLen(y+histCursor)); |
520 | int yp = y*columns; | 520 | int yp = y*columns; |
521 | int yq = (y+histCursor)*columns; | 521 | int yq = (y+histCursor)*columns; |
522 | 522 | ||
523 | hist.getCells(y+histCursor,0,len,merged+yp); | 523 | hist.getCells(y+histCursor,0,len,merged+yp); |
524 | for (x = len; x < columns; x++) merged[yp+x] = dft; | 524 | for (x = len; x < columns; x++) merged[yp+x] = dft; |
525 | for (x = 0; x < columns; x++) | 525 | for (x = 0; x < columns; x++) |
526 | { int p=x + yp; int q=x + yq; | 526 | { int p=x + yp; int q=x + yq; |
527 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) | 527 | if ( ( q >= sel_TL ) && ( q <= sel_BR ) ) |
528 | reverseRendition(&merged[p]); // for selection | 528 | reverseRendition(&merged[p]); // for selection |
529 | } | 529 | } |
530 | } | 530 | } |
531 | if (lines >= hist.getLines()-histCursor) | 531 | if (lines >= hist.getLines()-histCursor) |
532 | { | 532 | { |
533 | for (y = (hist.getLines()-histCursor); y < lines ; y++) | 533 | for (y = (hist.getLines()-histCursor); y < lines ; y++) |
534 | { | 534 | { |
535 | int yp = y*columns; | 535 | int yp = y*columns; |
536 | int yq = (y+histCursor)*columns; | 536 | int yq = (y+histCursor)*columns; |
537 | int yr = (y-hist.getLines()+histCursor)*columns; | 537 | int yr = (y-hist.getLines()+histCursor)*columns; |
538 | for (x = 0; x < columns; x++) | 538 | for (x = 0; x < columns; x++) |
539 | { int p = x + yp; int q = x + yq; int r = x + yr; | 539 | { int p = x + yp; int q = x + yq; int r = x + yr; |
540 | merged[p] = image[r]; | 540 | merged[p] = image[r]; |
541 | if ( q >= sel_TL && q <= sel_BR ) | 541 | if ( q >= sel_TL && q <= sel_BR ) |
542 | reverseRendition(&merged[p]); // for selection | 542 | reverseRendition(&merged[p]); // for selection |
543 | } | 543 | } |
544 | 544 | ||
545 | } | 545 | } |
546 | } | 546 | } |
547 | // evtl. inverse display | 547 | // evtl. inverse display |
548 | if (getMode(MODE_Screen)) | 548 | if (getMode(MODE_Screen)) |
549 | { int i,n = lines*columns; | 549 | { int i,n = lines*columns; |
550 | for (i = 0; i < n; i++) | 550 | for (i = 0; i < n; i++) |
551 | reverseRendition(&merged[i]); // for reverse display | 551 | reverseRendition(&merged[i]); // for reverse display |
552 | } | 552 | } |
553 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible | 553 | if (getMode(MODE_Cursor) && (cuY+(hist.getLines()-histCursor) < lines)) // cursor visible |
554 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); | 554 | reverseRendition(&merged[loc(cuX,cuY+(hist.getLines()-histCursor))]); |
555 | return merged; | 555 | return merged; |
556 | 556 | ||
557 | } | 557 | } |
558 | 558 | ||
559 | 559 | ||
560 | /*! | 560 | /*! |
561 | */ | 561 | */ |
562 | 562 | ||
563 | void TEScreen::reset() | 563 | void TEScreen::reset() |
564 | { | 564 | { |
565 | Config cfg("Qkonsole"); | 565 | Config cfg( "Konsole" ); |
566 | cfg.setGroup("ScrollBar"); | 566 | cfg.setGroup("ScrollBar"); |
567 | if( !cfg.readBoolEntry("HorzScroll",0) ) | 567 | if( !cfg.readBoolEntry("HorzScroll",0) ) |
568 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin | 568 | setMode(MODE_Wrap ); saveMode(MODE_Wrap ); // wrap at end of margin |
569 | 569 | ||
570 | 570 | ||
571 | resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] | 571 | resetMode(MODE_Origin); saveMode(MODE_Origin); // position refere to [1,1] |
572 | resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke | 572 | resetMode(MODE_Insert); saveMode(MODE_Insert); // overstroke |
573 | setMode(MODE_Cursor); // cursor visible | 573 | setMode(MODE_Cursor); // cursor visible |
574 | resetMode(MODE_Screen); // screen not inverse | 574 | resetMode(MODE_Screen); // screen not inverse |
575 | resetMode(MODE_NewLine); | 575 | resetMode(MODE_NewLine); |
576 | 576 | ||
577 | tmargin=0; | 577 | tmargin=0; |
578 | bmargin=lines-1; | 578 | bmargin=lines-1; |
579 | 579 | ||
580 | setDefaultRendition(); | 580 | setDefaultRendition(); |
581 | saveCursor(); | 581 | saveCursor(); |
582 | 582 | ||
583 | clear(); | 583 | clear(); |
584 | } | 584 | } |
585 | 585 | ||
586 | /*! Clear the entire screen and home the cursor. | 586 | /*! Clear the entire screen and home the cursor. |
587 | */ | 587 | */ |
588 | 588 | ||
589 | void TEScreen::clear() | 589 | void TEScreen::clear() |
590 | { | 590 | { |
591 | clearEntireScreen(); | 591 | clearEntireScreen(); |
592 | home(); | 592 | home(); |
593 | } | 593 | } |
594 | 594 | ||
595 | /*! Moves the cursor left one column. | 595 | /*! Moves the cursor left one column. |
596 | */ | 596 | */ |
597 | 597 | ||
598 | void TEScreen::BackSpace() | 598 | void TEScreen::BackSpace() |
599 | { | 599 | { |
600 | cuX = QMAX(0,cuX-1); | 600 | cuX = QMAX(0,cuX-1); |
601 | if (BS_CLEARS) image[loc(cuX,cuY)].c = ' '; | 601 | if (BS_CLEARS) image[loc(cuX,cuY)].c = ' '; |
602 | } | 602 | } |
603 | 603 | ||
604 | /*! | 604 | /*! |
605 | */ | 605 | */ |
606 | 606 | ||
607 | void TEScreen::Tabulate() | 607 | void TEScreen::Tabulate() |
608 | { | 608 | { |
609 | // note that TAB is a format effector (does not write ' '); | 609 | // note that TAB is a format effector (does not write ' '); |
610 | cursorRight(1); while(cuX < columns-1 && !tabstops[cuX]) cursorRight(1); | 610 | cursorRight(1); while(cuX < columns-1 && !tabstops[cuX]) cursorRight(1); |
611 | } | 611 | } |
612 | 612 | ||
613 | void TEScreen::clearTabStops() | 613 | void TEScreen::clearTabStops() |
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp index 98c3cdf..2e3e0f5 100644 --- a/core/apps/embeddedkonsole/TEWidget.cpp +++ b/core/apps/embeddedkonsole/TEWidget.cpp | |||
@@ -261,97 +261,97 @@ void TEWidget::fontChange(const QFont &) | |||
261 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") | 261 | strcmp(QFont::encodingName(font().charSet()).ascii(),"iso10646") |
262 | ? vt100extended | 262 | ? vt100extended |
263 | : | 263 | : |
264 | #endif | 264 | #endif |
265 | identicalMap; | 265 | identicalMap; |
266 | propagateSize(); | 266 | propagateSize(); |
267 | update(); | 267 | update(); |
268 | } | 268 | } |
269 | 269 | ||
270 | void TEWidget::setVTFont(const QFont& f) | 270 | void TEWidget::setVTFont(const QFont& f) |
271 | { | 271 | { |
272 | QFrame::setFont(f); | 272 | QFrame::setFont(f); |
273 | } | 273 | } |
274 | 274 | ||
275 | QFont TEWidget::getVTFont() { | 275 | QFont TEWidget::getVTFont() { |
276 | return font(); | 276 | return font(); |
277 | } | 277 | } |
278 | 278 | ||
279 | void TEWidget::setFont(const QFont &) | 279 | void TEWidget::setFont(const QFont &) |
280 | { | 280 | { |
281 | // ignore font change request if not coming from konsole itself | 281 | // ignore font change request if not coming from konsole itself |
282 | } | 282 | } |
283 | 283 | ||
284 | /* ------------------------------------------------------------------------- */ | 284 | /* ------------------------------------------------------------------------- */ |
285 | /* */ | 285 | /* */ |
286 | /* Constructor / Destructor */ | 286 | /* Constructor / Destructor */ |
287 | /* */ | 287 | /* */ |
288 | /* ------------------------------------------------------------------------- */ | 288 | /* ------------------------------------------------------------------------- */ |
289 | 289 | ||
290 | TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) | 290 | TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) |
291 | { | 291 | { |
292 | #ifndef QT_NO_CLIPBOARD | 292 | #ifndef QT_NO_CLIPBOARD |
293 | cb = QApplication::clipboard(); | 293 | cb = QApplication::clipboard(); |
294 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), | 294 | QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), |
295 | this, SLOT(onClearSelection()) ); | 295 | this, SLOT(onClearSelection()) ); |
296 | #endif | 296 | #endif |
297 | 297 | ||
298 | scrollbar = new QScrollBar(this); | 298 | scrollbar = new QScrollBar(this); |
299 | scrollbar->setCursor( arrowCursor ); | 299 | scrollbar->setCursor( arrowCursor ); |
300 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); | 300 | connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); |
301 | 301 | ||
302 | hScrollbar = new QScrollBar(this); | 302 | hScrollbar = new QScrollBar(this); |
303 | hScrollbar->setCursor( arrowCursor ); | 303 | hScrollbar->setCursor( arrowCursor ); |
304 | hScrollbar->setOrientation(QScrollBar::Horizontal); | 304 | hScrollbar->setOrientation(QScrollBar::Horizontal); |
305 | // hScrollbar->setMaximumHeight(16); | 305 | // hScrollbar->setMaximumHeight(16); |
306 | 306 | ||
307 | connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int))); | 307 | connect( hScrollbar, SIGNAL(valueChanged(int)), this, SLOT( hScrollChanged(int))); |
308 | 308 | ||
309 | Config cfg("Qkonsole"); | 309 | Config cfg( "Konsole" ); |
310 | cfg.setGroup("ScrollBar"); | 310 | cfg.setGroup("ScrollBar"); |
311 | switch( cfg.readNumEntry("Position",2)){ | 311 | switch( cfg.readNumEntry("Position",2)){ |
312 | case 0: | 312 | case 0: |
313 | scrollLoc = SCRNONE; | 313 | scrollLoc = SCRNONE; |
314 | break; | 314 | break; |
315 | case 1: | 315 | case 1: |
316 | scrollLoc = SCRLEFT; | 316 | scrollLoc = SCRLEFT; |
317 | break; | 317 | break; |
318 | case 2: | 318 | case 2: |
319 | scrollLoc = SCRRIGHT; | 319 | scrollLoc = SCRRIGHT; |
320 | break; | 320 | break; |
321 | }; | 321 | }; |
322 | 322 | ||
323 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); | 323 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); |
324 | 324 | ||
325 | blinkT = new QTimer(this); | 325 | blinkT = new QTimer(this); |
326 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); | 326 | connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); |
327 | // blinking = FALSE; | 327 | // blinking = FALSE; |
328 | blinking = TRUE; | 328 | blinking = TRUE; |
329 | 329 | ||
330 | resizing = FALSE; | 330 | resizing = FALSE; |
331 | actSel = 0; | 331 | actSel = 0; |
332 | image = 0; | 332 | image = 0; |
333 | lines = 1; | 333 | lines = 1; |
334 | columns = 1; | 334 | columns = 1; |
335 | font_w = 1; | 335 | font_w = 1; |
336 | font_h = 1; | 336 | font_h = 1; |
337 | font_a = 1; | 337 | font_a = 1; |
338 | word_selection_mode = FALSE; | 338 | word_selection_mode = FALSE; |
339 | hposition = 0; | 339 | hposition = 0; |
340 | vcolumns = 0; | 340 | vcolumns = 0; |
341 | useBeep = true; | 341 | useBeep = true; |
342 | 342 | ||
343 | setMouseMarks(TRUE); | 343 | setMouseMarks(TRUE); |
344 | setVTFont( QFont("fixed") ); | 344 | setVTFont( QFont("fixed") ); |
345 | setColorTable(base_color_table); // init color table | 345 | setColorTable(base_color_table); // init color table |
346 | 346 | ||
347 | qApp->installEventFilter( this ); //FIXME: see below | 347 | qApp->installEventFilter( this ); //FIXME: see below |
348 | // KCursor::setAutoHideCursor( this, true ); | 348 | // KCursor::setAutoHideCursor( this, true ); |
349 | 349 | ||
350 | // Init DnD //////////////////////////////////////////////////////////////// | 350 | // Init DnD //////////////////////////////////////////////////////////////// |
351 | currentSession = NULL; | 351 | currentSession = NULL; |
352 | // setAcceptDrops(true); // attempt | 352 | // setAcceptDrops(true); // attempt |
353 | // m_drop = new QPopupMenu(this); | 353 | // m_drop = new QPopupMenu(this); |
354 | // m_drop->insertItem( QString("Paste"), 0); | 354 | // m_drop->insertItem( QString("Paste"), 0); |
355 | // m_drop->insertItem( QString("cd"), 1); | 355 | // m_drop->insertItem( QString("cd"), 1); |
356 | // connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); | 356 | // connect(m_drop, SIGNAL(activated(int)), SLOT(drop_menu_activated(int))); |
357 | 357 | ||
@@ -1182,97 +1182,97 @@ void TEWidget::frameChanged() | |||
1182 | /* Sound */ | 1182 | /* Sound */ |
1183 | /* */ | 1183 | /* */ |
1184 | /* ------------------------------------------------------------------------- */ | 1184 | /* ------------------------------------------------------------------------- */ |
1185 | 1185 | ||
1186 | void TEWidget::Bell() | 1186 | void TEWidget::Bell() |
1187 | { | 1187 | { |
1188 | //#ifdef QT_QWS_SL5XXX | 1188 | //#ifdef QT_QWS_SL5XXX |
1189 | //# ifndef QT_NO_COP | 1189 | //# ifndef QT_NO_COP |
1190 | if(useBeep) | 1190 | if(useBeep) |
1191 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); | 1191 | QCopEnvelope( "QPE/TaskBar", "soundAlarm()" ); |
1192 | 1192 | ||
1193 | //# endif | 1193 | //# endif |
1194 | //#else | 1194 | //#else |
1195 | //# ifndef QT_NO_SOUND | 1195 | //# ifndef QT_NO_SOUND |
1196 | // QSound::play(Resource::findSound("alarm")); | 1196 | // QSound::play(Resource::findSound("alarm")); |
1197 | //# endif | 1197 | //# endif |
1198 | //#endif | 1198 | //#endif |
1199 | 1199 | ||
1200 | // QApplication::beep(); | 1200 | // QApplication::beep(); |
1201 | } | 1201 | } |
1202 | 1202 | ||
1203 | /* ------------------------------------------------------------------------- */ | 1203 | /* ------------------------------------------------------------------------- */ |
1204 | /* */ | 1204 | /* */ |
1205 | /* Auxiluary */ | 1205 | /* Auxiluary */ |
1206 | /* */ | 1206 | /* */ |
1207 | /* ------------------------------------------------------------------------- */ | 1207 | /* ------------------------------------------------------------------------- */ |
1208 | 1208 | ||
1209 | void TEWidget::clearImage() | 1209 | void TEWidget::clearImage() |
1210 | // initialize the image | 1210 | // initialize the image |
1211 | // for internal use only | 1211 | // for internal use only |
1212 | { | 1212 | { |
1213 | for (int y = 0; y < lines; y++) | 1213 | for (int y = 0; y < lines; y++) |
1214 | for (int x = 0; x < columns; x++) | 1214 | for (int x = 0; x < columns; x++) |
1215 | { | 1215 | { |
1216 | image[loc(x,y)].c = 0xff; //' '; | 1216 | image[loc(x,y)].c = 0xff; //' '; |
1217 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; | 1217 | image[loc(x,y)].f = 0xff; //DEFAULT_FORE_COLOR; |
1218 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; | 1218 | image[loc(x,y)].b = 0xff; //DEFAULT_BACK_COLOR; |
1219 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; | 1219 | image[loc(x,y)].r = 0xff; //DEFAULT_RENDITION; |
1220 | } | 1220 | } |
1221 | } | 1221 | } |
1222 | 1222 | ||
1223 | // Create Image /////////////////////////////////////////////////////// | 1223 | // Create Image /////////////////////////////////////////////////////// |
1224 | 1224 | ||
1225 | void TEWidget::calcGeometry() | 1225 | void TEWidget::calcGeometry() |
1226 | { | 1226 | { |
1227 | int showhscrollbar = 1; | 1227 | int showhscrollbar = 1; |
1228 | int hwidth = 0; | 1228 | int hwidth = 0; |
1229 | int dcolumns; | 1229 | int dcolumns; |
1230 | Config cfg("Qkonsole"); | 1230 | Config cfg( "Konsole" ); |
1231 | cfg.setGroup("ScrollBar"); | 1231 | cfg.setGroup("ScrollBar"); |
1232 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); | 1232 | useHorzScroll=cfg.readBoolEntry("HorzScroll",0); |
1233 | 1233 | ||
1234 | if(vcolumns == 0) showhscrollbar = 0; | 1234 | if(vcolumns == 0) showhscrollbar = 0; |
1235 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); | 1235 | if(showhscrollbar == 1) hwidth = QApplication::style().scrollBarExtent().width(); |
1236 | 1236 | ||
1237 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), | 1237 | scrollbar->resize(QApplication::style().scrollBarExtent().width(), |
1238 | contentsRect().height() - hwidth); | 1238 | contentsRect().height() - hwidth); |
1239 | 1239 | ||
1240 | switch(scrollLoc) { | 1240 | switch(scrollLoc) { |
1241 | case SCRNONE : | 1241 | case SCRNONE : |
1242 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; | 1242 | columns = ( contentsRect().width() - 2 * rimX ) / font_w; |
1243 | dcolumns = columns; | 1243 | dcolumns = columns; |
1244 | if(vcolumns) columns = vcolumns; | 1244 | if(vcolumns) columns = vcolumns; |
1245 | blX = (contentsRect().width() - (columns*font_w) ) / 2; | 1245 | blX = (contentsRect().width() - (columns*font_w) ) / 2; |
1246 | if(showhscrollbar) | 1246 | if(showhscrollbar) |
1247 | blX = -hposition * font_w; | 1247 | blX = -hposition * font_w; |
1248 | brX = blX; | 1248 | brX = blX; |
1249 | scrollbar->hide(); | 1249 | scrollbar->hide(); |
1250 | break; | 1250 | break; |
1251 | case SCRLEFT : | 1251 | case SCRLEFT : |
1252 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1252 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1253 | dcolumns = columns; | 1253 | dcolumns = columns; |
1254 | if(vcolumns) columns = vcolumns; | 1254 | if(vcolumns) columns = vcolumns; |
1255 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1255 | brX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1256 | if(showhscrollbar) | 1256 | if(showhscrollbar) |
1257 | brX = -hposition * font_w; | 1257 | brX = -hposition * font_w; |
1258 | blX = brX + scrollbar->width(); | 1258 | blX = brX + scrollbar->width(); |
1259 | scrollbar->move(contentsRect().topLeft()); | 1259 | scrollbar->move(contentsRect().topLeft()); |
1260 | scrollbar->show(); | 1260 | scrollbar->show(); |
1261 | break; | 1261 | break; |
1262 | case SCRRIGHT: | 1262 | case SCRRIGHT: |
1263 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; | 1263 | columns = ( contentsRect().width() - 2 * rimX - scrollbar->width()) / font_w; |
1264 | dcolumns = columns; | 1264 | dcolumns = columns; |
1265 | if(vcolumns) columns = vcolumns; | 1265 | if(vcolumns) columns = vcolumns; |
1266 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; | 1266 | blX = (contentsRect().width() - (columns*font_w) - scrollbar->width() ) / 2; |
1267 | if(showhscrollbar) | 1267 | if(showhscrollbar) |
1268 | blX = -hposition * font_w; | 1268 | blX = -hposition * font_w; |
1269 | brX = blX; | 1269 | brX = blX; |
1270 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); | 1270 | scrollbar->move(contentsRect().topRight() - QPoint(scrollbar->width()-1,0)); |
1271 | scrollbar->show(); | 1271 | scrollbar->show(); |
1272 | break; | 1272 | break; |
1273 | } | 1273 | } |
1274 | //FIXME: support 'rounding' styles | 1274 | //FIXME: support 'rounding' styles |
1275 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; | 1275 | lines = ( contentsRect().height() - 2 * rimY ) / font_h; |
1276 | bY = (contentsRect().height() - (lines *font_h)) / 2; | 1276 | bY = (contentsRect().height() - (lines *font_h)) / 2; |
1277 | 1277 | ||
1278 | if(showhscrollbar == 1) { | 1278 | if(showhscrollbar == 1) { |
diff --git a/core/apps/embeddedkonsole/commandeditdialog.cpp b/core/apps/embeddedkonsole/commandeditdialog.cpp index 03cba87..b23db18 100644 --- a/core/apps/embeddedkonsole/commandeditdialog.cpp +++ b/core/apps/embeddedkonsole/commandeditdialog.cpp | |||
@@ -57,97 +57,97 @@ CommandEditDialog::CommandEditDialog(QWidget *parent, const char* name, WFlags f | |||
57 | item = new QListViewItem( m_SuggestedCommandList,"route "); | 57 | item = new QListViewItem( m_SuggestedCommandList,"route "); |
58 | item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); | 58 | item = new QListViewItem( m_SuggestedCommandList,"cardctl eject "); |
59 | m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); | 59 | m_SuggestedCommandList->setSelected(m_SuggestedCommandList->firstChild(),TRUE); |
60 | m_SuggestedCommandList->sort(); | 60 | m_SuggestedCommandList->sort(); |
61 | 61 | ||
62 | connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); | 62 | connect( m_SuggestedCommandList, SIGNAL( clicked( QListViewItem * ) ), m_PlayListSelection, SLOT( addToSelection( QListViewItem *) ) ); |
63 | 63 | ||
64 | 64 | ||
65 | 65 | ||
66 | ToolButton1->setTextLabel("new"); | 66 | ToolButton1->setTextLabel("new"); |
67 | ToolButton1->setPixmap(Resource::loadPixmap("new")); | 67 | ToolButton1->setPixmap(Resource::loadPixmap("new")); |
68 | ToolButton1->setAutoRaise(TRUE); | 68 | ToolButton1->setAutoRaise(TRUE); |
69 | ToolButton1->setFocusPolicy(QWidget::NoFocus); | 69 | ToolButton1->setFocusPolicy(QWidget::NoFocus); |
70 | connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); | 70 | connect(ToolButton1,SIGNAL(clicked()),this,SLOT(showAddDialog())); |
71 | 71 | ||
72 | ToolButton2->setTextLabel("edit"); | 72 | ToolButton2->setTextLabel("edit"); |
73 | ToolButton2->setPixmap(Resource::loadPixmap("edit")); | 73 | ToolButton2->setPixmap(Resource::loadPixmap("edit")); |
74 | ToolButton2->setAutoRaise(TRUE); | 74 | ToolButton2->setAutoRaise(TRUE); |
75 | ToolButton2->setFocusPolicy(QWidget::NoFocus); | 75 | ToolButton2->setFocusPolicy(QWidget::NoFocus); |
76 | connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); | 76 | connect(ToolButton2,SIGNAL(clicked()),this,SLOT(showEditDialog())); |
77 | 77 | ||
78 | ToolButton3->setTextLabel("delete"); | 78 | ToolButton3->setTextLabel("delete"); |
79 | ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); | 79 | ToolButton3->setPixmap(Resource::loadPixmap("editdelete")); |
80 | ToolButton3->setAutoRaise(TRUE); | 80 | ToolButton3->setAutoRaise(TRUE); |
81 | ToolButton3->setFocusPolicy(QWidget::NoFocus); | 81 | ToolButton3->setFocusPolicy(QWidget::NoFocus); |
82 | connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); | 82 | connect(ToolButton3,SIGNAL(clicked()),m_PlayListSelection,SLOT(removeSelected())); |
83 | 83 | ||
84 | ToolButton4->setTextLabel("up"); | 84 | ToolButton4->setTextLabel("up"); |
85 | ToolButton4->setPixmap(Resource::loadPixmap("up")); | 85 | ToolButton4->setPixmap(Resource::loadPixmap("up")); |
86 | ToolButton4->setAutoRaise(TRUE); | 86 | ToolButton4->setAutoRaise(TRUE); |
87 | ToolButton4->setFocusPolicy(QWidget::NoFocus); | 87 | ToolButton4->setFocusPolicy(QWidget::NoFocus); |
88 | connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); | 88 | connect(ToolButton4,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedUp())); |
89 | 89 | ||
90 | ToolButton5->setTextLabel("down"); | 90 | ToolButton5->setTextLabel("down"); |
91 | ToolButton5->setPixmap(Resource::loadPixmap("down")); | 91 | ToolButton5->setPixmap(Resource::loadPixmap("down")); |
92 | ToolButton5->setAutoRaise(TRUE); | 92 | ToolButton5->setAutoRaise(TRUE); |
93 | ToolButton5->setFocusPolicy(QWidget::NoFocus); | 93 | ToolButton5->setFocusPolicy(QWidget::NoFocus); |
94 | 94 | ||
95 | connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); | 95 | connect(ToolButton5,SIGNAL(clicked()),m_PlayListSelection,SLOT(moveSelectedDown())); |
96 | 96 | ||
97 | 97 | ||
98 | 98 | ||
99 | 99 | ||
100 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); | 100 | QListViewItem *current = m_SuggestedCommandList->selectedItem(); |
101 | if ( current ) | 101 | if ( current ) |
102 | item->moveItem( current ); | 102 | item->moveItem( current ); |
103 | m_SuggestedCommandList->setSelected( item, TRUE ); | 103 | m_SuggestedCommandList->setSelected( item, TRUE ); |
104 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); | 104 | m_SuggestedCommandList->ensureItemVisible( m_SuggestedCommandList->selectedItem() ); |
105 | Config cfg("Qkonsole"); | 105 | Config cfg( "Konsole" ); |
106 | cfg.setGroup("Commands"); | 106 | cfg.setGroup("Commands"); |
107 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { | 107 | if (cfg.readEntry("Commands Set","FALSE") == "TRUE") { |
108 | for (int i = 0; i < 100; i++) { | 108 | for (int i = 0; i < 100; i++) { |
109 | QString tmp; | 109 | QString tmp; |
110 | tmp = cfg.readEntry( QString::number(i),""); | 110 | tmp = cfg.readEntry( QString::number(i),""); |
111 | if (!tmp.isEmpty()) | 111 | if (!tmp.isEmpty()) |
112 | m_PlayListSelection->addStringToSelection(tmp); | 112 | m_PlayListSelection->addStringToSelection(tmp); |
113 | } | 113 | } |
114 | } else { | 114 | } else { |
115 | 115 | ||
116 | m_PlayListSelection->addStringToSelection("ls "); | 116 | m_PlayListSelection->addStringToSelection("ls "); |
117 | m_PlayListSelection->addStringToSelection("cardctl eject"); | 117 | m_PlayListSelection->addStringToSelection("cardctl eject"); |
118 | m_PlayListSelection->addStringToSelection("cat "); | 118 | m_PlayListSelection->addStringToSelection("cat "); |
119 | m_PlayListSelection->addStringToSelection("cd "); | 119 | m_PlayListSelection->addStringToSelection("cd "); |
120 | m_PlayListSelection->addStringToSelection("chmod "); | 120 | m_PlayListSelection->addStringToSelection("chmod "); |
121 | m_PlayListSelection->addStringToSelection("cp "); | 121 | m_PlayListSelection->addStringToSelection("cp "); |
122 | m_PlayListSelection->addStringToSelection("dc "); | 122 | m_PlayListSelection->addStringToSelection("dc "); |
123 | m_PlayListSelection->addStringToSelection("df "); | 123 | m_PlayListSelection->addStringToSelection("df "); |
124 | m_PlayListSelection->addStringToSelection("dmesg"); | 124 | m_PlayListSelection->addStringToSelection("dmesg"); |
125 | m_PlayListSelection->addStringToSelection("echo "); | 125 | m_PlayListSelection->addStringToSelection("echo "); |
126 | m_PlayListSelection->addStringToSelection("env"); | 126 | m_PlayListSelection->addStringToSelection("env"); |
127 | m_PlayListSelection->addStringToSelection("find "); | 127 | m_PlayListSelection->addStringToSelection("find "); |
128 | m_PlayListSelection->addStringToSelection("free"); | 128 | m_PlayListSelection->addStringToSelection("free"); |
129 | m_PlayListSelection->addStringToSelection("grep "); | 129 | m_PlayListSelection->addStringToSelection("grep "); |
130 | m_PlayListSelection->addStringToSelection("ifconfig "); | 130 | m_PlayListSelection->addStringToSelection("ifconfig "); |
131 | m_PlayListSelection->addStringToSelection("ipkg "); | 131 | m_PlayListSelection->addStringToSelection("ipkg "); |
132 | m_PlayListSelection->addStringToSelection("mkdir "); | 132 | m_PlayListSelection->addStringToSelection("mkdir "); |
133 | m_PlayListSelection->addStringToSelection("mv "); | 133 | m_PlayListSelection->addStringToSelection("mv "); |
134 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); | 134 | m_PlayListSelection->addStringToSelection("nc localhost 7776"); |
135 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); | 135 | m_PlayListSelection->addStringToSelection("nc localhost 7777"); |
136 | m_PlayListSelection->addStringToSelection("nslookup "); | 136 | m_PlayListSelection->addStringToSelection("nslookup "); |
137 | m_PlayListSelection->addStringToSelection("ping "); | 137 | m_PlayListSelection->addStringToSelection("ping "); |
138 | m_PlayListSelection->addStringToSelection("ps aux"); | 138 | m_PlayListSelection->addStringToSelection("ps aux"); |
139 | m_PlayListSelection->addStringToSelection("pwd "); | 139 | m_PlayListSelection->addStringToSelection("pwd "); |
140 | m_PlayListSelection->addStringToSelection("rm "); | 140 | m_PlayListSelection->addStringToSelection("rm "); |
141 | m_PlayListSelection->addStringToSelection("rmdir "); | 141 | m_PlayListSelection->addStringToSelection("rmdir "); |
142 | m_PlayListSelection->addStringToSelection("route "); | 142 | m_PlayListSelection->addStringToSelection("route "); |
143 | m_PlayListSelection->addStringToSelection("set "); | 143 | m_PlayListSelection->addStringToSelection("set "); |
144 | m_PlayListSelection->addStringToSelection("traceroute"); | 144 | m_PlayListSelection->addStringToSelection("traceroute"); |
145 | 145 | ||
146 | } | 146 | } |
147 | } | 147 | } |
148 | CommandEditDialog::~CommandEditDialog() | 148 | CommandEditDialog::~CommandEditDialog() |
149 | { | 149 | { |
150 | } | 150 | } |
151 | 151 | ||
152 | void CommandEditDialog::accept() | 152 | void CommandEditDialog::accept() |
153 | { | 153 | { |
diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index 46c0203..3289a04 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp | |||
@@ -1,70 +1,71 @@ | |||
1 | 1 | ||
2 | /* ---------------------------------------------------------------------- */ | 2 | /* ---------------------------------------------------------------------- */ |
3 | /* */ | 3 | /* */ |
4 | /* [main.C] Konsole */ | 4 | /* [main.C] Konsole */ |
5 | /* */ | 5 | /* */ |
6 | /* ---------------------------------------------------------------------- */ | 6 | /* ---------------------------------------------------------------------- */ |
7 | /* */ | 7 | /* */ |
8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ | 8 | /* Copyright (c) 1997,1998 by Lars Doelle <lars.doelle@on-line.de> */ |
9 | /* */ | 9 | /* */ |
10 | /* This file is part of Konsole, an X terminal. */ | 10 | /* This file is part of Konsole, an X terminal. */ |
11 | /* */ | 11 | /* */ |
12 | /* The material contained in here more or less directly orginates from */ | 12 | /* The material contained in here more or less directly orginates from */ |
13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ | 13 | /* kvt, which is copyright (c) 1996 by Matthias Ettrich <ettrich@kde.org> */ |
14 | /* */ | 14 | /* */ |
15 | /* ---------------------------------------------------------------------- */ | 15 | /* ---------------------------------------------------------------------- */ |
16 | /* */ | 16 | /* */ |
17 | /* Ported Konsole to Qt/Embedded */ | 17 | /* Ported Konsole to Qt/Embedded */ |
18 | /* */ | 18 | /* */ |
19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ | 19 | /* Copyright (C) 2000 by John Ryland <jryland@trolltech.com> */ |
20 | /* */ | 20 | /* */ |
21 | /* -------------------------------------------------------------------------- */ | 21 | /* -------------------------------------------------------------------------- */ |
22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> | 22 | // enhancements added by L.J. Potter <ljp@llornkcor.com> |
23 | // enhancements added by Phillip Kuhn | ||
23 | //#define QT_QWS_OPIE | 24 | //#define QT_QWS_OPIE |
24 | 25 | ||
25 | #include <stdlib.h> | 26 | #include <stdlib.h> |
26 | 27 | ||
27 | #ifdef QT_QWS_OPIE | 28 | #ifdef QT_QWS_OPIE |
28 | #include <opie2/ocolorpopupmenu.h> | 29 | #include <opie2/ocolorpopupmenu.h> |
29 | #endif | 30 | #endif |
30 | 31 | ||
31 | #include <qpe/resource.h> | 32 | #include <qpe/resource.h> |
32 | 33 | ||
33 | #include <qdir.h> | 34 | #include <qdir.h> |
34 | #include <qevent.h> | 35 | #include <qevent.h> |
35 | #include <qdragobject.h> | 36 | #include <qdragobject.h> |
36 | #include <qobjectlist.h> | 37 | #include <qobjectlist.h> |
37 | #include <qtoolbutton.h> | 38 | #include <qtoolbutton.h> |
38 | #include <qtoolbar.h> | 39 | #include <qtoolbar.h> |
39 | #include <qpushbutton.h> | 40 | #include <qpushbutton.h> |
40 | #include <qfontdialog.h> | 41 | #include <qfontdialog.h> |
41 | #include <qglobal.h> | 42 | #include <qglobal.h> |
42 | #include <qpainter.h> | 43 | #include <qpainter.h> |
43 | #include <qmenubar.h> | 44 | #include <qmenubar.h> |
44 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
45 | #include <qaction.h> | 46 | #include <qaction.h> |
46 | #include <qapplication.h> | 47 | #include <qapplication.h> |
47 | #include <qfontmetrics.h> | 48 | #include <qfontmetrics.h> |
48 | #include <qcombobox.h> | 49 | #include <qcombobox.h> |
49 | #include <qevent.h> | 50 | #include <qevent.h> |
50 | #include <qtabwidget.h> | 51 | #include <qtabwidget.h> |
51 | #include <qtabbar.h> | 52 | #include <qtabbar.h> |
52 | #include <qpe/config.h> | 53 | #include <qpe/config.h> |
53 | #include <qstringlist.h> | 54 | #include <qstringlist.h> |
54 | #include <qpalette.h> | 55 | #include <qpalette.h> |
55 | #include <qfontdatabase.h> | 56 | #include <qfontdatabase.h> |
56 | #include <qfile.h> | 57 | #include <qfile.h> |
57 | #include <qspinbox.h> | 58 | #include <qspinbox.h> |
58 | #include <qlayout.h> | 59 | #include <qlayout.h> |
59 | #include <qvbox.h> | 60 | #include <qvbox.h> |
60 | 61 | ||
61 | #include <sys/wait.h> | 62 | #include <sys/wait.h> |
62 | #include <stdio.h> | 63 | #include <stdio.h> |
63 | #include <stdlib.h> | 64 | #include <stdlib.h> |
64 | #include <assert.h> | 65 | #include <assert.h> |
65 | 66 | ||
66 | #include "konsole.h" | 67 | #include "konsole.h" |
67 | #include "keytrans.h" | 68 | #include "keytrans.h" |
68 | #include "commandeditdialog.h" | 69 | #include "commandeditdialog.h" |
69 | 70 | ||
70 | class EKNumTabBar : public QTabBar | 71 | class EKNumTabBar : public QTabBar |
@@ -216,97 +217,97 @@ static const char *commonCmds[] = | |||
216 | */ | 217 | */ |
217 | 218 | ||
218 | "exit", | 219 | "exit", |
219 | NULL | 220 | NULL |
220 | }; | 221 | }; |
221 | 222 | ||
222 | 223 | ||
223 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : | 224 | Konsole::Konsole(QWidget* parent, const char* name, WFlags fl) : |
224 | QMainWindow(parent, name, fl) | 225 | QMainWindow(parent, name, fl) |
225 | { | 226 | { |
226 | QStrList args; | 227 | QStrList args; |
227 | init("/bin/bash",args); | 228 | init("/bin/bash",args); |
228 | } | 229 | } |
229 | 230 | ||
230 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) | 231 | Konsole::Konsole(const char* name, const char* _pgm, QStrList & _args, int) |
231 | : QMainWindow(0, name) | 232 | : QMainWindow(0, name) |
232 | { | 233 | { |
233 | init(_pgm,_args); | 234 | init(_pgm,_args); |
234 | } | 235 | } |
235 | 236 | ||
236 | struct HistoryItem | 237 | struct HistoryItem |
237 | { | 238 | { |
238 | HistoryItem(int c, const QString &l) | 239 | HistoryItem(int c, const QString &l) |
239 | { | 240 | { |
240 | count = c; | 241 | count = c; |
241 | line = l; | 242 | line = l; |
242 | } | 243 | } |
243 | int count; | 244 | int count; |
244 | QString line; | 245 | QString line; |
245 | }; | 246 | }; |
246 | 247 | ||
247 | class HistoryList : public QList<HistoryItem> | 248 | class HistoryList : public QList<HistoryItem> |
248 | { | 249 | { |
249 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) | 250 | virtual int compareItems( QCollection::Item item1, QCollection::Item item2) |
250 | { | 251 | { |
251 | int c1 = ((HistoryItem*)item1)->count; | 252 | int c1 = ((HistoryItem*)item1)->count; |
252 | int c2 = ((HistoryItem*)item2)->count; | 253 | int c2 = ((HistoryItem*)item2)->count; |
253 | if (c1 > c2) | 254 | if (c1 > c2) |
254 | return(1); | 255 | return(1); |
255 | if (c1 < c2) | 256 | if (c1 < c2) |
256 | return(-1); | 257 | return(-1); |
257 | return(0); | 258 | return(0); |
258 | } | 259 | } |
259 | }; | 260 | }; |
260 | 261 | ||
261 | void Konsole::initCommandList() | 262 | void Konsole::initCommandList() |
262 | { | 263 | { |
263 | // qDebug("Konsole::initCommandList"); | 264 | // qDebug("Konsole::initCommandList"); |
264 | Config cfg("Qkonsole"); | 265 | Config cfg( "Konsole" ); |
265 | cfg.setGroup("Commands"); | 266 | cfg.setGroup("Commands"); |
266 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); | 267 | // commonCombo->setInsertionPolicy(QComboBox::AtCurrent); |
267 | commonCombo->clear(); | 268 | commonCombo->clear(); |
268 | 269 | ||
269 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") | 270 | if (cfg.readEntry("ShellHistory","TRUE") == "TRUE") |
270 | { | 271 | { |
271 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; | 272 | QString histfilename = QString(getenv("HOME")) + "/.bash_history"; |
272 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); | 273 | histfilename = cfg.readEntry("ShellHistoryPath",histfilename); |
273 | QFile histfile(histfilename); | 274 | QFile histfile(histfilename); |
274 | // note: compiler barfed on: | 275 | // note: compiler barfed on: |
275 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); | 276 | // QFile histfile(QString(getenv("HOME")) + "/.bash_history"); |
276 | if (histfile.open( IO_ReadOnly )) | 277 | if (histfile.open( IO_ReadOnly )) |
277 | { | 278 | { |
278 | QString line; | 279 | QString line; |
279 | uint i; | 280 | uint i; |
280 | HistoryList items; | 281 | HistoryList items; |
281 | 282 | ||
282 | int lineno = 0; | 283 | int lineno = 0; |
283 | while(!histfile.atEnd()) | 284 | while(!histfile.atEnd()) |
284 | { | 285 | { |
285 | if (histfile.readLine(line, 200) < 0) | 286 | if (histfile.readLine(line, 200) < 0) |
286 | { | 287 | { |
287 | break; | 288 | break; |
288 | } | 289 | } |
289 | line = line.left(line.length()-1); | 290 | line = line.left(line.length()-1); |
290 | lineno++; | 291 | lineno++; |
291 | 292 | ||
292 | for(i=0; i<items.count(); i++) | 293 | for(i=0; i<items.count(); i++) |
293 | { | 294 | { |
294 | if (line == items.at(i)->line) | 295 | if (line == items.at(i)->line) |
295 | { | 296 | { |
296 | // weight recent commands & repeated commands more | 297 | // weight recent commands & repeated commands more |
297 | // by adding up the index of each command | 298 | // by adding up the index of each command |
298 | items.at(i)->count += lineno; | 299 | items.at(i)->count += lineno; |
299 | break; | 300 | break; |
300 | } | 301 | } |
301 | } | 302 | } |
302 | if (i >= items.count()) | 303 | if (i >= items.count()) |
303 | { | 304 | { |
304 | items.append(new HistoryItem(lineno, line)); | 305 | items.append(new HistoryItem(lineno, line)); |
305 | } | 306 | } |
306 | } | 307 | } |
307 | items.sort(); | 308 | items.sort(); |
308 | int n = items.count(); | 309 | int n = items.count(); |
309 | if (n > 40) | 310 | if (n > 40) |
310 | { | 311 | { |
311 | n = 40; | 312 | n = 40; |
312 | } | 313 | } |
@@ -326,97 +327,97 @@ void Konsole::initCommandList() | |||
326 | for (int i = 0; commonCmds[i] != NULL; i++) | 327 | for (int i = 0; commonCmds[i] != NULL; i++) |
327 | { | 328 | { |
328 | commonCombo->insertItem(commonCmds[i]); | 329 | commonCombo->insertItem(commonCmds[i]); |
329 | } | 330 | } |
330 | } | 331 | } |
331 | else | 332 | else |
332 | { | 333 | { |
333 | for (int i = 0; i < 100; i++) | 334 | for (int i = 0; i < 100; i++) |
334 | { | 335 | { |
335 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) | 336 | if (!(cfg.readEntry( QString::number(i),"")).isEmpty()) |
336 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); | 337 | commonCombo->insertItem(cfg.readEntry( QString::number(i),"")); |
337 | } | 338 | } |
338 | } | 339 | } |
339 | 340 | ||
340 | 341 | ||
341 | } | 342 | } |
342 | 343 | ||
343 | static void sig_handler(int x) | 344 | static void sig_handler(int x) |
344 | { | 345 | { |
345 | printf("got signal %d\n",x); | 346 | printf("got signal %d\n",x); |
346 | } | 347 | } |
347 | 348 | ||
348 | void Konsole::init(const char* _pgm, QStrList & _args) | 349 | void Konsole::init(const char* _pgm, QStrList & _args) |
349 | { | 350 | { |
350 | 351 | ||
351 | #if 0 | 352 | #if 0 |
352 | for(int i=1; i<=31; i++) | 353 | for(int i=1; i<=31; i++) |
353 | { | 354 | { |
354 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV | 355 | if (i != SIGPIPE && i != SIGPROF && i != SIGSEGV |
355 | && i != SIGINT && i != SIGILL && i != SIGTERM | 356 | && i != SIGINT && i != SIGILL && i != SIGTERM |
356 | && i != SIGBUS) | 357 | && i != SIGBUS) |
357 | signal(i,sig_handler); | 358 | signal(i,sig_handler); |
358 | } | 359 | } |
359 | #endif | 360 | #endif |
360 | signal(SIGSTOP, sig_handler); | 361 | signal(SIGSTOP, sig_handler); |
361 | signal(SIGCONT, sig_handler); | 362 | signal(SIGCONT, sig_handler); |
362 | signal(SIGTSTP, sig_handler); | 363 | signal(SIGTSTP, sig_handler); |
363 | 364 | ||
364 | b_scroll = TRUE; // histon; | 365 | b_scroll = TRUE; // histon; |
365 | n_keytab = 0; | 366 | n_keytab = 0; |
366 | n_render = 0; | 367 | n_render = 0; |
367 | startUp=0; | 368 | startUp=0; |
368 | fromMenu = FALSE; | 369 | fromMenu = FALSE; |
369 | fullscreen = false; | 370 | fullscreen = false; |
370 | 371 | ||
371 | setCaption( "Qkonsole" ); | 372 | setCaption( "Qkonsole" ); |
372 | setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); | 373 | setIcon( Resource::loadPixmap( "qkonsole/qkonsole" ) ); |
373 | 374 | ||
374 | Config cfg("Qkonsole"); | 375 | Config cfg( "Konsole" ); |
375 | cfg.setGroup("Font"); | 376 | cfg.setGroup("Font"); |
376 | QString tmp; | 377 | QString tmp; |
377 | 378 | ||
378 | // initialize the list of allowed fonts /////////////////////////////////// | 379 | // initialize the list of allowed fonts /////////////////////////////////// |
379 | 380 | ||
380 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); | 381 | QString cfgFontName = cfg.readEntry("FontName","Lcfont"); |
381 | int cfgFontSize = cfg.readNumEntry("FontSize",18); | 382 | int cfgFontSize = cfg.readNumEntry("FontSize",18); |
382 | 383 | ||
383 | cfont = -1; | 384 | cfont = -1; |
384 | 385 | ||
385 | // this code causes repeated access to all the font files | 386 | // this code causes repeated access to all the font files |
386 | // which does slow down startup | 387 | // which does slow down startup |
387 | QFontDatabase fontDB; | 388 | QFontDatabase fontDB; |
388 | QStringList familyNames; | 389 | QStringList familyNames; |
389 | familyNames = fontDB.families( FALSE ); | 390 | familyNames = fontDB.families( FALSE ); |
390 | QString s; | 391 | QString s; |
391 | int fontIndex = 0; | 392 | int fontIndex = 0; |
392 | int familyNum = 0; | 393 | int familyNum = 0; |
393 | fontList = new QPopupMenu( this ); | 394 | fontList = new QPopupMenu( this ); |
394 | 395 | ||
395 | for(uint j = 0; j < (uint)familyNames.count(); j++) | 396 | for(uint j = 0; j < (uint)familyNames.count(); j++) |
396 | { | 397 | { |
397 | s = familyNames[j]; | 398 | s = familyNames[j]; |
398 | if ( s.contains('-') ) | 399 | if ( s.contains('-') ) |
399 | { | 400 | { |
400 | int i = s.find('-'); | 401 | int i = s.find('-'); |
401 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; | 402 | s = s.right( s.length() - i - 1 ) + " [" + s.left( i ) + "]"; |
402 | } | 403 | } |
403 | s[0] = s[0].upper(); | 404 | s[0] = s[0].upper(); |
404 | 405 | ||
405 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); | 406 | QValueList<int> sizes = fontDB.pointSizes( familyNames[j] ); |
406 | 407 | ||
407 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), | 408 | printf("family[%d] = %s with %d sizes\n", j, familyNames[j].latin1(), |
408 | sizes.count()); | 409 | sizes.count()); |
409 | 410 | ||
410 | if (sizes.count() > 0) | 411 | if (sizes.count() > 0) |
411 | { | 412 | { |
412 | QPopupMenu *sizeMenu; | 413 | QPopupMenu *sizeMenu; |
413 | QFont f; | 414 | QFont f; |
414 | int last_width = -1; | 415 | int last_width = -1; |
415 | sizeMenu = NULL; | 416 | sizeMenu = NULL; |
416 | 417 | ||
417 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) | 418 | for(uint i = 0; i < (uint)sizes.count() + 4; i++) |
418 | { | 419 | { |
419 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); | 420 | // printf("family %s size %d ", familyNames[j].latin1(), sizes[i]); |
420 | // need to divide by 10 on the Z, but not otherwise | 421 | // need to divide by 10 on the Z, but not otherwise |
421 | int size; | 422 | int size; |
422 | 423 | ||
@@ -739,97 +740,97 @@ void Konsole::init(const char* _pgm, QStrList & _args) | |||
739 | parseCommandLine(); | 740 | parseCommandLine(); |
740 | 741 | ||
741 | // read and apply default values /////////////////////////////////////////// | 742 | // read and apply default values /////////////////////////////////////////// |
742 | resize(321, 321); // Dummy. | 743 | resize(321, 321); // Dummy. |
743 | QSize currentSize = size(); | 744 | QSize currentSize = size(); |
744 | if (currentSize != size()) | 745 | if (currentSize != size()) |
745 | defaultSize = size(); | 746 | defaultSize = size(); |
746 | 747 | ||
747 | 748 | ||
748 | /* allows us to catch cancel/escape */ | 749 | /* allows us to catch cancel/escape */ |
749 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, | 750 | reparent ( 0, WStyle_Customize | WStyle_NoBorder, |
750 | QPoint ( 0, 0 )); | 751 | QPoint ( 0, 0 )); |
751 | } | 752 | } |
752 | 753 | ||
753 | void Konsole::show() | 754 | void Konsole::show() |
754 | { | 755 | { |
755 | if ( !nsessions ) | 756 | if ( !nsessions ) |
756 | { | 757 | { |
757 | newSession(); | 758 | newSession(); |
758 | } | 759 | } |
759 | QMainWindow::show(); | 760 | QMainWindow::show(); |
760 | 761 | ||
761 | } | 762 | } |
762 | 763 | ||
763 | void Konsole::initSession(const char*, QStrList &) | 764 | void Konsole::initSession(const char*, QStrList &) |
764 | { | 765 | { |
765 | QMainWindow::show(); | 766 | QMainWindow::show(); |
766 | } | 767 | } |
767 | 768 | ||
768 | Konsole::~Konsole() | 769 | Konsole::~Konsole() |
769 | { | 770 | { |
770 | while (nsessions > 0) | 771 | while (nsessions > 0) |
771 | { | 772 | { |
772 | doneSession(getTe(), 0); | 773 | doneSession(getTe(), 0); |
773 | } | 774 | } |
774 | } | 775 | } |
775 | 776 | ||
776 | void | 777 | void |
777 | Konsole::historyDialog() | 778 | Konsole::historyDialog() |
778 | { | 779 | { |
779 | QDialog *d = new QDialog ( this, "histdlg", true ); | 780 | QDialog *d = new QDialog ( this, "histdlg", true ); |
780 | // d-> setCaption ( tr( "History" )); | 781 | // d-> setCaption ( tr( "History" )); |
781 | 782 | ||
782 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); | 783 | QBoxLayout *lay = new QVBoxLayout ( d, 4, 4 ); |
783 | 784 | ||
784 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); | 785 | QLabel *l = new QLabel ( tr( "History Lines:" ), d ); |
785 | lay-> addWidget ( l ); | 786 | lay-> addWidget ( l ); |
786 | 787 | ||
787 | Config cfg("Qkonsole"); | 788 | Config cfg( "Konsole" ); |
788 | cfg.setGroup("History"); | 789 | cfg.setGroup("History"); |
789 | int hist = cfg.readNumEntry("history_lines",300); | 790 | int hist = cfg.readNumEntry("history_lines",300); |
790 | int avg_line = cfg.readNumEntry("avg_line_length",60); | 791 | int avg_line = cfg.readNumEntry("avg_line_length",60); |
791 | 792 | ||
792 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); | 793 | QSpinBox *spin = new QSpinBox ( 1, 100000, 20, d ); |
793 | spin-> setValue ( hist ); | 794 | spin-> setValue ( hist ); |
794 | spin-> setWrapping ( true ); | 795 | spin-> setWrapping ( true ); |
795 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); | 796 | spin-> setButtonSymbols ( QSpinBox::PlusMinus ); |
796 | lay-> addWidget ( spin ); | 797 | lay-> addWidget ( spin ); |
797 | 798 | ||
798 | if ( d-> exec ( ) == QDialog::Accepted ) | 799 | if ( d-> exec ( ) == QDialog::Accepted ) |
799 | { | 800 | { |
800 | cfg.writeEntry("history_lines", spin->value()); | 801 | cfg.writeEntry("history_lines", spin->value()); |
801 | cfg.writeEntry("avg_line_length", avg_line); | 802 | cfg.writeEntry("avg_line_length", avg_line); |
802 | if (getTe() != NULL) | 803 | if (getTe() != NULL) |
803 | { | 804 | { |
804 | getTe()->currentSession->setHistory(true); | 805 | getTe()->currentSession->setHistory(true); |
805 | } | 806 | } |
806 | } | 807 | } |
807 | 808 | ||
808 | delete d; | 809 | delete d; |
809 | } | 810 | } |
810 | 811 | ||
811 | 812 | ||
812 | void Konsole::cycleZoom() | 813 | void Konsole::cycleZoom() |
813 | { | 814 | { |
814 | TEWidget* te = getTe(); | 815 | TEWidget* te = getTe(); |
815 | QFont font = te->getVTFont(); | 816 | QFont font = te->getVTFont(); |
816 | int size = font.pointSize(); | 817 | int size = font.pointSize(); |
817 | changeFontSize(1); | 818 | changeFontSize(1); |
818 | font = te->getVTFont(); | 819 | font = te->getVTFont(); |
819 | if (font.pointSize() <= size) | 820 | if (font.pointSize() <= size) |
820 | { | 821 | { |
821 | do | 822 | do |
822 | { | 823 | { |
823 | font = te->getVTFont(); | 824 | font = te->getVTFont(); |
824 | size = font.pointSize(); | 825 | size = font.pointSize(); |
825 | changeFontSize(-1); | 826 | changeFontSize(-1); |
826 | font = te->getVTFont(); | 827 | font = te->getVTFont(); |
827 | } | 828 | } |
828 | while (font.pointSize() < size); | 829 | while (font.pointSize() < size); |
829 | } | 830 | } |
830 | } | 831 | } |
831 | 832 | ||
832 | void Konsole::changeFontSize(int delta) | 833 | void Konsole::changeFontSize(int delta) |
833 | { | 834 | { |
834 | // printf("delta font size %d\n", delta); | 835 | // printf("delta font size %d\n", delta); |
835 | TEWidget* te = getTe(); | 836 | TEWidget* te = getTe(); |
@@ -882,97 +883,97 @@ int Konsole::findFont(QString name, int size, bool exactMatch) | |||
882 | { | 883 | { |
883 | for(uint i = 0; i < fonts.count(); i++) | 884 | for(uint i = 0; i < fonts.count(); i++) |
884 | { | 885 | { |
885 | if (fonts.at(i)->getName() == name | 886 | if (fonts.at(i)->getName() == name |
886 | && fonts.at(i)->getSize() == size) | 887 | && fonts.at(i)->getSize() == size) |
887 | { | 888 | { |
888 | return(i); | 889 | return(i); |
889 | } | 890 | } |
890 | } | 891 | } |
891 | if (exactMatch) | 892 | if (exactMatch) |
892 | { | 893 | { |
893 | return(-1); | 894 | return(-1); |
894 | } | 895 | } |
895 | for(uint i = 0; i < fonts.count(); i++) | 896 | for(uint i = 0; i < fonts.count(); i++) |
896 | { | 897 | { |
897 | if (fonts.at(i)->getSize() == size) | 898 | if (fonts.at(i)->getSize() == size) |
898 | { | 899 | { |
899 | return(i); | 900 | return(i); |
900 | } | 901 | } |
901 | } | 902 | } |
902 | return(-1); | 903 | return(-1); |
903 | } | 904 | } |
904 | 905 | ||
905 | void Konsole::setFont(int f) | 906 | void Konsole::setFont(int f) |
906 | { | 907 | { |
907 | VTFont* font = fonts.at(f); | 908 | VTFont* font = fonts.at(f); |
908 | if (font) | 909 | if (font) |
909 | { | 910 | { |
910 | TEWidget* te = getTe(); | 911 | TEWidget* te = getTe(); |
911 | if (te != 0) | 912 | if (te != 0) |
912 | { | 913 | { |
913 | te->setVTFont(font->getFont()); | 914 | te->setVTFont(font->getFont()); |
914 | } | 915 | } |
915 | cfont = f; | 916 | cfont = f; |
916 | 917 | ||
917 | int familyNum = font->getFamilyNum(); | 918 | int familyNum = font->getFamilyNum(); |
918 | int size = font->getSize(); | 919 | int size = font->getSize(); |
919 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, | 920 | printf("familyNum = %d size = %d count=%d\n", familyNum, size, |
920 | fontList->count()); | 921 | fontList->count()); |
921 | for(int i = 0; i < (int)fontList->count(); i++) | 922 | for(int i = 0; i < (int)fontList->count(); i++) |
922 | { | 923 | { |
923 | fontList->setItemChecked(i + 1000, i == familyNum); | 924 | fontList->setItemChecked(i + 1000, i == familyNum); |
924 | } | 925 | } |
925 | for(int i = 0; i < (int)fonts.count(); i++) | 926 | for(int i = 0; i < (int)fonts.count(); i++) |
926 | { | 927 | { |
927 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum | 928 | fontList->setItemChecked(i, fonts.at(i)->getFamilyNum() == familyNum |
928 | && fonts.at(i)->getSize() == size); | 929 | && fonts.at(i)->getSize() == size); |
929 | } | 930 | } |
930 | Config cfg("Qkonsole"); | 931 | Config cfg( "Konsole" ); |
931 | cfg.setGroup("Font"); | 932 | cfg.setGroup("Font"); |
932 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); | 933 | QString ss = "Session"+ QString::number(tab->currentPageIndex()+1); |
933 | if (tab->currentPageIndex() == 0) | 934 | if (tab->currentPageIndex() == 0) |
934 | { | 935 | { |
935 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); | 936 | cfg.writeEntry("FontName", fonts.at(cfont)->getFamily()); |
936 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); | 937 | cfg.writeEntry("FontSize", fonts.at(cfont)->getSize()); |
937 | } | 938 | } |
938 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); | 939 | cfg.writeEntry("FontName"+ss, fonts.at(cfont)->getFamily()); |
939 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); | 940 | cfg.writeEntry("FontSize"+ss, fonts.at(cfont)->getSize()); |
940 | } | 941 | } |
941 | } | 942 | } |
942 | 943 | ||
943 | #if 0 | 944 | #if 0 |
944 | void Konsole::fontChanged(int f) | 945 | void Konsole::fontChanged(int f) |
945 | { | 946 | { |
946 | VTFont* font = fonts.at(f); | 947 | VTFont* font = fonts.at(f); |
947 | if (font != 0) | 948 | if (font != 0) |
948 | { | 949 | { |
949 | for(uint i = 0; i < fonts.count(); i++) | 950 | for(uint i = 0; i < fonts.count(); i++) |
950 | { | 951 | { |
951 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); | 952 | fontList->setItemChecked(i, (i == (uint) f) ? TRUE : FALSE); |
952 | } | 953 | } |
953 | 954 | ||
954 | cfont = f; | 955 | cfont = f; |
955 | 956 | ||
956 | TEWidget* te = getTe(); | 957 | TEWidget* te = getTe(); |
957 | if (te != 0) | 958 | if (te != 0) |
958 | { | 959 | { |
959 | te->setVTFont(font->getFont()); | 960 | te->setVTFont(font->getFont()); |
960 | } | 961 | } |
961 | } | 962 | } |
962 | } | 963 | } |
963 | #endif | 964 | #endif |
964 | 965 | ||
965 | 966 | ||
966 | void Konsole::enterCommand(int c) | 967 | void Konsole::enterCommand(int c) |
967 | { | 968 | { |
968 | TEWidget* te = getTe(); | 969 | TEWidget* te = getTe(); |
969 | if (te != 0) | 970 | if (te != 0) |
970 | { | 971 | { |
971 | if(!commonCombo->editable()) | 972 | if(!commonCombo->editable()) |
972 | { | 973 | { |
973 | QString text = commonCombo->text(c); //commonCmds[c]; | 974 | QString text = commonCombo->text(c); //commonCmds[c]; |
974 | te->emitText(text); | 975 | te->emitText(text); |
975 | } | 976 | } |
976 | else | 977 | else |
977 | { | 978 | { |
978 | changeCommand( commonCombo->text(c), c); | 979 | changeCommand( commonCombo->text(c), c); |
@@ -1127,97 +1128,97 @@ void Konsole::doneSession(TEWidget* te, int ) | |||
1127 | // TEWidget *te = NULL; | 1128 | // TEWidget *te = NULL; |
1128 | // if (sess->currentSession == tab->currentPage()) { | 1129 | // if (sess->currentSession == tab->currentPage()) { |
1129 | // printf("done current session\n"); | 1130 | // printf("done current session\n"); |
1130 | // te = getTe(); | 1131 | // te = getTe(); |
1131 | // } else { | 1132 | // } else { |
1132 | // int currentPage = tab->currentPageIndex(); | 1133 | // int currentPage = tab->currentPageIndex(); |
1133 | // printf("done not current session\n"); | 1134 | // printf("done not current session\n"); |
1134 | // for(int i = 0; i < nsessions; i++) { | 1135 | // for(int i = 0; i < nsessions; i++) { |
1135 | // tab->setCurrentPage(i); | 1136 | // tab->setCurrentPage(i); |
1136 | // printf("find session %d tab page %x session %x\n", | 1137 | // printf("find session %d tab page %x session %x\n", |
1137 | // i, tab->currentPage(), sess->currentSession); | 1138 | // i, tab->currentPage(), sess->currentSession); |
1138 | // if (tab->currentPage() == sess->currentSession) { | 1139 | // if (tab->currentPage() == sess->currentSession) { |
1139 | // printf("found session %d\n", i); | 1140 | // printf("found session %d\n", i); |
1140 | // te = tab->currentPage(); | 1141 | // te = tab->currentPage(); |
1141 | // break; | 1142 | // break; |
1142 | // } | 1143 | // } |
1143 | // } | 1144 | // } |
1144 | // tab->setCurrentPage(currentPage); | 1145 | // tab->setCurrentPage(currentPage); |
1145 | // } | 1146 | // } |
1146 | if (te != 0) | 1147 | if (te != 0) |
1147 | { | 1148 | { |
1148 | te->currentSession->setConnect(FALSE); | 1149 | te->currentSession->setConnect(FALSE); |
1149 | tab->removeTab(te); | 1150 | tab->removeTab(te); |
1150 | delete te->currentSession; | 1151 | delete te->currentSession; |
1151 | delete te; | 1152 | delete te; |
1152 | sessionList->removeItem(nsessions); | 1153 | sessionList->removeItem(nsessions); |
1153 | nsessions--; | 1154 | nsessions--; |
1154 | } | 1155 | } |
1155 | if (nsessions == 0) | 1156 | if (nsessions == 0) |
1156 | { | 1157 | { |
1157 | close(); | 1158 | close(); |
1158 | } | 1159 | } |
1159 | } | 1160 | } |
1160 | 1161 | ||
1161 | void Konsole::changeTitle(TEWidget* te, QString newTitle ) | 1162 | void Konsole::changeTitle(TEWidget* te, QString newTitle ) |
1162 | { | 1163 | { |
1163 | if (te == getTe()) | 1164 | if (te == getTe()) |
1164 | { | 1165 | { |
1165 | setCaption(newTitle + " - QKonsole"); | 1166 | setCaption(newTitle + " - QKonsole"); |
1166 | } | 1167 | } |
1167 | } | 1168 | } |
1168 | 1169 | ||
1169 | 1170 | ||
1170 | void Konsole::newSession() | 1171 | void Konsole::newSession() |
1171 | { | 1172 | { |
1172 | if(nsessions < 15) | 1173 | if(nsessions < 15) |
1173 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? | 1174 | { // seems to be something weird about 16 tabs on the Zaurus.... memory? |
1174 | TEWidget* te = new TEWidget(tab); | 1175 | TEWidget* te = new TEWidget(tab); |
1175 | Config cfg("Qkonsole"); | 1176 | Config cfg( "Konsole" ); |
1176 | cfg.setGroup("Menubar"); | 1177 | cfg.setGroup("Menubar"); |
1177 | 1178 | ||
1178 | // FIXME use more defaults from config file | 1179 | // FIXME use more defaults from config file |
1179 | te->useBeep=cfg.readBoolEntry("useBeep",0); | 1180 | te->useBeep=cfg.readBoolEntry("useBeep",0); |
1180 | 1181 | ||
1181 | // te->setBackgroundMode(PaletteBase); //we want transparent!! | 1182 | // te->setBackgroundMode(PaletteBase); //we want transparent!! |
1182 | 1183 | ||
1183 | cfg.setGroup("Font"); | 1184 | cfg.setGroup("Font"); |
1184 | QString sn = "Session" + QString::number(nsessions+1); | 1185 | QString sn = "Session" + QString::number(nsessions+1); |
1185 | printf("read font session %s\n", sn.latin1()); | 1186 | printf("read font session %s\n", sn.latin1()); |
1186 | QString fontName = cfg.readEntry("FontName"+sn, | 1187 | QString fontName = cfg.readEntry("FontName"+sn, |
1187 | cfg.readEntry("FontName", | 1188 | cfg.readEntry("FontName", |
1188 | fonts.at(cfont)->getFamily())); | 1189 | fonts.at(cfont)->getFamily())); |
1189 | int fontSize = cfg.readNumEntry("FontSize"+sn, | 1190 | int fontSize = cfg.readNumEntry("FontSize"+sn, |
1190 | cfg.readNumEntry("FontSize", | 1191 | cfg.readNumEntry("FontSize", |
1191 | fonts.at(cfont)->getSize())); | 1192 | fonts.at(cfont)->getSize())); |
1192 | cfont = findFont(fontName, fontSize, false); | 1193 | cfont = findFont(fontName, fontSize, false); |
1193 | printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); | 1194 | printf("lookup font %s size %d got %d\n", fontName.latin1(), fontSize, cfont); |
1194 | if (cfont < 0) | 1195 | if (cfont < 0) |
1195 | cfont = 0; | 1196 | cfont = 0; |
1196 | te->setVTFont(fonts.at(cfont)->getFont()); | 1197 | te->setVTFont(fonts.at(cfont)->getFont()); |
1197 | 1198 | ||
1198 | tab->addTab(te); | 1199 | tab->addTab(te); |
1199 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); | 1200 | TESession* se = new TESession(this, te, se_pgm, se_args, "xterm"); |
1200 | te->currentSession = se; | 1201 | te->currentSession = se; |
1201 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); | 1202 | connect( se, SIGNAL(done(TEWidget*,int)), this, SLOT(doneSession(TEWidget*,int)) ); |
1202 | connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, | 1203 | connect( se, SIGNAL(changeTitle(TEWidget*,QString)), this, |
1203 | SLOT(changeTitle(TEWidget*,QString)) ); | 1204 | SLOT(changeTitle(TEWidget*,QString)) ); |
1204 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); | 1205 | connect(te, SIGNAL(changeFontSize(int)), this, SLOT(changeFontSize(int))); |
1205 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); | 1206 | connect(te, SIGNAL(changeSession(int)), this, SLOT(changeSession(int))); |
1206 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); | 1207 | connect(te, SIGNAL(newSession()), this, SLOT(newSession())); |
1207 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); | 1208 | connect(te, SIGNAL(toggleFullScreen()), this, SLOT(toggleFullScreen())); |
1208 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); | 1209 | connect(te, SIGNAL(setFullScreen(bool)), this, SLOT(setFullScreen(bool))); |
1209 | se->run(); | 1210 | se->run(); |
1210 | se->setConnect(TRUE); | 1211 | se->setConnect(TRUE); |
1211 | se->setHistory(b_scroll); | 1212 | se->setHistory(b_scroll); |
1212 | nsessions++; | 1213 | nsessions++; |
1213 | sessionList->insertItem(QString::number(nsessions), nsessions); | 1214 | sessionList->insertItem(QString::number(nsessions), nsessions); |
1214 | sessionListSelected(nsessions); | 1215 | sessionListSelected(nsessions); |
1215 | doWrap(); | 1216 | doWrap(); |
1216 | setColor(nsessions-1); | 1217 | setColor(nsessions-1); |
1217 | } | 1218 | } |
1218 | } | 1219 | } |
1219 | 1220 | ||
1220 | TEWidget* Konsole::getTe() | 1221 | TEWidget* Konsole::getTe() |
1221 | { | 1222 | { |
1222 | if (nsessions) | 1223 | if (nsessions) |
1223 | { | 1224 | { |
@@ -1366,97 +1367,97 @@ void Konsole::setFullScreen ( bool b ) | |||
1366 | } | 1367 | } |
1367 | } | 1368 | } |
1368 | else | 1369 | else |
1369 | { | 1370 | { |
1370 | showNormal ( ); | 1371 | showNormal ( ); |
1371 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); | 1372 | reparent ( 0, WStyle_Customize, QPoint ( 0, 0 )); |
1372 | resize ( normalsize ); | 1373 | resize ( normalsize ); |
1373 | showMaximized ( ); | 1374 | showMaximized ( ); |
1374 | normalsize = QSize ( ); | 1375 | normalsize = QSize ( ); |
1375 | 1376 | ||
1376 | menuToolBar->show(); | 1377 | menuToolBar->show(); |
1377 | toolBar->show(); | 1378 | toolBar->show(); |
1378 | if(! listHidden) | 1379 | if(! listHidden) |
1379 | { | 1380 | { |
1380 | secondToolBar->show(); | 1381 | secondToolBar->show(); |
1381 | } | 1382 | } |
1382 | // commonCombo->show(); | 1383 | // commonCombo->show(); |
1383 | menuToolBar->show(); | 1384 | menuToolBar->show(); |
1384 | if (tabPos != tm_hidden) | 1385 | if (tabPos != tm_hidden) |
1385 | { | 1386 | { |
1386 | tab->getTabBar()->show(); | 1387 | tab->getTabBar()->show(); |
1387 | } | 1388 | } |
1388 | } | 1389 | } |
1389 | tab->setMargin(tab->margin()); // cause setup to run | 1390 | tab->setMargin(tab->margin()); // cause setup to run |
1390 | } | 1391 | } |
1391 | 1392 | ||
1392 | 1393 | ||
1393 | void Konsole::fullscreenTimeout() | 1394 | void Konsole::fullscreenTimeout() |
1394 | { | 1395 | { |
1395 | fullscreen_msg->hide(); | 1396 | fullscreen_msg->hide(); |
1396 | } | 1397 | } |
1397 | 1398 | ||
1398 | void Konsole::colorMenuIsSelected(int iD) | 1399 | void Konsole::colorMenuIsSelected(int iD) |
1399 | { | 1400 | { |
1400 | fromMenu = TRUE; | 1401 | fromMenu = TRUE; |
1401 | colorMenuSelected(iD); | 1402 | colorMenuSelected(iD); |
1402 | } | 1403 | } |
1403 | 1404 | ||
1404 | /// ------------------------------- some new stuff by L.J. Potter | 1405 | /// ------------------------------- some new stuff by L.J. Potter |
1405 | 1406 | ||
1406 | 1407 | ||
1407 | void Konsole::colorMenuSelected(int iD) | 1408 | void Konsole::colorMenuSelected(int iD) |
1408 | { | 1409 | { |
1409 | // this is NOT pretty, elegant or anything else besides functional | 1410 | // this is NOT pretty, elegant or anything else besides functional |
1410 | // QString temp; | 1411 | // QString temp; |
1411 | // qDebug( temp.sprintf("colormenu %d", iD)); | 1412 | // qDebug( temp.sprintf("colormenu %d", iD)); |
1412 | 1413 | ||
1413 | TEWidget* te = getTe(); | 1414 | TEWidget* te = getTe(); |
1414 | Config cfg("Qkonsole"); | 1415 | Config cfg( "Konsole" ); |
1415 | cfg.setGroup("Colors"); | 1416 | cfg.setGroup("Colors"); |
1416 | 1417 | ||
1417 | ColorEntry m_table[TABLE_COLORS]; | 1418 | ColorEntry m_table[TABLE_COLORS]; |
1418 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1419 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1419 | 1420 | ||
1420 | int i; | 1421 | int i; |
1421 | 1422 | ||
1422 | // te->color_menu_item = iD; | 1423 | // te->color_menu_item = iD; |
1423 | 1424 | ||
1424 | colorMenu->setItemChecked(cm_ab,FALSE); | 1425 | colorMenu->setItemChecked(cm_ab,FALSE); |
1425 | colorMenu->setItemChecked(cm_bb,FALSE); | 1426 | colorMenu->setItemChecked(cm_bb,FALSE); |
1426 | colorMenu->setItemChecked(cm_wc,FALSE); | 1427 | colorMenu->setItemChecked(cm_wc,FALSE); |
1427 | colorMenu->setItemChecked(cm_cw,FALSE); | 1428 | colorMenu->setItemChecked(cm_cw,FALSE); |
1428 | colorMenu->setItemChecked(cm_mb,FALSE); | 1429 | colorMenu->setItemChecked(cm_mb,FALSE); |
1429 | colorMenu->setItemChecked(cm_bm,FALSE); | 1430 | colorMenu->setItemChecked(cm_bm,FALSE); |
1430 | colorMenu->setItemChecked(cm_gy,FALSE); | 1431 | colorMenu->setItemChecked(cm_gy,FALSE); |
1431 | colorMenu->setItemChecked(cm_rb,FALSE); | 1432 | colorMenu->setItemChecked(cm_rb,FALSE); |
1432 | colorMenu->setItemChecked(cm_br,FALSE); | 1433 | colorMenu->setItemChecked(cm_br,FALSE); |
1433 | colorMenu->setItemChecked(cm_wb,FALSE); | 1434 | colorMenu->setItemChecked(cm_wb,FALSE); |
1434 | colorMenu->setItemChecked(cm_bw,FALSE); | 1435 | colorMenu->setItemChecked(cm_bw,FALSE); |
1435 | colorMenu->setItemChecked(cm_gb,FALSE); | 1436 | colorMenu->setItemChecked(cm_gb,FALSE); |
1436 | 1437 | ||
1437 | if(iD==cm_default) | 1438 | if(iD==cm_default) |
1438 | { // default default | 1439 | { // default default |
1439 | printf("default colors\n"); | 1440 | printf("default colors\n"); |
1440 | for (i = 0; i < TABLE_COLORS; i++) | 1441 | for (i = 0; i < TABLE_COLORS; i++) |
1441 | { | 1442 | { |
1442 | m_table[i].color = defaultCt[i].color; | 1443 | m_table[i].color = defaultCt[i].color; |
1443 | if(i==1 || i == 11) | 1444 | if(i==1 || i == 11) |
1444 | m_table[i].transparent=1; | 1445 | m_table[i].transparent=1; |
1445 | colorMenu->setItemChecked(cm_default,TRUE); | 1446 | colorMenu->setItemChecked(cm_default,TRUE); |
1446 | } | 1447 | } |
1447 | te->setColorTable(m_table); | 1448 | te->setColorTable(m_table); |
1448 | } | 1449 | } |
1449 | if(iD==cm_gb) | 1450 | if(iD==cm_gb) |
1450 | { // green black | 1451 | { // green black |
1451 | foreground.setRgb(100,255,100); // (0x18,255,0x18); | 1452 | foreground.setRgb(100,255,100); // (0x18,255,0x18); |
1452 | background.setRgb(0x00,0x00,0x00); | 1453 | background.setRgb(0x00,0x00,0x00); |
1453 | colorMenu->setItemChecked(cm_gb,TRUE); | 1454 | colorMenu->setItemChecked(cm_gb,TRUE); |
1454 | } | 1455 | } |
1455 | if(iD==cm_bw) | 1456 | if(iD==cm_bw) |
1456 | { // black white | 1457 | { // black white |
1457 | foreground.setRgb(0x00,0x00,0x00); | 1458 | foreground.setRgb(0x00,0x00,0x00); |
1458 | background.setRgb(0xFF,0xFF,0xFF); | 1459 | background.setRgb(0xFF,0xFF,0xFF); |
1459 | colorMenu->setItemChecked(cm_bw,TRUE); | 1460 | colorMenu->setItemChecked(cm_bw,TRUE); |
1460 | } | 1461 | } |
1461 | if(iD==cm_wb) | 1462 | if(iD==cm_wb) |
1462 | { // white black | 1463 | { // white black |
@@ -1550,251 +1551,251 @@ void Konsole::colorMenuSelected(int iD) | |||
1550 | QString ss = QString("Session%1").arg(tabBar->currentTab()); | 1551 | QString ss = QString("Session%1").arg(tabBar->currentTab()); |
1551 | // printf("current tab = %d\n", tabBar->currentTab()); | 1552 | // printf("current tab = %d\n", tabBar->currentTab()); |
1552 | 1553 | ||
1553 | if (tabBar->currentTab() == 0) | 1554 | if (tabBar->currentTab() == 0) |
1554 | { | 1555 | { |
1555 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); | 1556 | cfg.writeEntry("foregroundRed",QString::number(foreground.red())); |
1556 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); | 1557 | cfg.writeEntry("foregroundGreen",QString::number(foreground.green())); |
1557 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); | 1558 | cfg.writeEntry("foregroundBlue",QString::number(foreground.blue())); |
1558 | cfg.writeEntry("backgroundRed",QString::number(background.red())); | 1559 | cfg.writeEntry("backgroundRed",QString::number(background.red())); |
1559 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); | 1560 | cfg.writeEntry("backgroundGreen",QString::number(background.green())); |
1560 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); | 1561 | cfg.writeEntry("backgroundBlue",QString::number(background.blue())); |
1561 | } | 1562 | } |
1562 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); | 1563 | cfg.writeEntry("foregroundRed"+ss,QString::number(foreground.red())); |
1563 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); | 1564 | cfg.writeEntry("foregroundGreen"+ss,QString::number(foreground.green())); |
1564 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); | 1565 | cfg.writeEntry("foregroundBlue"+ss,QString::number(foreground.blue())); |
1565 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); | 1566 | cfg.writeEntry("backgroundRed"+ss,QString::number(background.red())); |
1566 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); | 1567 | cfg.writeEntry("backgroundGreen"+ss,QString::number(background.green())); |
1567 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); | 1568 | cfg.writeEntry("backgroundBlue"+ss,QString::number(background.blue())); |
1568 | 1569 | ||
1569 | update(); | 1570 | update(); |
1570 | } | 1571 | } |
1571 | 1572 | ||
1572 | void Konsole::setColors(QColor foreground, QColor background) | 1573 | void Konsole::setColors(QColor foreground, QColor background) |
1573 | { | 1574 | { |
1574 | int i; | 1575 | int i; |
1575 | ColorEntry m_table[TABLE_COLORS]; | 1576 | ColorEntry m_table[TABLE_COLORS]; |
1576 | TEWidget* te = getTe(); | 1577 | TEWidget* te = getTe(); |
1577 | const ColorEntry * defaultCt=te->getdefaultColorTable(); | 1578 | const ColorEntry * defaultCt=te->getdefaultColorTable(); |
1578 | 1579 | ||
1579 | for (i = 0; i < TABLE_COLORS; i++) | 1580 | for (i = 0; i < TABLE_COLORS; i++) |
1580 | { | 1581 | { |
1581 | if(i==0 || i == 10) | 1582 | if(i==0 || i == 10) |
1582 | { | 1583 | { |
1583 | m_table[i].color = foreground; | 1584 | m_table[i].color = foreground; |
1584 | } | 1585 | } |
1585 | else if(i==1 || i == 11) | 1586 | else if(i==1 || i == 11) |
1586 | { | 1587 | { |
1587 | m_table[i].color = background; | 1588 | m_table[i].color = background; |
1588 | m_table[i].transparent=0; | 1589 | m_table[i].transparent=0; |
1589 | } | 1590 | } |
1590 | else | 1591 | else |
1591 | m_table[i].color = defaultCt[i].color; | 1592 | m_table[i].color = defaultCt[i].color; |
1592 | } | 1593 | } |
1593 | te->setColorTable(m_table); | 1594 | te->setColorTable(m_table); |
1594 | } | 1595 | } |
1595 | 1596 | ||
1596 | void Konsole::tabMenuSelected(int id) | 1597 | void Konsole::tabMenuSelected(int id) |
1597 | { | 1598 | { |
1598 | Config cfg("Qkonsole"); | 1599 | Config cfg( "Konsole" ); |
1599 | cfg.setGroup("Tabs"); | 1600 | cfg.setGroup("Tabs"); |
1600 | tabMenu->setItemChecked(tabPos, false); | 1601 | tabMenu->setItemChecked(tabPos, false); |
1601 | if (id == tm_bottom) | 1602 | if (id == tm_bottom) |
1602 | { | 1603 | { |
1603 | printf("set bottom tab\n"); | 1604 | printf("set bottom tab\n"); |
1604 | tab->getTabBar()->show(); | 1605 | tab->getTabBar()->show(); |
1605 | tab->setTabPosition(QTabWidget::Bottom); | 1606 | tab->setTabPosition(QTabWidget::Bottom); |
1606 | tab->getTabBar()->show(); | 1607 | tab->getTabBar()->show(); |
1607 | cfg.writeEntry("Position","Bottom"); | 1608 | cfg.writeEntry("Position","Bottom"); |
1608 | } | 1609 | } |
1609 | else if (id == tm_top) | 1610 | else if (id == tm_top) |
1610 | { | 1611 | { |
1611 | printf("set top tab\n"); | 1612 | printf("set top tab\n"); |
1612 | tab->getTabBar()->show(); | 1613 | tab->getTabBar()->show(); |
1613 | tab->setTabPosition(QTabWidget::Bottom); | 1614 | tab->setTabPosition(QTabWidget::Bottom); |
1614 | tab->setTabPosition(QTabWidget::Top); | 1615 | tab->setTabPosition(QTabWidget::Top); |
1615 | tab->getTabBar()->show(); | 1616 | tab->getTabBar()->show(); |
1616 | cfg.writeEntry("Position","Top"); | 1617 | cfg.writeEntry("Position","Top"); |
1617 | } | 1618 | } |
1618 | else if (id == tm_hidden) | 1619 | else if (id == tm_hidden) |
1619 | { | 1620 | { |
1620 | tab->getTabBar()->hide(); | 1621 | tab->getTabBar()->hide(); |
1621 | tab->setMargin(tab->margin()); | 1622 | tab->setMargin(tab->margin()); |
1622 | cfg.writeEntry("Position","Hidden"); | 1623 | cfg.writeEntry("Position","Hidden"); |
1623 | } | 1624 | } |
1624 | tabMenu->setItemChecked(id, true); | 1625 | tabMenu->setItemChecked(id, true); |
1625 | tabPos = id; | 1626 | tabPos = id; |
1626 | } | 1627 | } |
1627 | 1628 | ||
1628 | 1629 | ||
1629 | void Konsole::configMenuSelected(int iD) | 1630 | void Konsole::configMenuSelected(int iD) |
1630 | { | 1631 | { |
1631 | // QString temp; | 1632 | // QString temp; |
1632 | // qDebug( temp.sprintf("configmenu %d",iD)); | 1633 | // qDebug( temp.sprintf("configmenu %d",iD)); |
1633 | 1634 | ||
1634 | TEWidget* te = getTe(); | 1635 | TEWidget* te = getTe(); |
1635 | Config cfg("Qkonsole"); | 1636 | Config cfg( "Konsole" ); |
1636 | cfg.setGroup("Menubar"); | 1637 | cfg.setGroup("Menubar"); |
1637 | if(iD == cm_wrap) | 1638 | if(iD == cm_wrap) |
1638 | { | 1639 | { |
1639 | cfg.setGroup("ScrollBar"); | 1640 | cfg.setGroup("ScrollBar"); |
1640 | bool b=cfg.readBoolEntry("HorzScroll",0); | 1641 | bool b=cfg.readBoolEntry("HorzScroll",0); |
1641 | b=!b; | 1642 | b=!b; |
1642 | cfg.writeEntry("HorzScroll", b ); | 1643 | cfg.writeEntry("HorzScroll", b ); |
1643 | cfg.write(); | 1644 | cfg.write(); |
1644 | doWrap(); | 1645 | doWrap(); |
1645 | if(cfg.readNumEntry("Position",2) == 0) | 1646 | if(cfg.readNumEntry("Position",2) == 0) |
1646 | { | 1647 | { |
1647 | te->setScrollbarLocation(1); | 1648 | te->setScrollbarLocation(1); |
1648 | } | 1649 | } |
1649 | else | 1650 | else |
1650 | { | 1651 | { |
1651 | te->setScrollbarLocation(0); | 1652 | te->setScrollbarLocation(0); |
1652 | } | 1653 | } |
1653 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1654 | te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1654 | } | 1655 | } |
1655 | if(iD == cm_beep) | 1656 | if(iD == cm_beep) |
1656 | { | 1657 | { |
1657 | cfg.setGroup("Menubar"); | 1658 | cfg.setGroup("Menubar"); |
1658 | bool b=cfg.readBoolEntry("useBeep",0); | 1659 | bool b=cfg.readBoolEntry("useBeep",0); |
1659 | b=!b; | 1660 | b=!b; |
1660 | cfg.writeEntry("useBeep", b ); | 1661 | cfg.writeEntry("useBeep", b ); |
1661 | cfg.write(); | 1662 | cfg.write(); |
1662 | configMenu->setItemChecked(cm_beep,b); | 1663 | configMenu->setItemChecked(cm_beep,b); |
1663 | te->useBeep=b; | 1664 | te->useBeep=b; |
1664 | } | 1665 | } |
1665 | } | 1666 | } |
1666 | 1667 | ||
1667 | void Konsole::changeCommand(const QString &text, int c) | 1668 | void Konsole::changeCommand(const QString &text, int c) |
1668 | { | 1669 | { |
1669 | Config cfg("Qkonsole"); | 1670 | Config cfg( "Konsole" ); |
1670 | cfg.setGroup("Commands"); | 1671 | cfg.setGroup("Commands"); |
1671 | if(commonCmds[c] != text) | 1672 | if(commonCmds[c] != text) |
1672 | { | 1673 | { |
1673 | cfg.writeEntry(QString::number(c),text); | 1674 | cfg.writeEntry(QString::number(c),text); |
1674 | commonCombo->clearEdit(); | 1675 | commonCombo->clearEdit(); |
1675 | commonCombo->setCurrentItem(c); | 1676 | commonCombo->setCurrentItem(c); |
1676 | } | 1677 | } |
1677 | } | 1678 | } |
1678 | 1679 | ||
1679 | void Konsole::setColor(int sess) | 1680 | void Konsole::setColor(int sess) |
1680 | { | 1681 | { |
1681 | Config cfg("Qkonsole"); | 1682 | Config cfg( "Konsole" ); |
1682 | cfg.setGroup("Colors"); | 1683 | cfg.setGroup("Colors"); |
1683 | QColor foreground, background; | 1684 | QColor foreground, background; |
1684 | QString ss = QString("Session") + QString::number(sess); | 1685 | QString ss = QString("Session") + QString::number(sess); |
1685 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, | 1686 | foreground.setRgb(cfg.readNumEntry("foregroundRed"+ss, |
1686 | cfg.readNumEntry("foregroundRed",0xff)), | 1687 | cfg.readNumEntry("foregroundRed",0xff)), |
1687 | cfg.readNumEntry("foregroundGreen"+ss, | 1688 | cfg.readNumEntry("foregroundGreen"+ss, |
1688 | cfg.readNumEntry("foregroundGreen",0xff)), | 1689 | cfg.readNumEntry("foregroundGreen",0xff)), |
1689 | cfg.readNumEntry("foregroundBlue"+ss, | 1690 | cfg.readNumEntry("foregroundBlue"+ss, |
1690 | cfg.readNumEntry("foregroundBlue",0xff))); | 1691 | cfg.readNumEntry("foregroundBlue",0xff))); |
1691 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, | 1692 | background.setRgb(cfg.readNumEntry("backgroundRed"+ss, |
1692 | cfg.readNumEntry("backgroundRed",0)), | 1693 | cfg.readNumEntry("backgroundRed",0)), |
1693 | cfg.readNumEntry("backgroundGreen"+ss, | 1694 | cfg.readNumEntry("backgroundGreen"+ss, |
1694 | cfg.readNumEntry("backgroundGreen",0)), | 1695 | cfg.readNumEntry("backgroundGreen",0)), |
1695 | cfg.readNumEntry("backgroundBlue"+ss, | 1696 | cfg.readNumEntry("backgroundBlue"+ss, |
1696 | cfg.readNumEntry("backgroundBlue",0))); | 1697 | cfg.readNumEntry("backgroundBlue",0))); |
1697 | setColors(foreground, background); | 1698 | setColors(foreground, background); |
1698 | } | 1699 | } |
1699 | 1700 | ||
1700 | void Konsole::scrollMenuSelected(int index) | 1701 | void Konsole::scrollMenuSelected(int index) |
1701 | { | 1702 | { |
1702 | // qDebug( "scrollbar menu %d",index); | 1703 | // qDebug( "scrollbar menu %d",index); |
1703 | 1704 | ||
1704 | TEWidget* te = getTe(); | 1705 | TEWidget* te = getTe(); |
1705 | Config cfg("Qkonsole"); | 1706 | Config cfg( "Konsole" ); |
1706 | cfg.setGroup("ScrollBar"); | 1707 | cfg.setGroup("ScrollBar"); |
1707 | 1708 | ||
1708 | if(index == sm_none) | 1709 | if(index == sm_none) |
1709 | { | 1710 | { |
1710 | te->setScrollbarLocation(0); | 1711 | te->setScrollbarLocation(0); |
1711 | cfg.writeEntry("Position",0); | 1712 | cfg.writeEntry("Position",0); |
1712 | } | 1713 | } |
1713 | else if(index == sm_left) | 1714 | else if(index == sm_left) |
1714 | { | 1715 | { |
1715 | te->setScrollbarLocation(1); | 1716 | te->setScrollbarLocation(1); |
1716 | cfg.writeEntry("Position",1); | 1717 | cfg.writeEntry("Position",1); |
1717 | } | 1718 | } |
1718 | else if(index == sm_right) | 1719 | else if(index == sm_right) |
1719 | { | 1720 | { |
1720 | te->setScrollbarLocation(2); | 1721 | te->setScrollbarLocation(2); |
1721 | cfg.writeEntry("Position",2); | 1722 | cfg.writeEntry("Position",2); |
1722 | } | 1723 | } |
1723 | scrollMenu->setItemChecked(sm_none, index == sm_none); | 1724 | scrollMenu->setItemChecked(sm_none, index == sm_none); |
1724 | scrollMenu->setItemChecked(sm_left, index == sm_left); | 1725 | scrollMenu->setItemChecked(sm_left, index == sm_left); |
1725 | scrollMenu->setItemChecked(sm_right, index == sm_right); | 1726 | scrollMenu->setItemChecked(sm_right, index == sm_right); |
1726 | } | 1727 | } |
1727 | 1728 | ||
1728 | // case -29: { | 1729 | // case -29: { |
1729 | // bool b=cfg.readBoolEntry("HorzScroll",0); | 1730 | // bool b=cfg.readBoolEntry("HorzScroll",0); |
1730 | // cfg.writeEntry("HorzScroll", !b ); | 1731 | // cfg.writeEntry("HorzScroll", !b ); |
1731 | // cfg.write(); | 1732 | // cfg.write(); |
1732 | // if(cfg.readNumEntry("Position",2) == 0) { | 1733 | // if(cfg.readNumEntry("Position",2) == 0) { |
1733 | // te->setScrollbarLocation(1); | 1734 | // te->setScrollbarLocation(1); |
1734 | // te->setWrapAt(0); | 1735 | // te->setWrapAt(0); |
1735 | // } else { | 1736 | // } else { |
1736 | // te->setScrollbarLocation(0); | 1737 | // te->setScrollbarLocation(0); |
1737 | // te->setWrapAt(120); | 1738 | // te->setWrapAt(120); |
1738 | // } | 1739 | // } |
1739 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); | 1740 | // te->setScrollbarLocation( cfg.readNumEntry("Position",2)); |
1740 | // } | 1741 | // } |
1741 | // break; | 1742 | // break; |
1742 | 1743 | ||
1743 | void Konsole::editCommandListMenuSelected(int iD) | 1744 | void Konsole::editCommandListMenuSelected(int iD) |
1744 | { | 1745 | { |
1745 | // QString temp; | 1746 | // QString temp; |
1746 | // qDebug( temp.sprintf("edit command list %d",iD)); | 1747 | // qDebug( temp.sprintf("edit command list %d",iD)); |
1747 | 1748 | ||
1748 | // FIXME: more cleanup needed here | 1749 | // FIXME: more cleanup needed here |
1749 | 1750 | ||
1750 | 1751 | ||
1751 | TEWidget* te = getTe(); | 1752 | TEWidget* te = getTe(); |
1752 | Config cfg("Qkonsole"); | 1753 | Config cfg( "Konsole" ); |
1753 | cfg.setGroup("Menubar"); | 1754 | cfg.setGroup("Menubar"); |
1754 | if( iD == ec_cmdlist) | 1755 | if( iD == ec_cmdlist) |
1755 | { | 1756 | { |
1756 | if(!secondToolBar->isHidden()) | 1757 | if(!secondToolBar->isHidden()) |
1757 | { | 1758 | { |
1758 | secondToolBar->hide(); | 1759 | secondToolBar->hide(); |
1759 | configMenu->changeItem( iD,tr( "Show Command List" )); | 1760 | configMenu->changeItem( iD,tr( "Show Command List" )); |
1760 | cfg.writeEntry("Hidden","TRUE"); | 1761 | cfg.writeEntry("Hidden","TRUE"); |
1761 | configMenu->setItemEnabled(ec_edit ,FALSE); | 1762 | configMenu->setItemEnabled(ec_edit ,FALSE); |
1762 | configMenu->setItemEnabled(ec_quick ,FALSE); | 1763 | configMenu->setItemEnabled(ec_quick ,FALSE); |
1763 | } | 1764 | } |
1764 | else | 1765 | else |
1765 | { | 1766 | { |
1766 | secondToolBar->show(); | 1767 | secondToolBar->show(); |
1767 | configMenu->changeItem( iD,tr( "Hide Command List" )); | 1768 | configMenu->changeItem( iD,tr( "Hide Command List" )); |
1768 | cfg.writeEntry("Hidden","FALSE"); | 1769 | cfg.writeEntry("Hidden","FALSE"); |
1769 | configMenu->setItemEnabled(ec_edit ,TRUE); | 1770 | configMenu->setItemEnabled(ec_edit ,TRUE); |
1770 | configMenu->setItemEnabled(ec_quick ,TRUE); | 1771 | configMenu->setItemEnabled(ec_quick ,TRUE); |
1771 | 1772 | ||
1772 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") | 1773 | if(cfg.readEntry("EditEnabled","FALSE")=="TRUE") |
1773 | { | 1774 | { |
1774 | configMenu->setItemChecked(ec_edit,TRUE); | 1775 | configMenu->setItemChecked(ec_edit,TRUE); |
1775 | commonCombo->setEditable( TRUE ); | 1776 | commonCombo->setEditable( TRUE ); |
1776 | } | 1777 | } |
1777 | else | 1778 | else |
1778 | { | 1779 | { |
1779 | configMenu->setItemChecked(ec_edit,FALSE); | 1780 | configMenu->setItemChecked(ec_edit,FALSE); |
1780 | commonCombo->setEditable( FALSE ); | 1781 | commonCombo->setEditable( FALSE ); |
1781 | } | 1782 | } |
1782 | } | 1783 | } |
1783 | } | 1784 | } |
1784 | if( iD == ec_quick) | 1785 | if( iD == ec_quick) |
1785 | { | 1786 | { |
1786 | cfg.setGroup("Commands"); | 1787 | cfg.setGroup("Commands"); |
1787 | // qDebug("enableCommandEdit"); | 1788 | // qDebug("enableCommandEdit"); |
1788 | if( !configMenu->isItemChecked(iD) ) | 1789 | if( !configMenu->isItemChecked(iD) ) |
1789 | { | 1790 | { |
1790 | commonCombo->setEditable( TRUE ); | 1791 | commonCombo->setEditable( TRUE ); |
1791 | configMenu->setItemChecked(iD,TRUE); | 1792 | configMenu->setItemChecked(iD,TRUE); |
1792 | commonCombo->setCurrentItem(0); | 1793 | commonCombo->setCurrentItem(0); |
1793 | cfg.writeEntry("EditEnabled","TRUE"); | 1794 | cfg.writeEntry("EditEnabled","TRUE"); |
1794 | } | 1795 | } |
1795 | else | 1796 | else |
1796 | { | 1797 | { |
1797 | commonCombo->setEditable( FALSE ); | 1798 | commonCombo->setEditable( FALSE ); |
1798 | configMenu->setItemChecked(iD,FALSE); | 1799 | configMenu->setItemChecked(iD,FALSE); |
1799 | cfg.writeEntry("EditEnabled","FALSE"); | 1800 | cfg.writeEntry("EditEnabled","FALSE"); |
1800 | commonCombo->setFocusPolicy(QWidget::NoFocus); | 1801 | commonCombo->setFocusPolicy(QWidget::NoFocus); |
@@ -1820,99 +1821,99 @@ void Konsole::setDocument( const QString &cmd) | |||
1820 | { | 1821 | { |
1821 | QString cmd2; | 1822 | QString cmd2; |
1822 | cmd2=cmd.right(cmd.length()-3)+" &"; | 1823 | cmd2=cmd.right(cmd.length()-3)+" &"; |
1823 | system(cmd2.latin1()); | 1824 | system(cmd2.latin1()); |
1824 | if(startUp <= 1 && nsessions < 2) | 1825 | if(startUp <= 1 && nsessions < 2) |
1825 | { | 1826 | { |
1826 | doneSession(getTe(), 0); | 1827 | doneSession(getTe(), 0); |
1827 | exit(0); | 1828 | exit(0); |
1828 | } | 1829 | } |
1829 | else | 1830 | else |
1830 | doneSession(getTe(), 0); | 1831 | doneSession(getTe(), 0); |
1831 | } | 1832 | } |
1832 | else | 1833 | else |
1833 | { | 1834 | { |
1834 | if (te != 0) | 1835 | if (te != 0) |
1835 | { | 1836 | { |
1836 | te->emitText(cmd+"\r"); | 1837 | te->emitText(cmd+"\r"); |
1837 | } | 1838 | } |
1838 | } | 1839 | } |
1839 | startUp++; | 1840 | startUp++; |
1840 | } | 1841 | } |
1841 | 1842 | ||
1842 | 1843 | ||
1843 | // what is the point of this when you can just | 1844 | // what is the point of this when you can just |
1844 | // run commands by using the shell directly?? | 1845 | // run commands by using the shell directly?? |
1845 | void Konsole::parseCommandLine() | 1846 | void Konsole::parseCommandLine() |
1846 | { | 1847 | { |
1847 | QString cmd; | 1848 | QString cmd; |
1848 | // newSession(); | 1849 | // newSession(); |
1849 | for (int i=1;i< qApp->argc();i++) | 1850 | for (int i=1;i< qApp->argc();i++) |
1850 | { | 1851 | { |
1851 | if( QString(qApp->argv()[i]) == "-e") | 1852 | if( QString(qApp->argv()[i]) == "-e") |
1852 | { | 1853 | { |
1853 | i++; | 1854 | i++; |
1854 | for ( int j=i;j< qApp->argc();j++) | 1855 | for ( int j=i;j< qApp->argc();j++) |
1855 | { | 1856 | { |
1856 | cmd+=QString(qApp->argv()[j])+" "; | 1857 | cmd+=QString(qApp->argv()[j])+" "; |
1857 | } | 1858 | } |
1858 | cmd.stripWhiteSpace(); | 1859 | cmd.stripWhiteSpace(); |
1859 | system(cmd.latin1()); | 1860 | system(cmd.latin1()); |
1860 | exit(0);//close(); | 1861 | exit(0);//close(); |
1861 | } // end -e switch | 1862 | } // end -e switch |
1862 | } | 1863 | } |
1863 | startUp++; | 1864 | startUp++; |
1864 | } | 1865 | } |
1865 | 1866 | ||
1866 | void Konsole::changeForegroundColor(const QColor &color) | 1867 | void Konsole::changeForegroundColor(const QColor &color) |
1867 | { | 1868 | { |
1868 | Config cfg("Qkonsole"); | 1869 | Config cfg( "Konsole" ); |
1869 | cfg.setGroup("Colors"); | 1870 | cfg.setGroup("Colors"); |
1870 | int r, g, b; | 1871 | int r, g, b; |
1871 | color.rgb(&r,&g,&b); | 1872 | color.rgb(&r,&g,&b); |
1872 | foreground.setRgb(r,g,b); | 1873 | foreground.setRgb(r,g,b); |
1873 | 1874 | ||
1874 | cfg.writeEntry("foreground",color.name()); | 1875 | cfg.writeEntry("foreground",color.name()); |
1875 | qDebug("foreground "+color.name()); | 1876 | qDebug("foreground "+color.name()); |
1876 | cfg.write(); | 1877 | cfg.write(); |
1877 | 1878 | ||
1878 | qDebug("do other dialog"); | 1879 | qDebug("do other dialog"); |
1879 | #ifdef QT_QWS_OPIE | 1880 | #ifdef QT_QWS_OPIE |
1880 | 1881 | ||
1881 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); | 1882 | Opie::OColorPopupMenu* penColorPopupMenu2 = new Opie::OColorPopupMenu(Qt::black, this,"background color"); |
1882 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, | 1883 | connect(penColorPopupMenu2, SIGNAL(colorSelected(const QColor&)), this, |
1883 | SLOT(changeBackgroundColor(const QColor&))); | 1884 | SLOT(changeBackgroundColor(const QColor&))); |
1884 | penColorPopupMenu2->exec(); | 1885 | penColorPopupMenu2->exec(); |
1885 | #endif | 1886 | #endif |
1886 | } | 1887 | } |
1887 | 1888 | ||
1888 | void Konsole::changeBackgroundColor(const QColor &color) | 1889 | void Konsole::changeBackgroundColor(const QColor &color) |
1889 | { | 1890 | { |
1890 | 1891 | ||
1891 | qDebug("Change background"); | 1892 | qDebug("Change background"); |
1892 | Config cfg("Qkonsole"); | 1893 | Config cfg( "Konsole" ); |
1893 | cfg.setGroup("Colors"); | 1894 | cfg.setGroup("Colors"); |
1894 | int r, g, b; | 1895 | int r, g, b; |
1895 | color.rgb(&r,&g,&b); | 1896 | color.rgb(&r,&g,&b); |
1896 | background.setRgb(r,g,b); | 1897 | background.setRgb(r,g,b); |
1897 | cfg.writeEntry("background",color.name()); | 1898 | cfg.writeEntry("background",color.name()); |
1898 | qDebug("background "+color.name()); | 1899 | qDebug("background "+color.name()); |
1899 | cfg.write(); | 1900 | cfg.write(); |
1900 | } | 1901 | } |
1901 | 1902 | ||
1902 | void Konsole::doWrap() | 1903 | void Konsole::doWrap() |
1903 | { | 1904 | { |
1904 | Config cfg("Qkonsole"); | 1905 | Config cfg( "Konsole" ); |
1905 | cfg.setGroup("ScrollBar"); | 1906 | cfg.setGroup("ScrollBar"); |
1906 | TEWidget* te = getTe(); | 1907 | TEWidget* te = getTe(); |
1907 | if( !cfg.readBoolEntry("HorzScroll",0)) | 1908 | if( !cfg.readBoolEntry("HorzScroll",0)) |
1908 | { | 1909 | { |
1909 | te->setWrapAt(0); | 1910 | te->setWrapAt(0); |
1910 | configMenu->setItemChecked( cm_wrap,TRUE); | 1911 | configMenu->setItemChecked( cm_wrap,TRUE); |
1911 | } | 1912 | } |
1912 | else | 1913 | else |
1913 | { | 1914 | { |
1914 | // te->setWrapAt(90); | 1915 | // te->setWrapAt(90); |
1915 | te->setWrapAt(120); | 1916 | te->setWrapAt(120); |
1916 | configMenu->setItemChecked( cm_wrap,FALSE); | 1917 | configMenu->setItemChecked( cm_wrap,FALSE); |
1917 | } | 1918 | } |
1918 | } | 1919 | } |