summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/mainwindow.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp41
1 files changed, 41 insertions, 0 deletions
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
@@ -60,24 +60,25 @@ void MainWindow::initUI() {
60 60
61 setToolBarsMovable( FALSE ); 61 setToolBarsMovable( FALSE );
62 62
63 /* tool bar for the menu */ 63 /* tool bar for the menu */
64 m_tool = new QToolBar( this ); 64 m_tool = new QToolBar( this );
65 m_tool->setHorizontalStretchable( TRUE ); 65 m_tool->setHorizontalStretchable( TRUE );
66 66
67 m_bar = new QMenuBar( m_tool ); 67 m_bar = new QMenuBar( m_tool );
68 m_console = new QPopupMenu( this ); 68 m_console = new QPopupMenu( this );
69 m_scripts = new QPopupMenu( this ); 69 m_scripts = new QPopupMenu( this );
70 m_sessionsPop= new QPopupMenu( this ); 70 m_sessionsPop= new QPopupMenu( this );
71 m_scriptsPop = new QPopupMenu( this ); 71 m_scriptsPop = new QPopupMenu( this );
72 m_scrollbar = new QPopupMenu( this );
72 73
73 /* add a toolbar for icons */ 74 /* add a toolbar for icons */
74 m_icons = new QToolBar(this); 75 m_icons = new QToolBar(this);
75 76
76 /* 77 /*
77 * the settings action 78 * the settings action
78 */ 79 */
79 m_setProfiles = new QAction(tr("Configure Profiles"), 80 m_setProfiles = new QAction(tr("Configure Profiles"),
80 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ), 81 Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
81 QString::null, 0, this, 0); 82 QString::null, 0, this, 0);
82 m_setProfiles->addTo( m_console ); 83 m_setProfiles->addTo( m_console );
83 connect( m_setProfiles, SIGNAL(activated() ), 84 connect( m_setProfiles, SIGNAL(activated() ),
@@ -155,24 +156,35 @@ void MainWindow::initUI() {
155 156
156 /* 157 /*
157 * fullscreen 158 * fullscreen
158 */ 159 */
159 m_isFullscreen = false; 160 m_isFullscreen = false;
160 161
161 m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen", 162 m_fullscreen = new QAction( tr("Full screen"), Opie::Core::OResource::loadPixmap( "fullscreen",
162 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 ); 163 Opie::Core::OResource::SmallIcon ), QString::null, 0, this, 0 );
163 m_fullscreen->addTo( m_console ); 164 m_fullscreen->addTo( m_console );
164 connect( m_fullscreen, SIGNAL( activated() ), 165 connect( m_fullscreen, SIGNAL( activated() ),
165 this, SLOT( slotFullscreen() ) ); 166 this, SLOT( slotFullscreen() ) );
166 167
168 /*
169 * scrollbar
170 */
171 sm_none = m_scrollbar->insertItem(tr( "None" ));
172 sm_left = m_scrollbar->insertItem(tr( "Left" ));
173 sm_right = m_scrollbar->insertItem(tr( "Right" ));
174
175 m_console->insertItem(tr("Scrollbar"), m_scrollbar, -1, 0);
176 connect( m_scrollbar, SIGNAL(activated(int)),
177 this, SLOT(slotScrollbarSelected(int)));
178
167 m_console->insertSeparator(); 179 m_console->insertSeparator();
168 180
169 m_recordLog = new QAction(); 181 m_recordLog = new QAction();
170 m_recordLog->setText( tr("Start log") ); 182 m_recordLog->setText( tr("Start log") );
171 m_recordLog->addTo( m_console ); 183 m_recordLog->addTo( m_console );
172 connect(m_recordLog, SIGNAL(activated() ), 184 connect(m_recordLog, SIGNAL(activated() ),
173 this, SLOT( slotSaveLog() ) ); 185 this, SLOT( slotSaveLog() ) );
174 m_recordingLog = false; 186 m_recordingLog = false;
175 187
176 QAction *a = new QAction(); 188 QAction *a = new QAction();
177 a->setText( tr("Save history") ); 189 a->setText( tr("Save history") );
178 a->addTo( m_console ); 190 a->addTo( m_console );
@@ -684,24 +696,53 @@ void MainWindow::slotFullscreen() {
684 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); 696 ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() );
685 ( m_curSession->widgetStack() )->setFocus(); 697 ( m_curSession->widgetStack() )->setFocus();
686 ( m_curSession->widgetStack() )->show(); 698 ( m_curSession->widgetStack() )->show();
687 699
688 ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); 700 ( ( m_curSession->emulationHandler() )->cornerButton() )->show();
689 701
690 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 702 connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
691 } 703 }
692 704
693 m_isFullscreen = !m_isFullscreen; 705 m_isFullscreen = !m_isFullscreen;
694} 706}
695 707
708void MainWindow::slotScrollbarSelected(int index)
709{
710 int loc;
711
712 Config cfg( "Konsole" );
713 cfg.setGroup("ScrollBar");
714 if(index == sm_none)
715 {
716 loc = 0;
717 }
718 else if(index == sm_left)
719 {
720 loc = 1;
721 }
722 else if(index == sm_right)
723 {
724 loc = 2;
725 }
726
727 cfg.writeEntry("Position", loc);
728
729 if (currentSession()) {
730 currentSession()->emulationHandler()->setScrollbarLocation(loc);
731 }
732
733 m_scrollbar->setItemChecked(sm_none, index == sm_none);
734 m_scrollbar->setItemChecked(sm_left, index == sm_left);
735 m_scrollbar->setItemChecked(sm_right, index == sm_right);
736}
696 737
697void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { 738void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) {
698 739
699 if ( m_curSession ) { 740 if ( m_curSession ) {
700 741
701 QEvent::Type state; 742 QEvent::Type state;
702 743
703 if (pressed) state = QEvent::KeyPress; 744 if (pressed) state = QEvent::KeyPress;
704 else state = QEvent::KeyRelease; 745 else state = QEvent::KeyRelease;
705 746
706 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); 747 QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode)));
707 748