-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 | |||
@@ -173,40 +173,24 @@ void MainWindow::initUI() { | |||
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 ); |
@@ -343,33 +327,35 @@ void MainWindow::slotRunScript() { | |||
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() { |
@@ -438,38 +424,39 @@ void MainWindow::create( const Profile& prof ) { | |||
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 | } |
@@ -499,24 +486,30 @@ 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() ); |