From b7426bf997b8201667cecb0f66470e257b35ba60 Mon Sep 17 00:00:00 2001 From: llornkcor Date: Sun, 03 Feb 2002 15:33:27 +0000 Subject: re-introduced vert scrollbar, with position options --- 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 @@ -50,6 +50,7 @@ // #include "config.h" #include "TEWidget.h" #include "session.h" +#include #include #include @@ -152,7 +153,7 @@ const QPixmap *TEWidget::backgroundPixmap() void TEWidget::setColorTable(const ColorEntry table[]) { for (int i = 0; i < TABLE_COLORS; i++) color_table[i] = table[i]; - + const QPixmap* pm = backgroundPixmap(); if (!pm) setBackgroundColor(color_table[DEFAULT_BACK_COLOR].color); update(); @@ -285,7 +286,20 @@ TEWidget::TEWidget(QWidget *parent, const char *name) : QFrame(parent,name) scrollbar = new QScrollBar(this); scrollbar->setCursor( arrowCursor ); connect(scrollbar, SIGNAL(valueChanged(int)), this, SLOT(scrollChanged(int))); - scrollLoc = SCRNONE; + + Config cfg("Konsole"); + cfg.setGroup("ScrollBar"); + switch( cfg.readNumEntry("Position",2)){ + case 0: + scrollLoc = SCRNONE; + break; + case 1: + scrollLoc = SCRLEFT; + break; + case 2: + scrollLoc = SCRRIGHT; + break; + }; blinkT = new QTimer(this); connect(blinkT, SIGNAL(timeout()), this, SLOT(blinkEvent())); @@ -651,7 +665,7 @@ void TEWidget::mousePressEvent(QMouseEvent* ev) emit clearSelectionSignal(); iPntSel = pntSel = pos; actSel = 1; // left mouse button pressed but nothing selected yet. - grabMouse( /*crossCursor*/ ); // handle with care! + grabMouse( /*crossCursor*/ ); // handle with care! } else { diff --git a/core/apps/embeddedkonsole/konsole.cpp b/core/apps/embeddedkonsole/konsole.cpp index d54fa1f..e2d4886 100644 --- a/core/apps/embeddedkonsole/konsole.cpp +++ b/core/apps/embeddedkonsole/konsole.cpp @@ -224,7 +224,8 @@ void Konsole::init(const char* _pgm, QStrList & _args) configMenu = new QPopupMenu( this); colorMenu = new QPopupMenu( this); - + scrollMenu = new QPopupMenu( this); + bool listHidden; cfg.setGroup("Menubar"); if( cfg.readEntry("Hidden","FALSE") == "TRUE") { @@ -263,6 +264,7 @@ void Konsole::init(const char* _pgm, QStrList & _args) connect( fontList, SIGNAL( activated(int) ), this, SLOT( fontChanged(int) )); connect( configMenu, SIGNAL( activated(int) ), this, SLOT( configMenuSelected(int) )); connect( colorMenu, SIGNAL( activated(int) ), this, SLOT( colorMenuSelected(int) )); + connect( scrollMenu, SIGNAL(activated(int)),this,SLOT(scrollMenuSelected(int))); menuBar->insertItem( tr("Font"), fontList ); menuBar->insertItem( tr("Options"), configMenu ); @@ -316,6 +318,11 @@ void Konsole::init(const char* _pgm, QStrList & _args) connect( commonCombo, SIGNAL( activated(int) ), this, SLOT( enterCommand(int) )); + scrollMenu->insertItem("None"); + scrollMenu->insertItem("Left"); + scrollMenu->insertItem("Right"); + configMenu->insertItem("ScrollBar",scrollMenu); + // create applications ///////////////////////////////////////////////////// setCentralWidget(tab); @@ -763,3 +770,25 @@ void Konsole::setColor() if(scheme != 1) colorMenuSelected( -scheme); } + +void Konsole::scrollMenuSelected(int index) +{ + TEWidget* te = getTe(); +Config cfg("Konsole"); + cfg.setGroup("Scrollbar"); + switch( index){ + case -21: + te->setScrollbarLocation(0); + cfg.writeEntry("Position",0); + break; + case -22: + te->setScrollbarLocation(1); + cfg.writeEntry("Position",1); + break; + case -23: + te->setScrollbarLocation(2); + cfg.writeEntry("Position",2); + break; + }; + +} diff --git a/core/apps/embeddedkonsole/konsole.h b/core/apps/embeddedkonsole/konsole.h index 40003d4..b4e5d87 100644 --- a/core/apps/embeddedkonsole/konsole.h +++ b/core/apps/embeddedkonsole/konsole.h @@ -70,7 +70,7 @@ private slots: void switchSession(QWidget *); void newSession(); void changeCommand(const QString &, int); - + void scrollMenuSelected(int); private: void init(const char* _pgm, QStrList & _args); void initSession(const char* _pgm, QStrList & _args); @@ -112,7 +112,7 @@ private: QCString se_pgm; QStrList se_args; - QPopupMenu* fontList,*configMenu,*colorMenu; + QPopupMenu* fontList,*configMenu,*colorMenu,*scrollMenu; QComboBox *commonCombo; // history scrolling I think bool b_scroll; -- cgit v0.9.0.2