-rw-r--r-- | noncore/apps/opie-console/dialer.cpp | 6 | ||||
-rw-r--r-- | noncore/apps/opie-console/dialer.h | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.cpp | 5 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.h | 2 |
6 files changed, 16 insertions, 5 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp index bd6b50f..7bf9352 100644 --- a/noncore/apps/opie-console/dialer.cpp +++ b/noncore/apps/opie-console/dialer.cpp | |||
@@ -1,182 +1,188 @@ | |||
1 | #include "dialer.h" | 1 | #include "dialer.h" |
2 | 2 | ||
3 | #include <qlayout.h> | 3 | #include <qlayout.h> |
4 | #include <qprogressbar.h> | 4 | #include <qprogressbar.h> |
5 | #include <qlabel.h> | 5 | #include <qlabel.h> |
6 | #include <qpushbutton.h> | 6 | #include <qpushbutton.h> |
7 | #include <qapp.h> | 7 | #include <qapp.h> |
8 | #include <qtimer.h> | 8 | #include <qtimer.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | 10 | ||
11 | #include <unistd.h> | 11 | #include <unistd.h> |
12 | #include <string.h> | 12 | #include <string.h> |
13 | #include <fcntl.h> | 13 | #include <fcntl.h> |
14 | #include <errno.h> | 14 | #include <errno.h> |
15 | 15 | ||
16 | // State machine: | When an error occurs, we don't have to | 16 | // State machine: | When an error occurs, we don't have to |
17 | // | reset everything. | 17 | // | reset everything. |
18 | // (init) <------+ | But if the user wants to reset, | 18 | // (init) <------+ | But if the user wants to reset, |
19 | // | | | we stop dialing immediately. | 19 | // | | | we stop dialing immediately. |
20 | // v | | | 20 | // v | | |
21 | // (options) ----+ | Following the state machine is necessary | 21 | // (options) ----+ | Following the state machine is necessary |
22 | // | \ | to get determinable results. | 22 | // | \ | to get determinable results. |
23 | // v ^ | | 23 | // v ^ | |
24 | // (dial) ----+ | | 24 | // (dial) ----+ | |
25 | // | ^ | | 25 | // | ^ | |
26 | // v | | | 26 | // v | | |
27 | // (online) --+ | | 27 | // (online) --+ | |
28 | // | | | 28 | // | | |
29 | // v | | 29 | // v | |
30 | 30 | ||
31 | 31 | ||
32 | // from atconfigdialog | 32 | // from atconfigdialog |
33 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); | 33 | //initStringLine->setText( config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ) ); |
34 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); | 34 | //resetStringLine->setText( config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ) ); |
35 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 35 | //dialPref1Line->setText( config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
36 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 36 | //dialSuf1Line->setText( config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
37 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 37 | //dialPref2Line->setText( config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
38 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 38 | //dialSuf2Line->setText( config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
39 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); | 39 | //dialPref3Line->setText( config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ) ); |
40 | //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); | 40 | //dialSuf3Line->setText( config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ) ); |
41 | //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); | 41 | //connectLine->setText( config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ) ); |
42 | //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); | 42 | //hangupLine->setText( config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ) ); |
43 | 43 | ||
44 | // from modemconfigwidget | 44 | // from modemconfigwidget |
45 | //int rad_flow = prof.readNumEntry("Flow"); | 45 | //int rad_flow = prof.readNumEntry("Flow"); |
46 | //int rad_parity = prof.readNumEntry("Parity"); | 46 | //int rad_parity = prof.readNumEntry("Parity"); |
47 | //int speed = prof.readNumEntry("Speed"); | 47 | //int speed = prof.readNumEntry("Speed"); |
48 | //QString number = prof.readEntry("Number"); | 48 | //QString number = prof.readEntry("Number"); |
49 | 49 | ||
50 | Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name) | 50 | Dialer::Dialer(const Profile& profile, int fd, QWidget *parent, const char *name) |
51 | : QDialog(parent, name, true), m_fd(fd), m_profile(profile) | 51 | : QDialog(parent, name, true), m_fd(fd), m_profile(profile) |
52 | { | 52 | { |
53 | QVBoxLayout *vbox; | 53 | QVBoxLayout *vbox; |
54 | QLabel *desc; | 54 | QLabel *desc; |
55 | 55 | ||
56 | //m_profile.writeEntry("InitString", "ATZ"); | 56 | //m_profile.writeEntry("InitString", "ATZ"); |
57 | //m_profile.writeEntry("DialPrefix1", "ATDT"); | 57 | //m_profile.writeEntry("DialPrefix1", "ATDT"); |
58 | //m_profile.writeEntry("Termination", "\n"); | 58 | //m_profile.writeEntry("Termination", "\n"); |
59 | 59 | ||
60 | usercancel = 0; | 60 | usercancel = 0; |
61 | 61 | ||
62 | fcntl(m_fd, F_SETFL, O_NONBLOCK); | 62 | fcntl(m_fd, F_SETFL, O_NONBLOCK); |
63 | 63 | ||
64 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); | 64 | desc = new QLabel(QObject::tr("Dialing number: %1").arg(m_profile.readEntry("Number")), this); |
65 | progress = new QProgressBar(this); | 65 | progress = new QProgressBar(this); |
66 | status = new QLabel("", this); | 66 | status = new QLabel("", this); |
67 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 67 | status->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
68 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 68 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
69 | 69 | ||
70 | vbox = new QVBoxLayout(this, 2); | 70 | vbox = new QVBoxLayout(this, 2); |
71 | vbox->add(desc); | 71 | vbox->add(desc); |
72 | vbox->add(progress); | 72 | vbox->add(progress); |
73 | vbox->add(status); | 73 | vbox->add(status); |
74 | vbox->add(cancel); | 74 | vbox->add(cancel); |
75 | 75 | ||
76 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 76 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
77 | 77 | ||
78 | show(); | 78 | show(); |
79 | 79 | ||
80 | QTimer::singleShot(500, this, SLOT(slotAutostart())); | 80 | QTimer::singleShot(500, this, SLOT(slotAutostart())); |
81 | } | 81 | } |
82 | 82 | ||
83 | Dialer::~Dialer() | 83 | Dialer::~Dialer() |
84 | { | 84 | { |
85 | } | 85 | } |
86 | 86 | ||
87 | void Dialer::setHangupOnly() | ||
88 | { | ||
89 | state = state_cancel; | ||
90 | usercancel = 1; | ||
91 | } | ||
92 | |||
87 | void Dialer::slotCancel() | 93 | void Dialer::slotCancel() |
88 | { | 94 | { |
89 | if(state != state_online) | 95 | if(state != state_online) |
90 | { | 96 | { |
91 | usercancel = 1; | 97 | usercancel = 1; |
92 | reset(); | 98 | reset(); |
93 | } | 99 | } |
94 | else accept(); | 100 | else accept(); |
95 | } | 101 | } |
96 | 102 | ||
97 | void Dialer::reset() | 103 | void Dialer::reset() |
98 | { | 104 | { |
99 | switchState(state_cancel); | 105 | switchState(state_cancel); |
100 | } | 106 | } |
101 | 107 | ||
102 | void Dialer::slotAutostart() | 108 | void Dialer::slotAutostart() |
103 | { | 109 | { |
104 | //state = state_preinit; | 110 | //state = state_preinit; |
105 | dial(m_profile.readEntry("Number")); | 111 | dial(m_profile.readEntry("Number")); |
106 | } | 112 | } |
107 | 113 | ||
108 | void Dialer::dial(const QString& number) | 114 | void Dialer::dial(const QString& number) |
109 | { | 115 | { |
110 | while(state != state_online) | 116 | while(state != state_online) |
111 | { | 117 | { |
112 | if(!usercancel) | 118 | if(!usercancel) |
113 | { | 119 | { |
114 | state = state_preinit; | 120 | state = state_preinit; |
115 | trydial(number); | 121 | trydial(number); |
116 | } | 122 | } |
117 | else break; | 123 | else break; |
118 | } | 124 | } |
119 | 125 | ||
120 | if(usercancel) | 126 | if(usercancel) |
121 | { | 127 | { |
122 | // modem hangup | 128 | // modem hangup |
123 | trydial(QString::null); | 129 | trydial(QString::null); |
124 | reject(); | 130 | reject(); |
125 | } | 131 | } |
126 | } | 132 | } |
127 | 133 | ||
128 | void Dialer::trydial(const QString& number) | 134 | void Dialer::trydial(const QString& number) |
129 | { | 135 | { |
130 | //if(state != state_cancel) | 136 | //if(state != state_cancel) |
131 | //{ | 137 | //{ |
132 | if(state != state_cancel) switchState(state_preinit); | 138 | if(state != state_cancel) switchState(state_preinit); |
133 | send("+++ATH"); | 139 | send("+++ATH"); |
134 | send(""); | 140 | send(""); |
135 | //QString response = receive(); | 141 | //QString response = receive(); |
136 | //} | 142 | //} |
137 | 143 | ||
138 | if(state != state_cancel) | 144 | if(state != state_cancel) |
139 | { | 145 | { |
140 | switchState(state_init); | 146 | switchState(state_init); |
141 | send("ATZ"); | 147 | send("ATZ"); |
142 | //send(m_profile.readEntry("InitString")); | 148 | //send(m_profile.readEntry("InitString")); |
143 | QString response2 = receive(); | 149 | QString response2 = receive(); |
144 | if(!response2.contains("\nOK\r")) | 150 | if(!response2.contains("\nOK\r")) |
145 | reset(); | 151 | reset(); |
146 | } | 152 | } |
147 | 153 | ||
148 | if(state != state_cancel) | 154 | if(state != state_cancel) |
149 | { | 155 | { |
150 | switchState(state_options); | 156 | switchState(state_options); |
151 | 157 | ||
152 | send("ATM3L3"); | 158 | send("ATM3L3"); |
153 | QString response3 = receive(); | 159 | QString response3 = receive(); |
154 | if(!response3.contains("\nOK\r")) | 160 | if(!response3.contains("\nOK\r")) |
155 | reset(); | 161 | reset(); |
156 | } | 162 | } |
157 | 163 | ||
158 | if(state != state_cancel) | 164 | if(state != state_cancel) |
159 | { | 165 | { |
160 | switchState(state_dialtone); | 166 | switchState(state_dialtone); |
161 | 167 | ||
162 | send("ATX1"); | 168 | send("ATX1"); |
163 | QString response4 = receive(); | 169 | QString response4 = receive(); |
164 | if(!response4.contains("\nOK\r")) | 170 | if(!response4.contains("\nOK\r")) |
165 | reset(); | 171 | reset(); |
166 | } | 172 | } |
167 | 173 | ||
168 | if(state != state_cancel) | 174 | if(state != state_cancel) |
169 | { | 175 | { |
170 | switchState(state_dialing); | 176 | switchState(state_dialing); |
171 | 177 | ||
172 | send(QString("ATDT %1").arg(number)); | 178 | send(QString("ATDT %1").arg(number)); |
173 | //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); | 179 | //send(QString("%1 %2").arg(m_profile.readEntry("DialPrefix1")).arg(number)); |
174 | QString response5 = receive(); | 180 | QString response5 = receive(); |
175 | if(!response5.contains("\nCONNECT")) | 181 | if(!response5.contains("\nCONNECT")) |
176 | { | 182 | { |
177 | if(response5.contains("BUSY")) | 183 | if(response5.contains("BUSY")) |
178 | switchState(state_dialing); | 184 | switchState(state_dialing); |
179 | else | 185 | else |
180 | { | 186 | { |
181 | QMessageBox::warning(this, | 187 | QMessageBox::warning(this, |
182 | QObject::tr("Failure"), | 188 | QObject::tr("Failure"), |
diff --git a/noncore/apps/opie-console/dialer.h b/noncore/apps/opie-console/dialer.h index 4011880..84444b9 100644 --- a/noncore/apps/opie-console/dialer.h +++ b/noncore/apps/opie-console/dialer.h | |||
@@ -1,52 +1,53 @@ | |||
1 | #ifndef DIALER_H | 1 | #ifndef DIALER_H |
2 | #define DIALER_H | 2 | #define DIALER_H |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | 5 | ||
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | class QLabel; | 8 | class QLabel; |
9 | class QProgressBar; | 9 | class QProgressBar; |
10 | 10 | ||
11 | class Dialer : public QDialog | 11 | class Dialer : public QDialog |
12 | { | 12 | { |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | Dialer(const Profile& profile, int fd, QWidget *parent = NULL, const char *name = NULL); | 15 | Dialer(const Profile& profile, int fd, QWidget *parent = NULL, const char *name = NULL); |
16 | ~Dialer(); | 16 | ~Dialer(); |
17 | void setHangupOnly(); | ||
17 | 18 | ||
18 | public slots: | 19 | public slots: |
19 | void slotCancel(); | 20 | void slotCancel(); |
20 | void slotAutostart(); | 21 | void slotAutostart(); |
21 | 22 | ||
22 | private: | 23 | private: |
23 | void switchState(int newstate); | 24 | void switchState(int newstate); |
24 | void reset(); | 25 | void reset(); |
25 | void dial(const QString& number); | 26 | void dial(const QString& number); |
26 | void trydial(const QString& number); | 27 | void trydial(const QString& number); |
27 | 28 | ||
28 | void send(const QString& msg); | 29 | void send(const QString& msg); |
29 | QString receive(); | 30 | QString receive(); |
30 | 31 | ||
31 | enum States | 32 | enum States |
32 | { | 33 | { |
33 | state_cancel, | 34 | state_cancel, |
34 | state_preinit, | 35 | state_preinit, |
35 | state_init, | 36 | state_init, |
36 | state_options, | 37 | state_options, |
37 | state_dialtone, | 38 | state_dialtone, |
38 | state_dialing, | 39 | state_dialing, |
39 | state_online | 40 | state_online |
40 | }; | 41 | }; |
41 | 42 | ||
42 | QLabel *status; | 43 | QLabel *status; |
43 | QProgressBar *progress; | 44 | QProgressBar *progress; |
44 | QPushButton *cancel; | 45 | QPushButton *cancel; |
45 | int state; | 46 | int state; |
46 | int usercancel; | 47 | int usercancel; |
47 | const Profile& m_profile; | 48 | const Profile& m_profile; |
48 | int m_fd; | 49 | int m_fd; |
49 | }; | 50 | }; |
50 | 51 | ||
51 | #endif | 52 | #endif |
52 | 53 | ||
diff --git a/noncore/apps/opie-console/io_modem.cpp b/noncore/apps/opie-console/io_modem.cpp index c04aad1..2f0c04e 100644 --- a/noncore/apps/opie-console/io_modem.cpp +++ b/noncore/apps/opie-console/io_modem.cpp | |||
@@ -1,82 +1,85 @@ | |||
1 | 1 | ||
2 | #include "io_modem.h" | 2 | #include "io_modem.h" |
3 | 3 | ||
4 | #include "dialer.h" | 4 | #include "dialer.h" |
5 | 5 | ||
6 | IOModem::IOModem( const Profile &profile ) | 6 | IOModem::IOModem( const Profile &profile ) |
7 | : IOSerial( profile ) { | 7 | : IOSerial( profile ) { |
8 | m_profile = profile; | 8 | m_profile = profile; |
9 | } | 9 | } |
10 | 10 | ||
11 | 11 | ||
12 | IOModem::~IOModem() { | 12 | IOModem::~IOModem() { |
13 | 13 | ||
14 | } | 14 | } |
15 | 15 | ||
16 | 16 | ||
17 | void IOModem::close() { | 17 | void IOModem::close() { |
18 | // maybe do a hangup here just in case...? | 18 | // Hangup, discarding result |
19 | Dialer d(m_profile, rawIO()); | ||
20 | d.setHangupOnly(); | ||
21 | d.exec(); | ||
19 | 22 | ||
20 | IOSerial::close(); | 23 | IOSerial::close(); |
21 | } | 24 | } |
22 | 25 | ||
23 | bool IOModem::open() { | 26 | bool IOModem::open() { |
24 | bool ret = IOSerial::open(); | 27 | bool ret = IOSerial::open(); |
25 | if(!ret) return false; | 28 | if(!ret) return false; |
26 | 29 | ||
27 | Dialer d(m_profile, rawIO()); | 30 | Dialer d(m_profile, rawIO()); |
28 | 31 | ||
29 | int result = d.exec(); | 32 | int result = d.exec(); |
30 | if(result == QDialog::Accepted) | 33 | if(result == QDialog::Accepted) |
31 | { | 34 | { |
32 | return true; | 35 | return true; |
33 | } | 36 | } |
34 | else | 37 | else |
35 | { | 38 | { |
36 | close(); | 39 | close(); |
37 | return false; | 40 | return false; |
38 | } | 41 | } |
39 | } | 42 | } |
40 | 43 | ||
41 | void IOModem::reload( const Profile &config ) { | 44 | void IOModem::reload( const Profile &config ) { |
42 | 45 | ||
43 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); | 46 | m_device = config.readEntry("Device", MODEM_DEFAULT_DEVICE); |
44 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); | 47 | m_baud = config.readNumEntry("Baud", MODEM_DEFAULT_BAUD); |
45 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); | 48 | m_parity = config.readNumEntry("Parity", MODEM_DEFAULT_PARITY); |
46 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); | 49 | m_dbits = config.readNumEntry("DataBits", MODEM_DEFAULT_DBITS); |
47 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); | 50 | m_sbits = config.readNumEntry("StopBits", MODEM_DEFAULT_SBITS); |
48 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); | 51 | m_flow = config.readNumEntry("Flow", MODEM_DEFAULT_FLOW); |
49 | 52 | ||
50 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); | 53 | m_initString = config.readEntry("InitString", MODEM_DEFAULT_INIT_STRING ); |
51 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); | 54 | m_resetString = config.readEntry("ResetString", MODEM_DEFAULT_RESET_STRING ); |
52 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); | 55 | m_dialPref1 = config.readEntry("DialPrefix1", MODEM_DEFAULT_DIAL_PREFIX1 ); |
53 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 56 | m_dialSuf1 = config.readEntry("DialSuffix1", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
54 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); | 57 | m_dialPref2 = config.readEntry("DialPrefix2", MODEM_DEFAULT_DIAL_PREFIX1 ); |
55 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 58 | m_dialSuf2 = config.readEntry("DialSuffix2", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
56 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); | 59 | m_dialPref3 = config.readEntry("DialPrefix3", MODEM_DEFAULT_DIAL_PREFIX1 ); |
57 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); | 60 | m_dialSuf3 = config.readEntry("DialSuffix3", MODEM_DEFAULT_DIAL_SUFFIX1 ); |
58 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); | 61 | m_connect = config.readEntry("DefaultConnect" MODEM_DEFAULT_CONNECT_STRING ); |
59 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); | 62 | m_hangup = config.readEntry("HangupString", MODEM_DEFAULT_HANGUP_STRING ); |
60 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); | 63 | m_cancel = config.readEntry("CancelString", MODEM_DEFAULT_CANCEL_STRING ); |
61 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); | 64 | m_dialTime = config.readNumEntry("DialTime", MODEM_DEFAULT_DIAL_TIME ); |
62 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); | 65 | m_delayRedial = config.readNumEntry("DelayRedial", MODEM_DEFAULT_DELAY_REDIAL ); |
63 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); | 66 | m_numberTries = config.readNumEntry("NumberTries", MODEM_DEFAULT_NUMBER_TRIES ); |
64 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); | 67 | m_dtrDropTime = config.readNumEntry("DTRDRopTime", MODEM_DEFAULT_DTR_DROP_TIME ); |
65 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); | 68 | m_bpsDetect = config.readBoolEntry("BPSDetect", MODEM_DEFAULT_BPS_DETECT ); |
66 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); | 69 | m_dcdLines = config.readBoolEntry("DCDLines", MODEM_DEFAULT_DCD_LINES ); |
67 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); | 70 | m_multiLineUntag = config.readBoolEntry("MultiLineUntag", MODEM_DEFAULT_MULTI_LINE_UNTAG ); |
68 | } | 71 | } |
69 | 72 | ||
70 | 73 | ||
71 | QString IOModem::identifier() const { | 74 | QString IOModem::identifier() const { |
72 | return "modem"; | 75 | return "modem"; |
73 | } | 76 | } |
74 | 77 | ||
75 | QString IOModem::name() const { | 78 | QString IOModem::name() const { |
76 | return "Modem IO Layer"; | 79 | return "Modem IO Layer"; |
77 | } | 80 | } |
78 | 81 | ||
79 | void IOModem::slotExited(OProcess* proc ){ | 82 | void IOModem::slotExited(OProcess* proc ){ |
80 | close(); | 83 | close(); |
81 | } | 84 | } |
82 | 85 | ||
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 9a226bb..55e9836 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -349,182 +349,183 @@ void MainWindow::slotTerminate() { | |||
349 | 349 | ||
350 | slotClose(); | 350 | slotClose(); |
351 | /* FIXME move to the next session */ | 351 | /* FIXME move to the next session */ |
352 | } | 352 | } |
353 | 353 | ||
354 | void MainWindow::slotConfigure() { | 354 | void MainWindow::slotConfigure() { |
355 | ConfigDialog conf( manager()->all(), factory() ); | 355 | ConfigDialog conf( manager()->all(), factory() ); |
356 | conf.showMaximized(); | 356 | conf.showMaximized(); |
357 | 357 | ||
358 | int ret = conf.exec(); | 358 | int ret = conf.exec(); |
359 | 359 | ||
360 | if ( QDialog::Accepted == ret ) { | 360 | if ( QDialog::Accepted == ret ) { |
361 | manager()->setProfiles( conf.list() ); | 361 | manager()->setProfiles( conf.list() ); |
362 | manager()->save(); | 362 | manager()->save(); |
363 | populateProfiles(); | 363 | populateProfiles(); |
364 | } | 364 | } |
365 | } | 365 | } |
366 | /* | 366 | /* |
367 | * we will remove | 367 | * we will remove |
368 | * this window from the tabwidget | 368 | * this window from the tabwidget |
369 | * remove it from the list | 369 | * remove it from the list |
370 | * delete it | 370 | * delete it |
371 | * and set the currentSession() | 371 | * and set the currentSession() |
372 | */ | 372 | */ |
373 | void MainWindow::slotClose() { | 373 | void MainWindow::slotClose() { |
374 | if (!currentSession() ) | 374 | if (!currentSession() ) |
375 | return; | 375 | return; |
376 | 376 | ||
377 | Session* ses = currentSession(); | 377 | Session* ses = currentSession(); |
378 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 378 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
379 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 379 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
380 | m_curSession = NULL; | 380 | m_curSession = NULL; |
381 | tabWidget()->remove( /*currentSession()*/ses ); | 381 | tabWidget()->remove( /*currentSession()*/ses ); |
382 | /*it's autodelete */ | 382 | /*it's autodelete */ |
383 | m_sessions.remove( ses ); | 383 | m_sessions.remove( ses ); |
384 | qWarning("after remove!!"); | 384 | qWarning("after remove!!"); |
385 | 385 | ||
386 | if (!currentSession() ) { | 386 | if (!currentSession() ) { |
387 | m_connect->setEnabled( false ); | 387 | m_connect->setEnabled( false ); |
388 | m_disconnect->setEnabled( false ); | 388 | m_disconnect->setEnabled( false ); |
389 | m_terminate->setEnabled( false ); | 389 | m_terminate->setEnabled( false ); |
390 | m_transfer->setEnabled( false ); | 390 | m_transfer->setEnabled( false ); |
391 | m_recordScript->setEnabled( false ); | 391 | m_recordScript->setEnabled( false ); |
392 | m_saveScript->setEnabled( false ); | 392 | m_saveScript->setEnabled( false ); |
393 | m_runScript->setEnabled( false ); | 393 | m_runScript->setEnabled( false ); |
394 | m_fullscreen->setEnabled( false ); | 394 | m_fullscreen->setEnabled( false ); |
395 | m_closewindow->setEnabled( false ); | 395 | m_closewindow->setEnabled( false ); |
396 | } | 396 | } |
397 | } | 397 | } |
398 | 398 | ||
399 | /* | 399 | /* |
400 | * We will get the name | 400 | * We will get the name |
401 | * Then the profile | 401 | * Then the profile |
402 | * and then we will make a profile | 402 | * and then we will make a profile |
403 | */ | 403 | */ |
404 | void MainWindow::slotProfile( int id) { | 404 | void MainWindow::slotProfile( int id) { |
405 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 405 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
406 | create( prof ); | 406 | create( prof ); |
407 | } | 407 | } |
408 | void MainWindow::create( const Profile& prof ) { | 408 | void MainWindow::create( const Profile& prof ) { |
409 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 409 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
410 | 410 | ||
411 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 411 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
412 | { | 412 | { |
413 | QMessageBox::warning(this, | 413 | QMessageBox::warning(this, |
414 | QObject::tr("Session failed"), | 414 | QObject::tr("Session failed"), |
415 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 415 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
416 | //if(ses) delete ses; | 416 | //if(ses) delete ses; |
417 | return; | 417 | return; |
418 | } | 418 | } |
419 | 419 | ||
420 | m_sessions.append( ses ); | 420 | m_sessions.append( ses ); |
421 | tabWidget()->add( ses ); | 421 | tabWidget()->add( ses ); |
422 | m_curSession = ses; | 422 | m_curSession = ses; |
423 | 423 | ||
424 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 424 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
425 | m_connect->setEnabled( true ); | 425 | m_connect->setEnabled( true ); |
426 | m_disconnect->setEnabled( false ); | 426 | m_disconnect->setEnabled( false ); |
427 | m_terminate->setEnabled( true ); | 427 | m_terminate->setEnabled( true ); |
428 | m_transfer->setEnabled( true ); | 428 | m_transfer->setEnabled( true ); |
429 | m_recordScript->setEnabled( true ); | 429 | m_recordScript->setEnabled( true ); |
430 | m_saveScript->setEnabled( true ); | 430 | m_saveScript->setEnabled( true ); |
431 | m_runScript->setEnabled( true ); | 431 | m_runScript->setEnabled( true ); |
432 | m_fullscreen->setEnabled( true ); | 432 | m_fullscreen->setEnabled( true ); |
433 | m_closewindow->setEnabled( true ); | 433 | m_closewindow->setEnabled( true ); |
434 | 434 | ||
435 | 435 | ||
436 | // is io_layer wants direct connection, then autoconnect | 436 | // is io_layer wants direct connection, then autoconnect |
437 | if ( ( m_curSession->layer() )->supports()[0] = 1 ) { | 437 | if ( ( m_curSession->layer() )->supports()[0] = 1 ) { |
438 | slotConnect(); | 438 | slotConnect(); |
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | void MainWindow::slotTransfer() | 442 | void MainWindow::slotTransfer() |
443 | { | 443 | { |
444 | if ( currentSession() ) { | 444 | if ( currentSession() ) { |
445 | TransferDialog dlg(this); | 445 | TransferDialog dlg(currentSession()->widgetStack(), this); |
446 | dlg.showMaximized(); | 446 | dlg.showMaximized(); |
447 | //currentSession()->widgetStack()->add(dlg); | ||
447 | dlg.exec(); | 448 | dlg.exec(); |
448 | } | 449 | } |
449 | } | 450 | } |
450 | 451 | ||
451 | 452 | ||
452 | void MainWindow::slotOpenKeb(bool state) { | 453 | void MainWindow::slotOpenKeb(bool state) { |
453 | 454 | ||
454 | if (state) m_keyBar->show(); | 455 | if (state) m_keyBar->show(); |
455 | else m_keyBar->hide(); | 456 | else m_keyBar->hide(); |
456 | 457 | ||
457 | } | 458 | } |
458 | 459 | ||
459 | 460 | ||
460 | void MainWindow::slotOpenButtons( bool state ) { | 461 | void MainWindow::slotOpenButtons( bool state ) { |
461 | 462 | ||
462 | if ( state ) { | 463 | if ( state ) { |
463 | m_buttonBar->show(); | 464 | m_buttonBar->show(); |
464 | } else { | 465 | } else { |
465 | m_buttonBar->hide(); | 466 | m_buttonBar->hide(); |
466 | } | 467 | } |
467 | } | 468 | } |
468 | 469 | ||
469 | 470 | ||
470 | 471 | ||
471 | void MainWindow::slotSessionChanged( Session* ses ) { | 472 | void MainWindow::slotSessionChanged( Session* ses ) { |
472 | qWarning("changed!"); | 473 | qWarning("changed!"); |
473 | if ( ses ) { | 474 | if ( ses ) { |
474 | m_curSession = ses; | 475 | m_curSession = ses; |
475 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 476 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
476 | if ( m_curSession->layer()->isConnected() ) { | 477 | if ( m_curSession->layer()->isConnected() ) { |
477 | m_connect->setEnabled( false ); | 478 | m_connect->setEnabled( false ); |
478 | m_disconnect->setEnabled( true ); | 479 | m_disconnect->setEnabled( true ); |
479 | } else { | 480 | } else { |
480 | m_connect->setEnabled( true ); | 481 | m_connect->setEnabled( true ); |
481 | m_disconnect->setEnabled( false ); | 482 | m_disconnect->setEnabled( false ); |
482 | } | 483 | } |
483 | } | 484 | } |
484 | } | 485 | } |
485 | 486 | ||
486 | void MainWindow::slotFullscreen() { | 487 | void MainWindow::slotFullscreen() { |
487 | 488 | ||
488 | if ( m_isFullscreen ) { | 489 | if ( m_isFullscreen ) { |
489 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); | 490 | ( m_curSession->widgetStack() )->reparent( m_consoleWindow, 0, QPoint(0,0), false ); |
490 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); | 491 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::Panel | QFrame::Sunken ); |
491 | setCentralWidget( m_consoleWindow ); | 492 | setCentralWidget( m_consoleWindow ); |
492 | ( m_curSession->widgetStack() )->show(); | 493 | ( m_curSession->widgetStack() )->show(); |
493 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 494 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
494 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 495 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
495 | 496 | ||
496 | } else { | 497 | } else { |
497 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 498 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
498 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 499 | ( m_curSession->widgetStack() )->reparent( 0,WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
499 | , QPoint(0,0), false ); | 500 | , QPoint(0,0), false ); |
500 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 501 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
501 | ( m_curSession->widgetStack() )->setFocus(); | 502 | ( m_curSession->widgetStack() )->setFocus(); |
502 | ( m_curSession->widgetStack() )->show(); | 503 | ( m_curSession->widgetStack() )->show(); |
503 | 504 | ||
504 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 505 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
505 | 506 | ||
506 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 507 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
507 | } | 508 | } |
508 | 509 | ||
509 | m_isFullscreen = !m_isFullscreen; | 510 | m_isFullscreen = !m_isFullscreen; |
510 | } | 511 | } |
511 | 512 | ||
512 | 513 | ||
513 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) { | 514 | void MainWindow::slotKeyReceived(ushort u, ushort q, bool, bool pressed, bool) { |
514 | 515 | ||
515 | qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released"); | 516 | qWarning("unicode: %x, qkey: %x, %s", u, q, pressed ? "pressed" : "released"); |
516 | 517 | ||
517 | if ( m_curSession ) { | 518 | if ( m_curSession ) { |
518 | 519 | ||
519 | QEvent::Type state; | 520 | QEvent::Type state; |
520 | 521 | ||
521 | if (pressed) state = QEvent::KeyPress; | 522 | if (pressed) state = QEvent::KeyPress; |
522 | else state = QEvent::KeyRelease; | 523 | else state = QEvent::KeyRelease; |
523 | 524 | ||
524 | QKeyEvent ke(state, q, u, 0, QString(QChar(u))); | 525 | QKeyEvent ke(state, q, u, 0, QString(QChar(u))); |
525 | 526 | ||
526 | // where should i send this event? doesnt work sending it here | 527 | // where should i send this event? doesnt work sending it here |
527 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 528 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
528 | ke.ignore(); | 529 | ke.ignore(); |
529 | } | 530 | } |
530 | } | 531 | } |
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index f9a0b87..ac5b1d0 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp | |||
@@ -1,117 +1,117 @@ | |||
1 | #include <qlayout.h> | 1 | #include <qlayout.h> |
2 | #include <qcombobox.h> | 2 | #include <qcombobox.h> |
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qlineedit.h> | 4 | #include <qlineedit.h> |
5 | #include <qpushbutton.h> | 5 | #include <qpushbutton.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qprogressbar.h> | 7 | #include <qprogressbar.h> |
8 | #include <qradiobutton.h> | 8 | #include <qradiobutton.h> |
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(MainWindow *parent, const char *name) | 20 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *name) |
21 | : QDialog(0l, 0l, true), m_win(parent) | 21 | : QDialog(parent, 0l, true), 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 | 32 | ||
33 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); | 33 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); |
34 | mode_send = new QRadioButton(QObject::tr("Send"), group); | 34 | mode_send = new QRadioButton(QObject::tr("Send"), group); |
35 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); | 35 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); |
36 | group->insert(mode_send, id_send); | 36 | group->insert(mode_send, id_send); |
37 | group->insert(mode_receive, id_receive); | 37 | group->insert(mode_receive, id_receive); |
38 | vbox2 = new QVBoxLayout(group, 2); | 38 | vbox2 = new QVBoxLayout(group, 2); |
39 | vbox2->addSpacing(10); | 39 | vbox2->addSpacing(10); |
40 | hbox3 = new QHBoxLayout(vbox2, 2); | 40 | hbox3 = new QHBoxLayout(vbox2, 2); |
41 | hbox3->add(mode_send); | 41 | hbox3->add(mode_send); |
42 | hbox3->add(mode_receive); | 42 | hbox3->add(mode_receive); |
43 | mode_send->setChecked(true); | 43 | mode_send->setChecked(true); |
44 | m_transfermode = id_send; | 44 | m_transfermode = id_send; |
45 | 45 | ||
46 | file = new QLabel(QObject::tr("Send file"), this); | 46 | file = new QLabel(QObject::tr("Send file"), this); |
47 | mode = new QLabel(QObject::tr("Transfer protocol"), this); | 47 | mode = new QLabel(QObject::tr("Transfer protocol"), this); |
48 | progress = new QLabel(QObject::tr("Progress"), this); | 48 | progress = new QLabel(QObject::tr("Progress"), this); |
49 | status = new QLabel(QObject::tr("Status"), this); | 49 | status = new QLabel(QObject::tr("Status"), this); |
50 | 50 | ||
51 | statusbar = new QLabel(QObject::tr("Ready"), this); | 51 | statusbar = new QLabel(QObject::tr("Ready"), this); |
52 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 52 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
53 | 53 | ||
54 | protocol = new QComboBox(this); | 54 | protocol = new QComboBox(this); |
55 | QStringList list = m_win->factory()->fileTransferLayers(); | 55 | QStringList list = m_win->factory()->fileTransferLayers(); |
56 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) | 56 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) |
57 | protocol->insertItem((*it)); | 57 | protocol->insertItem((*it)); |
58 | 58 | ||
59 | filename = new QLineEdit(this); | 59 | filename = new QLineEdit(this); |
60 | 60 | ||
61 | progressbar = new QProgressBar(this); | 61 | progressbar = new QProgressBar(this); |
62 | progressbar->setProgress(0); | 62 | progressbar->setProgress(0); |
63 | 63 | ||
64 | selector = new QPushButton("...", this); | 64 | selector = new QPushButton("...", this); |
65 | ok = new QPushButton(QObject::tr("Start transfer"), this); | 65 | ok = new QPushButton(QObject::tr("Start transfer"), this); |
66 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 66 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
67 | 67 | ||
68 | vbox = new QVBoxLayout(this, 2); | 68 | vbox = new QVBoxLayout(this, 2); |
69 | vbox->add(group); | 69 | vbox->add(group); |
70 | vbox->add(file); | 70 | vbox->add(file); |
71 | hbox = new QHBoxLayout(vbox, 0); | 71 | hbox = new QHBoxLayout(vbox, 0); |
72 | hbox->add(filename); | 72 | hbox->add(filename); |
73 | hbox->add(selector); | 73 | hbox->add(selector); |
74 | vbox->add(mode); | 74 | vbox->add(mode); |
75 | vbox->add(protocol); | 75 | vbox->add(protocol); |
76 | vbox->add(progress); | 76 | vbox->add(progress); |
77 | vbox->add(progressbar); | 77 | vbox->add(progressbar); |
78 | vbox->add(status); | 78 | vbox->add(status); |
79 | vbox->add(statusbar); | 79 | vbox->add(statusbar); |
80 | vbox->addStretch(1); | 80 | vbox->addStretch(1); |
81 | hbox2 = new QHBoxLayout(vbox, 2); | 81 | hbox2 = new QHBoxLayout(vbox, 2); |
82 | hbox2->add(ok); | 82 | hbox2->add(ok); |
83 | hbox2->add(cancel); | 83 | hbox2->add(cancel); |
84 | 84 | ||
85 | setCaption(QObject::tr("File transfer")); | 85 | setCaption(QObject::tr("File transfer")); |
86 | show(); | 86 | show(); |
87 | 87 | ||
88 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); | 88 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); |
89 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); | 89 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); |
90 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 90 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
91 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); | 91 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); |
92 | } | 92 | } |
93 | 93 | ||
94 | TransferDialog::~TransferDialog() | 94 | TransferDialog::~TransferDialog() |
95 | { | 95 | { |
96 | } | 96 | } |
97 | 97 | ||
98 | void TransferDialog::slotFilename() | 98 | void TransferDialog::slotFilename() |
99 | { | 99 | { |
100 | QString f; | 100 | QString f; |
101 | 101 | ||
102 | f = OFileDialog::getOpenFileName(0); | 102 | f = OFileDialog::getOpenFileName(0); |
103 | if(!f.isNull()) filename->setText(f); | 103 | if(!f.isNull()) filename->setText(f); |
104 | } | 104 | } |
105 | 105 | ||
106 | void TransferDialog::slotTransfer() | 106 | void TransferDialog::slotTransfer() |
107 | { | 107 | { |
108 | if((m_transfermode == id_send) && (filename->text().isEmpty())) | 108 | if((m_transfermode == id_send) && (filename->text().isEmpty())) |
109 | { | 109 | { |
110 | QMessageBox::information(this, | 110 | QMessageBox::information(this, |
111 | QObject::tr("Attention"), | 111 | QObject::tr("Attention"), |
112 | QObject::tr("No file has been specified.")); | 112 | QObject::tr("No file has been specified.")); |
113 | return; | 113 | return; |
114 | } | 114 | } |
115 | 115 | ||
116 | ok->setEnabled(false); | 116 | ok->setEnabled(false); |
117 | 117 | ||
diff --git a/noncore/apps/opie-console/transferdialog.h b/noncore/apps/opie-console/transferdialog.h index 1b27f16..d87be6a 100644 --- a/noncore/apps/opie-console/transferdialog.h +++ b/noncore/apps/opie-console/transferdialog.h | |||
@@ -1,54 +1,54 @@ | |||
1 | #ifndef TRANSFER_DIALOG_H | 1 | #ifndef TRANSFER_DIALOG_H |
2 | #define TRANSFER_DIALOG_H | 2 | #define TRANSFER_DIALOG_H |
3 | 3 | ||
4 | #include "qdialog.h" | 4 | #include "qdialog.h" |
5 | 5 | ||
6 | class QLineEdit; | 6 | class QLineEdit; |
7 | class QComboBox; | 7 | class QComboBox; |
8 | class QProgressBar; | 8 | class QProgressBar; |
9 | class QLabel; | 9 | class QLabel; |
10 | class QPushButton; | 10 | class QPushButton; |
11 | class MainWindow; | 11 | class MainWindow; |
12 | class FileTransferLayer; | 12 | class FileTransferLayer; |
13 | class ReceiveLayer; | 13 | class ReceiveLayer; |
14 | 14 | ||
15 | class TransferDialog : public QDialog | 15 | class TransferDialog : public QDialog |
16 | { | 16 | { |
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | public: | 18 | public: |
19 | TransferDialog(MainWindow *parent = 0l, const char *name = 0l); | 19 | TransferDialog(QWidget *parent = 0l, MainWindow *mainwindow = 0l, const char *name = 0l); |
20 | ~TransferDialog(); | 20 | ~TransferDialog(); |
21 | 21 | ||
22 | public slots: | 22 | public slots: |
23 | void slotFilename(); | 23 | void slotFilename(); |
24 | void slotTransfer(); | 24 | void slotTransfer(); |
25 | void slotCancel(); | 25 | void slotCancel(); |
26 | void slotProgress(const QString&, int, int, int, int, int); | 26 | void slotProgress(const QString&, int, int, int, int, int); |
27 | void slotError(int error, const QString& message); | 27 | void slotError(int error, const QString& message); |
28 | void slotSent(); | 28 | void slotSent(); |
29 | void slotReceived(const QString& file); | 29 | void slotReceived(const QString& file); |
30 | void slotMode(int id); | 30 | void slotMode(int id); |
31 | 31 | ||
32 | private: | 32 | private: |
33 | enum Modes | 33 | enum Modes |
34 | { | 34 | { |
35 | id_send, | 35 | id_send, |
36 | id_receive | 36 | id_receive |
37 | }; | 37 | }; |
38 | 38 | ||
39 | void cleanup(); | 39 | void cleanup(); |
40 | 40 | ||
41 | QLineEdit *filename; | 41 | QLineEdit *filename; |
42 | QComboBox *protocol; | 42 | QComboBox *protocol; |
43 | QProgressBar *progressbar; | 43 | QProgressBar *progressbar; |
44 | QLabel *statusbar; | 44 | QLabel *statusbar; |
45 | QPushButton *ok, *cancel, *selector; | 45 | QPushButton *ok, *cancel, *selector; |
46 | MainWindow* m_win; | 46 | MainWindow* m_win; |
47 | FileTransferLayer* m_lay; | 47 | FileTransferLayer* m_lay; |
48 | ReceiveLayer *m_recvlay; | 48 | ReceiveLayer *m_recvlay; |
49 | int m_transfermode; | 49 | int m_transfermode; |
50 | int m_autocleanup; | 50 | int m_autocleanup; |
51 | }; | 51 | }; |
52 | 52 | ||
53 | #endif | 53 | #endif |
54 | 54 | ||