summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-console/transferdialog.cpp
Unidiff
Diffstat (limited to 'noncore/apps/opie-console/transferdialog.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp99
1 files changed, 65 insertions, 34 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp
index ba06199..d3b9c0a 100644
--- a/noncore/apps/opie-console/transferdialog.cpp
+++ b/noncore/apps/opie-console/transferdialog.cpp
@@ -7,2 +7,4 @@
7#include <qprogressbar.h> 7#include <qprogressbar.h>
8#include <qradiobutton.h>
9#include <qbuttongroup.h>
8 10
@@ -17,20 +19,27 @@
17 19
18
19
20
21
22
23
24TransferDialog::TransferDialog(MainWindow *parent, const char *name) 20TransferDialog::TransferDialog(MainWindow *parent, const char *name)
25: QDialog(/*parent, name*/0l, 0l, true), m_win(parent) 21: QDialog(0l, 0l, true), m_win(parent)
26{ 22{
27 m_lay = 0l; 23 m_lay = 0l;
28 QVBoxLayout *vbox; 24 QVBoxLayout *vbox, *vbox2;
29 QHBoxLayout *hbox, *hbox2; 25 QHBoxLayout *hbox, *hbox2, *hbox3;
30 QLabel *file, *mode, *progress, *status; 26 QLabel *file, *mode, *progress, *status;
31 QPushButton *selector; 27 QButtonGroup *group;
32 28 QRadioButton *mode_send, *mode_receive;
29
30 group = new QButtonGroup(QObject::tr("Transfer mode"), this);
31 mode_send = new QRadioButton(QObject::tr("Send"), group);
32 mode_receive = new QRadioButton(QObject::tr("Receive"), group);
33 group->insert(mode_send, id_send);
34 group->insert(mode_receive, id_receive);
35 vbox2 = new QVBoxLayout(group, 2);
36 vbox2->addSpacing(10);
37 hbox3 = new QHBoxLayout(vbox2, 2);
38 hbox3->add(mode_send);
39 hbox3->add(mode_receive);
40 mode_send->setChecked(true);
41 m_transfermode = id_send;
33 42
34 file = new QLabel(QObject::tr("Send file"), this); 43 file = new QLabel(QObject::tr("Send file"), this);
35 mode = new QLabel(QObject::tr("Transfer mode"), this); 44 mode = new QLabel(QObject::tr("Transfer protocol"), this);
36 progress = new QLabel(QObject::tr("Progress"), this); 45 progress = new QLabel(QObject::tr("Progress"), this);
@@ -38,3 +47,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
38 47
39 statusbar = new QLabel(QObject::tr("ready"), this); 48 statusbar = new QLabel(QObject::tr("Ready"), this);
40 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); 49 statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken);
@@ -42,10 +51,5 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
42 protocol = new QComboBox(this); 51 protocol = new QComboBox(this);
43 /* use the fscking MetaFactory 52 QStringList list = m_win->factory()->fileTransferLayers();
44 * because we invented it for that fscking reason 53 for (QStringList::Iterator it = list.begin(); it != list.end(); ++it)
45 * I'm really getting UPSET!!!! 54 protocol->insertItem((*it));
46 */
47 QStringList list = m_win->factory()->fileTransferLayers();
48 for (QStringList::Iterator it =list.begin(); it != list.end(); ++it ) {
49 protocol->insertItem( (*it) );
50 }
51 55
@@ -61,2 +65,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
61 vbox = new QVBoxLayout(this, 2); 65 vbox = new QVBoxLayout(this, 2);
66 vbox->add(group);
62 vbox->add(file); 67 vbox->add(file);
@@ -82,2 +87,3 @@ TransferDialog::TransferDialog(MainWindow *parent, const char *name)
82 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); 87 connect(cancel, SIGNAL(clicked()), SLOT(slotCancel()));
88 connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int)));
83} 89}
@@ -98,3 +104,3 @@ void TransferDialog::slotTransfer()
98{ 104{
99 if(filename->text().isEmpty()) 105 if((m_transfermode == id_send) && (filename->text().isEmpty()))
100 { 106 {
@@ -108,9 +114,15 @@ void TransferDialog::slotTransfer()
108 114
109 statusbar->setText(QObject::tr("Sending...")); 115 if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending..."));
116 else statusbar->setText(QObject::tr("Receiving..."));
110 117
111 m_lay = m_win->factory()->newFileTransfer( protocol->currentText(), 118 m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer());
112 m_win->currentSession()->layer() ); 119 if(m_transfermode == id_send)
113 m_lay->sendFile(filename->text()); 120 {
121 m_lay->sendFile(filename->text());
122 }
123 else
124 {
125 }
114 126
115 connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int))); 127 connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), SLOT(slotProgress(const QString&, int, int, int, int, int)));
116 connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); 128 connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&)));
@@ -122,2 +134,3 @@ void TransferDialog::slotCancel()
122 ok->setEnabled(true); 134 ok->setEnabled(true);
135 statusbar->setText(QObject::tr("Ready"));
123 136
@@ -126,3 +139,3 @@ void TransferDialog::slotCancel()
126 m_lay->cancel(); 139 m_lay->cancel();
127 delete m_lay; 140 delete m_lay;
128 m_lay = 0l; 141 m_lay = 0l;
@@ -145,2 +158,4 @@ void TransferDialog::slotError(int error, const QString& message)
145{ 158{
159 statusbar->setText(QObject::tr("Ready"));
160
146 switch(error) 161 switch(error)
@@ -155,3 +170,3 @@ void TransferDialog::slotError(int error, const QString& message)
155 QObject::tr("Error"), 170 QObject::tr("Error"),
156 QObject::tr("Operation not supported.")); 171 QObject::tr("Transfer could not be started."));
157 break; 172 break;
@@ -160,3 +175,3 @@ void TransferDialog::slotError(int error, const QString& message)
160 QObject::tr("Error"), 175 QObject::tr("Error"),
161 QObject::tr("Operation not supported.")); 176 QObject::tr("No error."));
162 break; 177 break;
@@ -165,3 +180,3 @@ void TransferDialog::slotError(int error, const QString& message)
165 QObject::tr("Error"), 180 QObject::tr("Error"),
166 QObject::tr("Operation not supported.")); 181 QObject::tr("Undefined error occured."));
167 break; 182 break;
@@ -170,3 +185,3 @@ void TransferDialog::slotError(int error, const QString& message)
170 QObject::tr("Error"), 185 QObject::tr("Error"),
171 QObject::tr("Operation not supported.")); 186 QObject::tr("Incomplete transfer."));
172 break; 187 break;
@@ -176,3 +191,3 @@ void TransferDialog::slotError(int error, const QString& message)
176 QObject::tr("Error"), 191 QObject::tr("Error"),
177 QObject::tr("Operation not supported.")); 192 QObject::tr("Unknown error occured."));
178 break; 193 break;
@@ -185,2 +200,18 @@ void TransferDialog::slotSent()
185 ok->setEnabled(true); 200 ok->setEnabled(true);
201 statusbar->setText(QObject::tr("Ready"));
202}
203
204void TransferDialog::slotMode(int id)
205{
206 if(id == id_send)
207 {
208 selector->setEnabled(true);
209 filename->setEnabled(true);
210 }
211 else
212 {
213 selector->setEnabled(false);
214 filename->setEnabled(false);
215 }
216 m_transfermode = id;
186} 217}