Diffstat (limited to 'noncore/apps/opie-console/mainwindow.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 88727e4..2a4d069 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,22 +1,25 @@ | |||
1 | 1 | ||
2 | #include <qaction.h> | 2 | #include <qaction.h> |
3 | #include <qmenubar.h> | 3 | #include <qmenubar.h> |
4 | #include <qlabel.h> | 4 | #include <qlabel.h> |
5 | #include <qpopupmenu.h> | 5 | #include <qpopupmenu.h> |
6 | #include <qtoolbar.h> | 6 | #include <qtoolbar.h> |
7 | #include <qpe/resource.h> | ||
8 | |||
7 | 9 | ||
8 | #include "profileeditordialog.h" | 10 | #include "profileeditordialog.h" |
9 | #include "configdialog.h" | 11 | #include "configdialog.h" |
10 | #include "default.h" | 12 | #include "default.h" |
11 | #include "metafactory.h" | 13 | #include "metafactory.h" |
12 | #include "profile.h" | 14 | #include "profile.h" |
13 | #include "profilemanager.h" | 15 | #include "profilemanager.h" |
14 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
15 | #include "tabwidget.h" | 17 | #include "tabwidget.h" |
16 | #include "transferdialog.h" | 18 | #include "transferdialog.h" |
19 | #include "function_keyboard.h" | ||
17 | 20 | ||
18 | MainWindow::MainWindow() { | 21 | MainWindow::MainWindow() { |
19 | m_factory = new MetaFactory(); | 22 | m_factory = new MetaFactory(); |
20 | Default def(m_factory); | 23 | Default def(m_factory); |
21 | m_sessions.setAutoDelete( TRUE ); | 24 | m_sessions.setAutoDelete( TRUE ); |
22 | m_curSession = 0; | 25 | m_curSession = 0; |
@@ -26,20 +29,25 @@ MainWindow::MainWindow() { | |||
26 | initUI(); | 29 | initUI(); |
27 | populateProfiles(); | 30 | populateProfiles(); |
28 | } | 31 | } |
29 | void MainWindow::initUI() { | 32 | void MainWindow::initUI() { |
30 | setToolBarsMovable( FALSE ); | 33 | setToolBarsMovable( FALSE ); |
31 | 34 | ||
35 | /* tool bar for the menu */ | ||
32 | m_tool = new QToolBar( this ); | 36 | m_tool = new QToolBar( this ); |
33 | m_tool->setHorizontalStretchable( TRUE ); | 37 | m_tool->setHorizontalStretchable( TRUE ); |
34 | 38 | ||
35 | m_bar = new QMenuBar( m_tool ); | 39 | m_bar = new QMenuBar( m_tool ); |
36 | m_console = new QPopupMenu( this ); | 40 | m_console = new QPopupMenu( this ); |
37 | m_sessionsPop= new QPopupMenu( this ); | 41 | m_sessionsPop= new QPopupMenu( this ); |
38 | m_settings = new QPopupMenu( this ); | 42 | m_settings = new QPopupMenu( this ); |
39 | 43 | ||
44 | /* add a toolbar for icons */ | ||
45 | m_icons = new QToolBar(this); | ||
46 | m_icons->setHorizontalStretchable( TRUE ); | ||
47 | |||
40 | /* | 48 | /* |
41 | * new Action for new sessions | 49 | * new Action for new sessions |
42 | */ | 50 | */ |
43 | QAction* a = new QAction(); | 51 | QAction* a = new QAction(); |
44 | a->setText( tr("New Connection") ); | 52 | a->setText( tr("New Connection") ); |
45 | a->addTo( m_console ); | 53 | a->addTo( m_console ); |
@@ -91,22 +99,44 @@ void MainWindow::initUI() { | |||
91 | m_setProfiles = new QAction(); | 99 | m_setProfiles = new QAction(); |
92 | m_setProfiles->setText( tr("Configure Profiles") ); | 100 | m_setProfiles->setText( tr("Configure Profiles") ); |
93 | m_setProfiles->addTo( m_settings ); | 101 | m_setProfiles->addTo( m_settings ); |
94 | connect( m_setProfiles, SIGNAL(activated() ), | 102 | connect( m_setProfiles, SIGNAL(activated() ), |
95 | this, SLOT(slotConfigure() ) ); | 103 | this, SLOT(slotConfigure() ) ); |
96 | 104 | ||
105 | /* | ||
106 | * action that open/closes the keyboard | ||
107 | */ | ||
108 | m_openKeys = new QAction ("Keyboard...", | ||
109 | Resource::loadPixmap( "down" ), | ||
110 | QString::null, 0, this, 0); | ||
111 | |||
112 | m_openKeys->setToggleAction(true); | ||
113 | |||
114 | connect (m_openKeys, SIGNAL(toggled(bool)), | ||
115 | this, SLOT(slotOpenKeb(bool))); | ||
116 | m_openKeys->addTo(m_icons); | ||
117 | |||
118 | |||
97 | /* insert the submenu */ | 119 | /* insert the submenu */ |
98 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 120 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
99 | -1, 0); | 121 | -1, 0); |
100 | 122 | ||
101 | /* insert the connection menu */ | 123 | /* insert the connection menu */ |
102 | m_bar->insertItem( tr("Connection"), m_console ); | 124 | m_bar->insertItem( tr("Connection"), m_console ); |
103 | 125 | ||
104 | /* the settings menu */ | 126 | /* the settings menu */ |
105 | m_bar->insertItem( tr("Settings"), m_settings ); | 127 | m_bar->insertItem( tr("Settings"), m_settings ); |
106 | 128 | ||
129 | /* and the keyboard */ | ||
130 | m_keyBar = new QToolBar(this); | ||
131 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | ||
132 | m_keyBar->setHorizontalStretchable( TRUE ); | ||
133 | m_keyBar->hide(); | ||
134 | |||
135 | m_kb = new FunctionKeyboard(m_keyBar); | ||
136 | |||
107 | /* | 137 | /* |
108 | * connect to the menu activation | 138 | * connect to the menu activation |
109 | */ | 139 | */ |
110 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 140 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
111 | this, SLOT(slotProfile( int ) ) ); | 141 | this, SLOT(slotProfile( int ) ) ); |
112 | 142 | ||
@@ -230,6 +260,13 @@ void MainWindow::slotTransfer() | |||
230 | TransferDialog dlg(this); | 260 | TransferDialog dlg(this); |
231 | dlg.showMaximized(); | 261 | dlg.showMaximized(); |
232 | dlg.exec(); | 262 | dlg.exec(); |
233 | } | 263 | } |
234 | } | 264 | } |
235 | 265 | ||
266 | |||
267 | void MainWindow::slotOpenKeb(bool state) { | ||
268 | |||
269 | if (state) m_keyBar->show(); | ||
270 | else m_keyBar->hide(); | ||
271 | |||
272 | } | ||