author | harlekin <harlekin> | 2003-03-21 23:38:17 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2003-03-21 23:38:17 (UTC) |
commit | ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4 (patch) (unidiff) | |
tree | 82690d415f22ffe554d4fcfe359ee8121b90d888 | |
parent | 43b0fded770624c907aae043e88449f80040d7df (diff) | |
download | opie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.zip opie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.tar.gz opie-ab8cb739c666f5f22049258a4bcbb06d1e1ad0c4.tar.bz2 |
even better then poping up an error dialog: make a new profile
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 9 |
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 | |||
@@ -221,390 +221,397 @@ void MainWindow::initUI() { | |||
221 | 221 | ||
222 | 222 | ||
223 | a = new QAction(tr("Copy"), | 223 | a = new QAction(tr("Copy"), |
224 | Resource::loadPixmap("copy"), QString::null, | 224 | Resource::loadPixmap("copy"), QString::null, |
225 | 0, this, 0 ); | 225 | 0, this, 0 ); |
226 | //a->addTo( m_icons ); | 226 | //a->addTo( m_icons ); |
227 | connect( a, SIGNAL(activated() ), | 227 | connect( a, SIGNAL(activated() ), |
228 | this, SLOT(slotCopy() ) ); | 228 | this, SLOT(slotCopy() ) ); |
229 | 229 | ||
230 | QAction *paste = new QAction(tr("Paste"), | 230 | QAction *paste = new QAction(tr("Paste"), |
231 | Resource::loadPixmap("paste"), QString::null, | 231 | Resource::loadPixmap("paste"), QString::null, |
232 | 0, this, 0 ); | 232 | 0, this, 0 ); |
233 | connect( paste, SIGNAL(activated() ), | 233 | connect( paste, SIGNAL(activated() ), |
234 | this, SLOT(slotPaste() ) ); | 234 | this, SLOT(slotPaste() ) ); |
235 | 235 | ||
236 | 236 | ||
237 | newCon->addTo( m_icons ); | 237 | newCon->addTo( m_icons ); |
238 | m_setProfiles->addTo( m_icons ); | 238 | m_setProfiles->addTo( m_icons ); |
239 | paste->addTo( m_icons ); | 239 | paste->addTo( m_icons ); |
240 | m_openKeys->addTo(m_icons); | 240 | m_openKeys->addTo(m_icons); |
241 | m_fullscreen->addTo( m_icons ); | 241 | m_fullscreen->addTo( m_icons ); |
242 | 242 | ||
243 | m_connect->setEnabled( false ); | 243 | m_connect->setEnabled( false ); |
244 | m_disconnect->setEnabled( false ); | 244 | m_disconnect->setEnabled( false ); |
245 | m_terminate->setEnabled( false ); | 245 | m_terminate->setEnabled( false ); |
246 | m_transfer->setEnabled( false ); | 246 | m_transfer->setEnabled( false ); |
247 | m_scripts->setItemEnabled(m_runScript_id, false); | 247 | m_scripts->setItemEnabled(m_runScript_id, false); |
248 | m_recordScript->setEnabled( false ); | 248 | m_recordScript->setEnabled( false ); |
249 | m_saveScript->setEnabled( false ); | 249 | m_saveScript->setEnabled( false ); |
250 | m_fullscreen->setEnabled( false ); | 250 | m_fullscreen->setEnabled( false ); |
251 | m_closewindow->setEnabled( false ); | 251 | m_closewindow->setEnabled( false ); |
252 | m_wrap->setEnabled( false ); | 252 | m_wrap->setEnabled( false ); |
253 | 253 | ||
254 | /* | 254 | /* |
255 | * connect to the menu activation | 255 | * connect to the menu activation |
256 | */ | 256 | */ |
257 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 257 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
258 | this, SLOT(slotProfile( int ) ) ); | 258 | this, SLOT(slotProfile( int ) ) ); |
259 | 259 | ||
260 | m_consoleWindow = new TabWidget( this, "blah"); | 260 | m_consoleWindow = new TabWidget( this, "blah"); |
261 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 261 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
262 | this, SLOT(slotSessionChanged(Session*) ) ); | 262 | this, SLOT(slotSessionChanged(Session*) ) ); |
263 | setCentralWidget( m_consoleWindow ); | 263 | setCentralWidget( m_consoleWindow ); |
264 | 264 | ||
265 | } | 265 | } |
266 | 266 | ||
267 | ProfileManager* MainWindow::manager() { | 267 | ProfileManager* MainWindow::manager() { |
268 | return m_manager; | 268 | return m_manager; |
269 | } | 269 | } |
270 | TabWidget* MainWindow::tabWidget() { | 270 | TabWidget* MainWindow::tabWidget() { |
271 | return m_consoleWindow; | 271 | return m_consoleWindow; |
272 | } | 272 | } |
273 | void MainWindow::populateProfiles() { | 273 | void MainWindow::populateProfiles() { |
274 | m_sessionsPop->clear(); | 274 | m_sessionsPop->clear(); |
275 | Profile::ValueList list = manager()->all(); | 275 | Profile::ValueList list = manager()->all(); |
276 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 276 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
277 | m_sessionsPop->insertItem( (*it).name() ); | 277 | m_sessionsPop->insertItem( (*it).name() ); |
278 | } | 278 | } |
279 | 279 | ||
280 | } | 280 | } |
281 | 281 | ||
282 | void MainWindow::populateScripts() { | 282 | void MainWindow::populateScripts() { |
283 | m_scriptsPop->clear(); | 283 | m_scriptsPop->clear(); |
284 | m_scriptsData.clear(); | 284 | m_scriptsData.clear(); |
285 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 285 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
286 | QListIterator<DocLnk> dit(files.children()); | 286 | QListIterator<DocLnk> dit(files.children()); |
287 | for (; dit.current(); ++dit) { | 287 | for (; dit.current(); ++dit) { |
288 | if (*dit && (*dit)->name().length()>0) { | 288 | if (*dit && (*dit)->name().length()>0) { |
289 | QFileInfo info((*dit)->file()); | 289 | QFileInfo info((*dit)->file()); |
290 | if (info.extension(false) == "script") { | 290 | if (info.extension(false) == "script") { |
291 | m_scriptsData.append(new DocLnk(**dit)); | 291 | m_scriptsData.append(new DocLnk(**dit)); |
292 | m_scriptsPop->insertItem((*dit)->name()); | 292 | m_scriptsPop->insertItem((*dit)->name()); |
293 | } | 293 | } |
294 | } | 294 | } |
295 | } | 295 | } |
296 | 296 | ||
297 | } | 297 | } |
298 | 298 | ||
299 | MainWindow::~MainWindow() { | 299 | MainWindow::~MainWindow() { |
300 | delete m_factory; | 300 | delete m_factory; |
301 | manager()->save(); | 301 | manager()->save(); |
302 | } | 302 | } |
303 | 303 | ||
304 | MetaFactory* MainWindow::factory() { | 304 | MetaFactory* MainWindow::factory() { |
305 | return m_factory; | 305 | return m_factory; |
306 | } | 306 | } |
307 | 307 | ||
308 | Session* MainWindow::currentSession() { | 308 | Session* MainWindow::currentSession() { |
309 | return m_curSession; | 309 | return m_curSession; |
310 | } | 310 | } |
311 | 311 | ||
312 | QList<Session> MainWindow::sessions() { | 312 | QList<Session> MainWindow::sessions() { |
313 | return m_sessions; | 313 | return m_sessions; |
314 | } | 314 | } |
315 | 315 | ||
316 | void MainWindow::slotNew() { | 316 | void MainWindow::slotNew() { |
317 | ProfileEditorDialog dlg(factory() ); | 317 | ProfileEditorDialog dlg(factory() ); |
318 | dlg.showMaximized(); | 318 | dlg.showMaximized(); |
319 | dlg.setCaption( tr("New Connection") ); | 319 | dlg.setCaption( tr("New Connection") ); |
320 | int ret = dlg.exec(); | 320 | int ret = dlg.exec(); |
321 | 321 | ||
322 | if ( ret == QDialog::Accepted ) { | 322 | if ( ret == QDialog::Accepted ) { |
323 | create( dlg.profile() ); | 323 | create( dlg.profile() ); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | void MainWindow::slotRecordScript() { | 327 | void MainWindow::slotRecordScript() { |
328 | if (currentSession()) { | 328 | if (currentSession()) { |
329 | currentSession()->emulationHandler()->startRecording(); | 329 | currentSession()->emulationHandler()->startRecording(); |
330 | m_saveScript->setEnabled(true); | 330 | m_saveScript->setEnabled(true); |
331 | m_recordScript->setEnabled(false); | 331 | m_recordScript->setEnabled(false); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | void MainWindow::slotSaveScript() { | 335 | void MainWindow::slotSaveScript() { |
336 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 336 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
337 | QMap<QString, QStringList> map; | 337 | QMap<QString, QStringList> map; |
338 | QStringList text; | 338 | QStringList text; |
339 | text << "text/plain"; | 339 | text << "text/plain"; |
340 | map.insert(tr("Script"), text ); | 340 | map.insert(tr("Script"), text ); |
341 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 341 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
342 | if (!filename.isEmpty()) { | 342 | if (!filename.isEmpty()) { |
343 | QFileInfo info(filename); | 343 | QFileInfo info(filename); |
344 | if (info.extension(FALSE) != "script") | 344 | if (info.extension(FALSE) != "script") |
345 | filename += ".script"; | 345 | filename += ".script"; |
346 | DocLnk nf; | 346 | DocLnk nf; |
347 | nf.setType("text/plain"); | 347 | nf.setType("text/plain"); |
348 | nf.setFile(filename); | 348 | nf.setFile(filename); |
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 | ||
360 | void MainWindow::slotRunScript(int id) { | 360 | void 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 | ||
370 | void MainWindow::slotConnect() { | 370 | void 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 | ||
393 | void MainWindow::slotDisconnect() { | 393 | void 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 | ||
405 | void MainWindow::slotTerminate() { | 405 | void 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 | |||
413 | void MainWindow::slotQuickLaunch() { | 418 | void 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 | ||
423 | void MainWindow::slotConfigure() { | 430 | void 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 | */ |
442 | void MainWindow::slotClose() { | 449 | void 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 | */ |
476 | void MainWindow::slotProfile( int id) { | 483 | void 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 | ||
483 | void MainWindow::create( const Profile& prof ) { | 490 | void MainWindow::create( const Profile& prof ) { |
484 | if(m_curSession) | 491 | if(m_curSession) |
485 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 492 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
486 | 493 | ||
487 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 494 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
488 | 495 | ||
489 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 496 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
490 | { | 497 | { |
491 | QMessageBox::warning(this, | 498 | QMessageBox::warning(this, |
492 | QObject::tr("Session failed"), | 499 | QObject::tr("Session failed"), |
493 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 500 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
494 | //if(ses) delete ses; | 501 | //if(ses) delete ses; |
495 | return; | 502 | return; |
496 | } | 503 | } |
497 | 504 | ||
498 | m_sessions.append( ses ); | 505 | m_sessions.append( ses ); |
499 | tabWidget()->add( ses ); | 506 | tabWidget()->add( ses ); |
500 | tabWidget()->repaint(); | 507 | tabWidget()->repaint(); |
501 | m_curSession = ses; | 508 | m_curSession = ses; |
502 | 509 | ||
503 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 510 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
504 | m_connect->setEnabled( true ); | 511 | m_connect->setEnabled( true ); |
505 | m_disconnect->setEnabled( false ); | 512 | m_disconnect->setEnabled( false ); |
506 | m_terminate->setEnabled( true ); | 513 | m_terminate->setEnabled( true ); |
507 | m_fullscreen->setEnabled( true ); | 514 | m_fullscreen->setEnabled( true ); |
508 | m_wrap->setEnabled( true ); | 515 | m_wrap->setEnabled( true ); |
509 | m_closewindow->setEnabled( true ); | 516 | m_closewindow->setEnabled( true ); |
510 | m_transfer->setEnabled( false ); | 517 | m_transfer->setEnabled( false ); |
511 | m_recordScript->setEnabled( false ); | 518 | m_recordScript->setEnabled( false ); |
512 | m_saveScript->setEnabled( false ); | 519 | m_saveScript->setEnabled( false ); |
513 | m_scripts->setItemEnabled(m_runScript_id, false); | 520 | m_scripts->setItemEnabled(m_runScript_id, false); |
514 | 521 | ||
515 | // is io_layer wants direct connection, then autoconnect | 522 | // is io_layer wants direct connection, then autoconnect |
516 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 523 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
517 | if (prof.autoConnect()) { | 524 | if (prof.autoConnect()) { |
518 | slotConnect(); | 525 | slotConnect(); |
519 | } | 526 | } |
520 | 527 | ||
521 | 528 | ||
522 | QWidget *w = currentSession()->widget(); | 529 | QWidget *w = currentSession()->widget(); |
523 | if(w) w->setFocus(); | 530 | if(w) w->setFocus(); |
524 | 531 | ||
525 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 532 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
526 | m_isWrapped = true; | 533 | m_isWrapped = true; |
527 | } else { | 534 | } else { |
528 | m_isWrapped = false; | 535 | m_isWrapped = false; |
529 | } | 536 | } |
530 | 537 | ||
531 | m_kb->load(currentSession()->profile()); | 538 | m_kb->load(currentSession()->profile()); |
532 | } | 539 | } |
533 | 540 | ||
534 | void MainWindow::slotTransfer() | 541 | void MainWindow::slotTransfer() |
535 | { | 542 | { |
536 | if ( currentSession() ) { | 543 | if ( currentSession() ) { |
537 | Session *mysession = currentSession(); | 544 | Session *mysession = currentSession(); |
538 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 545 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
539 | mysession->setTransferDialog(&dlg); | 546 | mysession->setTransferDialog(&dlg); |
540 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 547 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
541 | //dlg.showMaximized(); | 548 | //dlg.showMaximized(); |
542 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 549 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
543 | dlg.show(); | 550 | dlg.show(); |
544 | //dlg.exec(); | 551 | //dlg.exec(); |
545 | while(dlg.isRunning()) qApp->processEvents(); | 552 | while(dlg.isRunning()) qApp->processEvents(); |
546 | mysession->setTransferDialog(0l); | 553 | mysession->setTransferDialog(0l); |
547 | } | 554 | } |
548 | } | 555 | } |
549 | 556 | ||
550 | 557 | ||
551 | void MainWindow::slotOpenKeb(bool state) { | 558 | void MainWindow::slotOpenKeb(bool state) { |
552 | 559 | ||
553 | if (state) m_keyBar->show(); | 560 | if (state) m_keyBar->show(); |
554 | else m_keyBar->hide(); | 561 | else m_keyBar->hide(); |
555 | 562 | ||
556 | } | 563 | } |
557 | 564 | ||
558 | 565 | ||
559 | void MainWindow::slotOpenButtons( bool state ) { | 566 | void MainWindow::slotOpenButtons( bool state ) { |
560 | 567 | ||
561 | if ( state ) { | 568 | if ( state ) { |
562 | m_buttonBar->show(); | 569 | m_buttonBar->show(); |
563 | } else { | 570 | } else { |
564 | m_buttonBar->hide(); | 571 | m_buttonBar->hide(); |
565 | } | 572 | } |
566 | } | 573 | } |
567 | 574 | ||
568 | 575 | ||
569 | 576 | ||
570 | void MainWindow::slotSessionChanged( Session* ses ) { | 577 | void MainWindow::slotSessionChanged( Session* ses ) { |
571 | qWarning("changed!"); | 578 | qWarning("changed!"); |
572 | 579 | ||
573 | if(m_curSession) | 580 | if(m_curSession) |
574 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 581 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
575 | if(ses) | 582 | if(ses) |
576 | if(ses->transferDialog()) ses->transferDialog()->show(); | 583 | if(ses->transferDialog()) ses->transferDialog()->show(); |
577 | 584 | ||
578 | if ( ses ) { | 585 | if ( ses ) { |
579 | m_curSession = ses; | 586 | m_curSession = ses; |
580 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 587 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
581 | if ( m_curSession->layer()->isConnected() ) { | 588 | if ( m_curSession->layer()->isConnected() ) { |
582 | m_connect->setEnabled( false ); | 589 | m_connect->setEnabled( false ); |
583 | m_disconnect->setEnabled( true ); | 590 | m_disconnect->setEnabled( true ); |
584 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 591 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
585 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 592 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
586 | m_scripts->setItemEnabled(m_runScript_id, true); | 593 | m_scripts->setItemEnabled(m_runScript_id, true); |
587 | } else { | 594 | } else { |
588 | m_connect->setEnabled( true ); | 595 | m_connect->setEnabled( true ); |
589 | m_disconnect->setEnabled( false ); | 596 | m_disconnect->setEnabled( false ); |
590 | m_recordScript->setEnabled( false ); | 597 | m_recordScript->setEnabled( false ); |
591 | m_saveScript->setEnabled( false ); | 598 | m_saveScript->setEnabled( false ); |
592 | m_scripts->setItemEnabled(m_runScript_id, false); | 599 | m_scripts->setItemEnabled(m_runScript_id, false); |
593 | } | 600 | } |
594 | 601 | ||
595 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 602 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
596 | m_transfer->setEnabled( false ); | 603 | m_transfer->setEnabled( false ); |
597 | } else { | 604 | } else { |
598 | m_transfer->setEnabled( true ); | 605 | m_transfer->setEnabled( true ); |
599 | } | 606 | } |
600 | 607 | ||
601 | QWidget *w = m_curSession->widget(); | 608 | QWidget *w = m_curSession->widget(); |
602 | if(w) w->setFocus(); | 609 | if(w) w->setFocus(); |
603 | 610 | ||
604 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 611 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
605 | m_isWrapped = true; | 612 | m_isWrapped = true; |
606 | } else { | 613 | } else { |
607 | m_isWrapped = false; | 614 | m_isWrapped = false; |
608 | } | 615 | } |
609 | 616 | ||
610 | m_kb->load(currentSession()->profile()); | 617 | m_kb->load(currentSession()->profile()); |