summaryrefslogtreecommitdiff
path: root/core/apps/embeddedkonsole/TEWidget.cpp
Unidiff
Diffstat (limited to 'core/apps/embeddedkonsole/TEWidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/apps/embeddedkonsole/TEWidget.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/core/apps/embeddedkonsole/TEWidget.cpp b/core/apps/embeddedkonsole/TEWidget.cpp
index f10bfb2..a56dc50 100644
--- a/core/apps/embeddedkonsole/TEWidget.cpp
+++ b/core/apps/embeddedkonsole/TEWidget.cpp
@@ -41,24 +41,25 @@
41 - 'font_a' not used in mouse events 41 - 'font_a' not used in mouse events
42 - add destructor 42 - add destructor
43*/ 43*/
44 44
45/* TODO 45/* TODO
46 - evtl. be sensitive to `paletteChange' while using default colors. 46 - evtl. be sensitive to `paletteChange' while using default colors.
47 - set different 'rounding' styles? I.e. have a mode to show clipped chars? 47 - set different 'rounding' styles? I.e. have a mode to show clipped chars?
48*/ 48*/
49 49
50// #include "config.h" 50// #include "config.h"
51#include "TEWidget.h" 51#include "TEWidget.h"
52#include "session.h" 52#include "session.h"
53#include <qpe/config.h>
53 54
54#include <qcursor.h> 55#include <qcursor.h>
55#include <qregexp.h> 56#include <qregexp.h>
56#include <qpainter.h> 57#include <qpainter.h>
57#include <qclipboard.h> 58#include <qclipboard.h>
58#include <qstyle.h> 59#include <qstyle.h>
59#include <qfile.h> 60#include <qfile.h>
60#include <qdragobject.h> 61#include <qdragobject.h>
61 62
62#include <stdio.h> 63#include <stdio.h>
63#include <stdlib.h> 64#include <stdlib.h>
64#include <unistd.h> 65#include <unistd.h>
@@ -143,25 +144,25 @@ const ColorEntry* TEWidget::getdefaultColorTable() const
143 144
144 145
145const QPixmap *TEWidget::backgroundPixmap() 146const QPixmap *TEWidget::backgroundPixmap()
146{ 147{
147 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm"); 148 static QPixmap *bg = new QPixmap("~/qpim/main/pics/faded_bg.xpm");
148 const QPixmap *pm = bg; 149 const QPixmap *pm = bg;
149 return pm; 150 return pm;
150} 151}
151 152
152void TEWidget::setColorTable(const ColorEntry table[]) 153void TEWidget::setColorTable(const ColorEntry table[])
153{ 154{
154 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; 155 for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i];
155 156
156 const QPixmap* pm = backgroundPixmap(); 157 const QPixmap* pm = backgroundPixmap();
157 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); 158 if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color);
158 update(); 159 update();
159} 160}
160 161
161//FIXME: add backgroundPixmapChanged. 162//FIXME: add backgroundPixmapChanged.
162 163
163/* ------------------------------------------------------------------------- */ 164/* ------------------------------------------------------------------------- */
164/* */ 165/* */
165/* Font */ 166/* Font */
166/* */ 167/* */
167/* ------------------------------------------------------------------------- */ 168/* ------------------------------------------------------------------------- */
@@ -276,25 +277,38 @@ void TEWidget::setFont(const QFont &)
276 277
277TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) 278TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name)
278{ 279{
279#ifndef QT_NO_CLIPBOARD 280#ifndef QT_NO_CLIPBOARD
280 cb = QApplication::clipboard(); 281 cb = QApplication::clipboard();
281 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()), 282 QObject::connect( (QObject*)cb, SIGNAL(dataChanged()),
282 this, SLOT(onClearSelection()) ); 283 this, SLOT(onClearSelection()) );
283#endif 284#endif
284 285
285 scrollbar = new QScrollBar(this); 286 scrollbar = new QScrollBar(this);
286 scrollbar->setCursor( arrowCursor ); 287 scrollbar->setCursor( arrowCursor );
287 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); 288 connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int)));
288 scrollLoc = SCRNONE; 289
290 Config cfg("Konsole");
291 cfg.setGroup("ScrollBar");
292 switch( cfg.readNumEntry("Position",2)){
293 case 0:
294 scrollLoc = SCRNONE;
295 break;
296 case 1:
297 scrollLoc = SCRLEFT;
298 break;
299 case 2:
300 scrollLoc = SCRRIGHT;
301 break;
302 };
289 303
290 blinkT = new QTimer(this); 304 blinkT = new QTimer(this);
291 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); 305 connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent()));
292 // blinking = FALSE; 306 // blinking = FALSE;
293 blinking = TRUE; 307 blinking = TRUE;
294 308
295 resizing = FALSE; 309 resizing = FALSE;
296 actSel = 0; 310 actSel = 0;
297 image = 0; 311 image = 0;
298 lines = 1; 312 lines = 1;
299 columns = 1; 313 columns = 1;
300 font_w = 1; 314 font_w = 1;
@@ -642,25 +656,25 @@ void TEWidget::mousePressEvent(QMouseEvent* ev)
642//printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY); 656//printf("press top left [%d,%d] by=%d\n",tLx,tLy, bY);
643 if ( ev->button() == LeftButton) 657 if ( ev->button() == LeftButton)
644 { 658 {
645 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h); 659 QPoint pos = QPoint((ev->x()-tLx-blX)/font_w,(ev->y()-tLy-bY)/font_h);
646 660
647 if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ; 661 if ( ev->state() & ControlButton ) preserve_line_breaks = FALSE ;
648 662
649 if (mouse_marks || (ev->state() & ShiftButton)) 663 if (mouse_marks || (ev->state() & ShiftButton))
650 { 664 {
651 emit clearSelectionSignal(); 665 emit clearSelectionSignal();
652 iPntSel = pntSel = pos; 666 iPntSel = pntSel = pos;
653 actSel = 1; // left mouse button pressed but nothing selected yet. 667 actSel = 1; // left mouse button pressed but nothing selected yet.
654 grabMouse( /*crossCursor*/ ); // handle with care! 668 grabMouse( /*crossCursor*/ ); // handle with care!
655 } 669 }
656 else 670 else
657 { 671 {
658 emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button 672 emit mouseSignal( 0, pos.x() + 1, pos.y() + 1 ); // left button
659 } 673 }
660 } 674 }
661 if ( ev->button() == MidButton ) 675 if ( ev->button() == MidButton )
662 { 676 {
663 emitSelection(); 677 emitSelection();
664 } 678 }
665 if ( ev->button() == RightButton ) // Configure 679 if ( ev->button() == RightButton ) // Configure
666 { 680 {