summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-13 12:11:15 (UTC)
committer josef <josef>2002-10-13 12:11:15 (UTC)
commit0e6d241e26211a8ffff07ba8e23f4a3cec9065be (patch) (unidiff)
tree1cecafc71b4261943250cf7f83013e749c5c3a1e
parent5f9fb52583eb399c79a108b8e79c1a558a730422 (diff)
downloadopie-0e6d241e26211a8ffff07ba8e23f4a3cec9065be.zip
opie-0e6d241e26211a8ffff07ba8e23f4a3cec9065be.tar.gz
opie-0e6d241e26211a8ffff07ba8e23f4a3cec9065be.tar.bz2
- extend file transfer dialog so it can receive too (without filename argument)
- fix error messages so they match the error code - don't show dialog maximized. It's still modal but we're coming near... - reset status to "ready" after interrupting or finishing operation - bugfix in filetransfer.cpp: don't kill process if pid is not set => before the fix, cancel() killed random processes!
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/filetransfer.cpp4
-rw-r--r--noncore/apps/opie-console/mainwindow.cpp2
-rw-r--r--noncore/apps/opie-console/transferdialog.cpp99
-rw-r--r--noncore/apps/opie-console/transferdialog.h14
4 files changed, 79 insertions, 40 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp
index 8e86ebb..14787f6 100644
--- a/noncore/apps/opie-console/filetransfer.cpp
+++ b/noncore/apps/opie-console/filetransfer.cpp
@@ -16,3 +16,3 @@
16FileTransfer::FileTransfer( Type t, IOLayer* lay ) 16FileTransfer::FileTransfer( Type t, IOLayer* lay )
17 : FileTransferLayer( lay ), m_type( t ) { 17 : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) {
18 signal(SIGPIPE, SIG_IGN ); 18 signal(SIGPIPE, SIG_IGN );
@@ -237,3 +237,3 @@ void FileTransfer::slotProgress( const QStringList& list ) {
237void FileTransfer::cancel() { 237void FileTransfer::cancel() {
238 ::kill(m_pid,9 ); 238 if(m_pid > 0) ::kill(m_pid,9 );
239 delete m_not; 239 delete m_not;
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp
index 3af0cba..8f5d56b 100644
--- a/noncore/apps/opie-console/mainwindow.cpp
+++ b/noncore/apps/opie-console/mainwindow.cpp
@@ -263,3 +263,3 @@ void MainWindow::slotTransfer()
263 TransferDialog dlg(this); 263 TransferDialog dlg(this);
264 dlg.showMaximized(); 264 //dlg.showMaximized();
265 dlg.exec(); 265 dlg.exec();
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}
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h
index b0c1a76..a567161 100644
--- a/noncore/apps/opie-console/transferdialog.h
+++ b/noncore/apps/opie-console/transferdialog.h
@@ -27,4 +27,11 @@ class TransferDialog : public QDialog
27 void slotSent(); 27 void slotSent();
28 void slotMode(int id);
28 29
29 private: 30 private:
31 enum Modes
32 {
33 id_send,
34 id_receive
35 };
36
30 QLineEdit *filename; 37 QLineEdit *filename;
@@ -33,5 +40,6 @@ class TransferDialog : public QDialog
33 QLabel *statusbar; 40 QLabel *statusbar;
34 QPushButton *ok, *cancel; 41 QPushButton *ok, *cancel, *selector;
35 MainWindow* m_win; 42 MainWindow* m_win;
36 FileTransferLayer* m_lay; 43 FileTransferLayer* m_lay;
44 int m_transfermode;
37}; 45};