author | harlekin <harlekin> | 2002-10-17 17:56:30 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-17 17:56:30 (UTC) |
commit | 08e9fcbbaf57383fd65fe4eb197d97a51abe0f26 (patch) (unidiff) | |
tree | 5d7fc6d46ae5721481e1f8f98a7872416f720993 | |
parent | eb70c5c231b80d1e925b0098ad3c951917900071 (diff) | |
download | opie-08e9fcbbaf57383fd65fe4eb197d97a51abe0f26.zip opie-08e9fcbbaf57383fd65fe4eb197d97a51abe0f26.tar.gz opie-08e9fcbbaf57383fd65fe4eb197d97a51abe0f26.tar.bz2 |
autologin if profiles io layer offers it
-rw-r--r-- | noncore/apps/opie-console/MyPty.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 5 |
2 files changed, 7 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/MyPty.cpp b/noncore/apps/opie-console/MyPty.cpp index 565d03f..a2373bf 100644 --- a/noncore/apps/opie-console/MyPty.cpp +++ b/noncore/apps/opie-console/MyPty.cpp | |||
@@ -271,54 +271,56 @@ void MyPty::close() { | |||
271 | } | 271 | } |
272 | void MyPty::reload( const Profile& ) { | 272 | void MyPty::reload( const Profile& ) { |
273 | 273 | ||
274 | } | 274 | } |
275 | /*! sends len bytes through the line */ | 275 | /*! sends len bytes through the line */ |
276 | void MyPty::send(const QByteArray& ar) | 276 | void MyPty::send(const QByteArray& ar) |
277 | { | 277 | { |
278 | #ifdef VERBOSE_DEBUG | 278 | #ifdef VERBOSE_DEBUG |
279 | // verbose debug | 279 | // verbose debug |
280 | printf("sending bytes:\n"); | 280 | printf("sending bytes:\n"); |
281 | for (uint i = 0; i < ar.count(); i++) | 281 | for (uint i = 0; i < ar.count(); i++) |
282 | printf("%c", ar[i]); | 282 | printf("%c", ar[i]); |
283 | printf("\n"); | 283 | printf("\n"); |
284 | #endif | 284 | #endif |
285 | 285 | ||
286 | ::write(m_fd, ar.data(), ar.count()); | 286 | ::write(m_fd, ar.data(), ar.count()); |
287 | } | 287 | } |
288 | 288 | ||
289 | /*! indicates that a block of data is received */ | 289 | /*! indicates that a block of data is received */ |
290 | void MyPty::readPty() | 290 | void MyPty::readPty() |
291 | { | 291 | { |
292 | QByteArray buf(4096); | 292 | QByteArray buf(4096); |
293 | 293 | ||
294 | int len = ::read( m_fd, buf.data(), 4096 ); | 294 | int len = ::read( m_fd, buf.data(), 4096 ); |
295 | 295 | ||
296 | if (len == -1 || len == 0) { | 296 | if (len == -1 || len == 0) { |
297 | donePty(); | 297 | donePty(); |
298 | return; | 298 | return; |
299 | } | 299 | } |
300 | 300 | ||
301 | if (len < 0) | 301 | if (len < 0) |
302 | return; | 302 | return; |
303 | 303 | ||
304 | 304 | ||
305 | buf.resize(len); | 305 | buf.resize(len); |
306 | emit received(buf); | 306 | emit received(buf); |
307 | 307 | ||
308 | #ifdef VERBOSE_DEBUG | 308 | #ifdef VERBOSE_DEBUG |
309 | // verbose debug | 309 | // verbose debug |
310 | printf("read bytes:\n"); | 310 | printf("read bytes:\n"); |
311 | for (uint i = 0; i < buf.count(); i++) | 311 | for (uint i = 0; i < buf.count(); i++) |
312 | printf("%c", buf[i]); | 312 | printf("%c", buf[i]); |
313 | printf("\n"); | 313 | printf("\n"); |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | } | 316 | } |
317 | QBitArray MyPty::supports()const { | 317 | QBitArray MyPty::supports()const { |
318 | QBitArray ar(3); | 318 | QBitArray ar(3); |
319 | //autoconnect | ||
319 | ar[0] = 1; | 320 | ar[0] = 1; |
321 | // | ||
320 | ar[1] = 0; | 322 | ar[1] = 0; |
321 | ar[2] = 0; | 323 | ar[2] = 0; |
322 | 324 | ||
323 | return ar; | 325 | return ar; |
324 | } | 326 | } |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3066b35..fdb0452 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -353,96 +353,101 @@ void MainWindow::slotClose() { | |||
353 | 353 | ||
354 | Session* ses = currentSession(); | 354 | Session* ses = currentSession(); |
355 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 355 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
356 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 356 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
357 | m_curSession = NULL; | 357 | m_curSession = NULL; |
358 | tabWidget()->remove( /*currentSession()*/ses ); | 358 | tabWidget()->remove( /*currentSession()*/ses ); |
359 | /*it's autodelete */ | 359 | /*it's autodelete */ |
360 | m_sessions.remove( ses ); | 360 | m_sessions.remove( ses ); |
361 | qWarning("after remove!!"); | 361 | qWarning("after remove!!"); |
362 | 362 | ||
363 | if (!currentSession() ) { | 363 | if (!currentSession() ) { |
364 | m_connect->setEnabled( false ); | 364 | m_connect->setEnabled( false ); |
365 | m_disconnect->setEnabled( false ); | 365 | m_disconnect->setEnabled( false ); |
366 | m_terminate->setEnabled( false ); | 366 | m_terminate->setEnabled( false ); |
367 | m_transfer->setEnabled( false ); | 367 | m_transfer->setEnabled( false ); |
368 | m_recordScript->setEnabled( false ); | 368 | m_recordScript->setEnabled( false ); |
369 | m_saveScript->setEnabled( false ); | 369 | m_saveScript->setEnabled( false ); |
370 | m_runScript->setEnabled( false ); | 370 | m_runScript->setEnabled( false ); |
371 | m_fullscreen->setEnabled( false ); | 371 | m_fullscreen->setEnabled( false ); |
372 | m_closewindow->setEnabled( false ); | 372 | m_closewindow->setEnabled( false ); |
373 | } | 373 | } |
374 | } | 374 | } |
375 | 375 | ||
376 | /* | 376 | /* |
377 | * We will get the name | 377 | * We will get the name |
378 | * Then the profile | 378 | * Then the profile |
379 | * and then we will make a profile | 379 | * and then we will make a profile |
380 | */ | 380 | */ |
381 | void MainWindow::slotProfile( int id) { | 381 | void MainWindow::slotProfile( int id) { |
382 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 382 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
383 | create( prof ); | 383 | create( prof ); |
384 | } | 384 | } |
385 | void MainWindow::create( const Profile& prof ) { | 385 | void MainWindow::create( const Profile& prof ) { |
386 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 386 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
387 | 387 | ||
388 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 388 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
389 | { | 389 | { |
390 | QMessageBox::warning(this, | 390 | QMessageBox::warning(this, |
391 | QObject::tr("Session failed"), | 391 | QObject::tr("Session failed"), |
392 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 392 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
393 | //if(ses) delete ses; | 393 | //if(ses) delete ses; |
394 | return; | 394 | return; |
395 | } | 395 | } |
396 | 396 | ||
397 | m_sessions.append( ses ); | 397 | m_sessions.append( ses ); |
398 | tabWidget()->add( ses ); | 398 | tabWidget()->add( ses ); |
399 | m_curSession = ses; | 399 | m_curSession = ses; |
400 | 400 | ||
401 | // is io_layer wants direct connection, then autoconnect | ||
402 | if ( ( m_curSession->layer() )->supports()[0] = 1 ) { | ||
403 | slotConnect(); | ||
404 | } | ||
405 | |||
401 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 406 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
402 | m_connect->setEnabled( true ); | 407 | m_connect->setEnabled( true ); |
403 | m_disconnect->setEnabled( false ); | 408 | m_disconnect->setEnabled( false ); |
404 | m_terminate->setEnabled( true ); | 409 | m_terminate->setEnabled( true ); |
405 | m_transfer->setEnabled( true ); | 410 | m_transfer->setEnabled( true ); |
406 | m_recordScript->setEnabled( true ); | 411 | m_recordScript->setEnabled( true ); |
407 | m_saveScript->setEnabled( true ); | 412 | m_saveScript->setEnabled( true ); |
408 | m_runScript->setEnabled( true ); | 413 | m_runScript->setEnabled( true ); |
409 | m_fullscreen->setEnabled( true ); | 414 | m_fullscreen->setEnabled( true ); |
410 | m_closewindow->setEnabled( true ); | 415 | m_closewindow->setEnabled( true ); |
411 | } | 416 | } |
412 | 417 | ||
413 | void MainWindow::slotTransfer() | 418 | void MainWindow::slotTransfer() |
414 | { | 419 | { |
415 | if ( currentSession() ) { | 420 | if ( currentSession() ) { |
416 | TransferDialog dlg(this); | 421 | TransferDialog dlg(this); |
417 | dlg.showMaximized(); | 422 | dlg.showMaximized(); |
418 | dlg.exec(); | 423 | dlg.exec(); |
419 | } | 424 | } |
420 | } | 425 | } |
421 | 426 | ||
422 | 427 | ||
423 | void MainWindow::slotOpenKeb(bool state) { | 428 | void MainWindow::slotOpenKeb(bool state) { |
424 | 429 | ||
425 | if (state) m_keyBar->show(); | 430 | if (state) m_keyBar->show(); |
426 | else m_keyBar->hide(); | 431 | else m_keyBar->hide(); |
427 | 432 | ||
428 | } | 433 | } |
429 | void MainWindow::slotSessionChanged( Session* ses ) { | 434 | void MainWindow::slotSessionChanged( Session* ses ) { |
430 | qWarning("changed!"); | 435 | qWarning("changed!"); |
431 | if ( ses ) { | 436 | if ( ses ) { |
432 | m_curSession = ses; | 437 | m_curSession = ses; |
433 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 438 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
434 | if ( m_curSession->layer()->isConnected() ) { | 439 | if ( m_curSession->layer()->isConnected() ) { |
435 | m_connect->setEnabled( false ); | 440 | m_connect->setEnabled( false ); |
436 | m_disconnect->setEnabled( true ); | 441 | m_disconnect->setEnabled( true ); |
437 | } else { | 442 | } else { |
438 | m_connect->setEnabled( true ); | 443 | m_connect->setEnabled( true ); |
439 | m_disconnect->setEnabled( false ); | 444 | m_disconnect->setEnabled( false ); |
440 | } | 445 | } |
441 | } | 446 | } |
442 | } | 447 | } |
443 | 448 | ||
444 | void MainWindow::slotFullscreen() { | 449 | void MainWindow::slotFullscreen() { |
445 | 450 | ||
446 | if ( m_isFullscreen ) { | 451 | if ( m_isFullscreen ) { |
447 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); | 452 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
448 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 453 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |