Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
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 | |||
@@ -9,35 +9,36 @@ | |||
9 | #include <qbuttongroup.h> | 9 | #include <qbuttongroup.h> |
10 | 10 | ||
11 | #include <opie/ofiledialog.h> | 11 | #include <opie/ofiledialog.h> |
12 | 12 | ||
13 | #include "file_layer.h" | 13 | #include "file_layer.h" |
14 | #include "receive_layer.h" | 14 | #include "receive_layer.h" |
15 | #include "metafactory.h" | 15 | #include "metafactory.h" |
16 | #include "mainwindow.h" | 16 | #include "mainwindow.h" |
17 | 17 | ||
18 | #include "transferdialog.h" | 18 | #include "transferdialog.h" |
19 | 19 | ||
20 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) | 20 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) |
21 | : QDialog(parent, 0l, true), m_win(mainwindow) | 21 | : QDialog(parent, 0l, false), m_win(mainwindow) |
22 | { | 22 | { |
23 | m_lay = 0l; | 23 | m_lay = 0l; |
24 | m_recvlay = 0l; | 24 | m_recvlay = 0l; |
25 | QVBoxLayout *vbox, *vbox2; | 25 | QVBoxLayout *vbox, *vbox2; |
26 | QHBoxLayout *hbox, *hbox2, *hbox3; | 26 | QHBoxLayout *hbox, *hbox2, *hbox3; |
27 | QLabel *file, *mode, *progress, *status; | 27 | QLabel *file, *mode, *progress, *status; |
28 | QButtonGroup *group; | 28 | QButtonGroup *group; |
29 | QRadioButton *mode_send, *mode_receive; | 29 | QRadioButton *mode_send, *mode_receive; |
30 | 30 | ||
31 | m_autocleanup = 0; | 31 | m_autocleanup = 0; |
32 | m_running = true; | ||
32 | 33 | ||
33 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); | 34 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); |
34 | mode_send = new QRadioButton(QObject::tr("Send"), group); | 35 | mode_send = new QRadioButton(QObject::tr("Send"), group); |
35 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); | 36 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); |
36 | group->insert(mode_send, id_send); | 37 | group->insert(mode_send, id_send); |
37 | group->insert(mode_receive, id_receive); | 38 | group->insert(mode_receive, id_receive); |
38 | vbox2 = new QVBoxLayout(group, 2); | 39 | vbox2 = new QVBoxLayout(group, 2); |
39 | vbox2->addSpacing(10); | 40 | vbox2->addSpacing(10); |
40 | hbox3 = new QHBoxLayout(vbox2, 2); | 41 | hbox3 = new QHBoxLayout(vbox2, 2); |
41 | hbox3->add(mode_send); | 42 | hbox3->add(mode_send); |
42 | hbox3->add(mode_receive); | 43 | hbox3->add(mode_receive); |
43 | mode_send->setChecked(true); | 44 | mode_send->setChecked(true); |
@@ -158,34 +159,39 @@ void TransferDialog::cleanup() | |||
158 | m_recvlay = 0l; | 159 | m_recvlay = 0l; |
159 | } | 160 | } |
160 | } | 161 | } |
161 | 162 | ||
162 | void TransferDialog::slotCancel() | 163 | void TransferDialog::slotCancel() |
163 | { | 164 | { |
164 | ok->setEnabled(true); | 165 | ok->setEnabled(true); |
165 | statusbar->setText(QObject::tr("Ready")); | 166 | statusbar->setText(QObject::tr("Ready")); |
166 | 167 | ||
167 | if((m_lay) || (m_recvlay)) | 168 | if((m_lay) || (m_recvlay)) |
168 | { | 169 | { |
169 | cleanup(); | 170 | cleanup(); |
170 | if(m_autocleanup) close(); | 171 | if(m_autocleanup) |
172 | { | ||
173 | m_running = false; | ||
174 | close(); | ||
175 | } | ||
171 | else | 176 | else |
172 | { | 177 | { |
173 | QMessageBox::information(this, | 178 | QMessageBox::information(this, |
174 | QObject::tr("Cancelled"), | 179 | QObject::tr("Cancelled"), |
175 | QObject::tr("The file transfer has been cancelled.")); | 180 | QObject::tr("The file transfer has been cancelled.")); |
176 | } | 181 | } |
177 | } | 182 | } |
178 | else | 183 | else |
179 | { | 184 | { |
185 | m_running = false; | ||
180 | close(); | 186 | close(); |
181 | } | 187 | } |
182 | } | 188 | } |
183 | 189 | ||
184 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) | 190 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) |
185 | { | 191 | { |
186 | progressbar->setProgress(progress); | 192 | progressbar->setProgress(progress); |
187 | } | 193 | } |
188 | 194 | ||
189 | void TransferDialog::slotError(int error, const QString& ) | 195 | void TransferDialog::slotError(int error, const QString& ) |
190 | { | 196 | { |
191 | statusbar->setText(QObject::tr("Ready")); | 197 | statusbar->setText(QObject::tr("Ready")); |
@@ -255,12 +261,17 @@ void TransferDialog::slotMode(int id) | |||
255 | { | 261 | { |
256 | selector->setEnabled(true); | 262 | selector->setEnabled(true); |
257 | filename->setEnabled(true); | 263 | filename->setEnabled(true); |
258 | } | 264 | } |
259 | else | 265 | else |
260 | { | 266 | { |
261 | selector->setEnabled(false); | 267 | selector->setEnabled(false); |
262 | filename->setEnabled(false); | 268 | filename->setEnabled(false); |
263 | } | 269 | } |
264 | m_transfermode = id; | 270 | m_transfermode = id; |
265 | } | 271 | } |
266 | 272 | ||
273 | bool TransferDialog::isRunning() | ||
274 | { | ||
275 | return m_running; | ||
276 | } | ||
277 | |||