summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-21 23:38:17 (UTC)
committer harlekin <harlekin>2003-03-21 23:38:17 (UTC)
commitab8cb739c666f5f22049258a4bcbb06d1e1ad0c4 (patch) (unidiff)
tree82690d415f22ffe554d4fcfe359ee8121b90d888
parent43b0fded770624c907aae043e88449f80040d7df (diff)
downloadopie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.zip
opie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.tar.gz
opie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.tar.bz2
even better then poping up an error dialog: make a new profile
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index a6fc30b..3acbfad 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -349,134 +349,141 @@ void MainWindow::slotSaveScript() {
349 nf.setName(info.fileName()); 349 nf.setName(info.fileName());
350 FileManager fm; 350 FileManager fm;
351 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); 351 fm.saveFile(nf, currentSession()->emulationHandler()->script()->script());
352 currentSession()->emulationHandler()->clearScript(); 352 currentSession()->emulationHandler()->clearScript();
353 m_saveScript->setEnabled(false); 353 m_saveScript->setEnabled(false);
354 m_recordScript->setEnabled(true); 354 m_recordScript->setEnabled(true);
355 populateScripts(); 355 populateScripts();
356 } 356 }
357 } 357 }
358} 358}
359 359
360void MainWindow::slotRunScript(int id) { 360void MainWindow::slotRunScript(int id) {
361 if (currentSession()) { 361 if (currentSession()) {
362 int index = m_scriptsPop->indexOf(id); 362 int index = m_scriptsPop->indexOf(id);
363 DocLnk *lnk = m_scriptsData.at(index); 363 DocLnk *lnk = m_scriptsData.at(index);
364 QString filePath = lnk->file(); 364 QString filePath = lnk->file();
365 Script script(filePath); 365 Script script(filePath);
366 currentSession()->emulationHandler()->runScript(&script); 366 currentSession()->emulationHandler()->runScript(&script);
367 } 367 }
368} 368}
369 369
370void MainWindow::slotConnect() { 370void MainWindow::slotConnect() {
371 if ( currentSession() ) { 371 if ( currentSession() ) {
372 bool ret = currentSession()->layer()->open(); 372 bool ret = currentSession()->layer()->open();
373 if(!ret) QMessageBox::warning(currentSession()->widgetStack(), 373 if(!ret) QMessageBox::warning(currentSession()->widgetStack(),
374 QObject::tr("Failed"), 374 QObject::tr("Failed"),
375 QObject::tr("Connecting failed for this session.")); 375 QObject::tr("Connecting failed for this session."));
376 else { 376 else {
377 m_connect->setEnabled( false ); 377 m_connect->setEnabled( false );
378 m_disconnect->setEnabled( true ); 378 m_disconnect->setEnabled( true );
379 379
380 // if it does not support file transfer, disable the menu entry 380 // if it does not support file transfer, disable the menu entry
381 if ( ( m_curSession->layer() )->supports()[1] == 0 ) { 381 if ( ( m_curSession->layer() )->supports()[1] == 0 ) {
382 m_transfer->setEnabled( false ); 382 m_transfer->setEnabled( false );
383 } else { 383 } else {
384 m_transfer->setEnabled( true ); 384 m_transfer->setEnabled( true );
385 } 385 }
386 386
387 m_recordScript->setEnabled( true ); 387 m_recordScript->setEnabled( true );
388 m_scripts->setItemEnabled(m_runScript_id, true); 388 m_scripts->setItemEnabled(m_runScript_id, true);
389 } 389 }
390 } 390 }
391} 391}
392 392
393void MainWindow::slotDisconnect() { 393void MainWindow::slotDisconnect() {
394 if ( currentSession() ) { 394 if ( currentSession() ) {
395 currentSession()->layer()->close(); 395 currentSession()->layer()->close();
396 m_connect->setEnabled( true ); 396 m_connect->setEnabled( true );
397 m_disconnect->setEnabled( false ); 397 m_disconnect->setEnabled( false );
398 m_transfer->setEnabled( false ); 398 m_transfer->setEnabled( false );
399 m_recordScript->setEnabled( false); 399 m_recordScript->setEnabled( false);
400 m_saveScript->setEnabled( false ); 400 m_saveScript->setEnabled( false );
401 m_scripts->setItemEnabled(m_runScript_id, false); 401 m_scripts->setItemEnabled(m_runScript_id, false);
402 } 402 }
403} 403}
404 404
405void MainWindow::slotTerminate() { 405void MainWindow::slotTerminate() {
406 if ( currentSession() ) 406 if ( currentSession() )
407 currentSession()->layer()->close(); 407 currentSession()->layer()->close();
408 408
409 slotClose(); 409 slotClose();
410 /* FIXME move to the next session */ 410 /* FIXME move to the next session */
411} 411}
412 412
413
414
415
416
417
413void MainWindow::slotQuickLaunch() { 418void MainWindow::slotQuickLaunch() {
414 Profile prof = manager()->profile( "default" ); 419 Profile prof = manager()->profile( "default" );
415 if ( prof.name() == "default" ) { 420 if ( prof.name() == "default" ) {
416 create( prof ); 421 create( prof );
417 } else { 422 } else {
418 QMessageBox::warning(this, tr("Failure"),tr("please configure one profile named \"default\"")); 423 Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 );
424 newProf.setAutoConnect( true );
425 create( newProf );
419 } 426 }
420 427
421} 428}
422 429
423void MainWindow::slotConfigure() { 430void MainWindow::slotConfigure() {
424 ConfigDialog conf( manager()->all(), factory() ); 431 ConfigDialog conf( manager()->all(), factory() );
425 conf.showMaximized(); 432 conf.showMaximized();
426 433
427 int ret = conf.exec(); 434 int ret = conf.exec();
428 435
429 if ( QDialog::Accepted == ret ) { 436 if ( QDialog::Accepted == ret ) {
430 manager()->setProfiles( conf.list() ); 437 manager()->setProfiles( conf.list() );
431 manager()->save(); 438 manager()->save();
432 populateProfiles(); 439 populateProfiles();
433 } 440 }
434} 441}
435/* 442/*
436 * we will remove 443 * we will remove
437 * this window from the tabwidget 444 * this window from the tabwidget
438 * remove it from the list 445 * remove it from the list
439 * delete it 446 * delete it
440 * and set the currentSession() 447 * and set the currentSession()
441 */ 448 */
442void MainWindow::slotClose() { 449void MainWindow::slotClose() {
443 if (!currentSession() ) 450 if (!currentSession() )
444 return; 451 return;
445 452
446 Session* ses = currentSession(); 453 Session* ses = currentSession();
447 qWarning("removing! currentSession %s", currentSession()->name().latin1() ); 454 qWarning("removing! currentSession %s", currentSession()->name().latin1() );
448 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ 455 /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */
449 m_curSession = NULL; 456 m_curSession = NULL;
450 tabWidget()->remove( /*currentSession()*/ses ); 457 tabWidget()->remove( /*currentSession()*/ses );
451 /*it's autodelete */ 458 /*it's autodelete */
452 m_sessions.remove( ses ); 459 m_sessions.remove( ses );
453 qWarning("after remove!!"); 460 qWarning("after remove!!");
454 461
455 if (!currentSession() ) { 462 if (!currentSession() ) {
456 m_connect->setEnabled( false ); 463 m_connect->setEnabled( false );
457 m_disconnect->setEnabled( false ); 464 m_disconnect->setEnabled( false );
458 m_terminate->setEnabled( false ); 465 m_terminate->setEnabled( false );
459 m_transfer->setEnabled( false ); 466 m_transfer->setEnabled( false );
460 m_recordScript->setEnabled( false ); 467 m_recordScript->setEnabled( false );
461 m_saveScript->setEnabled( false ); 468 m_saveScript->setEnabled( false );
462 m_scripts->setItemEnabled(m_runScript_id, false); 469 m_scripts->setItemEnabled(m_runScript_id, false);
463 m_fullscreen->setEnabled( false ); 470 m_fullscreen->setEnabled( false );
464 m_wrap->setEnabled( false ); 471 m_wrap->setEnabled( false );
465 m_closewindow->setEnabled( false ); 472 m_closewindow->setEnabled( false );
466 } 473 }
467 474
468 m_kb->loadDefaults(); 475 m_kb->loadDefaults();
469} 476}
470 477
471/* 478/*
472 * We will get the name 479 * We will get the name
473 * Then the profile 480 * Then the profile
474 * and then we will make a profile 481 * and then we will make a profile
475 */ 482 */
476void MainWindow::slotProfile( int id) { 483void MainWindow::slotProfile( int id) {
477 Profile prof = manager()->profile( m_sessionsPop->text( id) ); 484 Profile prof = manager()->profile( m_sessionsPop->text( id) );
478 create( prof ); 485 create( prof );
479} 486}
480 487
481 488
482 489