summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp44
-rw-r--r--noncore/apps/opie-console/transferdialog.h3
2 files changed, 34 insertions, 13 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index 0083cc1..f9a0b87 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -29,4 +29,6 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
QRadioButton *mode_send, *mode_receive;
+ m_autocleanup = 0;
+
group = new QButtonGroup(QObject::tr("Transfer mode"), this);
mode_send = new QRadioButton(QObject::tr("Send"), group);
@@ -114,4 +116,7 @@ void TransferDialog::slotTransfer()
ok->setEnabled(false);
+ cleanup();
+ m_autocleanup = 0;
+
if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
else statusbar->setText(QObject::tr("Receiving..."));
@@ -139,4 +144,20 @@ void TransferDialog::slotTransfer()
}
+void TransferDialog::cleanup()
+{
+ if(m_lay)
+ {
+ m_lay->cancel();
+ delete m_lay;
+ m_lay = 0l;
+ }
+ if(m_recvlay)
+ {
+ m_recvlay->cancel();
+ delete m_recvlay;
+ m_recvlay = 0l;
+ }
+}
+
void TransferDialog::slotCancel()
{
@@ -146,19 +167,12 @@ void TransferDialog::slotCancel()
if((m_lay) || (m_recvlay))
{
- if(m_lay)
- {
- m_lay->cancel();
- delete m_lay;
- m_lay = 0l;
- }
- if(m_recvlay)
+ cleanup();
+ if(m_autocleanup) close();
+ else
{
- m_recvlay->cancel();
- delete m_recvlay;
- m_recvlay = 0l;
+ QMessageBox::information(this,
+ QObject::tr("Cancelled"),
+ QObject::tr("The file transfer has been cancelled."));
}
- QMessageBox::information(this,
- QObject::tr("Cancelled"),
- QObject::tr("The file transfer has been cancelled."));
}
else
@@ -211,4 +225,6 @@ void TransferDialog::slotError(int error, const QString& message)
break;
}
+
+ m_autocleanup = 1;
}
@@ -218,4 +234,5 @@ void TransferDialog::slotSent()
ok->setEnabled(true);
statusbar->setText(QObject::tr("Ready"));
+ m_autocleanup = 1;
}
@@ -225,4 +242,5 @@ void TransferDialog::slotReceived(const QString& file)
ok->setEnabled(true);
statusbar->setText(QObject::tr("Ready"));
+ m_autocleanup = 1;
}
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index de3a5cf..1b27f16 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -37,4 +37,6 @@ class TransferDialog : public QDialog
};
+ void cleanup();
+
QLineEdit *filename;
QComboBox *protocol;
@@ -46,4 +48,5 @@ class TransferDialog : public QDialog
ReceiveLayer *m_recvlay;
int m_transfermode;
+ int m_autocleanup;
};