summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp18
-rw-r--r--noncore/apps/opie-console/mainwindow.h2
-rw-r--r--noncore/apps/opie-console/opie-console.control2
3 files changed, 11 insertions, 11 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 9ccefa0..5295600 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -1,245 +1,246 @@
1#include <assert.h> 1#include <assert.h>
2 2
3 3
4 4
5#include <qaction.h> 5#include <qaction.h>
6#include <qmenubar.h> 6#include <qmenubar.h>
7#include <qlabel.h> 7#include <qlabel.h>
8#include <qpopupmenu.h> 8#include <qpopupmenu.h>
9#include <qtoolbar.h> 9#include <qtoolbar.h>
10#include <qmessagebox.h> 10#include <qmessagebox.h>
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qwhatsthis.h>
12 13
13#include <qpe/resource.h> 14#include <qpe/resource.h>
14#include <opie/ofiledialog.h> 15#include <opie/ofiledialog.h>
15 16
16 17
17#include "keytrans.h" 18#include "keytrans.h"
18#include "profileeditordialog.h" 19#include "profileeditordialog.h"
19#include "configdialog.h" 20#include "configdialog.h"
20#include "default.h" 21#include "default.h"
21#include "metafactory.h" 22#include "metafactory.h"
22#include "profile.h" 23#include "profile.h"
23#include "profilemanager.h" 24#include "profilemanager.h"
24#include "mainwindow.h" 25#include "mainwindow.h"
25#include "tabwidget.h" 26#include "tabwidget.h"
26#include "transferdialog.h" 27#include "transferdialog.h"
27#include "function_keyboard.h" 28#include "function_keyboard.h"
28#include "script.h" 29#include "script.h"
29 30
30 31
31 32
32static char * menu_xpm[] = { 33static char * menu_xpm[] = {
33"12 12 5 1", 34"12 12 5 1",
34 " c None", 35 " c None",
35 ".c #000000", 36 ".c #000000",
36 "+c #FFFDAD", 37 "+c #FFFDAD",
37 "@c #FFFF00", 38 "@c #FFFF00",
38 "#c #E5E100", 39 "#c #E5E100",
39" ", 40" ",
40" ", 41" ",
41" ......... ", 42" ......... ",
42" .+++++++. ", 43" .+++++++. ",
43" .+@@@@#. ", 44" .+@@@@#. ",
44" .+@@@#. ", 45" .+@@@#. ",
45" .+@@#. ", 46" .+@@#. ",
46" .+@#. ", 47" .+@#. ",
47" .+#. ", 48" .+#. ",
48" .+. ", 49" .+. ",
49" .. ", 50" .. ",
50" "}; 51" "};
51 52
52 53
53MainWindow::MainWindow() { 54MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
54 KeyTrans::loadAll(); 55 KeyTrans::loadAll();
55 for (int i = 0; i < KeyTrans::count(); i++ ) { 56 for (int i = 0; i < KeyTrans::count(); i++ ) {
56 KeyTrans* s = KeyTrans::find(i ); 57 KeyTrans* s = KeyTrans::find(i );
57 assert( s ); 58 assert( s );
58 } 59 }
59 m_factory = new MetaFactory(); 60 m_factory = new MetaFactory();
60 Default def(m_factory); 61 Default def(m_factory);
61 m_sessions.setAutoDelete( TRUE ); 62 m_sessions.setAutoDelete( TRUE );
62 m_curSession = 0; 63 m_curSession = 0;
63 m_manager = new ProfileManager( m_factory ); 64 m_manager = new ProfileManager( m_factory );
64 m_manager->load(); 65 m_manager->load();
65 66
66 initUI(); 67 initUI();
67 populateProfiles(); 68 populateProfiles();
68} 69}
69void MainWindow::initUI() { 70void MainWindow::initUI() {
70 setToolBarsMovable( FALSE ); 71 setToolBarsMovable( FALSE );
71 72
72 /* tool bar for the menu */ 73 /* tool bar for the menu */
73 m_tool = new QToolBar( this ); 74 m_tool = new QToolBar( this );
74 m_tool->setHorizontalStretchable( TRUE ); 75 m_tool->setHorizontalStretchable( TRUE );
75 76
76 m_bar = new QMenuBar( m_tool ); 77 m_bar = new QMenuBar( m_tool );
77 m_console = new QPopupMenu( this ); 78 m_console = new QPopupMenu( this );
78 m_scripts = new QPopupMenu( this ); 79 m_scripts = new QPopupMenu( this );
79 m_sessionsPop= new QPopupMenu( this ); 80 m_sessionsPop= new QPopupMenu( this );
80 m_settings = new QPopupMenu( this ); 81 m_settings = new QPopupMenu( this );
81 82
82 /* add a toolbar for icons */ 83 /* add a toolbar for icons */
83 m_icons = new QToolBar(this); 84 m_icons = new QToolBar(this);
84 85
85 /* 86 /*
86 * new Action for new sessions 87 * new Action for new sessions
87 */ 88 */
88 QAction* a = new QAction(tr("New Connection"), 89 QAction* a = new QAction(tr("New Connection"),
89 Resource::loadPixmap( "new" ), 90 Resource::loadPixmap( "new" ),
90 QString::null, 0, this, 0); 91 QString::null, 0, this, 0);
91 a->addTo( m_console ); 92 a->addTo( m_console );
92 a->addTo( m_icons ); 93 a->addTo( m_icons );
93 connect(a, SIGNAL(activated() ), 94 connect(a, SIGNAL(activated() ),
94 this, SLOT(slotNew() ) ); 95 this, SLOT(slotNew() ) );
95 96
96 /* 97 /*
97 * connect action 98 * connect action
98 */ 99 */
99 m_connect = new QAction(); 100 m_connect = new QAction();
100 m_connect->setText( tr("Connect") ); 101 m_connect->setText( tr("Connect") );
101 m_connect->addTo( m_console ); 102 m_connect->addTo( m_console );
102 connect(m_connect, SIGNAL(activated() ), 103 connect(m_connect, SIGNAL(activated() ),
103 this, SLOT(slotConnect() ) ); 104 this, SLOT(slotConnect() ) );
104 105
105 /* 106 /*
106 * disconnect action 107 * disconnect action
107 */ 108 */
108 m_disconnect = new QAction(); 109 m_disconnect = new QAction();
109 m_disconnect->setText( tr("Disconnect") ); 110 m_disconnect->setText( tr("Disconnect") );
110 m_disconnect->addTo( m_console ); 111 m_disconnect->addTo( m_console );
111 connect(m_disconnect, SIGNAL(activated() ), 112 connect(m_disconnect, SIGNAL(activated() ),
112 this, SLOT(slotDisconnect() ) ); 113 this, SLOT(slotDisconnect() ) );
113 114
114 m_transfer = new QAction(); 115 m_transfer = new QAction();
115 m_transfer->setText( tr("Transfer file...") ); 116 m_transfer->setText( tr("Transfer file...") );
116 m_transfer->addTo( m_console ); 117 m_transfer->addTo( m_console );
117 connect(m_transfer, SIGNAL(activated() ), 118 connect(m_transfer, SIGNAL(activated() ),
118 this, SLOT(slotTransfer() ) ); 119 this, SLOT(slotTransfer() ) );
119 120
120 121
121 /* 122 /*
122 * fullscreen 123 * fullscreen
123 */ 124 */
124 m_isFullscreen = false; 125 m_isFullscreen = false;
125 126
126 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) 127 m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" )
127 , QString::null, 0, this, 0); 128 , QString::null, 0, this, 0);
128 m_fullscreen->addTo( m_console ); 129 m_fullscreen->addTo( m_console );
129 m_fullscreen->addTo( m_icons ); 130 m_fullscreen->addTo( m_icons );
130 connect( m_fullscreen, SIGNAL( activated() ), 131 connect( m_fullscreen, SIGNAL( activated() ),
131 this, SLOT( slotFullscreen() ) ); 132 this, SLOT( slotFullscreen() ) );
132 133
133 /* 134 /*
134 * terminate action 135 * terminate action
135 */ 136 */
136 m_terminate = new QAction(); 137 m_terminate = new QAction();
137 m_terminate->setText( tr("Terminate") ); 138 m_terminate->setText( tr("Terminate") );
138 m_terminate->addTo( m_console ); 139 m_terminate->addTo( m_console );
139 connect(m_terminate, SIGNAL(activated() ), 140 connect(m_terminate, SIGNAL(activated() ),
140 this, SLOT(slotTerminate() ) ); 141 this, SLOT(slotTerminate() ) );
141 142
142 m_closewindow = new QAction(); 143 m_closewindow = new QAction();
143 m_closewindow->setText( tr("Close Window") ); 144 m_closewindow->setText( tr("Close Window") );
144 m_closewindow->addTo( m_console ); 145 m_closewindow->addTo( m_console );
145 connect( m_closewindow, SIGNAL(activated() ), 146 connect( m_closewindow, SIGNAL(activated() ),
146 this, SLOT(slotClose() ) ); 147 this, SLOT(slotClose() ) );
147 148
148 /* 149 /*
149 * the settings action 150 * the settings action
150 */ 151 */
151 m_setProfiles = new QAction(tr("Configure Profiles"), 152 m_setProfiles = new QAction(tr("Configure Profiles"),
152 Resource::loadPixmap( "SettingsIcon" ), 153 Resource::loadPixmap( "SettingsIcon" ),
153 QString::null, 0, this, 0); 154 QString::null, 0, this, 0);
154 m_setProfiles->addTo( m_settings ); 155 m_setProfiles->addTo( m_settings );
155 m_setProfiles->addTo( m_icons ); 156 m_setProfiles->addTo( m_icons );
156 connect( m_setProfiles, SIGNAL(activated() ), 157 connect( m_setProfiles, SIGNAL(activated() ),
157 this, SLOT(slotConfigure() ) ); 158 this, SLOT(slotConfigure() ) );
158 159
159 /* 160 /*
160 * script actions 161 * script actions
161 */ 162 */
162 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); 163 m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0);
163 m_recordScript->addTo(m_scripts); 164 m_recordScript->addTo(m_scripts);
164 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); 165 connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript()));
165 166
166 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); 167 m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0);
167 m_saveScript->addTo(m_scripts); 168 m_saveScript->addTo(m_scripts);
168 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); 169 connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript()));
169 170
170 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); 171 m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0);
171 m_runScript->addTo(m_scripts); 172 m_runScript->addTo(m_scripts);
172 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); 173 connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript()));
173 174
174 /* 175 /*
175 * action that open/closes the keyboard 176 * action that open/closes the keyboard
176 */ 177 */
177 m_openKeys = new QAction (tr("Open Keyboard..."), 178 m_openKeys = new QAction (tr("Open Keyboard..."),
178 Resource::loadPixmap( "down" ), 179 Resource::loadPixmap( "down" ),
179 QString::null, 0, this, 0); 180 QString::null, 0, this, 0);
180 181
181 m_openKeys->setToggleAction(true); 182 m_openKeys->setToggleAction(true);
182 183
183 connect (m_openKeys, SIGNAL(toggled(bool)), 184 connect (m_openKeys, SIGNAL(toggled(bool)),
184 this, SLOT(slotOpenKeb(bool))); 185 this, SLOT(slotOpenKeb(bool)));
185 m_openKeys->addTo(m_icons); 186 m_openKeys->addTo(m_icons);
186 187
187 188
188 /* insert the submenu */ 189 /* insert the submenu */
189 m_console->insertItem(tr("New from Profile"), m_sessionsPop, 190 m_console->insertItem(tr("New from Profile"), m_sessionsPop,
190 -1, 0); 191 -1, 0);
191 192
192 /* insert the connection menu */ 193 /* insert the connection menu */
193 m_bar->insertItem( tr("Connection"), m_console ); 194 m_bar->insertItem( tr("Connection"), m_console );
194 195
195 /* the scripts menu */ 196 /* the scripts menu */
196 m_bar->insertItem( tr("Scripts"), m_scripts ); 197 m_bar->insertItem( tr("Scripts"), m_scripts );
197 198
198 /* the settings menu */ 199 /* the settings menu */
199 m_bar->insertItem( tr("Settings"), m_settings ); 200 m_bar->insertItem( tr("Settings"), m_settings );
200 201
201 /* and the keyboard */ 202 /* and the keyboard */
202 m_keyBar = new QToolBar(this); 203 m_keyBar = new QToolBar(this);
203 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); 204 addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE );
204 m_keyBar->setHorizontalStretchable( TRUE ); 205 m_keyBar->setHorizontalStretchable( TRUE );
205 m_keyBar->hide(); 206 m_keyBar->hide();
206 207
207 m_kb = new FunctionKeyboard(m_keyBar); 208 m_kb = new FunctionKeyboard(m_keyBar);
208 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), 209 connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)),
209 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); 210 this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool)));
210 211
211 212
212 213
213 m_connect->setEnabled( false ); 214 m_connect->setEnabled( false );
214 m_disconnect->setEnabled( false ); 215 m_disconnect->setEnabled( false );
215 m_terminate->setEnabled( false ); 216 m_terminate->setEnabled( false );
216 m_transfer->setEnabled( false ); 217 m_transfer->setEnabled( false );
217 m_recordScript->setEnabled( false ); 218 m_recordScript->setEnabled( false );
218 m_saveScript->setEnabled( false ); 219 m_saveScript->setEnabled( false );
219 m_runScript->setEnabled( false ); 220 m_runScript->setEnabled( false );
220 m_fullscreen->setEnabled( false ); 221 m_fullscreen->setEnabled( false );
221 m_closewindow->setEnabled( false ); 222 m_closewindow->setEnabled( false );
222 223
223 /* 224 /*
224 * connect to the menu activation 225 * connect to the menu activation
225 */ 226 */
226 connect( m_sessionsPop, SIGNAL(activated( int ) ), 227 connect( m_sessionsPop, SIGNAL(activated( int ) ),
227 this, SLOT(slotProfile( int ) ) ); 228 this, SLOT(slotProfile( int ) ) );
228 229
229 m_consoleWindow = new TabWidget( this, "blah"); 230 m_consoleWindow = new TabWidget( this, "blah");
230 connect(m_consoleWindow, SIGNAL(activated(Session*) ), 231 connect(m_consoleWindow, SIGNAL(activated(Session*) ),
231 this, SLOT(slotSessionChanged(Session*) ) ); 232 this, SLOT(slotSessionChanged(Session*) ) );
232 setCentralWidget( m_consoleWindow ); 233 setCentralWidget( m_consoleWindow );
233 234
234} 235}
235 236
236ProfileManager* MainWindow::manager() { 237ProfileManager* MainWindow::manager() {
237 return m_manager; 238 return m_manager;
238} 239}
239TabWidget* MainWindow::tabWidget() { 240TabWidget* MainWindow::tabWidget() {
240 return m_consoleWindow; 241 return m_consoleWindow;
241} 242}
242void MainWindow::populateProfiles() { 243void MainWindow::populateProfiles() {
243 m_sessionsPop->clear(); 244 m_sessionsPop->clear();
244 Profile::ValueList list = manager()->all(); 245 Profile::ValueList list = manager()->all();
245 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { 246 for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) {
@@ -276,223 +277,222 @@ void MainWindow::slotNew() {
276 277
277void MainWindow::slotRecordScript() { 278void MainWindow::slotRecordScript() {
278/* if (currentSession()) { 279/* if (currentSession()) {
279 currentSession()->emulationLayer()->startRecording(); 280 currentSession()->emulationLayer()->startRecording();
280 } 281 }
281 */ 282 */
282} 283}
283 284
284void MainWindow::slotSaveScript() { 285void MainWindow::slotSaveScript() {
285/* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { 286/* if (currentSession() && currentSession()->emulationLayer()->isRecording()) {
286 MimeTypes types; 287 MimeTypes types;
287 QStringList script; 288 QStringList script;
288 script << "text/plain"; 289 script << "text/plain";
289 types.insert("Script", script); 290 types.insert("Script", script);
290 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); 291 QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types);
291 if (!filename.isEmpty()) { 292 if (!filename.isEmpty()) {
292 currentSession()->emulationLayer()->script()->saveTo(filename); 293 currentSession()->emulationLayer()->script()->saveTo(filename);
293 currentSession()->emulationLayer()->clearScript(); 294 currentSession()->emulationLayer()->clearScript();
294 } 295 }
295 } 296 }
296 */ 297 */
297} 298}
298 299
299void MainWindow::slotRunScript() { 300void MainWindow::slotRunScript() {
300/* 301/*
301 if (currentSession()) { 302 if (currentSession()) {
302 MimeTypes types; 303 MimeTypes types;
303 QStringList script; 304 QStringList script;
304 script << "text/plain"; 305 script << "text/plain";
305 types.insert("Script", script); 306 types.insert("Script", script);
306 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); 307 QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types);
307 if (!filename.isEmpty()) { 308 if (!filename.isEmpty()) {
308 Script script(DocLnk(filename).file()); 309 Script script(DocLnk(filename).file());
309 currentSession()->emulationLayer()->runScript(&script); 310 currentSession()->emulationLayer()->runScript(&script);
310 } 311 }
311 } 312 }
312 */ 313 */
313} 314}
314 315
315void MainWindow::slotConnect() { 316void MainWindow::slotConnect() {
316 if ( currentSession() ) { 317 if ( currentSession() ) {
317 bool ret = currentSession()->layer()->open(); 318 bool ret = currentSession()->layer()->open();
318 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 319 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
319 QObject::tr("Failed"), 320 QObject::tr("Failed"),
320 QObject::tr("Connecting failed for this session.")); 321 QObject::tr("Connecting failed for this session."));
321 else { 322 else {
322 m_connect->setEnabled( false ); 323 m_connect->setEnabled( false );
323 m_disconnect->setEnabled( true ); 324 m_disconnect->setEnabled( true );
324 } 325 }
325 } 326 }
326} 327}
327 328
328void MainWindow::slotDisconnect() { 329void MainWindow::slotDisconnect() {
329 if ( currentSession() ) { 330 if ( currentSession() ) {
330 currentSession()->layer()->close(); 331 currentSession()->layer()->close();
331 m_connect->setEnabled( true ); 332 m_connect->setEnabled( true );
332 m_disconnect->setEnabled( false ); 333 m_disconnect->setEnabled( false );
333 } 334 }
334} 335}
335 336
336void MainWindow::slotTerminate() { 337void MainWindow::slotTerminate() {
337 if ( currentSession() ) 338 if ( currentSession() )
338 currentSession()->layer()->close(); 339 currentSession()->layer()->close();
339 340
340 slotClose(); 341 slotClose();
341 /* FIXME move to the next session */ 342 /* FIXME move to the next session */
342} 343}
343 344
344void MainWindow::slotConfigure() { 345void MainWindow::slotConfigure() {
345 ConfigDialog conf( manager()->all(), factory() ); 346 ConfigDialog conf( manager()->all(), factory() );
346 conf.showMaximized(); 347 conf.showMaximized();
347 348
348 int ret = conf.exec(); 349 int ret = conf.exec();
349 350
350 if ( QDialog::Accepted == ret ) { 351 if ( QDialog::Accepted == ret ) {
351 manager()->setProfiles( conf.list() ); 352 manager()->setProfiles( conf.list() );
352 manager()->save(); 353 manager()->save();
353 populateProfiles(); 354 populateProfiles();
354 } 355 }
355} 356}
356/* 357/*
357 * we will remove 358 * we will remove
358 * this window from the tabwidget 359 * this window from the tabwidget
359 * remove it from the list 360 * remove it from the list
360 * delete it 361 * delete it
361 * and set the currentSession() 362 * and set the currentSession()
362 */ 363 */
363void MainWindow::slotClose() { 364void MainWindow::slotClose() {
364 if (!currentSession() ) 365 if (!currentSession() )
365 return; 366 return;
366 367
367 Session* ses = currentSession(); 368 Session* ses = currentSession();
368 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 369 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
369 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 370 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
370 m_curSession = NULL; 371 m_curSession = NULL;
371 tabWidget()->remove( /*currentSession()*/ses ); 372 tabWidget()->remove( /*currentSession()*/ses );
372 /*it's autodelete */ 373 /*it's autodelete */
373 m_sessions.remove( ses ); 374 m_sessions.remove( ses );
374 qWarning("after remove!!"); 375 qWarning("after remove!!");
375 376
376 if (!currentSession() ) { 377 if (!currentSession() ) {
377 m_connect->setEnabled( false ); 378 m_connect->setEnabled( false );
378 m_disconnect->setEnabled( false ); 379 m_disconnect->setEnabled( false );
379 m_terminate->setEnabled( false ); 380 m_terminate->setEnabled( false );
380 m_transfer->setEnabled( false ); 381 m_transfer->setEnabled( false );
381 m_recordScript->setEnabled( false ); 382 m_recordScript->setEnabled( false );
382 m_saveScript->setEnabled( false ); 383 m_saveScript->setEnabled( false );
383 m_runScript->setEnabled( false ); 384 m_runScript->setEnabled( false );
384 m_fullscreen->setEnabled( false ); 385 m_fullscreen->setEnabled( false );
385 m_closewindow->setEnabled( false ); 386 m_closewindow->setEnabled( false );
386 } 387 }
387} 388}
388 389
389/* 390/*
390 * We will get the name 391 * We will get the name
391 * Then the profile 392 * Then the profile
392 * and then we will make a profile 393 * and then we will make a profile
393 */ 394 */
394void MainWindow::slotProfile( int id) { 395void MainWindow::slotProfile( int id) {
395 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 396 Profile prof = manager()->profile( m_sessionsPop->text( id) );
396 create( prof ); 397 create( prof );
397} 398}
398void MainWindow::create( const Profile& prof ) { 399void MainWindow::create( const Profile& prof ) {
399 Session *ses = manager()->fromProfile( prof, tabWidget() ); 400 Session *ses = manager()->fromProfile( prof, tabWidget() );
400 401
401 if((!ses) || (!ses->layer()) || (!ses->widgetStack())) 402 if((!ses) || (!ses->layer()) || (!ses->widgetStack()))
402 { 403 {
403 QMessageBox::warning(this, 404 QMessageBox::warning(this,
404 QObject::tr("Session failed"), 405 QObject::tr("Session failed"),
405 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); 406 QObject::tr("<qt>Cannot open session: Not all components were found.</qt>"));
406 //if(ses) delete ses; 407 //if(ses) delete ses;
407 return; 408 return;
408 } 409 }
409 410
410 m_sessions.append( ses ); 411 m_sessions.append( ses );
411 tabWidget()->add( ses ); 412 tabWidget()->add( ses );
412 m_curSession = ses; 413 m_curSession = ses;
413 414
414 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it 415 // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it
415 m_connect->setEnabled( true ); 416 m_connect->setEnabled( true );
416 m_disconnect->setEnabled( false ); 417 m_disconnect->setEnabled( false );
417 m_terminate->setEnabled( true ); 418 m_terminate->setEnabled( true );
418 m_transfer->setEnabled( true ); 419 m_transfer->setEnabled( true );
419 m_recordScript->setEnabled( true ); 420 m_recordScript->setEnabled( true );
420 m_saveScript->setEnabled( true ); 421 m_saveScript->setEnabled( true );
421 m_runScript->setEnabled( true ); 422 m_runScript->setEnabled( true );
422 m_fullscreen->setEnabled( true ); 423 m_fullscreen->setEnabled( true );
423 m_closewindow->setEnabled( true ); 424 m_closewindow->setEnabled( true );
424} 425}
425 426
426void MainWindow::slotTransfer() 427void MainWindow::slotTransfer()
427{ 428{
428 if ( currentSession() ) { 429 if ( currentSession() ) {
429 TransferDialog dlg(this); 430 TransferDialog dlg(this);
430 dlg.showMaximized(); 431 dlg.showMaximized();
431 dlg.exec(); 432 dlg.exec();
432 } 433 }
433} 434}
434 435
435 436
436void MainWindow::slotOpenKeb(bool state) { 437void MainWindow::slotOpenKeb(bool state) {
437 438
438 if (state) m_keyBar->show(); 439 if (state) m_keyBar->show();
439 else m_keyBar->hide(); 440 else m_keyBar->hide();
440 441
441} 442}
442void MainWindow::slotSessionChanged( Session* ses ) { 443void MainWindow::slotSessionChanged( Session* ses ) {
443 qWarning("changed!"); 444 qWarning("changed!");
444 if ( ses ) { 445 if ( ses ) {
445 m_curSession = ses; 446 m_curSession = ses;
446 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); 447 qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) );
447 if ( m_curSession->layer()->isConnected() ) { 448 if ( m_curSession->layer()->isConnected() ) {
448 m_connect->setEnabled( false ); 449 m_connect->setEnabled( false );
449 m_disconnect->setEnabled( true ); 450 m_disconnect->setEnabled( true );
450 } else { 451 } else {
451 m_connect->setEnabled( true ); 452 m_connect->setEnabled( true );
452 m_disconnect->setEnabled( false ); 453 m_disconnect->setEnabled( false );
453 } 454 }
454 } 455 }
455} 456}
456 457
457void MainWindow::slotFullscreen() { 458void MainWindow::slotFullscreen() {
458 459
459 if ( m_isFullscreen ) { 460 if ( m_isFullscreen ) {
460 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); 461 ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false );
461 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); 462 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken );
462 setCentralWidget( m_consoleWindow ); 463 setCentralWidget( m_consoleWindow );
463 ( m_curSession->widgetStack() )->show(); 464 ( m_curSession->widgetStack() )->show();
464 m_fullscreen->setText( tr("Full screen") ); 465 m_fullscreen->setText( tr("Full screen") );
465 466
466 } else { 467 } else {
467 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); 468 ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame );
468 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop, 469 ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop
469 QPoint(0,0), false); 470 , QPoint(0,0), false);
470 ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height()); 471 ( m_curSession->widgetStack() )->resize(qApp->desktop()->width(), qApp->desktop()->height());
471 ( m_curSession->widgetStack() )->setFocus(); 472 ( m_curSession->widgetStack() )->setFocus();
472 ( m_curSession->widgetStack() )->show(); 473 ( m_curSession->widgetStack() )->show();
473 474
474 //QPushButton *cornerButton = new QPushButton( ); 475 QPushButton *cornerButton = new QPushButton( m_curSession->widgetStack() );
475 //cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) ); 476 cornerButton->setPixmap( QPixmap( (const char**)menu_xpm ) );
476 //connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); 477 connect( cornerButton, SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) );
477 // need teh scrollbar 478 // would need a scrollview
478 // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton ); 479 // ( m_curSession->widgetStack() )->setCornerWidget( cornerButton );
479 m_fullscreen->setText( tr("Stop full screen") ); 480 m_fullscreen->setText( tr("Stop full screen") );
480 } 481 }
481
482 m_isFullscreen = !m_isFullscreen; 482 m_isFullscreen = !m_isFullscreen;
483 483
484} 484}
485 485
486 486
487void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) { 487void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool, bool) {
488 488
489 qWarning("received key event! relay to TE widget"); 489 qWarning("received key event! relay to TE widget");
490 490
491 if ( m_curSession ) { 491 if ( m_curSession ) {
492 QKeyEvent ke(QEvent::KeyPress, q, u, 0); 492 QKeyEvent ke(QEvent::KeyPress, q, u, 0);
493 493
494 ke.ignore(); 494 ke.ignore();
495 // where should i send this event? doesnt work sending it here 495 // where should i send this event? doesnt work sending it here
496 QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke); 496 QApplication::sendEvent((QObject *)m_curSession->widgetStack(), &ke);
497 } 497 }
498} 498}
diff --git a/noncore/apps/opie-console/mainwindow.h b/noncore/apps/opie-console/mainwindow.h
index 91ca147..35338b7 100644
--- a/noncore/apps/opie-console/mainwindow.h
+++ b/noncore/apps/opie-console/mainwindow.h
@@ -1,115 +1,115 @@
1#ifndef OPIE_MAIN_WINDOW_H 1#ifndef OPIE_MAIN_WINDOW_H
2#define OPIE_MAIN_WINDOW_H 2#define OPIE_MAIN_WINDOW_H
3 3
4#include <qmainwindow.h> 4#include <qmainwindow.h>
5#include <qlist.h> 5#include <qlist.h>
6 6
7#include "session.h" 7#include "session.h"
8 8
9/** 9/**
10 * this is the MainWindow of the new opie console 10 * this is the MainWindow of the new opie console
11 * it's also the dispatcher between the different 11 * it's also the dispatcher between the different
12 * actions supported by the gui 12 * actions supported by the gui
13 */ 13 */
14class QToolBar; 14class QToolBar;
15class QToolButton; 15class QToolButton;
16class QMenuBar; 16class QMenuBar;
17class QAction; 17class QAction;
18class MetaFactory; 18class MetaFactory;
19class TabWidget; 19class TabWidget;
20class ProfileManager; 20class ProfileManager;
21class Profile; 21class Profile;
22class FunctionKeyboard; 22class FunctionKeyboard;
23class MainWindow : public QMainWindow { 23class MainWindow : public QMainWindow {
24 Q_OBJECT 24 Q_OBJECT
25public: 25public:
26 MainWindow(); 26 MainWindow( QWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
27 ~MainWindow(); 27 ~MainWindow();
28 28
29 /** 29 /**
30 * our factory to generate IOLayer and so on 30 * our factory to generate IOLayer and so on
31 * 31 *
32 */ 32 */
33 MetaFactory* factory(); 33 MetaFactory* factory();
34 34
35 /** 35 /**
36 * A session contains a QWidget*, 36 * A session contains a QWidget*,
37 * an IOLayer* and some infos for us 37 * an IOLayer* and some infos for us
38 */ 38 */
39 Session* currentSession(); 39 Session* currentSession();
40 40
41 /** 41 /**
42 * the session list 42 * the session list
43 */ 43 */
44 QList<Session> sessions(); 44 QList<Session> sessions();
45 45
46 /** 46 /**
47 * 47 *
48 */ 48 */
49 ProfileManager* manager(); 49 ProfileManager* manager();
50 TabWidget* tabWidget(); 50 TabWidget* tabWidget();
51 51
52private slots: 52private slots:
53 void slotNew(); 53 void slotNew();
54 void slotConnect(); 54 void slotConnect();
55 void slotDisconnect(); 55 void slotDisconnect();
56 void slotTerminate(); 56 void slotTerminate();
57 void slotConfigure(); 57 void slotConfigure();
58 void slotClose(); 58 void slotClose();
59 void slotProfile(int); 59 void slotProfile(int);
60 void slotTransfer(); 60 void slotTransfer();
61 void slotOpenKeb(bool); 61 void slotOpenKeb(bool);
62 void slotRecordScript(); 62 void slotRecordScript();
63 void slotSaveScript(); 63 void slotSaveScript();
64 void slotRunScript(); 64 void slotRunScript();
65 void slotFullscreen(); 65 void slotFullscreen();
66 void slotSessionChanged( Session* ); 66 void slotSessionChanged( Session* );
67 void slotKeyReceived(ushort, ushort, bool, bool, bool); 67 void slotKeyReceived(ushort, ushort, bool, bool, bool);
68 68
69private: 69private:
70 void initUI(); 70 void initUI();
71 void populateProfiles(); 71 void populateProfiles();
72 void create( const Profile& ); 72 void create( const Profile& );
73 /** 73 /**
74 * the current session 74 * the current session
75 */ 75 */
76 Session* m_curSession; 76 Session* m_curSession;
77 77
78 /** 78 /**
79 * the session list 79 * the session list
80 */ 80 */
81 QList<Session> m_sessions; 81 QList<Session> m_sessions;
82 82
83 /** 83 /**
84 * the metafactory 84 * the metafactory
85 */ 85 */
86 MetaFactory* m_factory; 86 MetaFactory* m_factory;
87 ProfileManager* m_manager; 87 ProfileManager* m_manager;
88 88
89 TabWidget* m_consoleWindow; 89 TabWidget* m_consoleWindow;
90 QToolBar* m_tool; 90 QToolBar* m_tool;
91 QToolBar* m_icons; 91 QToolBar* m_icons;
92 QToolBar* m_keyBar; 92 QToolBar* m_keyBar;
93 QMenuBar* m_bar; 93 QMenuBar* m_bar;
94 QPopupMenu* m_console; 94 QPopupMenu* m_console;
95 QPopupMenu* m_settings; 95 QPopupMenu* m_settings;
96 QPopupMenu* m_sessionsPop; 96 QPopupMenu* m_sessionsPop;
97 QPopupMenu* m_scripts; 97 QPopupMenu* m_scripts;
98 QAction* m_connect; 98 QAction* m_connect;
99 QAction* m_disconnect; 99 QAction* m_disconnect;
100 QAction* m_terminate; 100 QAction* m_terminate;
101 QAction* m_transfer; 101 QAction* m_transfer;
102 QAction* m_setProfiles; 102 QAction* m_setProfiles;
103 QAction* m_openKeys; 103 QAction* m_openKeys;
104 QAction* m_recordScript; 104 QAction* m_recordScript;
105 QAction* m_saveScript; 105 QAction* m_saveScript;
106 QAction* m_runScript; 106 QAction* m_runScript;
107 QAction* m_fullscreen; 107 QAction* m_fullscreen;
108 QAction* m_closewindow; 108 QAction* m_closewindow;
109 109
110 FunctionKeyboard *m_kb; 110 FunctionKeyboard *m_kb;
111 bool m_isFullscreen; 111 bool m_isFullscreen;
112}; 112};
113 113
114 114
115#endif 115#endif
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control
index aba2192..e307fef 100644
--- a/noncore/apps/opie-console/opie-console.control
+++ b/noncore/apps/opie-console/opie-console.control
@@ -1,10 +1,10 @@
1Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* 1Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/*
2Priority: optional 2Priority: optional
3Section: opie/applications 3Section: opie/applications
4Maintainer: Opie team <opie@handhelds.org> 4Maintainer: Opie team <opie@handhelds.org>
5Architecture: arm 5Architecture: arm
6Version: 0.6-$SUB_VERSION 6Version: 0.6-$SUB_VERSION
7Depends: qpe-base ($QPE_VERSION), libopie ($QPE_VERSION) 7Depends: qpe-base ($QPE_VERSION), libopie ($QPE_VERSION), opie-console-help-en
8License: GPL 8License: GPL
9Description: Opie terminal app 9Description: Opie terminal app
10 10