author | josef <josef> | 2002-10-18 10:25:44 (UTC) |
---|---|---|
committer | josef <josef> | 2002-10-18 10:25:44 (UTC) |
commit | dd15f8b7104678da5969a3e93a4b14cd3640955c (patch) (unidiff) | |
tree | ca05d8e196a72101a6044ac0f7ca5fefdbd63d66 | |
parent | c01fc99488d4ff9e1de2eb4d93fc200ed8e19a81 (diff) | |
download | opie-dd15f8b7104678da5969a3e93a4b14cd3640955c.zip opie-dd15f8b7104678da5969a3e93a4b14cd3640955c.tar.gz opie-dd15f8b7104678da5969a3e93a4b14cd3640955c.tar.bz2 |
- implement proper disconnect for modem connections
- let transfer dialog use widgetStack()
-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,289 +1,295 @@ | |||
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"), |
183 | QObject::tr("Dialing the number failed.")); | 189 | QObject::tr("Dialing the number failed.")); |
184 | slotCancel(); | 190 | slotCancel(); |
185 | } | 191 | } |
186 | } | 192 | } |
187 | } | 193 | } |
188 | 194 | ||
189 | if(state != state_cancel) | 195 | if(state != state_cancel) |
190 | { | 196 | { |
191 | switchState(state_online); | 197 | switchState(state_online); |
192 | } | 198 | } |
193 | } | 199 | } |
194 | 200 | ||
195 | void Dialer::send(const QString& msg) | 201 | void Dialer::send(const QString& msg) |
196 | { | 202 | { |
197 | QString m = msg; | 203 | QString m = msg; |
198 | int bytes; | 204 | int bytes; |
199 | QString termination; | 205 | QString termination; |
200 | 206 | ||
201 | qWarning("Sending: '%s'", m.latin1()); | 207 | qWarning("Sending: '%s'", m.latin1()); |
202 | 208 | ||
203 | termination = "\r"; | 209 | termination = "\r"; |
204 | //termination = m_profile.readEntry("Termination"); | 210 | //termination = m_profile.readEntry("Termination"); |
205 | if(termination == "\n") m = m + "\n"; | 211 | if(termination == "\n") m = m + "\n"; |
206 | else if(termination == "\r") m = m + "\r"; | 212 | else if(termination == "\r") m = m + "\r"; |
207 | else m = m + "\r\n"; | 213 | else m = m + "\r\n"; |
208 | 214 | ||
209 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); | 215 | bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); |
210 | if(bytes < 0) | 216 | if(bytes < 0) |
211 | { | 217 | { |
212 | reset(); | 218 | reset(); |
213 | } | 219 | } |
214 | } | 220 | } |
215 | 221 | ||
216 | QString Dialer::receive() | 222 | QString Dialer::receive() |
217 | { | 223 | { |
218 | QString buf; | 224 | QString buf; |
219 | char buffer[1024]; | 225 | char buffer[1024]; |
220 | int ret; | 226 | int ret; |
221 | 227 | ||
222 | qApp->processEvents(); | 228 | qApp->processEvents(); |
223 | 229 | ||
224 | while(1) | 230 | while(1) |
225 | { | 231 | { |
226 | ret = ::read(m_fd, buffer, sizeof(buffer)); | 232 | ret = ::read(m_fd, buffer, sizeof(buffer)); |
227 | 233 | ||
228 | if(ret > 0) | 234 | if(ret > 0) |
229 | { | 235 | { |
230 | for(int i = 0; i < ret; i++) | 236 | for(int i = 0; i < ret; i++) |
231 | buffer[i] = buffer[i] & 0x7F; | 237 | buffer[i] = buffer[i] & 0x7F; |
232 | buffer[ret] = 0; | 238 | buffer[ret] = 0; |
233 | qWarning("Got: '%s'", buffer); | 239 | qWarning("Got: '%s'", buffer); |
234 | buf.append(QString(buffer)); | 240 | buf.append(QString(buffer)); |
235 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) | 241 | if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) |
236 | { | 242 | { |
237 | qWarning("Receiving: '%s'", buf.latin1()); | 243 | qWarning("Receiving: '%s'", buf.latin1()); |
238 | return buf; | 244 | return buf; |
239 | } | 245 | } |
240 | } | 246 | } |
241 | else if(ret < 0) | 247 | else if(ret < 0) |
242 | { | 248 | { |
243 | if(errno != EAGAIN) reset(); | 249 | if(errno != EAGAIN) reset(); |
244 | } | 250 | } |
245 | } | 251 | } |
246 | 252 | ||
247 | return QString::null; | 253 | return QString::null; |
248 | } | 254 | } |
249 | 255 | ||
250 | void Dialer::switchState(int newstate) | 256 | void Dialer::switchState(int newstate) |
251 | { | 257 | { |
252 | int oldstate = state; | 258 | int oldstate = state; |
253 | state = newstate; | 259 | state = newstate; |
254 | 260 | ||
255 | switch(state) | 261 | switch(state) |
256 | { | 262 | { |
257 | case state_cancel: | 263 | case state_cancel: |
258 | status->setText(QObject::tr("Cancelling...")); | 264 | status->setText(QObject::tr("Cancelling...")); |
259 | progress->setProgress(0); | 265 | progress->setProgress(0); |
260 | break; | 266 | break; |
261 | case state_preinit: | 267 | case state_preinit: |
262 | status->setText(QObject::tr("Searching modem")); | 268 | status->setText(QObject::tr("Searching modem")); |
263 | progress->setProgress(10); | 269 | progress->setProgress(10); |
264 | break; | 270 | break; |
265 | case state_init: | 271 | case state_init: |
266 | status->setText(QObject::tr("Initializing...")); | 272 | status->setText(QObject::tr("Initializing...")); |
267 | progress->setProgress(20); | 273 | progress->setProgress(20); |
268 | break; | 274 | break; |
269 | case state_options: | 275 | case state_options: |
270 | status->setText(QObject::tr("Reset speakers")); | 276 | status->setText(QObject::tr("Reset speakers")); |
271 | progress->setProgress(30); | 277 | progress->setProgress(30); |
272 | break; | 278 | break; |
273 | case state_dialtone: | 279 | case state_dialtone: |
274 | status->setText(QObject::tr("Turning off dialtone")); | 280 | status->setText(QObject::tr("Turning off dialtone")); |
275 | progress->setProgress(40); | 281 | progress->setProgress(40); |
276 | break; | 282 | break; |
277 | case state_dialing: | 283 | case state_dialing: |
278 | if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); | 284 | if(oldstate != state_dialing) status->setText(QObject::tr("Dial number")); |
279 | else status->setText(QObject::tr("Line busy, redialing number")); | 285 | else status->setText(QObject::tr("Line busy, redialing number")); |
280 | progress->setProgress(50); | 286 | progress->setProgress(50); |
281 | break; | 287 | break; |
282 | case state_online: | 288 | case state_online: |
283 | status->setText(QObject::tr("Connection established")); | 289 | status->setText(QObject::tr("Connection established")); |
284 | progress->setProgress(100); | 290 | progress->setProgress(100); |
285 | cancel->setText(QObject::tr("Dismiss")); | 291 | cancel->setText(QObject::tr("Dismiss")); |
286 | break; | 292 | break; |
287 | } | 293 | } |
288 | } | 294 | } |
289 | 295 | ||
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 | |||
@@ -1,530 +1,531 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | 3 | ||
4 | 4 | ||
5 | #include <qaction.h> | 5 | #include <qaction.h> |
6 | #include <qmenubar.h> | 6 | #include <qmenubar.h> |
7 | #include <qlabel.h> | 7 | #include <qlabel.h> |
8 | #include <qpopupmenu.h> | 8 | #include <qpopupmenu.h> |
9 | #include <qtoolbar.h> | 9 | #include <qtoolbar.h> |
10 | #include <qmessagebox.h> | 10 | #include <qmessagebox.h> |
11 | #include <qpushbutton.h> | 11 | #include <qpushbutton.h> |
12 | #include <qwhatsthis.h> | 12 | #include <qwhatsthis.h> |
13 | 13 | ||
14 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
15 | #include <opie/ofiledialog.h> | 15 | #include <opie/ofiledialog.h> |
16 | 16 | ||
17 | 17 | ||
18 | #include "keytrans.h" | 18 | #include "keytrans.h" |
19 | #include "profileeditordialog.h" | 19 | #include "profileeditordialog.h" |
20 | #include "configdialog.h" | 20 | #include "configdialog.h" |
21 | #include "default.h" | 21 | #include "default.h" |
22 | #include "metafactory.h" | 22 | #include "metafactory.h" |
23 | #include "profile.h" | 23 | #include "profile.h" |
24 | #include "profilemanager.h" | 24 | #include "profilemanager.h" |
25 | #include "mainwindow.h" | 25 | #include "mainwindow.h" |
26 | #include "tabwidget.h" | 26 | #include "tabwidget.h" |
27 | #include "transferdialog.h" | 27 | #include "transferdialog.h" |
28 | #include "function_keyboard.h" | 28 | #include "function_keyboard.h" |
29 | #include "emulation_handler.h" | 29 | #include "emulation_handler.h" |
30 | #include "script.h" | 30 | #include "script.h" |
31 | #include "quick_button.h" | 31 | #include "quick_button.h" |
32 | 32 | ||
33 | 33 | ||
34 | 34 | ||
35 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 35 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
36 | KeyTrans::loadAll(); | 36 | KeyTrans::loadAll(); |
37 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 37 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
38 | KeyTrans* s = KeyTrans::find(i ); | 38 | KeyTrans* s = KeyTrans::find(i ); |
39 | assert( s ); | 39 | assert( s ); |
40 | } | 40 | } |
41 | m_factory = new MetaFactory(); | 41 | m_factory = new MetaFactory(); |
42 | Default def(m_factory); | 42 | Default def(m_factory); |
43 | m_sessions.setAutoDelete( TRUE ); | 43 | m_sessions.setAutoDelete( TRUE ); |
44 | m_curSession = 0; | 44 | m_curSession = 0; |
45 | m_manager = new ProfileManager( m_factory ); | 45 | m_manager = new ProfileManager( m_factory ); |
46 | m_manager->load(); | 46 | m_manager->load(); |
47 | 47 | ||
48 | initUI(); | 48 | initUI(); |
49 | populateProfiles(); | 49 | populateProfiles(); |
50 | } | 50 | } |
51 | void MainWindow::initUI() { | 51 | void MainWindow::initUI() { |
52 | setToolBarsMovable( FALSE ); | 52 | setToolBarsMovable( FALSE ); |
53 | 53 | ||
54 | /* tool bar for the menu */ | 54 | /* tool bar for the menu */ |
55 | m_tool = new QToolBar( this ); | 55 | m_tool = new QToolBar( this ); |
56 | m_tool->setHorizontalStretchable( TRUE ); | 56 | m_tool->setHorizontalStretchable( TRUE ); |
57 | 57 | ||
58 | m_bar = new QMenuBar( m_tool ); | 58 | m_bar = new QMenuBar( m_tool ); |
59 | m_console = new QPopupMenu( this ); | 59 | m_console = new QPopupMenu( this ); |
60 | m_scripts = new QPopupMenu( this ); | 60 | m_scripts = new QPopupMenu( this ); |
61 | m_sessionsPop= new QPopupMenu( this ); | 61 | m_sessionsPop= new QPopupMenu( this ); |
62 | //m_settings = new QPopupMenu( this ); | 62 | //m_settings = new QPopupMenu( this ); |
63 | 63 | ||
64 | /* add a toolbar for icons */ | 64 | /* add a toolbar for icons */ |
65 | m_icons = new QToolBar(this); | 65 | m_icons = new QToolBar(this); |
66 | 66 | ||
67 | 67 | ||
68 | 68 | ||
69 | 69 | ||
70 | /* | 70 | /* |
71 | * the settings action | 71 | * the settings action |
72 | */ | 72 | */ |
73 | m_setProfiles = new QAction(tr("Configure Profiles"), | 73 | m_setProfiles = new QAction(tr("Configure Profiles"), |
74 | Resource::loadPixmap( "SettingsIcon" ), | 74 | Resource::loadPixmap( "SettingsIcon" ), |
75 | QString::null, 0, this, 0); | 75 | QString::null, 0, this, 0); |
76 | // m_setProfiles->addTo( m_settings ); | 76 | // m_setProfiles->addTo( m_settings ); |
77 | m_setProfiles->addTo( m_icons ); | 77 | m_setProfiles->addTo( m_icons ); |
78 | m_setProfiles->addTo( m_console ); | 78 | m_setProfiles->addTo( m_console ); |
79 | connect( m_setProfiles, SIGNAL(activated() ), | 79 | connect( m_setProfiles, SIGNAL(activated() ), |
80 | this, SLOT(slotConfigure() ) ); | 80 | this, SLOT(slotConfigure() ) ); |
81 | 81 | ||
82 | 82 | ||
83 | /* | 83 | /* |
84 | * new Action for new sessions | 84 | * new Action for new sessions |
85 | */ | 85 | */ |
86 | QAction* a = new QAction(tr("New Connection"), | 86 | QAction* a = new QAction(tr("New Connection"), |
87 | Resource::loadPixmap( "new" ), | 87 | Resource::loadPixmap( "new" ), |
88 | QString::null, 0, this, 0); | 88 | QString::null, 0, this, 0); |
89 | a->addTo( m_console ); | 89 | a->addTo( m_console ); |
90 | a->addTo( m_icons ); | 90 | a->addTo( m_icons ); |
91 | connect(a, SIGNAL(activated() ), | 91 | connect(a, SIGNAL(activated() ), |
92 | this, SLOT(slotNew() ) ); | 92 | this, SLOT(slotNew() ) ); |
93 | 93 | ||
94 | /* | 94 | /* |
95 | * connect action | 95 | * connect action |
96 | */ | 96 | */ |
97 | m_connect = new QAction(); | 97 | m_connect = new QAction(); |
98 | m_connect->setText( tr("Connect") ); | 98 | m_connect->setText( tr("Connect") ); |
99 | m_connect->addTo( m_console ); | 99 | m_connect->addTo( m_console ); |
100 | connect(m_connect, SIGNAL(activated() ), | 100 | connect(m_connect, SIGNAL(activated() ), |
101 | this, SLOT(slotConnect() ) ); | 101 | this, SLOT(slotConnect() ) ); |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * disconnect action | 104 | * disconnect action |
105 | */ | 105 | */ |
106 | m_disconnect = new QAction(); | 106 | m_disconnect = new QAction(); |
107 | m_disconnect->setText( tr("Disconnect") ); | 107 | m_disconnect->setText( tr("Disconnect") ); |
108 | m_disconnect->addTo( m_console ); | 108 | m_disconnect->addTo( m_console ); |
109 | connect(m_disconnect, SIGNAL(activated() ), | 109 | connect(m_disconnect, SIGNAL(activated() ), |
110 | this, SLOT(slotDisconnect() ) ); | 110 | this, SLOT(slotDisconnect() ) ); |
111 | 111 | ||
112 | m_transfer = new QAction(); | 112 | m_transfer = new QAction(); |
113 | m_transfer->setText( tr("Transfer file...") ); | 113 | m_transfer->setText( tr("Transfer file...") ); |
114 | m_transfer->addTo( m_console ); | 114 | m_transfer->addTo( m_console ); |
115 | connect(m_transfer, SIGNAL(activated() ), | 115 | connect(m_transfer, SIGNAL(activated() ), |
116 | this, SLOT(slotTransfer() ) ); | 116 | this, SLOT(slotTransfer() ) ); |
117 | 117 | ||
118 | 118 | ||
119 | /* | 119 | /* |
120 | * fullscreen | 120 | * fullscreen |
121 | */ | 121 | */ |
122 | m_isFullscreen = false; | 122 | m_isFullscreen = false; |
123 | 123 | ||
124 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 124 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
125 | , QString::null, 0, this, 0); | 125 | , QString::null, 0, this, 0); |
126 | m_fullscreen->addTo( m_console ); | 126 | m_fullscreen->addTo( m_console ); |
127 | m_fullscreen->addTo( m_icons ); | 127 | m_fullscreen->addTo( m_icons ); |
128 | connect( m_fullscreen, SIGNAL( activated() ), | 128 | connect( m_fullscreen, SIGNAL( activated() ), |
129 | this, SLOT( slotFullscreen() ) ); | 129 | this, SLOT( slotFullscreen() ) ); |
130 | 130 | ||
131 | /* | 131 | /* |
132 | * terminate action | 132 | * terminate action |
133 | */ | 133 | */ |
134 | m_terminate = new QAction(); | 134 | m_terminate = new QAction(); |
135 | m_terminate->setText( tr("Terminate") ); | 135 | m_terminate->setText( tr("Terminate") ); |
136 | m_terminate->addTo( m_console ); | 136 | m_terminate->addTo( m_console ); |
137 | connect(m_terminate, SIGNAL(activated() ), | 137 | connect(m_terminate, SIGNAL(activated() ), |
138 | this, SLOT(slotTerminate() ) ); | 138 | this, SLOT(slotTerminate() ) ); |
139 | 139 | ||
140 | m_closewindow = new QAction(); | 140 | m_closewindow = new QAction(); |
141 | m_closewindow->setText( tr("Close Window") ); | 141 | m_closewindow->setText( tr("Close Window") ); |
142 | m_closewindow->addTo( m_console ); | 142 | m_closewindow->addTo( m_console ); |
143 | connect( m_closewindow, SIGNAL(activated() ), | 143 | connect( m_closewindow, SIGNAL(activated() ), |
144 | this, SLOT(slotClose() ) ); | 144 | this, SLOT(slotClose() ) ); |
145 | 145 | ||
146 | 146 | ||
147 | /* | 147 | /* |
148 | * script actions | 148 | * script actions |
149 | */ | 149 | */ |
150 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 150 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
151 | m_recordScript->addTo(m_scripts); | 151 | m_recordScript->addTo(m_scripts); |
152 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 152 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
153 | 153 | ||
154 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 154 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
155 | m_saveScript->addTo(m_scripts); | 155 | m_saveScript->addTo(m_scripts); |
156 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 156 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
157 | 157 | ||
158 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); | 158 | m_runScript = new QAction(tr("Run Script"), QString::null, 0, this, 0); |
159 | m_runScript->addTo(m_scripts); | 159 | m_runScript->addTo(m_scripts); |
160 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); | 160 | connect(m_runScript, SIGNAL(activated()), this, SLOT(slotRunScript())); |
161 | 161 | ||
162 | /* | 162 | /* |
163 | * action that open/closes the keyboard | 163 | * action that open/closes the keyboard |
164 | */ | 164 | */ |
165 | m_openKeys = new QAction (tr("Open Keyboard..."), | 165 | m_openKeys = new QAction (tr("Open Keyboard..."), |
166 | Resource::loadPixmap( "down" ), | 166 | Resource::loadPixmap( "down" ), |
167 | QString::null, 0, this, 0); | 167 | QString::null, 0, this, 0); |
168 | 168 | ||
169 | m_openKeys->setToggleAction(true); | 169 | m_openKeys->setToggleAction(true); |
170 | 170 | ||
171 | connect (m_openKeys, SIGNAL(toggled(bool)), | 171 | connect (m_openKeys, SIGNAL(toggled(bool)), |
172 | this, SLOT(slotOpenKeb(bool))); | 172 | this, SLOT(slotOpenKeb(bool))); |
173 | m_openKeys->addTo(m_icons); | 173 | m_openKeys->addTo(m_icons); |
174 | 174 | ||
175 | 175 | ||
176 | /* | 176 | /* |
177 | * action that open/closes the keyboard | 177 | * action that open/closes the keyboard |
178 | */ | 178 | */ |
179 | m_openButtons = new QAction ( tr( "Open Buttons..." ), | 179 | m_openButtons = new QAction ( tr( "Open Buttons..." ), |
180 | Resource::loadPixmap( "down" ), | 180 | Resource::loadPixmap( "down" ), |
181 | QString::null, 0, this, 0 ); | 181 | QString::null, 0, this, 0 ); |
182 | 182 | ||
183 | m_openButtons->setToggleAction( true ); | 183 | m_openButtons->setToggleAction( true ); |
184 | 184 | ||
185 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), | 185 | connect ( m_openButtons, SIGNAL( toggled( bool ) ), |
186 | this, SLOT( slotOpenButtons( bool ) ) ); | 186 | this, SLOT( slotOpenButtons( bool ) ) ); |
187 | m_openButtons->addTo( m_icons ); | 187 | m_openButtons->addTo( m_icons ); |
188 | 188 | ||
189 | 189 | ||
190 | /* insert the submenu */ | 190 | /* insert the submenu */ |
191 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 191 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
192 | -1, 0); | 192 | -1, 0); |
193 | 193 | ||
194 | /* insert the connection menu */ | 194 | /* insert the connection menu */ |
195 | m_bar->insertItem( tr("Connection"), m_console ); | 195 | m_bar->insertItem( tr("Connection"), m_console ); |
196 | 196 | ||
197 | /* the scripts menu */ | 197 | /* the scripts menu */ |
198 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 198 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
199 | 199 | ||
200 | /* the settings menu */ | 200 | /* the settings menu */ |
201 | // m_bar->insertItem( tr("Settings"), m_settings ); | 201 | // m_bar->insertItem( tr("Settings"), m_settings ); |
202 | 202 | ||
203 | /* and the keyboard */ | 203 | /* and the keyboard */ |
204 | m_keyBar = new QToolBar(this); | 204 | m_keyBar = new QToolBar(this); |
205 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 205 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
206 | m_keyBar->setHorizontalStretchable( TRUE ); | 206 | m_keyBar->setHorizontalStretchable( TRUE ); |
207 | m_keyBar->hide(); | 207 | m_keyBar->hide(); |
208 | 208 | ||
209 | m_kb = new FunctionKeyboard(m_keyBar); | 209 | m_kb = new FunctionKeyboard(m_keyBar); |
210 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), | 210 | connect(m_kb, SIGNAL(keyPressed(ushort, ushort, bool, bool, bool)), |
211 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); | 211 | this, SLOT(slotKeyReceived(ushort, ushort, bool, bool, bool))); |
212 | 212 | ||
213 | m_buttonBar = new QToolBar( this ); | 213 | m_buttonBar = new QToolBar( this ); |
214 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); | 214 | addToolBar( m_buttonBar, "Buttons", QMainWindow::Top, TRUE ); |
215 | m_buttonBar->setHorizontalStretchable( TRUE ); | 215 | m_buttonBar->setHorizontalStretchable( TRUE ); |
216 | m_buttonBar->hide(); | 216 | m_buttonBar->hide(); |
217 | 217 | ||
218 | m_qb = new QuickButton( m_buttonBar ); | 218 | m_qb = new QuickButton( m_buttonBar ); |
219 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), | 219 | connect( m_qb, SIGNAL( keyPressed( ushort, ushort, bool, bool, bool) ), |
220 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); | 220 | this, SLOT( slotKeyReceived( ushort, ushort, bool, bool, bool) ) ); |
221 | 221 | ||
222 | 222 | ||
223 | m_connect->setEnabled( false ); | 223 | m_connect->setEnabled( false ); |
224 | m_disconnect->setEnabled( false ); | 224 | m_disconnect->setEnabled( false ); |
225 | m_terminate->setEnabled( false ); | 225 | m_terminate->setEnabled( false ); |
226 | m_transfer->setEnabled( false ); | 226 | m_transfer->setEnabled( false ); |
227 | m_recordScript->setEnabled( false ); | 227 | m_recordScript->setEnabled( false ); |
228 | m_saveScript->setEnabled( false ); | 228 | m_saveScript->setEnabled( false ); |
229 | m_runScript->setEnabled( false ); | 229 | m_runScript->setEnabled( false ); |
230 | m_fullscreen->setEnabled( false ); | 230 | m_fullscreen->setEnabled( false ); |
231 | m_closewindow->setEnabled( false ); | 231 | m_closewindow->setEnabled( false ); |
232 | 232 | ||
233 | /* | 233 | /* |
234 | * connect to the menu activation | 234 | * connect to the menu activation |
235 | */ | 235 | */ |
236 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 236 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
237 | this, SLOT(slotProfile( int ) ) ); | 237 | this, SLOT(slotProfile( int ) ) ); |
238 | 238 | ||
239 | m_consoleWindow = new TabWidget( this, "blah"); | 239 | m_consoleWindow = new TabWidget( this, "blah"); |
240 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 240 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
241 | this, SLOT(slotSessionChanged(Session*) ) ); | 241 | this, SLOT(slotSessionChanged(Session*) ) ); |
242 | setCentralWidget( m_consoleWindow ); | 242 | setCentralWidget( m_consoleWindow ); |
243 | 243 | ||
244 | } | 244 | } |
245 | 245 | ||
246 | ProfileManager* MainWindow::manager() { | 246 | ProfileManager* MainWindow::manager() { |
247 | return m_manager; | 247 | return m_manager; |
248 | } | 248 | } |
249 | TabWidget* MainWindow::tabWidget() { | 249 | TabWidget* MainWindow::tabWidget() { |
250 | return m_consoleWindow; | 250 | return m_consoleWindow; |
251 | } | 251 | } |
252 | void MainWindow::populateProfiles() { | 252 | void MainWindow::populateProfiles() { |
253 | m_sessionsPop->clear(); | 253 | m_sessionsPop->clear(); |
254 | Profile::ValueList list = manager()->all(); | 254 | Profile::ValueList list = manager()->all(); |
255 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 255 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
256 | m_sessionsPop->insertItem( (*it).name() ); | 256 | m_sessionsPop->insertItem( (*it).name() ); |
257 | } | 257 | } |
258 | 258 | ||
259 | } | 259 | } |
260 | MainWindow::~MainWindow() { | 260 | MainWindow::~MainWindow() { |
261 | delete m_factory; | 261 | delete m_factory; |
262 | manager()->save(); | 262 | manager()->save(); |
263 | } | 263 | } |
264 | 264 | ||
265 | MetaFactory* MainWindow::factory() { | 265 | MetaFactory* MainWindow::factory() { |
266 | return m_factory; | 266 | return m_factory; |
267 | } | 267 | } |
268 | 268 | ||
269 | Session* MainWindow::currentSession() { | 269 | Session* MainWindow::currentSession() { |
270 | return m_curSession; | 270 | return m_curSession; |
271 | } | 271 | } |
272 | 272 | ||
273 | QList<Session> MainWindow::sessions() { | 273 | QList<Session> MainWindow::sessions() { |
274 | return m_sessions; | 274 | return m_sessions; |
275 | } | 275 | } |
276 | 276 | ||
277 | void MainWindow::slotNew() { | 277 | void MainWindow::slotNew() { |
278 | ProfileEditorDialog dlg(factory() ); | 278 | ProfileEditorDialog dlg(factory() ); |
279 | dlg.showMaximized(); | 279 | dlg.showMaximized(); |
280 | int ret = dlg.exec(); | 280 | int ret = dlg.exec(); |
281 | 281 | ||
282 | if ( ret == QDialog::Accepted ) { | 282 | if ( ret == QDialog::Accepted ) { |
283 | create( dlg.profile() ); | 283 | create( dlg.profile() ); |
284 | } | 284 | } |
285 | } | 285 | } |
286 | 286 | ||
287 | void MainWindow::slotRecordScript() { | 287 | void MainWindow::slotRecordScript() { |
288 | /* if (currentSession()) { | 288 | /* if (currentSession()) { |
289 | currentSession()->emulationLayer()->startRecording(); | 289 | currentSession()->emulationLayer()->startRecording(); |
290 | } | 290 | } |
291 | */ | 291 | */ |
292 | } | 292 | } |
293 | 293 | ||
294 | void MainWindow::slotSaveScript() { | 294 | void MainWindow::slotSaveScript() { |
295 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { | 295 | /* if (currentSession() && currentSession()->emulationLayer()->isRecording()) { |
296 | MimeTypes types; | 296 | MimeTypes types; |
297 | QStringList script; | 297 | QStringList script; |
298 | script << "text/plain"; | 298 | script << "text/plain"; |
299 | types.insert("Script", script); | 299 | types.insert("Script", script); |
300 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); | 300 | QString filename = OFileDialog::getSaveFileName(2, "/", QString::null, types); |
301 | if (!filename.isEmpty()) { | 301 | if (!filename.isEmpty()) { |
302 | currentSession()->emulationLayer()->script()->saveTo(filename); | 302 | currentSession()->emulationLayer()->script()->saveTo(filename); |
303 | currentSession()->emulationLayer()->clearScript(); | 303 | currentSession()->emulationLayer()->clearScript(); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | */ | 306 | */ |
307 | } | 307 | } |
308 | 308 | ||
309 | void MainWindow::slotRunScript() { | 309 | void MainWindow::slotRunScript() { |
310 | /* | 310 | /* |
311 | if (currentSession()) { | 311 | if (currentSession()) { |
312 | MimeTypes types; | 312 | MimeTypes types; |
313 | QStringList script; | 313 | QStringList script; |
314 | script << "text/plain"; | 314 | script << "text/plain"; |
315 | types.insert("Script", script); | 315 | types.insert("Script", script); |
316 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); | 316 | QString filename = OFileDialog::getOpenFileName(2, "/", QString::null, types); |
317 | if (!filename.isEmpty()) { | 317 | if (!filename.isEmpty()) { |
318 | Script script(DocLnk(filename).file()); | 318 | Script script(DocLnk(filename).file()); |
319 | currentSession()->emulationLayer()->runScript(&script); | 319 | currentSession()->emulationLayer()->runScript(&script); |
320 | } | 320 | } |
321 | } | 321 | } |
322 | */ | 322 | */ |
323 | } | 323 | } |
324 | 324 | ||
325 | void MainWindow::slotConnect() { | 325 | void MainWindow::slotConnect() { |
326 | if ( currentSession() ) { | 326 | if ( currentSession() ) { |
327 | bool ret = currentSession()->layer()->open(); | 327 | bool ret = currentSession()->layer()->open(); |
328 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 328 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
329 | QObject::tr("Failed"), | 329 | QObject::tr("Failed"), |
330 | QObject::tr("Connecting failed for this session.")); | 330 | QObject::tr("Connecting failed for this session.")); |
331 | else { | 331 | else { |
332 | m_connect->setEnabled( false ); | 332 | m_connect->setEnabled( false ); |
333 | m_disconnect->setEnabled( true ); | 333 | m_disconnect->setEnabled( true ); |
334 | } | 334 | } |
335 | } | 335 | } |
336 | } | 336 | } |
337 | 337 | ||
338 | void MainWindow::slotDisconnect() { | 338 | void MainWindow::slotDisconnect() { |
339 | if ( currentSession() ) { | 339 | if ( currentSession() ) { |
340 | currentSession()->layer()->close(); | 340 | currentSession()->layer()->close(); |
341 | m_connect->setEnabled( true ); | 341 | m_connect->setEnabled( true ); |
342 | m_disconnect->setEnabled( false ); | 342 | m_disconnect->setEnabled( false ); |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | void MainWindow::slotTerminate() { | 346 | void MainWindow::slotTerminate() { |
347 | if ( currentSession() ) | 347 | if ( currentSession() ) |
348 | currentSession()->layer()->close(); | 348 | currentSession()->layer()->close(); |
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,261 +1,261 @@ | |||
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 | ||
118 | cleanup(); | 118 | cleanup(); |
119 | m_autocleanup = 0; | 119 | m_autocleanup = 0; |
120 | 120 | ||
121 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); | 121 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); |
122 | else statusbar->setText(QObject::tr("Receiving...")); | 122 | else statusbar->setText(QObject::tr("Receiving...")); |
123 | 123 | ||
124 | if(m_transfermode == id_send) | 124 | if(m_transfermode == id_send) |
125 | { | 125 | { |
126 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); | 126 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); |
127 | m_lay->sendFile(filename->text()); | 127 | m_lay->sendFile(filename->text()); |
128 | 128 | ||
129 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 129 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), |
130 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 130 | SLOT(slotProgress(const QString&, int, int, int, int, int))); |
131 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 131 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); |
132 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); | 132 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); |
133 | } | 133 | } |
134 | else | 134 | else |
135 | { | 135 | { |
136 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); | 136 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); |
137 | m_recvlay->receive(); | 137 | m_recvlay->receive(); |
138 | 138 | ||
139 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 139 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), |
140 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 140 | SLOT(slotProgress(const QString&, int, int, int, int, int))); |
141 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 141 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); |
142 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); | 142 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void TransferDialog::cleanup() | 146 | void TransferDialog::cleanup() |
147 | { | 147 | { |
148 | if(m_lay) | 148 | if(m_lay) |
149 | { | 149 | { |
150 | m_lay->cancel(); | 150 | m_lay->cancel(); |
151 | delete m_lay; | 151 | delete m_lay; |
152 | m_lay = 0l; | 152 | m_lay = 0l; |
153 | } | 153 | } |
154 | if(m_recvlay) | 154 | if(m_recvlay) |
155 | { | 155 | { |
156 | m_recvlay->cancel(); | 156 | m_recvlay->cancel(); |
157 | delete m_recvlay; | 157 | delete m_recvlay; |
158 | m_recvlay = 0l; | 158 | m_recvlay = 0l; |
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | void TransferDialog::slotCancel() | 162 | void TransferDialog::slotCancel() |
163 | { | 163 | { |
164 | ok->setEnabled(true); | 164 | ok->setEnabled(true); |
165 | statusbar->setText(QObject::tr("Ready")); | 165 | statusbar->setText(QObject::tr("Ready")); |
166 | 166 | ||
167 | if((m_lay) || (m_recvlay)) | 167 | if((m_lay) || (m_recvlay)) |
168 | { | 168 | { |
169 | cleanup(); | 169 | cleanup(); |
170 | if(m_autocleanup) close(); | 170 | if(m_autocleanup) close(); |
171 | else | 171 | else |
172 | { | 172 | { |
173 | QMessageBox::information(this, | 173 | QMessageBox::information(this, |
174 | QObject::tr("Cancelled"), | 174 | QObject::tr("Cancelled"), |
175 | QObject::tr("The file transfer has been cancelled.")); | 175 | QObject::tr("The file transfer has been cancelled.")); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | close(); | 180 | close(); |
181 | } | 181 | } |
182 | } | 182 | } |
183 | 183 | ||
184 | void TransferDialog::slotProgress(const QString& file, int progress, int speed, int hours, int minutes, int seconds) | 184 | void TransferDialog::slotProgress(const QString& file, int progress, int speed, int hours, int minutes, int seconds) |
185 | { | 185 | { |
186 | progressbar->setProgress(progress); | 186 | progressbar->setProgress(progress); |
187 | } | 187 | } |
188 | 188 | ||
189 | void TransferDialog::slotError(int error, const QString& message) | 189 | void TransferDialog::slotError(int error, const QString& message) |
190 | { | 190 | { |
191 | statusbar->setText(QObject::tr("Ready")); | 191 | statusbar->setText(QObject::tr("Ready")); |
192 | 192 | ||
193 | switch(error) | 193 | switch(error) |
194 | { | 194 | { |
195 | case FileTransferLayer::NotSupported: | 195 | case FileTransferLayer::NotSupported: |
196 | QMessageBox::critical(this, | 196 | QMessageBox::critical(this, |
197 | QObject::tr("Error"), | 197 | QObject::tr("Error"), |
198 | QObject::tr("Operation not supported.")); | 198 | QObject::tr("Operation not supported.")); |
199 | break; | 199 | break; |
200 | case FileTransferLayer::StartError: | 200 | case FileTransferLayer::StartError: |
201 | QMessageBox::critical(this, | 201 | QMessageBox::critical(this, |
202 | QObject::tr("Error"), | 202 | QObject::tr("Error"), |
203 | QObject::tr("Transfer could not be started.")); | 203 | QObject::tr("Transfer could not be started.")); |
204 | break; | 204 | break; |
205 | case FileTransferLayer::NoError: | 205 | case FileTransferLayer::NoError: |
206 | QMessageBox::critical(this, | 206 | QMessageBox::critical(this, |
207 | QObject::tr("Error"), | 207 | QObject::tr("Error"), |
208 | QObject::tr("No error.")); | 208 | QObject::tr("No error.")); |
209 | break; | 209 | break; |
210 | case FileTransferLayer::Undefined: | 210 | case FileTransferLayer::Undefined: |
211 | QMessageBox::critical(this, | 211 | QMessageBox::critical(this, |
212 | QObject::tr("Error"), | 212 | QObject::tr("Error"), |
213 | QObject::tr("Undefined error occured.")); | 213 | QObject::tr("Undefined error occured.")); |
214 | break; | 214 | break; |
215 | case FileTransferLayer::Incomplete: | 215 | case FileTransferLayer::Incomplete: |
216 | QMessageBox::critical(this, | 216 | QMessageBox::critical(this, |
217 | QObject::tr("Error"), | 217 | QObject::tr("Error"), |
218 | QObject::tr("Incomplete transfer.")); | 218 | QObject::tr("Incomplete transfer.")); |
219 | break; | 219 | break; |
220 | case FileTransferLayer::Unknown: | 220 | case FileTransferLayer::Unknown: |
221 | default: | 221 | default: |
222 | QMessageBox::critical(this, | 222 | QMessageBox::critical(this, |
223 | QObject::tr("Error"), | 223 | QObject::tr("Error"), |
224 | QObject::tr("Unknown error occured.")); | 224 | QObject::tr("Unknown error occured.")); |
225 | break; | 225 | break; |
226 | } | 226 | } |
227 | 227 | ||
228 | m_autocleanup = 1; | 228 | m_autocleanup = 1; |
229 | } | 229 | } |
230 | 230 | ||
231 | void TransferDialog::slotSent() | 231 | void TransferDialog::slotSent() |
232 | { | 232 | { |
233 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); | 233 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); |
234 | ok->setEnabled(true); | 234 | ok->setEnabled(true); |
235 | statusbar->setText(QObject::tr("Ready")); | 235 | statusbar->setText(QObject::tr("Ready")); |
236 | m_autocleanup = 1; | 236 | m_autocleanup = 1; |
237 | } | 237 | } |
238 | 238 | ||
239 | void TransferDialog::slotReceived(const QString& file) | 239 | void TransferDialog::slotReceived(const QString& file) |
240 | { | 240 | { |
241 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); | 241 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); |
242 | ok->setEnabled(true); | 242 | ok->setEnabled(true); |
243 | statusbar->setText(QObject::tr("Ready")); | 243 | statusbar->setText(QObject::tr("Ready")); |
244 | m_autocleanup = 1; | 244 | m_autocleanup = 1; |
245 | } | 245 | } |
246 | 246 | ||
247 | void TransferDialog::slotMode(int id) | 247 | void TransferDialog::slotMode(int id) |
248 | { | 248 | { |
249 | if(id == id_send) | 249 | if(id == id_send) |
250 | { | 250 | { |
251 | selector->setEnabled(true); | 251 | selector->setEnabled(true); |
252 | filename->setEnabled(true); | 252 | filename->setEnabled(true); |
253 | } | 253 | } |
254 | else | 254 | else |
255 | { | 255 | { |
256 | selector->setEnabled(false); | 256 | selector->setEnabled(false); |
257 | filename->setEnabled(false); | 257 | filename->setEnabled(false); |
258 | } | 258 | } |
259 | m_transfermode = id; | 259 | m_transfermode = id; |
260 | } | 260 | } |
261 | 261 | ||
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 | ||