author | hrw <hrw> | 2005-10-12 21:05:47 (UTC) |
---|---|---|
committer | hrw <hrw> | 2005-10-12 21:05:47 (UTC) |
commit | 6d3c752d2e93f5a43a4b5156f9968e07b3144c0a (patch) (side-by-side diff) | |
tree | 0bdc7f3c4db68a21c266993a96bc428dc96bcbfa /noncore | |
parent | d5beae7038e36633480cc3e17134a85b6d68fbc7 (diff) | |
download | opie-6d3c752d2e93f5a43a4b5156f9968e07b3144c0a.zip opie-6d3c752d2e93f5a43a4b5156f9968e07b3144c0a.tar.gz opie-6d3c752d2e93f5a43a4b5156f9968e07b3144c0a.tar.bz2 |
fixed bug #1686: opie-console lack U I setting for switching scrollbar
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/emulation_handler.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 41 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.h | 9 |
4 files changed, 54 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/emulation_handler.cpp b/noncore/apps/opie-console/emulation_handler.cpp index 2087f57..d5a435e 100644 --- a/noncore/apps/opie-console/emulation_handler.cpp +++ b/noncore/apps/opie-console/emulation_handler.cpp @@ -247,6 +247,9 @@ void EmulationHandler::paste() { } void EmulationHandler::setWrap(int columns) { m_teWid->setWrapAt(columns); } +void EmulationHandler::setScrollbarLocation(int index) { + m_teWid->setScrollbarLocation(index); +} diff --git a/noncore/apps/opie-console/emulation_handler.h b/noncore/apps/opie-console/emulation_handler.h index 1092c82..dabdb15 100644 --- a/noncore/apps/opie-console/emulation_handler.h +++ b/noncore/apps/opie-console/emulation_handler.h @@ -80,12 +80,13 @@ public: /* Run a script by forwarding its keys to the EmulationLayer */ void runScript(const Script *); /* Propagate change to widget */ void setWrap(int columns); + void setScrollbarLocation(int index); signals: void send( const QByteArray& ); void changeSize(int rows, int cols ); public slots: diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 45a662c..18c0434 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -66,12 +66,13 @@ void MainWindow::initUI() { m_bar = new QMenuBar( m_tool ); m_console = new QPopupMenu( this ); m_scripts = new QPopupMenu( this ); m_sessionsPop= new QPopupMenu( this ); m_scriptsPop = new QPopupMenu( this ); + m_scrollbar = new QPopupMenu( this ); /* add a toolbar for icons */ m_icons = new QToolBar(this); /* * the settings action @@ -161,12 +162,23 @@ void MainWindow::initUI() { m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen", Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); m_fullscreen->addTo( m_console ); connect( m_fullscreen, SIGNAL( activated() ), this, SLOT( slotFullscreen() ) ); + /* + * scrollbar + */ + sm_none = m_scrollbar->insertItem(tr( "None" )); + sm_left = m_scrollbar->insertItem(tr( "Left" )); + sm_right = m_scrollbar->insertItem(tr( "Right" )); + + m_console->insertItem(tr("Scrollbar"), m_scrollbar, -1, 0); + connect( m_scrollbar, SIGNAL(activated(int)), + this, SLOT(slotScrollbarSelected(int))); + m_console->insertSeparator(); m_recordLog = new QAction(); m_recordLog->setText( tr("Start log") ); m_recordLog->addTo( m_console ); connect(m_recordLog, SIGNAL(activated() ), @@ -690,12 +702,41 @@ void MainWindow::slotFullscreen() { connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); } m_isFullscreen = !m_isFullscreen; } +void MainWindow::slotScrollbarSelected(int index) +{ + int loc; + + Config cfg( "Konsole" ); + cfg.setGroup("ScrollBar"); + if(index == sm_none) + { + loc = 0; + } + else if(index == sm_left) + { + loc = 1; + } + else if(index == sm_right) + { + loc = 2; + } + + cfg.writeEntry("Position", loc); + + if (currentSession()) { + currentSession()->emulationHandler()->setScrollbarLocation(loc); + } + + m_scrollbar->setItemChecked(sm_none, index == sm_none); + m_scrollbar->setItemChecked(sm_left, index == sm_left); + m_scrollbar->setItemChecked(sm_right, index == sm_right); +} void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { if ( m_curSession ) { QEvent::Type state; diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h index f3c8b81..abdf6ee 100644 --- a/noncore/apps/opie-console/mainwindow.h +++ b/noncore/apps/opie-console/mainwindow.h @@ -21,12 +21,13 @@ class TabWidget; class ProfileManager; class Profile; class FunctionKeyboard; class FKey; class DocLnk; + class MainWindow : public QMainWindow { Q_OBJECT public: MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 ); ~MainWindow(); static QString appName() {return QString::fromLatin1("opie-console"); } @@ -72,12 +73,13 @@ private slots: void slotQuickLaunch(); void slotWrap(); void slotSessionChanged( Session* ); void slotKeyReceived(FKey, ushort, ushort, bool); void slotSaveHistory(); void slotSaveLog(); + void slotScrollbarSelected(int); /* what could these both slot do? */ void slotCopy(); void slotPaste(); /* save the currentSession() to Profiles */ @@ -102,22 +104,29 @@ private: /** * the metafactory */ MetaFactory* m_factory; ProfileManager* m_manager; + /* + * scrollbar + */ + + int sm_none, sm_left, sm_right; + TabWidget* m_consoleWindow; QToolBar* m_tool; QToolBar* m_icons; QToolBar* m_keyBar; QToolBar* m_buttonBar; QMenuBar* m_bar; QPopupMenu* m_console; QPopupMenu* m_sessionsPop; QPopupMenu* m_scriptsPop; QPopupMenu* m_scripts; + QPopupMenu* m_scrollbar; QAction* m_connect; QAction* m_disconnect; QAction* m_quickLaunch; QAction* m_terminate; QAction* m_transfer; QAction* m_setProfiles; |