-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 24 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.cpp | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/session.h | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 15 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 2 |
5 files changed, 46 insertions, 10 deletions
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index c44b359..5f6dc12 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp @@ -533,8 +533,11 @@ void MainWindow::slotProfile( int id) { Profile prof = manager()->profile( m_sessionsPop->text( id) ); create( prof ); } void MainWindow::create( const Profile& prof ) { + if(m_curSession) + if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); + Session *ses = manager()->fromProfile( prof, tabWidget() ); if((!ses) || (!ses->layer()) || (!ses->widgetStack())) { @@ -577,12 +580,17 @@ void MainWindow::create( const Profile& prof ) { void MainWindow::slotTransfer() { if ( currentSession() ) { - TransferDialog dlg(currentSession()->widgetStack(), this); - dlg.showMaximized(); + Session *mysession = currentSession(); + TransferDialog dlg(mysession->widgetStack(), this); + mysession->setTransferDialog(&dlg); + dlg.show(); + //dlg.showMaximized(); //currentSession()->widgetStack()->add(dlg); - dlg.exec(); + //dlg.exec(); + while(dlg.isRunning()) qApp->processEvents(); + mysession->setTransferDialog(0l); } } @@ -606,8 +614,14 @@ void MainWindow::slotOpenButtons( bool state ) { void MainWindow::slotSessionChanged( Session* ses ) { qWarning("changed!"); + + if(m_curSession) + if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); + if(ses) + if(ses->transferDialog()) ses->transferDialog()->show(); + if ( ses ) { m_curSession = ses; qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); if ( m_curSession->layer()->isConnected() ) { @@ -629,12 +643,8 @@ void MainWindow::slotSessionChanged( Session* ses ) { } else { m_transfer->setEnabled( true ); } - - - - QWidget *w = m_curSession->widget(); if(w) w->setFocus(); m_kb->load(currentSession()->profile()); diff --git a/noncore/apps/opie-console/session.cpp b/noncore/apps/opie-console/session.cpp index c166d95..4f52584 100644 --- a/noncore/apps/opie-console/session.cpp +++ b/noncore/apps/opie-console/session.cpp @@ -10,8 +10,9 @@ Session::Session() { m_widget = 0l; m_layer = 0l; m_emu = 0l; + m_transfer = 0l; } Session::Session( const QString& na, QWidgetStack* widget, IOLayer* lay) : m_name( na ), m_widget( widget ), m_layer( lay ) { @@ -103,5 +104,14 @@ void Session::setEmulationWidget( WidgetLayer* lay ) { delete m_widLay; m_widLay = lay; } */ +void Session::setTransferDialog(QWidget *d) +{ + m_transfer = d; +} + +QWidget *Session::transferDialog() +{ + return m_transfer; +} diff --git a/noncore/apps/opie-console/session.h b/noncore/apps/opie-console/session.h index f60a6c0..d69224a 100644 --- a/noncore/apps/opie-console/session.h +++ b/noncore/apps/opie-console/session.h @@ -63,15 +63,18 @@ public: void setIOLayer( IOLayer* ); void setName( const QString& ); void setProfile( const Profile& ); + void setTransferDialog(QWidget *d); + QWidget *transferDialog(); + private: QString m_name; QWidgetStack* m_widget; IOLayer* m_layer; EmulationHandler* m_emu; bool m_connected : 1; Profile m_prof; - + QWidget *m_transfer; }; #endif diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 75c4c72..0af1911 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp @@ -17,9 +17,9 @@ #include "transferdialog.h" TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) -: QDialog(parent, 0l, true), m_win(mainwindow) +: QDialog(parent, 0l, false), m_win(mainwindow) { m_lay = 0l; m_recvlay = 0l; QVBoxLayout *vbox, *vbox2; @@ -28,8 +28,9 @@ TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const ch QButtonGroup *group; QRadioButton *mode_send, *mode_receive; m_autocleanup = 0; + m_running = true; group = new QButtonGroup(QObject::tr("Transfer mode"), this); mode_send = new QRadioButton(QObject::tr("Send"), group); mode_receive = new QRadioButton(QObject::tr("Receive"), group); @@ -166,9 +167,13 @@ void TransferDialog::slotCancel() if((m_lay) || (m_recvlay)) { cleanup(); - if(m_autocleanup) close(); + if(m_autocleanup) + { + m_running = false; + close(); + } else { QMessageBox::information(this, QObject::tr("Cancelled"), @@ -176,8 +181,9 @@ void TransferDialog::slotCancel() } } else { + m_running = false; close(); } } @@ -263,4 +269,9 @@ void TransferDialog::slotMode(int id) } m_transfermode = id; } +bool TransferDialog::isRunning() +{ + return m_running; +} + diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h index d87be6a..23691e0 100644 --- a/noncore/apps/opie-console/transferdialog.h +++ b/noncore/apps/opie-console/transferdialog.h @@ -17,8 +17,9 @@ class TransferDialog : public QDialog Q_OBJECT public: TransferDialog(QWidget *parent = 0l, MainWindow *mainwindow = 0l, const char *name = 0l); ~TransferDialog(); + bool isRunning(); public slots: void slotFilename(); void slotTransfer(); @@ -47,8 +48,9 @@ class TransferDialog : public QDialog FileTransferLayer* m_lay; ReceiveLayer *m_recvlay; int m_transfermode; int m_autocleanup; + bool m_running; }; #endif |