author | josef <josef> | 2002-10-07 10:03:39 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-07 10:03:39 (UTC) |
commit | 399828740380aa59273cce8ddd9cc05588e2aeac (patch) (unidiff) | |
tree | b55316c98555f529239c1fcc841aad96ad69a18d | |
parent | 46171dcd991e8c3bfff8e662b3913f454714560a (diff) | |
download | opie-399828740380aa59273cce8ddd9cc05588e2aeac.zip opie-399828740380aa59273cce8ddd9cc05588e2aeac.tar.gz opie-399828740380aa59273cce8ddd9cc05588e2aeac.tar.bz2 |
- add first widget for transfer dialog
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 92 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 30 |
2 files changed, 122 insertions, 0 deletions
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp new file mode 100644 index 0000000..08fb32b --- a/dev/null +++ b/noncore/apps/opie-console/transferdialog.cpp | |||
@@ -0,0 +1,92 @@ | |||
1 | #include "transferdialog.h" | ||
2 | |||
3 | #include "qlayout.h" | ||
4 | #include "qcombobox.h" | ||
5 | #include "qlabel.h" | ||
6 | #include "qlineedit.h" | ||
7 | #include "qpushbutton.h" | ||
8 | #include "qmessagebox.h" | ||
9 | #include "qprogressbar.h" | ||
10 | |||
11 | #include "opie/ofiledialog.h" | ||
12 | |||
13 | TransferDialog::TransferDialog(QWidget *parent, const char *name) | ||
14 | : QWidget(parent, name) | ||
15 | { | ||
16 | QVBoxLayout *vbox; | ||
17 | QHBoxLayout *hbox, *hbox2; | ||
18 | QLabel *file, *mode, *progress, *status; | ||
19 | QPushButton *selector, *ok, *cancel; | ||
20 | |||
21 | file = new QLabel(QObject::tr("Send file"), this); | ||
22 | mode = new QLabel(QObject::tr("Transfer mode"), this); | ||
23 | progress = new QLabel(QObject::tr("Progress"), this); | ||
24 | status = new QLabel(QObject::tr("Status"), this); | ||
25 | |||
26 | statusbar = new QLabel(QObject::tr("ready"), this); | ||
27 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); | ||
28 | |||
29 | protocol = new QComboBox(this); | ||
30 | protocol->insertItem("XModem"); | ||
31 | protocol->insertItem("YModem"); | ||
32 | protocol->insertItem("ZModem"); | ||
33 | |||
34 | filename = new QLineEdit(this); | ||
35 | |||
36 | progressbar = new QProgressBar(this); | ||
37 | progressbar->setProgress(0); | ||
38 | |||
39 | selector = new QPushButton("...", this); | ||
40 | ok = new QPushButton(QObject::tr("OK"), this); | ||
41 | cancel = new QPushButton(QObject::tr("Cancel"), this); | ||
42 | |||
43 | vbox = new QVBoxLayout(this, 2); | ||
44 | vbox->add(file); | ||
45 | hbox = new QHBoxLayout(vbox, 0); | ||
46 | hbox->add(filename); | ||
47 | hbox->add(selector); | ||
48 | vbox->add(mode); | ||
49 | vbox->add(protocol); | ||
50 | vbox->add(progress); | ||
51 | vbox->add(progressbar); | ||
52 | vbox->add(status); | ||
53 | vbox->add(statusbar); | ||
54 | vbox->addStretch(1); | ||
55 | hbox2 = new QHBoxLayout(vbox, 2); | ||
56 | hbox2->add(ok); | ||
57 | hbox2->add(cancel); | ||
58 | |||
59 | setCaption(QObject::tr("File transfer")); | ||
60 | show(); | ||
61 | |||
62 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); | ||
63 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); | ||
64 | connect(cancel, SIGNAL(clicked()), SLOT(close())); | ||
65 | } | ||
66 | |||
67 | TransferDialog::~TransferDialog() | ||
68 | { | ||
69 | } | ||
70 | |||
71 | void TransferDialog::slotFilename() | ||
72 | { | ||
73 | QString f; | ||
74 | |||
75 | f = OFileDialog::getOpenFileName(0); | ||
76 | if(!f.isNull()) filename->setText(f); | ||
77 | } | ||
78 | |||
79 | void TransferDialog::slotTransfer() | ||
80 | { | ||
81 | if(filename->text().isEmpty()) | ||
82 | { | ||
83 | QMessageBox::information(this, | ||
84 | QObject::tr("Attention"), | ||
85 | QObject::tr("No file has been specified.")); | ||
86 | return; | ||
87 | } | ||
88 | |||
89 | statusbar->setText(QObject::tr("Sending...")); | ||
90 | progressbar->setProgress(1); | ||
91 | } | ||
92 | |||
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h new file mode 100644 index 0000000..4fe17dd --- a/dev/null +++ b/noncore/apps/opie-console/transferdialog.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef TRANSFER_DIALOG_H | ||
2 | #define TRANSFER_DIALOG_H | ||
3 | |||
4 | #include "qwidget.h" | ||
5 | |||
6 | class QLineEdit; | ||
7 | class QComboBox; | ||
8 | class QProgressBar; | ||
9 | class QLabel; | ||
10 | |||
11 | class TransferDialog : public QWidget | ||
12 | { | ||
13 | Q_OBJECT | ||
14 | public: | ||
15 | TransferDialog(QWidget *parent = NULL, const char *name = NULL); | ||
16 | ~TransferDialog(); | ||
17 | |||
18 | public slots: | ||
19 | void slotFilename(); | ||
20 | void slotTransfer(); | ||
21 | |||
22 | private: | ||
23 | QLineEdit *filename; | ||
24 | QComboBox *protocol; | ||
25 | QProgressBar *progressbar; | ||
26 | QLabel *statusbar; | ||
27 | }; | ||
28 | |||
29 | #endif | ||
30 | |||