-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index ddaaf1b..c7750be 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -137,112 +137,96 @@ void MainWindow::initUI() { | |||
137 | connect( m_fullscreen, SIGNAL( activated() ), | 137 | connect( m_fullscreen, SIGNAL( activated() ), |
138 | this, SLOT( slotFullscreen() ) ); | 138 | this, SLOT( slotFullscreen() ) ); |
139 | 139 | ||
140 | m_console->insertSeparator(); | 140 | m_console->insertSeparator(); |
141 | /* | 141 | /* |
142 | * terminate action | 142 | * terminate action |
143 | */ | 143 | */ |
144 | m_terminate = new QAction(); | 144 | m_terminate = new QAction(); |
145 | m_terminate->setText( tr("Terminate") ); | 145 | m_terminate->setText( tr("Terminate") ); |
146 | m_terminate->addTo( m_console ); | 146 | m_terminate->addTo( m_console ); |
147 | connect(m_terminate, SIGNAL(activated() ), | 147 | connect(m_terminate, SIGNAL(activated() ), |
148 | this, SLOT(slotTerminate() ) ); | 148 | this, SLOT(slotTerminate() ) ); |
149 | 149 | ||
150 | m_closewindow = new QAction(); | 150 | m_closewindow = new QAction(); |
151 | m_closewindow->setText( tr("Close Window") ); | 151 | m_closewindow->setText( tr("Close Window") ); |
152 | m_closewindow->addTo( m_console ); | 152 | m_closewindow->addTo( m_console ); |
153 | connect( m_closewindow, SIGNAL(activated() ), | 153 | connect( m_closewindow, SIGNAL(activated() ), |
154 | this, SLOT(slotClose() ) ); | 154 | this, SLOT(slotClose() ) ); |
155 | 155 | ||
156 | 156 | ||
157 | /* | 157 | /* |
158 | * script actions | 158 | * script actions |
159 | */ | 159 | */ |
160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 160 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
161 | m_recordScript->addTo(m_scripts); | 161 | m_recordScript->addTo(m_scripts); |
162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 162 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
163 | 163 | ||
164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 164 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
165 | m_saveScript->addTo(m_scripts); | 165 | m_saveScript->addTo(m_scripts); |
166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 166 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
167 | 167 | ||
168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 168 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
169 | m_runScript->addTo(m_scripts); | 169 | m_runScript->addTo(m_scripts); |
170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 170 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
171 | 171 | ||
172 | /* | 172 | /* |
173 | * action that open/closes the keyboard | 173 | * action that open/closes the keyboard |
174 | */ | 174 | */ |
175 | m_openKeys = new QAction (tr("Open Keyboard..."), | 175 | m_openKeys = new QAction (tr("Open Keyboard..."), |
176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 176 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
177 | QString::null, 0, this, 0); | 177 | QString::null, 0, this, 0); |
178 | 178 | ||
179 | m_openKeys->setToggleAction(true); | 179 | m_openKeys->setToggleAction(true); |
180 | 180 | ||
181 | connect (m_openKeys, SIGNAL(toggled(bool)), | 181 | connect (m_openKeys, SIGNAL(toggled(bool)), |
182 | this, SLOT(slotOpenKeb(bool))); | 182 | this, SLOT(slotOpenKeb(bool))); |
183 | m_openKeys->addTo(m_icons); | 183 | m_openKeys->addTo(m_icons); |
184 | 184 | ||
185 | |||
186 | /* | ||
187 | * action that open/closes the keyboard | ||
188 | |||
189 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | ||
190 | Resource::loadPixmap( "" ), | ||
191 | QString::null, 0, this, 0 ); | ||
192 | |||
193 | m_openButtons->setToggleAction( true ); | ||
194 | |||
195 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | ||
196 | this, SLOT( slotOpenButtons( bool ) ) ); | ||
197 | m_openButtons->addTo( m_icons ); | ||
198 | |||
199 | */ | ||
200 | |||
201 | /* insert the submenu */ | 185 | /* insert the submenu */ |
202 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 186 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
203 | -1, 0); | 187 | -1, 0); |
204 | 188 | ||
205 | /* insert the connection menu */ | 189 | /* insert the connection menu */ |
206 | m_bar->insertItem( tr("Connection"), m_console ); | 190 | m_bar->insertItem( tr("Connection"), m_console ); |
207 | 191 | ||
208 | /* the scripts menu */ | 192 | /* the scripts menu */ |
209 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 193 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
210 | 194 | ||
211 | /* the settings menu */ | 195 | /* the settings menu */ |
212 | // m_bar->insertItem( tr("Settings"), m_settings ); | 196 | // m_bar->insertItem( tr("Settings"), m_settings ); |
213 | 197 | ||
214 | /* and the keyboard */ | 198 | /* and the keyboard */ |
215 | m_keyBar = new QToolBar(this); | 199 | m_keyBar = new QToolBar(this); |
216 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 200 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
217 | m_keyBar->setHorizontalStretchable( TRUE ); | 201 | m_keyBar->setHorizontalStretchable( TRUE ); |
218 | m_keyBar->hide(); | 202 | m_keyBar->hide(); |
219 | 203 | ||
220 | m_kb = new FunctionKeyboard(m_keyBar); | 204 | m_kb = new FunctionKeyboard(m_keyBar); |
221 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 205 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
222 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 206 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
223 | 207 | ||
224 | m_buttonBar = new QToolBar( this ); | 208 | m_buttonBar = new QToolBar( this ); |
225 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 209 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
226 | m_buttonBar->setHorizontalStretchable( TRUE ); | 210 | m_buttonBar->setHorizontalStretchable( TRUE ); |
227 | m_buttonBar->hide(); | 211 | m_buttonBar->hide(); |
228 | 212 | ||
229 | a = new QAction(tr("Copy"), | 213 | a = new QAction(tr("Copy"), |
230 | Resource::loadPixmap("copy"), QString::null, | 214 | Resource::loadPixmap("copy"), QString::null, |
231 | 0, this, 0 ); | 215 | 0, this, 0 ); |
232 | //a->addTo( m_icons ); | 216 | //a->addTo( m_icons ); |
233 | connect( a, SIGNAL(activated() ), | 217 | connect( a, SIGNAL(activated() ), |
234 | this, SLOT(slotCopy() ) ); | 218 | this, SLOT(slotCopy() ) ); |
235 | 219 | ||
236 | a = new QAction(tr("Paste"), | 220 | a = new QAction(tr("Paste"), |
237 | Resource::loadPixmap("paste"), QString::null, | 221 | Resource::loadPixmap("paste"), QString::null, |
238 | 0, this, 0 ); | 222 | 0, this, 0 ); |
239 | a->addTo( m_icons ); | 223 | a->addTo( m_icons ); |
240 | connect( a, SIGNAL(activated() ), | 224 | connect( a, SIGNAL(activated() ), |
241 | this, SLOT(slotPaste() ) ); | 225 | this, SLOT(slotPaste() ) ); |
242 | 226 | ||
243 | 227 | ||
244 | m_connect->setEnabled( false ); | 228 | m_connect->setEnabled( false ); |
245 | m_disconnect->setEnabled( false ); | 229 | m_disconnect->setEnabled( false ); |
246 | m_terminate->setEnabled( false ); | 230 | m_terminate->setEnabled( false ); |
247 | m_transfer->setEnabled( false ); | 231 | m_transfer->setEnabled( false ); |
248 | m_recordScript->setEnabled( false ); | 232 | m_recordScript->setEnabled( false ); |
@@ -307,252 +291,261 @@ void MainWindow::slotNew() { | |||
307 | 291 | ||
308 | void MainWindow::slotRecordScript() { | 292 | void MainWindow::slotRecordScript() { |
309 | if (currentSession()) { | 293 | if (currentSession()) { |
310 | currentSession()->emulationHandler()->startRecording(); | 294 | currentSession()->emulationHandler()->startRecording(); |
311 | } | 295 | } |
312 | } | 296 | } |
313 | 297 | ||
314 | void MainWindow::slotSaveScript() { | 298 | void MainWindow::slotSaveScript() { |
315 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 299 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
316 | MimeTypes types; | 300 | MimeTypes types; |
317 | QStringList script; | 301 | QStringList script; |
318 | script << "text/plain"; | 302 | script << "text/plain"; |
319 | script << "text/all"; | 303 | script << "text/all"; |
320 | script << "application/octet-stream"; | 304 | script << "application/octet-stream"; |
321 | types.insert("Script", script); | 305 | types.insert("Script", script); |
322 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 306 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
323 | if (!filename.isEmpty()) { | 307 | if (!filename.isEmpty()) { |
324 | currentSession()->emulationHandler()->script()->saveTo(filename); | 308 | currentSession()->emulationHandler()->script()->saveTo(filename); |
325 | currentSession()->emulationHandler()->clearScript(); | 309 | currentSession()->emulationHandler()->clearScript(); |
326 | } | 310 | } |
327 | } | 311 | } |
328 | } | 312 | } |
329 | 313 | ||
330 | void MainWindow::slotRunScript() { | 314 | void MainWindow::slotRunScript() { |
331 | if (currentSession()) { | 315 | if (currentSession()) { |
332 | MimeTypes types; | 316 | MimeTypes types; |
333 | QStringList script; | 317 | QStringList script; |
334 | script << "text/plain"; | 318 | script << "text/plain"; |
335 | script << "text/all"; | 319 | script << "text/all"; |
336 | script << "application/octet-stream"; | 320 | script << "application/octet-stream"; |
337 | types.insert("Script", script); | 321 | types.insert("Script", script); |
338 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 322 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
339 | if (!filename.isEmpty()) { | 323 | if (!filename.isEmpty()) { |
340 | Script script(DocLnk(filename).file()); | 324 | Script script(DocLnk(filename).file()); |
341 | currentSession()->emulationHandler()->runScript(&script); | 325 | currentSession()->emulationHandler()->runScript(&script); |
342 | } | 326 | } |
343 | } | 327 | } |
344 | } | 328 | } |
345 | 329 | ||
346 | void MainWindow::slotConnect() { | 330 | void MainWindow::slotConnect() { |
347 | if ( currentSession() ) { | 331 | if ( currentSession() ) { |
348 | bool ret = currentSession()->layer()->open(); | 332 | bool ret = currentSession()->layer()->open(); |
349 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 333 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
350 | QObject::tr("Failed"), | 334 | QObject::tr("Failed"), |
351 | QObject::tr("Connecting failed for this session.")); | 335 | QObject::tr("Connecting failed for this session.")); |
352 | else { | 336 | else { |
353 | m_connect->setEnabled( false ); | 337 | m_connect->setEnabled( false ); |
354 | m_disconnect->setEnabled( true ); | 338 | m_disconnect->setEnabled( true ); |
339 | m_transfer->setEnabled( true ); | ||
355 | } | 340 | } |
356 | } | 341 | } |
357 | } | 342 | } |
358 | 343 | ||
359 | void MainWindow::slotDisconnect() { | 344 | void MainWindow::slotDisconnect() { |
360 | if ( currentSession() ) { | 345 | if ( currentSession() ) { |
361 | currentSession()->layer()->close(); | 346 | currentSession()->layer()->close(); |
362 | m_connect->setEnabled( true ); | 347 | m_connect->setEnabled( true ); |
363 | m_disconnect->setEnabled( false ); | 348 | m_disconnect->setEnabled( false ); |
349 | m_transfer->setEnabled( false ); | ||
364 | } | 350 | } |
365 | } | 351 | } |
366 | 352 | ||
367 | void MainWindow::slotTerminate() { | 353 | void MainWindow::slotTerminate() { |
368 | if ( currentSession() ) | 354 | if ( currentSession() ) |
369 | currentSession()->layer()->close(); | 355 | currentSession()->layer()->close(); |
370 | 356 | ||
371 | slotClose(); | 357 | slotClose(); |
372 | /* FIXME move to the next session */ | 358 | /* FIXME move to the next session */ |
373 | } | 359 | } |
374 | 360 | ||
375 | void MainWindow::slotConfigure() { | 361 | void MainWindow::slotConfigure() { |
376 | ConfigDialog conf( manager()->all(), factory() ); | 362 | ConfigDialog conf( manager()->all(), factory() ); |
377 | conf.showMaximized(); | 363 | conf.showMaximized(); |
378 | 364 | ||
379 | int ret = conf.exec(); | 365 | int ret = conf.exec(); |
380 | 366 | ||
381 | if ( QDialog::Accepted == ret ) { | 367 | if ( QDialog::Accepted == ret ) { |
382 | manager()->setProfiles( conf.list() ); | 368 | manager()->setProfiles( conf.list() ); |
383 | manager()->save(); | 369 | manager()->save(); |
384 | populateProfiles(); | 370 | populateProfiles(); |
385 | } | 371 | } |
386 | } | 372 | } |
387 | /* | 373 | /* |
388 | * we will remove | 374 | * we will remove |
389 | * this window from the tabwidget | 375 | * this window from the tabwidget |
390 | * remove it from the list | 376 | * remove it from the list |
391 | * delete it | 377 | * delete it |
392 | * and set the currentSession() | 378 | * and set the currentSession() |
393 | */ | 379 | */ |
394 | void MainWindow::slotClose() { | 380 | void MainWindow::slotClose() { |
395 | if (!currentSession() ) | 381 | if (!currentSession() ) |
396 | return; | 382 | return; |
397 | 383 | ||
398 | Session* ses = currentSession(); | 384 | Session* ses = currentSession(); |
399 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 385 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
400 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 386 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
401 | m_curSession = NULL; | 387 | m_curSession = NULL; |
402 | tabWidget()->remove( /*currentSession()*/ses ); | 388 | tabWidget()->remove( /*currentSession()*/ses ); |
403 | /*it's autodelete */ | 389 | /*it's autodelete */ |
404 | m_sessions.remove( ses ); | 390 | m_sessions.remove( ses ); |
405 | qWarning("after remove!!"); | 391 | qWarning("after remove!!"); |
406 | 392 | ||
407 | if (!currentSession() ) { | 393 | if (!currentSession() ) { |
408 | m_connect->setEnabled( false ); | 394 | m_connect->setEnabled( false ); |
409 | m_disconnect->setEnabled( false ); | 395 | m_disconnect->setEnabled( false ); |
410 | m_terminate->setEnabled( false ); | 396 | m_terminate->setEnabled( false ); |
411 | m_transfer->setEnabled( false ); | 397 | m_transfer->setEnabled( false ); |
412 | m_recordScript->setEnabled( false ); | 398 | m_recordScript->setEnabled( false ); |
413 | m_saveScript->setEnabled( false ); | 399 | m_saveScript->setEnabled( false ); |
414 | m_runScript->setEnabled( false ); | 400 | m_runScript->setEnabled( false ); |
415 | m_fullscreen->setEnabled( false ); | 401 | m_fullscreen->setEnabled( false ); |
416 | m_closewindow->setEnabled( false ); | 402 | m_closewindow->setEnabled( false ); |
417 | } | 403 | } |
418 | } | 404 | } |
419 | 405 | ||
420 | /* | 406 | /* |
421 | * We will get the name | 407 | * We will get the name |
422 | * Then the profile | 408 | * Then the profile |
423 | * and then we will make a profile | 409 | * and then we will make a profile |
424 | */ | 410 | */ |
425 | void MainWindow::slotProfile( int id) { | 411 | void MainWindow::slotProfile( int id) { |
426 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 412 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
427 | create( prof ); | 413 | create( prof ); |
428 | } | 414 | } |
429 | void MainWindow::create( const Profile& prof ) { | 415 | void MainWindow::create( const Profile& prof ) { |
430 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 416 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
431 | 417 | ||
432 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 418 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
433 | { | 419 | { |
434 | QMessageBox::warning(this, | 420 | QMessageBox::warning(this, |
435 | QObject::tr("Session failed"), | 421 | QObject::tr("Session failed"), |
436 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 422 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
437 | //if(ses) delete ses; | 423 | //if(ses) delete ses; |
438 | return; | 424 | return; |
439 | } | 425 | } |
440 | 426 | ||
441 | m_sessions.append( ses ); | 427 | m_sessions.append( ses ); |
442 | tabWidget()->add( ses ); | 428 | tabWidget()->add( ses ); |
443 | tabWidget()->repaint(); | 429 | tabWidget()->repaint(); |
444 | m_curSession = ses; | 430 | m_curSession = ses; |
445 | 431 | ||
446 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 432 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
447 | m_connect->setEnabled( true ); | 433 | m_connect->setEnabled( true ); |
448 | m_disconnect->setEnabled( false ); | 434 | m_disconnect->setEnabled( false ); |
449 | m_terminate->setEnabled( true ); | 435 | m_terminate->setEnabled( true ); |
450 | m_transfer->setEnabled( true ); | ||
451 | m_recordScript->setEnabled( true ); | 436 | m_recordScript->setEnabled( true ); |
452 | m_saveScript->setEnabled( true ); | 437 | m_saveScript->setEnabled( true ); |
453 | m_runScript->setEnabled( true ); | 438 | m_runScript->setEnabled( true ); |
454 | m_fullscreen->setEnabled( true ); | 439 | m_fullscreen->setEnabled( true ); |
455 | m_closewindow->setEnabled( true ); | 440 | m_closewindow->setEnabled( true ); |
456 | 441 | m_transfer->setEnabled( false ); | |
457 | 442 | ||
458 | // is io_layer wants direct connection, then autoconnect | 443 | // is io_layer wants direct connection, then autoconnect |
459 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 444 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
460 | if (prof.autoConnect()) { | 445 | if (prof.autoConnect()) { |
461 | slotConnect(); | 446 | slotConnect(); |
462 | } | 447 | } |
463 | 448 | ||
449 | |||
450 | |||
464 | QWidget *w = currentSession()->widget(); | 451 | QWidget *w = currentSession()->widget(); |
465 | if(w) w->setFocus(); | 452 | if(w) w->setFocus(); |
466 | } | 453 | } |
467 | 454 | ||
468 | void MainWindow::slotTransfer() | 455 | void MainWindow::slotTransfer() |
469 | { | 456 | { |
470 | if ( currentSession() ) { | 457 | if ( currentSession() ) { |
471 | TransferDialog dlg(currentSession()->widgetStack(), this); | 458 | TransferDialog dlg(currentSession()->widgetStack(), this); |
472 | dlg.showMaximized(); | 459 | dlg.showMaximized(); |
473 | //currentSession()->widgetStack()->add(dlg); | 460 | //currentSession()->widgetStack()->add(dlg); |
474 | dlg.exec(); | 461 | dlg.exec(); |
475 | } | 462 | } |
476 | } | 463 | } |
477 | 464 | ||
478 | 465 | ||
479 | void MainWindow::slotOpenKeb(bool state) { | 466 | void MainWindow::slotOpenKeb(bool state) { |
480 | 467 | ||
481 | if (state) m_keyBar->show(); | 468 | if (state) m_keyBar->show(); |
482 | else m_keyBar->hide(); | 469 | else m_keyBar->hide(); |
483 | 470 | ||
484 | } | 471 | } |
485 | 472 | ||
486 | 473 | ||
487 | void MainWindow::slotOpenButtons( bool state ) { | 474 | void MainWindow::slotOpenButtons( bool state ) { |
488 | 475 | ||
489 | if ( state ) { | 476 | if ( state ) { |
490 | m_buttonBar->show(); | 477 | m_buttonBar->show(); |
491 | } else { | 478 | } else { |
492 | m_buttonBar->hide(); | 479 | m_buttonBar->hide(); |
493 | } | 480 | } |
494 | } | 481 | } |
495 | 482 | ||
496 | 483 | ||
497 | 484 | ||
498 | void MainWindow::slotSessionChanged( Session* ses ) { | 485 | void MainWindow::slotSessionChanged( Session* ses ) { |
499 | qWarning("changed!"); | 486 | qWarning("changed!"); |
500 | if ( ses ) { | 487 | if ( ses ) { |
501 | m_curSession = ses; | 488 | m_curSession = ses; |
502 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 489 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
503 | if ( m_curSession->layer()->isConnected() ) { | 490 | if ( m_curSession->layer()->isConnected() ) { |
504 | m_connect->setEnabled( false ); | 491 | m_connect->setEnabled( false ); |
505 | m_disconnect->setEnabled( true ); | 492 | m_disconnect->setEnabled( true ); |
506 | } else { | 493 | } else { |
507 | m_connect->setEnabled( true ); | 494 | m_connect->setEnabled( true ); |
508 | m_disconnect->setEnabled( false ); | 495 | m_disconnect->setEnabled( false ); |
509 | } | 496 | } |
510 | 497 | ||
498 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | ||
499 | m_transfer->setEnabled( false ); | ||
500 | } else { | ||
501 | m_transfer->setEnabled( true ); | ||
502 | } | ||
503 | |||
511 | QWidget *w = m_curSession->widget(); | 504 | QWidget *w = m_curSession->widget(); |
512 | if(w) w->setFocus(); | 505 | if(w) w->setFocus(); |
513 | } | 506 | } |
514 | } | 507 | } |
515 | 508 | ||
516 | void MainWindow::slotFullscreen() { | 509 | void MainWindow::slotFullscreen() { |
517 | 510 | ||
518 | 511 | ||
519 | 512 | ||
520 | if ( m_isFullscreen ) { | 513 | if ( m_isFullscreen ) { |
521 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 514 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
522 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 515 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
523 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 516 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
524 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 517 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
525 | 518 | ||
526 | } else { | 519 | } else { |
527 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 520 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
528 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 521 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
529 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 522 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
530 | , QPoint(0,0), false ); | 523 | , QPoint(0,0), false ); |
531 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 524 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
532 | ( m_curSession->widgetStack() )->setFocus(); | 525 | ( m_curSession->widgetStack() )->setFocus(); |
533 | ( m_curSession->widgetStack() )->show(); | 526 | ( m_curSession->widgetStack() )->show(); |
534 | 527 | ||
535 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 528 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
536 | 529 | ||
537 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 530 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
538 | } | 531 | } |
539 | 532 | ||
540 | m_isFullscreen = !m_isFullscreen; | 533 | m_isFullscreen = !m_isFullscreen; |
541 | } | 534 | } |
542 | 535 | ||
543 | 536 | ||
544 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 537 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
545 | 538 | ||
546 | if ( m_curSession ) { | 539 | if ( m_curSession ) { |
547 | 540 | ||
548 | QEvent::Type state; | 541 | QEvent::Type state; |
549 | 542 | ||
550 | if (pressed) state = QEvent::KeyPress; | 543 | if (pressed) state = QEvent::KeyPress; |
551 | else state = QEvent::KeyRelease; | 544 | else state = QEvent::KeyRelease; |
552 | 545 | ||
553 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 546 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
554 | 547 | ||
555 | // where should i send this event? doesnt work sending it here | 548 | // where should i send this event? doesnt work sending it here |
556 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 549 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
557 | ke.ignore(); | 550 | ke.ignore(); |
558 | } | 551 | } |