-rw-r--r-- | noncore/apps/opie-console/config.in | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/file_layer.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/filetransfer.h | 3 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_bt.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_irda.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/io_modem.h | 4 | ||||
-rw-r--r-- | noncore/apps/opie-console/mainwindow.cpp | 74 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.control | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/opie-console.pro | 112 | ||||
-rw-r--r-- | noncore/apps/opie-console/profileeditordialog.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.cpp | 1 | ||||
-rw-r--r-- | noncore/apps/opie-console/sz_transfer.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/tabwidget.h | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/console.pro | 10 | ||||
-rw-r--r-- | noncore/apps/opie-console/test/senderui.cpp | 2 | ||||
-rw-r--r-- | noncore/apps/opie-console/transferdialog.cpp | 416 |
17 files changed, 318 insertions, 322 deletions
diff --git a/noncore/apps/opie-console/config.in b/noncore/apps/opie-console/config.in index 521154d..b5702a9 100644 --- a/noncore/apps/opie-console/config.in +++ b/noncore/apps/opie-console/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config OPIE-CONSOLE | 1 | config OPIE-CONSOLE |
2 | boolean "opie-console (scriptable terminal program)" | 2 | boolean "opie-console (scriptable terminal program)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2UI |
diff --git a/noncore/apps/opie-console/file_layer.cpp b/noncore/apps/opie-console/file_layer.cpp index 9ddef80..870e913 100644 --- a/noncore/apps/opie-console/file_layer.cpp +++ b/noncore/apps/opie-console/file_layer.cpp | |||
@@ -1,22 +1,20 @@ | |||
1 | #include <opie/oprocess.h> | ||
2 | |||
3 | #include "file_layer.h" | 1 | #include "file_layer.h" |
4 | 2 | ||
5 | FileTransferLayer::FileTransferLayer(IOLayer *layer) | 3 | FileTransferLayer::FileTransferLayer(IOLayer *layer) |
6 | : QObject(), m_layer( layer ) | 4 | : QObject(), m_layer( layer ) |
7 | { | 5 | { |
8 | } | 6 | } |
9 | 7 | ||
10 | FileTransferLayer::~FileTransferLayer() { | 8 | FileTransferLayer::~FileTransferLayer() { |
11 | } | 9 | } |
12 | 10 | ||
13 | void FileTransferLayer::sendFile(const QFile&) { | 11 | void FileTransferLayer::sendFile(const QFile&) { |
14 | 12 | ||
15 | } | 13 | } |
16 | 14 | ||
17 | void FileTransferLayer::sendFile(const QString&) { | 15 | void FileTransferLayer::sendFile(const QString&) { |
18 | } | 16 | } |
19 | 17 | ||
20 | IOLayer* FileTransferLayer::layer() { | 18 | IOLayer* FileTransferLayer::layer() { |
21 | return m_layer; | 19 | return m_layer; |
22 | } | 20 | } |
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 347d6e0..7eebc65 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -1,250 +1,248 @@ | |||
1 | #include <stdio.h> | 1 | #include <stdio.h> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <errno.h> | 3 | #include <errno.h> |
4 | #include <fcntl.h> | 4 | #include <fcntl.h> |
5 | #include <unistd.h> | 5 | #include <unistd.h> |
6 | 6 | ||
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include <opie/oprocess.h> | ||
10 | |||
11 | #include "procctl.h" | 9 | #include "procctl.h" |
12 | #include "filetransfer.h" | 10 | #include "filetransfer.h" |
13 | 11 | ||
14 | 12 | ||
15 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) | 13 | FileTransfer::FileTransfer( Type t, IOLayer* lay ) |
16 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { | 14 | : FileTransferLayer( lay ), m_type( t ), m_pid ( 0 ) { |
17 | signal(SIGPIPE, SIG_IGN ); | 15 | signal(SIGPIPE, SIG_IGN ); |
18 | 16 | ||
19 | m_pid = 0; | 17 | m_pid = 0; |
20 | m_not = 0l; | 18 | m_not = 0l; |
21 | m_proc = 0l; | 19 | m_proc = 0l; |
22 | } | 20 | } |
23 | FileTransfer::~FileTransfer() { | 21 | FileTransfer::~FileTransfer() { |
24 | } | 22 | } |
25 | 23 | ||
26 | /** | 24 | /** |
27 | * now we will send the file. | 25 | * now we will send the file. |
28 | * | 26 | * |
29 | * we request an fd. The IOLayer should be closed | 27 | * we request an fd. The IOLayer should be closed |
30 | * then we will setup a pipe for progress communication | 28 | * then we will setup a pipe for progress communication |
31 | * then we will dup2 the m_fd in the forked process | 29 | * then we will dup2 the m_fd in the forked process |
32 | * to do direct IO from and to the fd | 30 | * to do direct IO from and to the fd |
33 | */ | 31 | */ |
34 | void FileTransfer::sendFile( const QString& file ) { | 32 | void FileTransfer::sendFile( const QString& file ) { |
35 | m_prog =-1; | 33 | m_prog =-1; |
36 | m_fd = layer()->rawIO(); | 34 | m_fd = layer()->rawIO(); |
37 | // | 35 | // |
38 | // m_fd = ::open("/dev/ttyS0", O_RDWR); | 36 | // m_fd = ::open("/dev/ttyS0", O_RDWR); |
39 | 37 | ||
40 | m_file = file; | 38 | m_file = file; |
41 | if ( pipe( m_comm ) < 0 ) | 39 | if ( pipe( m_comm ) < 0 ) |
42 | m_comm[0] = m_comm[1] = 0; | 40 | m_comm[0] = m_comm[1] = 0; |
43 | if ( pipe( m_info ) < 0 ) | 41 | if ( pipe( m_info ) < 0 ) |
44 | m_info[0] = m_info[1] = 0; | 42 | m_info[0] = m_info[1] = 0; |
45 | 43 | ||
46 | 44 | ||
47 | m_pid = fork(); | 45 | m_pid = fork(); |
48 | switch( m_pid ) { | 46 | switch( m_pid ) { |
49 | case -1: | 47 | case -1: |
50 | emit error( StartError, tr("Was not able to fork") ); | 48 | emit error( StartError, tr("Was not able to fork") ); |
51 | slotExec(); | 49 | slotExec(); |
52 | break; | 50 | break; |
53 | case 0:{ | 51 | case 0:{ |
54 | setupChild(); | 52 | setupChild(); |
55 | /* exec */ | 53 | /* exec */ |
56 | char* verbose = "-vv"; | 54 | char* verbose = "-vv"; |
57 | char* binray = "-b"; | 55 | char* binray = "-b"; |
58 | 56 | ||
59 | 57 | ||
60 | char* typus; | 58 | char* typus; |
61 | switch(m_type ) { | 59 | switch(m_type ) { |
62 | default: | 60 | default: |
63 | case SZ: | 61 | case SZ: |
64 | typus = ""; | 62 | typus = ""; |
65 | break; | 63 | break; |
66 | case SX: | 64 | case SX: |
67 | typus = "-X"; | 65 | typus = "-X"; |
68 | break; | 66 | break; |
69 | case SY: | 67 | case SY: |
70 | typus = "--ymodem"; | 68 | typus = "--ymodem"; |
71 | break; | 69 | break; |
72 | } | 70 | } |
73 | 71 | ||
74 | /* we should never return from here */ | 72 | /* we should never return from here */ |
75 | execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL ); | 73 | execlp("sz", "sz", verbose, binray, file.latin1(), typus, NULL ); |
76 | 74 | ||
77 | /* communication for error!*/ | 75 | /* communication for error!*/ |
78 | char resultByte =1; | 76 | char resultByte =1; |
79 | if (m_info[1] ) | 77 | if (m_info[1] ) |
80 | write(m_info[1], &resultByte, 1 ); | 78 | write(m_info[1], &resultByte, 1 ); |
81 | _exit( -1 ); | 79 | _exit( -1 ); |
82 | break; | 80 | break; |
83 | } | 81 | } |
84 | default:{ | 82 | default:{ |
85 | if ( m_info[1] ) | 83 | if ( m_info[1] ) |
86 | close( m_info[1] ); | 84 | close( m_info[1] ); |
87 | if ( m_info[0] ) for (;;) { | 85 | if ( m_info[0] ) for (;;) { |
88 | char resultByte; int len; | 86 | char resultByte; int len; |
89 | len = read(m_info[0], &resultByte, 1 ); | 87 | len = read(m_info[0], &resultByte, 1 ); |
90 | /* len == 1 start up failed */ | 88 | /* len == 1 start up failed */ |
91 | if ( len == 1 ) { | 89 | if ( len == 1 ) { |
92 | emit error( StartError, tr("Could not start") ); | 90 | emit error( StartError, tr("Could not start") ); |
93 | return; | 91 | return; |
94 | } | 92 | } |
95 | if ( len == -1 ) | 93 | if ( len == -1 ) |
96 | if ( (errno == ECHILD ) || (errno == EINTR ) ) | 94 | if ( (errno == ECHILD ) || (errno == EINTR ) ) |
97 | continue; | 95 | continue; |
98 | 96 | ||
99 | // len == 0 or something like this | 97 | // len == 0 or something like this |
100 | break; | 98 | break; |
101 | } | 99 | } |
102 | if ( m_info[0] ) | 100 | if ( m_info[0] ) |
103 | close( m_info[0] ); | 101 | close( m_info[0] ); |
104 | 102 | ||
105 | 103 | ||
106 | 104 | ||
107 | /* replace by QSocketNotifier!!! */ | 105 | /* replace by QSocketNotifier!!! */ |
108 | m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read ); | 106 | m_not = new QSocketNotifier(m_comm[0], QSocketNotifier::Read ); |
109 | connect(m_not, SIGNAL(activated(int) ), | 107 | connect(m_not, SIGNAL(activated(int) ), |
110 | this, SLOT(slotRead() ) ); | 108 | this, SLOT(slotRead() ) ); |
111 | if ( pipe(m_term) < 0 ) | 109 | if ( pipe(m_term) < 0 ) |
112 | m_term[0] = m_term[1] = 0; | 110 | m_term[0] = m_term[1] = 0; |
113 | 111 | ||
114 | ProcCtl::self()->add(m_pid, m_term[1] ); | 112 | ProcCtl::self()->add(m_pid, m_term[1] ); |
115 | m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read ); | 113 | m_proc = new QSocketNotifier(m_term[0], QSocketNotifier::Read ); |
116 | connect(m_proc, SIGNAL(activated(int) ), | 114 | connect(m_proc, SIGNAL(activated(int) ), |
117 | this, SLOT(slotExec() ) ); | 115 | this, SLOT(slotExec() ) ); |
118 | 116 | ||
119 | } | 117 | } |
120 | break; | 118 | break; |
121 | } | 119 | } |
122 | } | 120 | } |
123 | /* | 121 | /* |
124 | * let's call the one with the filename | 122 | * let's call the one with the filename |
125 | */ | 123 | */ |
126 | void FileTransfer::sendFile( const QFile& file ) { | 124 | void FileTransfer::sendFile( const QFile& file ) { |
127 | sendFile( file.name() ); | 125 | sendFile( file.name() ); |
128 | } | 126 | } |
129 | 127 | ||
130 | /* | 128 | /* |
131 | * setting up communication | 129 | * setting up communication |
132 | * between parent child and ioLayer | 130 | * between parent child and ioLayer |
133 | */ | 131 | */ |
134 | void FileTransfer::setupChild() { | 132 | void FileTransfer::setupChild() { |
135 | /* | 133 | /* |
136 | * we do not want to read from our | 134 | * we do not want to read from our |
137 | * information channel | 135 | * information channel |
138 | */ | 136 | */ |
139 | if (m_info[0] ) | 137 | if (m_info[0] ) |
140 | close(m_info[0] ); | 138 | close(m_info[0] ); |
141 | /* | 139 | /* |
142 | * FD_CLOEXEC will close the | 140 | * FD_CLOEXEC will close the |
143 | * fd on successful exec | 141 | * fd on successful exec |
144 | */ | 142 | */ |
145 | if (m_info[1] ) | 143 | if (m_info[1] ) |
146 | fcntl(m_info[1], F_SETFD, FD_CLOEXEC ); | 144 | fcntl(m_info[1], F_SETFD, FD_CLOEXEC ); |
147 | 145 | ||
148 | if (m_comm[0] ) | 146 | if (m_comm[0] ) |
149 | close( m_comm[0] ); | 147 | close( m_comm[0] ); |
150 | /* | 148 | /* |
151 | * now set the communication | 149 | * now set the communication |
152 | * m_fd STDIN_FILENO | 150 | * m_fd STDIN_FILENO |
153 | * STDOUT_FILENO | 151 | * STDOUT_FILENO |
154 | * STDERR_FILENO | 152 | * STDERR_FILENO |
155 | */ | 153 | */ |
156 | dup2( m_fd, STDIN_FILENO ); | 154 | dup2( m_fd, STDIN_FILENO ); |
157 | dup2( m_fd, STDOUT_FILENO ); | 155 | dup2( m_fd, STDOUT_FILENO ); |
158 | dup2( m_comm[1], STDERR_FILENO ); | 156 | dup2( m_comm[1], STDERR_FILENO ); |
159 | } | 157 | } |
160 | 158 | ||
161 | /* | 159 | /* |
162 | * read from the stderr of the child | 160 | * read from the stderr of the child |
163 | * process | 161 | * process |
164 | */ | 162 | */ |
165 | void FileTransfer::slotRead() { | 163 | void FileTransfer::slotRead() { |
166 | QByteArray ar(4096); | 164 | QByteArray ar(4096); |
167 | int len = read(m_comm[0], ar.data(), 4096 ); | 165 | int len = read(m_comm[0], ar.data(), 4096 ); |
168 | for (int i = 0; i < len; i++ ) { | 166 | for (int i = 0; i < len; i++ ) { |
169 | // printf("%c", ar[i] ); | 167 | // printf("%c", ar[i] ); |
170 | } | 168 | } |
171 | ar.resize( len ); | 169 | ar.resize( len ); |
172 | QString str( ar ); | 170 | QString str( ar ); |
173 | QStringList lis = QStringList::split(' ', str ); | 171 | QStringList lis = QStringList::split(' ', str ); |
174 | /* | 172 | /* |
175 | * Transfer finished.. either complete or incomplete | 173 | * Transfer finished.. either complete or incomplete |
176 | */ | 174 | */ |
177 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { | 175 | if ( lis[0].simplifyWhiteSpace() == "Transfer" ) { |
178 | return; | 176 | return; |
179 | } | 177 | } |
180 | /* | 178 | /* |
181 | * do progress reading | 179 | * do progress reading |
182 | */ | 180 | */ |
183 | slotProgress( lis ); | 181 | slotProgress( lis ); |
184 | 182 | ||
185 | 183 | ||
186 | } | 184 | } |
187 | /* | 185 | /* |
188 | * find the progress | 186 | * find the progress |
189 | */ | 187 | */ |
190 | void FileTransfer::slotProgress( const QStringList& list ) { | 188 | void FileTransfer::slotProgress( const QStringList& list ) { |
191 | if ( m_type != SZ ) | 189 | if ( m_type != SZ ) |
192 | return; | 190 | return; |
193 | bool complete = true; | 191 | bool complete = true; |
194 | int min, sec; | 192 | int min, sec; |
195 | int bps; | 193 | int bps; |
196 | unsigned long sent, total; | 194 | unsigned long sent, total; |
197 | 195 | ||
198 | min = sec = bps = -1; | 196 | min = sec = bps = -1; |
199 | sent = total = 0; | 197 | sent = total = 0; |
200 | 198 | ||
201 | // Data looks like this | 199 | // Data looks like this |
202 | // 0 1 2 3 4 5 | 200 | // 0 1 2 3 4 5 |
203 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 | 201 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 |
204 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); | 202 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); |
205 | sent = progi[0].toULong(&complete ); | 203 | sent = progi[0].toULong(&complete ); |
206 | if (!complete ) return; | 204 | if (!complete ) return; |
207 | 205 | ||
208 | total = progi[1].toULong(&complete ); | 206 | total = progi[1].toULong(&complete ); |
209 | if (!complete || total == 0) { | 207 | if (!complete || total == 0) { |
210 | return; | 208 | return; |
211 | } | 209 | } |
212 | 210 | ||
213 | 211 | ||
214 | double pro = (double)sent/total; | 212 | double pro = (double)sent/total; |
215 | int prog = pro * 100; | 213 | int prog = pro * 100; |
216 | 214 | ||
217 | // speed | 215 | // speed |
218 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); | 216 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); |
219 | bps = progi[1].toInt(); | 217 | bps = progi[1].toInt(); |
220 | 218 | ||
221 | // time | 219 | // time |
222 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); | 220 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); |
223 | min = progi[0].toInt(); | 221 | min = progi[0].toInt(); |
224 | sec = progi[1].toInt(); | 222 | sec = progi[1].toInt(); |
225 | 223 | ||
226 | 224 | ||
227 | if ( prog > m_prog ) { | 225 | if ( prog > m_prog ) { |
228 | m_prog = prog; | 226 | m_prog = prog; |
229 | emit progress(m_file, m_prog, bps, -1, min , sec ); | 227 | emit progress(m_file, m_prog, bps, -1, min , sec ); |
230 | } | 228 | } |
231 | 229 | ||
232 | } | 230 | } |
233 | void FileTransfer::cancel() { | 231 | void FileTransfer::cancel() { |
234 | if(m_pid > 0) ::kill(m_pid,9 ); | 232 | if(m_pid > 0) ::kill(m_pid,9 ); |
235 | 233 | ||
236 | } | 234 | } |
237 | void FileTransfer::slotExec() { | 235 | void FileTransfer::slotExec() { |
238 | char buf[2]; | 236 | char buf[2]; |
239 | ::read(m_term[0], buf, 1 ); | 237 | ::read(m_term[0], buf, 1 ); |
240 | delete m_proc; | 238 | delete m_proc; |
241 | delete m_not; | 239 | delete m_not; |
242 | m_proc = m_not = 0l; | 240 | m_proc = m_not = 0l; |
243 | close( m_term[0] ); | 241 | close( m_term[0] ); |
244 | close( m_term[1] ); | 242 | close( m_term[1] ); |
245 | close( m_comm[0] ); | 243 | close( m_comm[0] ); |
246 | close( m_comm[1] ); | 244 | close( m_comm[1] ); |
247 | layer()->closeRawIO( m_fd ); | 245 | layer()->closeRawIO( m_fd ); |
248 | emit sent(); | 246 | emit sent(); |
249 | m_pid = 0; | 247 | m_pid = 0; |
250 | } | 248 | } |
diff --git a/noncore/apps/opie-console/filetransfer.h b/noncore/apps/opie-console/filetransfer.h index 8f55041..3b79cda 100644 --- a/noncore/apps/opie-console/filetransfer.h +++ b/noncore/apps/opie-console/filetransfer.h | |||
@@ -1,48 +1,49 @@ | |||
1 | #ifndef OPIE_FILE_TRANSFER_H | 1 | #ifndef OPIE_FILE_TRANSFER_H |
2 | #define OPIE_FILE_TRANSFER_H | 2 | #define OPIE_FILE_TRANSFER_H |
3 | 3 | ||
4 | #include <sys/types.h> | 4 | #include <sys/types.h> |
5 | 5 | ||
6 | #include <opie2/oprocess.h> | ||
7 | |||
6 | #include <qfile.h> | 8 | #include <qfile.h> |
7 | #include <qstringlist.h> | 9 | #include <qstringlist.h> |
8 | 10 | ||
9 | #include "file_layer.h" | 11 | #include "file_layer.h" |
10 | 12 | ||
11 | class QSocketNotifier; | 13 | class QSocketNotifier; |
12 | class OProcess; | ||
13 | class FileTransferControl; | 14 | class FileTransferControl; |
14 | class FileTransfer : public FileTransferLayer{ | 15 | class FileTransfer : public FileTransferLayer{ |
15 | Q_OBJECT | 16 | Q_OBJECT |
16 | friend class FileTransferControl; | 17 | friend class FileTransferControl; |
17 | public: | 18 | public: |
18 | enum Type { | 19 | enum Type { |
19 | SZ = 0, | 20 | SZ = 0, |
20 | SX, | 21 | SX, |
21 | SY | 22 | SY |
22 | }; | 23 | }; |
23 | FileTransfer( Type t, IOLayer* ); | 24 | FileTransfer( Type t, IOLayer* ); |
24 | ~FileTransfer(); | 25 | ~FileTransfer(); |
25 | 26 | ||
26 | void sendFile( const QString& file ); | 27 | void sendFile( const QString& file ); |
27 | void sendFile( const QFile& ); | 28 | void sendFile( const QFile& ); |
28 | void cancel(); | 29 | void cancel(); |
29 | 30 | ||
30 | private slots: | 31 | private slots: |
31 | void setupChild(); | 32 | void setupChild(); |
32 | void slotRead(); | 33 | void slotRead(); |
33 | void slotProgress( const QStringList& ); | 34 | void slotProgress( const QStringList& ); |
34 | void slotExec(); | 35 | void slotExec(); |
35 | private: | 36 | private: |
36 | Type m_type; | 37 | Type m_type; |
37 | pid_t m_pid; | 38 | pid_t m_pid; |
38 | int m_fd; | 39 | int m_fd; |
39 | int m_prog; | 40 | int m_prog; |
40 | int m_info[2]; | 41 | int m_info[2]; |
41 | int m_comm[2]; | 42 | int m_comm[2]; |
42 | int m_term[2]; | 43 | int m_term[2]; |
43 | QString m_file; | 44 | QString m_file; |
44 | QSocketNotifier *m_not; | 45 | QSocketNotifier *m_not; |
45 | QSocketNotifier* m_proc; | 46 | QSocketNotifier* m_proc; |
46 | }; | 47 | }; |
47 | 48 | ||
48 | #endif | 49 | #endif |
diff --git a/noncore/apps/opie-console/io_bt.h b/noncore/apps/opie-console/io_bt.h index 239eefb..df6dd38 100644 --- a/noncore/apps/opie-console/io_bt.h +++ b/noncore/apps/opie-console/io_bt.h | |||
@@ -1,51 +1,51 @@ | |||
1 | #ifndef OPIE_IO_BT | 1 | #ifndef OPIE_IO_BT |
2 | #define OPIE_IO_BT | 2 | #define OPIE_IO_BT |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie2/oprocess.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | 6 | ||
7 | /* Default values to be used if the profile information is incomplete */ | 7 | /* Default values to be used if the profile information is incomplete */ |
8 | #define BT_DEFAULT_DEVICE "/dev/ttyU0" | 8 | #define BT_DEFAULT_DEVICE "/dev/ttyU0" |
9 | #define BT_DEFAULT_BAUD 9600 | 9 | #define BT_DEFAULT_BAUD 9600 |
10 | #define BT_DEFAULT_PARITY 0 | 10 | #define BT_DEFAULT_PARITY 0 |
11 | #define BT_DEFAULT_DBITS 8 | 11 | #define BT_DEFAULT_DBITS 8 |
12 | #define BT_DEFAULT_SBITS 1 | 12 | #define BT_DEFAULT_SBITS 1 |
13 | #define BT_DEFAULT_FLOW 0 | 13 | #define BT_DEFAULT_FLOW 0 |
14 | #define BT_DEFAULT_MAC 0 | 14 | #define BT_DEFAULT_MAC 0 |
15 | 15 | ||
16 | 16 | ||
17 | /* IOSerial implements a RS232 IO Layer */ | 17 | /* IOSerial implements a RS232 IO Layer */ |
18 | 18 | ||
19 | class IOBt : public IOSerial { | 19 | class IOBt : public IOSerial { |
20 | 20 | ||
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | 22 | ||
23 | public: | 23 | public: |
24 | 24 | ||
25 | IOBt(const Profile &); | 25 | IOBt(const Profile &); |
26 | ~IOBt(); | 26 | ~IOBt(); |
27 | 27 | ||
28 | virtual QString identifier() const; | 28 | virtual QString identifier() const; |
29 | virtual QString name() const; | 29 | virtual QString name() const; |
30 | virtual QBitArray supports() const; | 30 | virtual QBitArray supports() const; |
31 | virtual bool isConnected(); | 31 | virtual bool isConnected(); |
32 | 32 | ||
33 | signals: | 33 | signals: |
34 | void received(const QByteArray &); | 34 | void received(const QByteArray &); |
35 | void error(int, const QString &); | 35 | void error(int, const QString &); |
36 | 36 | ||
37 | public slots: | 37 | public slots: |
38 | virtual void send( const QByteArray& ); | 38 | virtual void send( const QByteArray& ); |
39 | virtual bool open(); | 39 | virtual bool open(); |
40 | virtual void close(); | 40 | virtual void close(); |
41 | virtual void reload(const Profile &); | 41 | virtual void reload(const Profile &); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | OProcess *m_attach; | 44 | OProcess *m_attach; |
45 | QString m_mac; | 45 | QString m_mac; |
46 | private slots: | 46 | private slots: |
47 | void slotExited(OProcess* proc); | 47 | void slotExited(OProcess* proc); |
48 | 48 | ||
49 | }; | 49 | }; |
50 | 50 | ||
51 | #endif /* OPIE_IO_IRDA */ | 51 | #endif /* OPIE_IO_IRDA */ |
diff --git a/noncore/apps/opie-console/io_irda.h b/noncore/apps/opie-console/io_irda.h index 14b1ae3..69bed7d 100644 --- a/noncore/apps/opie-console/io_irda.h +++ b/noncore/apps/opie-console/io_irda.h | |||
@@ -1,49 +1,49 @@ | |||
1 | #ifndef OPIE_IO_IRDA | 1 | #ifndef OPIE_IO_IRDA |
2 | #define OPIE_IO_IRDA | 2 | #define OPIE_IO_IRDA |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie2/oprocess.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | 6 | ||
7 | /* Default values to be used if the profile information is incomplete */ | 7 | /* Default values to be used if the profile information is incomplete */ |
8 | #define IRDA_DEFAULT_DEVICE "/dev/ircomm0" | 8 | #define IRDA_DEFAULT_DEVICE "/dev/ircomm0" |
9 | #define IRDA_DEFAULT_BAUD 9600 | 9 | #define IRDA_DEFAULT_BAUD 9600 |
10 | #define IRDA_DEFAULT_PARITY 0 | 10 | #define IRDA_DEFAULT_PARITY 0 |
11 | #define IRDA_DEFAULT_DBITS 8 | 11 | #define IRDA_DEFAULT_DBITS 8 |
12 | #define IRDA_DEFAULT_SBITS 1 | 12 | #define IRDA_DEFAULT_SBITS 1 |
13 | #define IRDA_DEFAULT_FLOW 0 | 13 | #define IRDA_DEFAULT_FLOW 0 |
14 | 14 | ||
15 | /* IOSerial implements a RS232 IO Layer */ | 15 | /* IOSerial implements a RS232 IO Layer */ |
16 | 16 | ||
17 | class IOIrda : public IOSerial { | 17 | class IOIrda : public IOSerial { |
18 | 18 | ||
19 | Q_OBJECT | 19 | Q_OBJECT |
20 | 20 | ||
21 | public: | 21 | public: |
22 | 22 | ||
23 | IOIrda(const Profile &); | 23 | IOIrda(const Profile &); |
24 | ~IOIrda(); | 24 | ~IOIrda(); |
25 | 25 | ||
26 | virtual QString identifier() const; | 26 | virtual QString identifier() const; |
27 | virtual QString name() const; | 27 | virtual QString name() const; |
28 | virtual QBitArray supports() const; | 28 | virtual QBitArray supports() const; |
29 | virtual bool isConnected(); | 29 | virtual bool isConnected(); |
30 | 30 | ||
31 | signals: | 31 | signals: |
32 | void received(const QByteArray &); | 32 | void received(const QByteArray &); |
33 | void error(int, const QString &); | 33 | void error(int, const QString &); |
34 | 34 | ||
35 | public slots: | 35 | public slots: |
36 | virtual void send( const QByteArray& ); | 36 | virtual void send( const QByteArray& ); |
37 | virtual bool open(); | 37 | virtual bool open(); |
38 | virtual void close(); | 38 | virtual void close(); |
39 | virtual void reload(const Profile &); | 39 | virtual void reload(const Profile &); |
40 | 40 | ||
41 | private: | 41 | private: |
42 | OProcess *m_attach; | 42 | OProcess *m_attach; |
43 | 43 | ||
44 | private slots: | 44 | private slots: |
45 | void slotExited(OProcess* proc); | 45 | void slotExited(OProcess* proc); |
46 | 46 | ||
47 | }; | 47 | }; |
48 | 48 | ||
49 | #endif /* OPIE_IO_IRDA */ | 49 | #endif /* OPIE_IO_IRDA */ |
diff --git a/noncore/apps/opie-console/io_modem.h b/noncore/apps/opie-console/io_modem.h index 2a926df..96ec3ef 100644 --- a/noncore/apps/opie-console/io_modem.h +++ b/noncore/apps/opie-console/io_modem.h | |||
@@ -1,74 +1,74 @@ | |||
1 | #ifndef OPIE_IO_MODEM | 1 | #ifndef OPIE_IO_MODEM |
2 | #define OPIE_IO_MODEM | 2 | #define OPIE_IO_MODEM |
3 | 3 | ||
4 | #include <opie/oprocess.h> | 4 | #include <opie2/oprocess.h> |
5 | #include "io_serial.h" | 5 | #include "io_serial.h" |
6 | #include "profile.h" | 6 | #include "profile.h" |
7 | 7 | ||
8 | /* Default values to be used if the profile information is incomplete */ | 8 | /* Default values to be used if the profile information is incomplete */ |
9 | #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" | 9 | #define MODEM_DEFAULT_DEVICE "/dev/ttyS0" |
10 | #define MODEM_DEFAULT_BAUD 9600 | 10 | #define MODEM_DEFAULT_BAUD 9600 |
11 | #define MODEM_DEFAULT_PARITY 0 | 11 | #define MODEM_DEFAULT_PARITY 0 |
12 | #define MODEM_DEFAULT_DBITS 8 | 12 | #define MODEM_DEFAULT_DBITS 8 |
13 | #define MODEM_DEFAULT_SBITS 1 | 13 | #define MODEM_DEFAULT_SBITS 1 |
14 | #define MODEM_DEFAULT_FLOW 0 | 14 | #define MODEM_DEFAULT_FLOW 0 |
15 | 15 | ||
16 | #define MODEM_DEFAULT_INIT_STRING "AT" | 16 | #define MODEM_DEFAULT_INIT_STRING "AT" |
17 | #define MODEM_DEFAULT_RESET_STRING "ATZ~" | 17 | #define MODEM_DEFAULT_RESET_STRING "ATZ~" |
18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" | 18 | #define MODEM_DEFAULT_DIAL_PREFIX1 "ATDT" |
19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "" | 19 | #define MODEM_DEFAULT_DIAL_SUFFIX1 "" |
20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "" | 20 | #define MODEM_DEFAULT_DIAL_PREFIX2 "" |
21 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "" | 21 | #define MODEM_DEFAULT_DIAL_SUFFIX2 "" |
22 | #define MODEM_DEFAULT_DIAL_PREFIX3 "" | 22 | #define MODEM_DEFAULT_DIAL_PREFIX3 "" |
23 | #define MODEM_DEFAULT_DIAL_SUFFIX3 "" | 23 | #define MODEM_DEFAULT_DIAL_SUFFIX3 "" |
24 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" | 24 | #define MODEM_DEFAULT_CONNECT_STRING "CONNECT" |
25 | #define MODEM_DEFAULT_HANGUP_STRING "+++ATH" | 25 | #define MODEM_DEFAULT_HANGUP_STRING "+++ATH" |
26 | #define MODEM_DEFAULT_CANCEL_STRING "" | 26 | #define MODEM_DEFAULT_CANCEL_STRING "" |
27 | #define MODEM_DEFAULT_DIAL_TIME 45 | 27 | #define MODEM_DEFAULT_DIAL_TIME 45 |
28 | #define MODEM_DEFAULT_DELAY_REDIAL 2 | 28 | #define MODEM_DEFAULT_DELAY_REDIAL 2 |
29 | #define MODEM_DEFAULT_NUMBER_TRIES 10 | 29 | #define MODEM_DEFAULT_NUMBER_TRIES 10 |
30 | #define MODEM_DEFAULT_DTR_DROP_TIME 1 | 30 | #define MODEM_DEFAULT_DTR_DROP_TIME 1 |
31 | #define MODEM_DEFAULT_BPS_DETECT 0 // bool | 31 | #define MODEM_DEFAULT_BPS_DETECT 0 // bool |
32 | #define MODEM_DEFAULT_DCD_LINES 1 //bool | 32 | #define MODEM_DEFAULT_DCD_LINES 1 //bool |
33 | #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool | 33 | #define MODEM_DEFAULT_MULTI_LINE_UNTAG 0 // bool |
34 | 34 | ||
35 | /* IOSerial implements a RS232 IO Layer */ | 35 | /* IOSerial implements a RS232 IO Layer */ |
36 | 36 | ||
37 | class IOModem : public IOSerial { | 37 | class IOModem : public IOSerial { |
38 | 38 | ||
39 | Q_OBJECT | 39 | Q_OBJECT |
40 | 40 | ||
41 | public: | 41 | public: |
42 | 42 | ||
43 | IOModem(const Profile &); | 43 | IOModem(const Profile &); |
44 | ~IOModem(); | 44 | ~IOModem(); |
45 | 45 | ||
46 | virtual QString identifier() const; | 46 | virtual QString identifier() const; |
47 | virtual QString name() const; | 47 | virtual QString name() const; |
48 | virtual QBitArray supports() const; | 48 | virtual QBitArray supports() const; |
49 | virtual bool isConnected(); | 49 | virtual bool isConnected(); |
50 | 50 | ||
51 | signals: | 51 | signals: |
52 | void received(const QByteArray &); | 52 | void received(const QByteArray &); |
53 | void error(int, const QString &); | 53 | void error(int, const QString &); |
54 | 54 | ||
55 | public slots: | 55 | public slots: |
56 | virtual void send( const QByteArray& ); | 56 | virtual void send( const QByteArray& ); |
57 | virtual bool open(); | 57 | virtual bool open(); |
58 | virtual void close(); | 58 | virtual void close(); |
59 | virtual void reload(const Profile &); | 59 | virtual void reload(const Profile &); |
60 | 60 | ||
61 | private: | 61 | private: |
62 | 62 | ||
63 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, | 63 | QString m_initString, m_resetString, m_dialPref1, m_dialSuf1, m_dialPref2, |
64 | m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; | 64 | m_dialSuf2, m_dialPref3, m_dialSuf3, m_connect, m_hangup, m_cancel; |
65 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, | 65 | int m_dialTime, m_delayRedial, m_numberTries, m_dtrDropTime, |
66 | m_bpsDetect, m_dcdLines, m_multiLineUntag; | 66 | m_bpsDetect, m_dcdLines, m_multiLineUntag; |
67 | Profile m_profile; | 67 | Profile m_profile; |
68 | 68 | ||
69 | private slots: | 69 | private slots: |
70 | void slotExited(OProcess* proc); | 70 | void slotExited(OProcess* proc); |
71 | 71 | ||
72 | }; | 72 | }; |
73 | 73 | ||
74 | #endif | 74 | #endif |
diff --git a/noncore/apps/opie-console/mainwindow.cpp b/noncore/apps/opie-console/mainwindow.cpp index 3fe9040..0a475d8 100644 --- a/noncore/apps/opie-console/mainwindow.cpp +++ b/noncore/apps/opie-console/mainwindow.cpp | |||
@@ -1,728 +1,728 @@ | |||
1 | #include <assert.h> | 1 | #include <assert.h> |
2 | 2 | ||
3 | #include <qaction.h> | 3 | #include <qaction.h> |
4 | #include <qmenubar.h> | 4 | #include <qmenubar.h> |
5 | #include <qtoolbar.h> | 5 | #include <qtoolbar.h> |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qwhatsthis.h> | 7 | #include <qwhatsthis.h> |
8 | #include <qfileinfo.h> | 8 | #include <qfileinfo.h> |
9 | 9 | ||
10 | #include <qpe/filemanager.h> | 10 | #include <qpe/filemanager.h> |
11 | #include <qpe/qpeapplication.h> | 11 | #include <qpe/qpeapplication.h> |
12 | 12 | ||
13 | #include <opie/ofiledialog.h> | 13 | #include <opie2/ofiledialog.h> |
14 | 14 | ||
15 | #include "TEmulation.h" | 15 | #include "TEmulation.h" |
16 | #include "profileeditordialog.h" | 16 | #include "profileeditordialog.h" |
17 | #include "configdialog.h" | 17 | #include "configdialog.h" |
18 | #include "default.h" | 18 | #include "default.h" |
19 | #include "profilemanager.h" | 19 | #include "profilemanager.h" |
20 | #include "mainwindow.h" | 20 | #include "mainwindow.h" |
21 | #include "tabwidget.h" | 21 | #include "tabwidget.h" |
22 | #include "transferdialog.h" | 22 | #include "transferdialog.h" |
23 | #include "function_keyboard.h" | 23 | #include "function_keyboard.h" |
24 | #include "emulation_handler.h" | 24 | #include "emulation_handler.h" |
25 | #include "script.h" | 25 | #include "script.h" |
26 | 26 | ||
27 | 27 | ||
28 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { | 28 | MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) { |
29 | KeyTrans::loadAll(); | 29 | KeyTrans::loadAll(); |
30 | for (int i = 0; i < KeyTrans::count(); i++ ) { | 30 | for (int i = 0; i < KeyTrans::count(); i++ ) { |
31 | KeyTrans* s = KeyTrans::find(i ); | 31 | KeyTrans* s = KeyTrans::find(i ); |
32 | assert( s ); | 32 | assert( s ); |
33 | } | 33 | } |
34 | m_factory = new MetaFactory(); | 34 | m_factory = new MetaFactory(); |
35 | Default def(m_factory); | 35 | Default def(m_factory); |
36 | m_sessions.setAutoDelete( TRUE ); | 36 | m_sessions.setAutoDelete( TRUE ); |
37 | m_curSession = 0; | 37 | m_curSession = 0; |
38 | m_manager = new ProfileManager( m_factory ); | 38 | m_manager = new ProfileManager( m_factory ); |
39 | m_manager->load(); | 39 | m_manager->load(); |
40 | m_scriptsData.setAutoDelete(TRUE); | 40 | m_scriptsData.setAutoDelete(TRUE); |
41 | 41 | ||
42 | initUI(); | 42 | initUI(); |
43 | populateProfiles(); | 43 | populateProfiles(); |
44 | populateScripts(); | 44 | populateScripts(); |
45 | } | 45 | } |
46 | 46 | ||
47 | void MainWindow::initUI() { | 47 | void MainWindow::initUI() { |
48 | 48 | ||
49 | setToolBarsMovable( FALSE ); | 49 | setToolBarsMovable( FALSE ); |
50 | 50 | ||
51 | /* tool bar for the menu */ | 51 | /* tool bar for the menu */ |
52 | m_tool = new QToolBar( this ); | 52 | m_tool = new QToolBar( this ); |
53 | m_tool->setHorizontalStretchable( TRUE ); | 53 | m_tool->setHorizontalStretchable( TRUE ); |
54 | 54 | ||
55 | m_bar = new QMenuBar( m_tool ); | 55 | m_bar = new QMenuBar( m_tool ); |
56 | m_console = new QPopupMenu( this ); | 56 | m_console = new QPopupMenu( this ); |
57 | m_scripts = new QPopupMenu( this ); | 57 | m_scripts = new QPopupMenu( this ); |
58 | m_sessionsPop= new QPopupMenu( this ); | 58 | m_sessionsPop= new QPopupMenu( this ); |
59 | m_scriptsPop = new QPopupMenu( this ); | 59 | m_scriptsPop = new QPopupMenu( this ); |
60 | 60 | ||
61 | /* add a toolbar for icons */ | 61 | /* add a toolbar for icons */ |
62 | m_icons = new QToolBar(this); | 62 | m_icons = new QToolBar(this); |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * the settings action | 65 | * the settings action |
66 | */ | 66 | */ |
67 | m_setProfiles = new QAction(tr("Configure Profiles"), | 67 | m_setProfiles = new QAction(tr("Configure Profiles"), |
68 | Resource::loadPixmap( "SettingsIcon" ), | 68 | Resource::loadPixmap( "SettingsIcon" ), |
69 | QString::null, 0, this, 0); | 69 | QString::null, 0, this, 0); |
70 | m_setProfiles->addTo( m_console ); | 70 | m_setProfiles->addTo( m_console ); |
71 | connect( m_setProfiles, SIGNAL(activated() ), | 71 | connect( m_setProfiles, SIGNAL(activated() ), |
72 | this, SLOT(slotConfigure() ) ); | 72 | this, SLOT(slotConfigure() ) ); |
73 | 73 | ||
74 | m_console->insertSeparator(); | 74 | m_console->insertSeparator(); |
75 | /* | 75 | /* |
76 | * new Action for new sessions | 76 | * new Action for new sessions |
77 | */ | 77 | */ |
78 | QAction* newCon = new QAction(tr("New Profile"), | 78 | QAction* newCon = new QAction(tr("New Profile"), |
79 | Resource::loadPixmap( "new" ), | 79 | Resource::loadPixmap( "new" ), |
80 | QString::null, 0, this, 0); | 80 | QString::null, 0, this, 0); |
81 | newCon->addTo( m_console ); | 81 | newCon->addTo( m_console ); |
82 | connect( newCon, SIGNAL(activated() ), | 82 | connect( newCon, SIGNAL(activated() ), |
83 | this, SLOT(slotNew() ) ); | 83 | this, SLOT(slotNew() ) ); |
84 | 84 | ||
85 | m_console->insertSeparator(); | 85 | m_console->insertSeparator(); |
86 | 86 | ||
87 | QAction *saveCon = new QAction( tr("Save Profile" ), | 87 | QAction *saveCon = new QAction( tr("Save Profile" ), |
88 | Resource::loadPixmap( "save" ), QString::null, | 88 | Resource::loadPixmap( "save" ), QString::null, |
89 | 0, this, 0 ); | 89 | 0, this, 0 ); |
90 | saveCon->addTo( m_console ); | 90 | saveCon->addTo( m_console ); |
91 | connect( saveCon, SIGNAL(activated() ), | 91 | connect( saveCon, SIGNAL(activated() ), |
92 | this, SLOT(slotSaveSession() ) ); | 92 | this, SLOT(slotSaveSession() ) ); |
93 | m_console->insertSeparator(); | 93 | m_console->insertSeparator(); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * connect action | 96 | * connect action |
97 | */ | 97 | */ |
98 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), | 98 | m_connect = new QAction( tr("Connect"), Resource::loadPixmap("console/connected"), |
99 | QString::null, 0, this, 0 ); | 99 | QString::null, 0, this, 0 ); |
100 | m_connect->addTo( m_console ); | 100 | m_connect->addTo( m_console ); |
101 | connect(m_connect, SIGNAL(activated() ), | 101 | connect(m_connect, SIGNAL(activated() ), |
102 | this, SLOT(slotConnect() ) ); | 102 | this, SLOT(slotConnect() ) ); |
103 | 103 | ||
104 | /* | 104 | /* |
105 | * disconnect action | 105 | * disconnect action |
106 | */ | 106 | */ |
107 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), | 107 | m_disconnect = new QAction( tr("Disconnect"), Resource::loadPixmap("console/notconnected"), |
108 | QString::null, 0, this, 0 ); | 108 | QString::null, 0, this, 0 ); |
109 | m_disconnect->addTo( m_console ); | 109 | m_disconnect->addTo( m_console ); |
110 | connect(m_disconnect, SIGNAL(activated() ), | 110 | connect(m_disconnect, SIGNAL(activated() ), |
111 | this, SLOT(slotDisconnect() ) ); | 111 | this, SLOT(slotDisconnect() ) ); |
112 | 112 | ||
113 | m_console->insertSeparator(); | 113 | m_console->insertSeparator(); |
114 | 114 | ||
115 | 115 | ||
116 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); | 116 | m_quickLaunch = new QAction( tr("QuickLaunch"), Resource::loadPixmap("console/konsole_mini"), QString::null, 0, this, 0 ); |
117 | m_quickLaunch->addTo( m_icons ); | 117 | m_quickLaunch->addTo( m_icons ); |
118 | connect( m_quickLaunch, SIGNAL( activated() ), | 118 | connect( m_quickLaunch, SIGNAL( activated() ), |
119 | this, SLOT( slotQuickLaunch() ) ); | 119 | this, SLOT( slotQuickLaunch() ) ); |
120 | 120 | ||
121 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); | 121 | QWhatsThis::add( m_icons, tr( "The shell button launches the \"default\" profile. If there is none default values are taken" ) ); |
122 | 122 | ||
123 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, | 123 | m_transfer = new QAction( tr("Transfer file..."), Resource::loadPixmap("pass") , QString::null, |
124 | 0, this, 0 ); | 124 | 0, this, 0 ); |
125 | m_transfer->addTo( m_console ); | 125 | m_transfer->addTo( m_console ); |
126 | connect(m_transfer, SIGNAL(activated() ), | 126 | connect(m_transfer, SIGNAL(activated() ), |
127 | this, SLOT(slotTransfer() ) ); | 127 | this, SLOT(slotTransfer() ) ); |
128 | 128 | ||
129 | 129 | ||
130 | 130 | ||
131 | /* | 131 | /* |
132 | * immediate change of line wrap policy | 132 | * immediate change of line wrap policy |
133 | */ | 133 | */ |
134 | m_isWrapped = false; | 134 | m_isWrapped = false; |
135 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); | 135 | m_wrap = new QAction( tr("Line wrap"), Resource::loadPixmap( "linewrap" ), QString::null, 0, this, 0 ); |
136 | m_wrap->addTo( m_console ); | 136 | m_wrap->addTo( m_console ); |
137 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); | 137 | connect( m_wrap, SIGNAL( activated() ), SLOT( slotWrap() ) ); |
138 | 138 | ||
139 | /* | 139 | /* |
140 | * fullscreen | 140 | * fullscreen |
141 | */ | 141 | */ |
142 | m_isFullscreen = false; | 142 | m_isFullscreen = false; |
143 | 143 | ||
144 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) | 144 | m_fullscreen = new QAction( tr("Full screen"), Resource::loadPixmap( "fullscreen" ) |
145 | , QString::null, 0, this, 0); | 145 | , QString::null, 0, this, 0); |
146 | m_fullscreen->addTo( m_console ); | 146 | m_fullscreen->addTo( m_console ); |
147 | connect( m_fullscreen, SIGNAL( activated() ), | 147 | connect( m_fullscreen, SIGNAL( activated() ), |
148 | this, SLOT( slotFullscreen() ) ); | 148 | this, SLOT( slotFullscreen() ) ); |
149 | 149 | ||
150 | m_console->insertSeparator(); | 150 | m_console->insertSeparator(); |
151 | 151 | ||
152 | QAction *a = new QAction(); | 152 | QAction *a = new QAction(); |
153 | a->setText( tr("Save history") ); | 153 | a->setText( tr("Save history") ); |
154 | a->addTo( m_console ); | 154 | a->addTo( m_console ); |
155 | connect(a, SIGNAL(activated() ), | 155 | connect(a, SIGNAL(activated() ), |
156 | this, SLOT(slotSaveHistory() ) ); | 156 | this, SLOT(slotSaveHistory() ) ); |
157 | /* | 157 | /* |
158 | * terminate action | 158 | * terminate action |
159 | */ | 159 | */ |
160 | m_terminate = new QAction(); | 160 | m_terminate = new QAction(); |
161 | m_terminate->setText( tr("Terminate") ); | 161 | m_terminate->setText( tr("Terminate") ); |
162 | m_terminate->addTo( m_console ); | 162 | m_terminate->addTo( m_console ); |
163 | connect(m_terminate, SIGNAL(activated() ), | 163 | connect(m_terminate, SIGNAL(activated() ), |
164 | this, SLOT(slotTerminate() ) ); | 164 | this, SLOT(slotTerminate() ) ); |
165 | 165 | ||
166 | m_closewindow = new QAction(); | 166 | m_closewindow = new QAction(); |
167 | m_closewindow->setText( tr("Close Window") ); | 167 | m_closewindow->setText( tr("Close Window") ); |
168 | m_closewindow->addTo( m_console ); | 168 | m_closewindow->addTo( m_console ); |
169 | connect( m_closewindow, SIGNAL(activated() ), | 169 | connect( m_closewindow, SIGNAL(activated() ), |
170 | this, SLOT(slotClose() ) ); | 170 | this, SLOT(slotClose() ) ); |
171 | 171 | ||
172 | 172 | ||
173 | /* | 173 | /* |
174 | * script actions | 174 | * script actions |
175 | */ | 175 | */ |
176 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); | 176 | m_runScript_id = m_scripts->insertItem(tr("Run Script"), m_scriptsPop, -1, 0); |
177 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); | 177 | connect(m_scriptsPop, SIGNAL(activated(int)), this, SLOT(slotRunScript(int))); |
178 | 178 | ||
179 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); | 179 | m_recordScript = new QAction(tr("Record Script"), QString::null, 0, this, 0); |
180 | m_recordScript->addTo(m_scripts); | 180 | m_recordScript->addTo(m_scripts); |
181 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); | 181 | connect(m_recordScript, SIGNAL(activated()), this, SLOT(slotRecordScript())); |
182 | 182 | ||
183 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); | 183 | m_saveScript = new QAction(tr("Save Script"), QString::null, 0, this, 0); |
184 | m_saveScript->addTo(m_scripts); | 184 | m_saveScript->addTo(m_scripts); |
185 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); | 185 | connect(m_saveScript, SIGNAL(activated()), this, SLOT(slotSaveScript())); |
186 | 186 | ||
187 | 187 | ||
188 | /* | 188 | /* |
189 | * action that open/closes the keyboard | 189 | * action that open/closes the keyboard |
190 | */ | 190 | */ |
191 | m_openKeys = new QAction (tr("Open Keyboard..."), | 191 | m_openKeys = new QAction (tr("Open Keyboard..."), |
192 | Resource::loadPixmap( "console/keys/keyboard_icon" ), | 192 | Resource::loadPixmap( "console/keys/keyboard_icon" ), |
193 | QString::null, 0, this, 0); | 193 | QString::null, 0, this, 0); |
194 | m_openKeys->setToggleAction(true); | 194 | m_openKeys->setToggleAction(true); |
195 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); | 195 | connect (m_openKeys, SIGNAL(toggled(bool)), this, SLOT(slotOpenKeb(bool))); |
196 | 196 | ||
197 | /* insert the submenu */ | 197 | /* insert the submenu */ |
198 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, | 198 | m_console->insertItem(tr("New from Profile"), m_sessionsPop, |
199 | -1, 0); | 199 | -1, 0); |
200 | 200 | ||
201 | /* insert the connection menu */ | 201 | /* insert the connection menu */ |
202 | m_bar->insertItem( tr("Connection"), m_console ); | 202 | m_bar->insertItem( tr("Connection"), m_console ); |
203 | 203 | ||
204 | /* the scripts menu */ | 204 | /* the scripts menu */ |
205 | m_bar->insertItem( tr("Scripts"), m_scripts ); | 205 | m_bar->insertItem( tr("Scripts"), m_scripts ); |
206 | 206 | ||
207 | /* and the keyboard */ | 207 | /* and the keyboard */ |
208 | m_keyBar = new QToolBar(this); | 208 | m_keyBar = new QToolBar(this); |
209 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); | 209 | addToolBar( m_keyBar, "Keyboard", QMainWindow::Top, TRUE ); |
210 | m_keyBar->setHorizontalStretchable( TRUE ); | 210 | m_keyBar->setHorizontalStretchable( TRUE ); |
211 | m_keyBar->hide(); | 211 | m_keyBar->hide(); |
212 | 212 | ||
213 | m_kb = new FunctionKeyboard(m_keyBar); | 213 | m_kb = new FunctionKeyboard(m_keyBar); |
214 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), | 214 | connect(m_kb, SIGNAL(keyPressed(FKey, ushort, ushort, bool)), |
215 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); | 215 | this, SLOT(slotKeyReceived(FKey, ushort, ushort, bool))); |
216 | 216 | ||
217 | 217 | ||
218 | a = new QAction(tr("Copy"), | 218 | a = new QAction(tr("Copy"), |
219 | Resource::loadPixmap("copy"), QString::null, | 219 | Resource::loadPixmap("copy"), QString::null, |
220 | 0, this, 0 ); | 220 | 0, this, 0 ); |
221 | //a->addTo( m_icons ); | 221 | //a->addTo( m_icons ); |
222 | connect( a, SIGNAL(activated() ), | 222 | connect( a, SIGNAL(activated() ), |
223 | this, SLOT(slotCopy() ) ); | 223 | this, SLOT(slotCopy() ) ); |
224 | 224 | ||
225 | QAction *paste = new QAction(tr("Paste"), | 225 | QAction *paste = new QAction(tr("Paste"), |
226 | Resource::loadPixmap("paste"), QString::null, | 226 | Resource::loadPixmap("paste"), QString::null, |
227 | 0, this, 0 ); | 227 | 0, this, 0 ); |
228 | connect( paste, SIGNAL(activated() ), | 228 | connect( paste, SIGNAL(activated() ), |
229 | this, SLOT(slotPaste() ) ); | 229 | this, SLOT(slotPaste() ) ); |
230 | 230 | ||
231 | 231 | ||
232 | newCon->addTo( m_icons ); | 232 | newCon->addTo( m_icons ); |
233 | //m_setProfiles->addTo( m_icons ); | 233 | //m_setProfiles->addTo( m_icons ); |
234 | paste->addTo( m_icons ); | 234 | paste->addTo( m_icons ); |
235 | m_openKeys->addTo(m_icons); | 235 | m_openKeys->addTo(m_icons); |
236 | m_fullscreen->addTo( m_icons ); | 236 | m_fullscreen->addTo( m_icons ); |
237 | 237 | ||
238 | m_connect->setEnabled( false ); | 238 | m_connect->setEnabled( false ); |
239 | m_disconnect->setEnabled( false ); | 239 | m_disconnect->setEnabled( false ); |
240 | m_terminate->setEnabled( false ); | 240 | m_terminate->setEnabled( false ); |
241 | m_transfer->setEnabled( false ); | 241 | m_transfer->setEnabled( false ); |
242 | m_scripts->setItemEnabled(m_runScript_id, false); | 242 | m_scripts->setItemEnabled(m_runScript_id, false); |
243 | m_recordScript->setEnabled( false ); | 243 | m_recordScript->setEnabled( false ); |
244 | m_saveScript->setEnabled( false ); | 244 | m_saveScript->setEnabled( false ); |
245 | m_fullscreen->setEnabled( false ); | 245 | m_fullscreen->setEnabled( false ); |
246 | m_closewindow->setEnabled( false ); | 246 | m_closewindow->setEnabled( false ); |
247 | m_wrap->setEnabled( false ); | 247 | m_wrap->setEnabled( false ); |
248 | 248 | ||
249 | /* | 249 | /* |
250 | * connect to the menu activation | 250 | * connect to the menu activation |
251 | */ | 251 | */ |
252 | connect( m_sessionsPop, SIGNAL(activated( int ) ), | 252 | connect( m_sessionsPop, SIGNAL(activated( int ) ), |
253 | this, SLOT(slotProfile( int ) ) ); | 253 | this, SLOT(slotProfile( int ) ) ); |
254 | 254 | ||
255 | m_consoleWindow = new TabWidget( this, "blah"); | 255 | m_consoleWindow = new TabWidget( this, "blah"); |
256 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), | 256 | connect(m_consoleWindow, SIGNAL(activated(Session*) ), |
257 | this, SLOT(slotSessionChanged(Session*) ) ); | 257 | this, SLOT(slotSessionChanged(Session*) ) ); |
258 | setCentralWidget( m_consoleWindow ); | 258 | setCentralWidget( m_consoleWindow ); |
259 | 259 | ||
260 | slotQuickLaunch(); | 260 | slotQuickLaunch(); |
261 | } | 261 | } |
262 | 262 | ||
263 | ProfileManager* MainWindow::manager() { | 263 | ProfileManager* MainWindow::manager() { |
264 | return m_manager; | 264 | return m_manager; |
265 | } | 265 | } |
266 | TabWidget* MainWindow::tabWidget() { | 266 | TabWidget* MainWindow::tabWidget() { |
267 | return m_consoleWindow; | 267 | return m_consoleWindow; |
268 | } | 268 | } |
269 | void MainWindow::populateProfiles() { | 269 | void MainWindow::populateProfiles() { |
270 | m_sessionsPop->clear(); | 270 | m_sessionsPop->clear(); |
271 | Profile::ValueList list = manager()->all(); | 271 | Profile::ValueList list = manager()->all(); |
272 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { | 272 | for (Profile::ValueList::Iterator it = list.begin(); it != list.end(); ++it ) { |
273 | m_sessionsPop->insertItem( (*it).name() ); | 273 | m_sessionsPop->insertItem( (*it).name() ); |
274 | } | 274 | } |
275 | 275 | ||
276 | } | 276 | } |
277 | 277 | ||
278 | void MainWindow::populateScripts() { | 278 | void MainWindow::populateScripts() { |
279 | m_scriptsPop->clear(); | 279 | m_scriptsPop->clear(); |
280 | m_scriptsData.clear(); | 280 | m_scriptsData.clear(); |
281 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); | 281 | DocLnkSet files(QPEApplication::documentDir(), "text/plain"); |
282 | QListIterator<DocLnk> dit(files.children()); | 282 | QListIterator<DocLnk> dit(files.children()); |
283 | for (; dit.current(); ++dit) { | 283 | for (; dit.current(); ++dit) { |
284 | if (*dit && (*dit)->name().length()>0) { | 284 | if (*dit && (*dit)->name().length()>0) { |
285 | QFileInfo info((*dit)->file()); | 285 | QFileInfo info((*dit)->file()); |
286 | if (info.extension(false) == "script") { | 286 | if (info.extension(false) == "script") { |
287 | m_scriptsData.append(new DocLnk(**dit)); | 287 | m_scriptsData.append(new DocLnk(**dit)); |
288 | m_scriptsPop->insertItem((*dit)->name()); | 288 | m_scriptsPop->insertItem((*dit)->name()); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | } | 293 | } |
294 | 294 | ||
295 | MainWindow::~MainWindow() { | 295 | MainWindow::~MainWindow() { |
296 | delete m_factory; | 296 | delete m_factory; |
297 | manager()->save(); | 297 | manager()->save(); |
298 | } | 298 | } |
299 | 299 | ||
300 | MetaFactory* MainWindow::factory() { | 300 | MetaFactory* MainWindow::factory() { |
301 | return m_factory; | 301 | return m_factory; |
302 | } | 302 | } |
303 | 303 | ||
304 | Session* MainWindow::currentSession() { | 304 | Session* MainWindow::currentSession() { |
305 | return m_curSession; | 305 | return m_curSession; |
306 | } | 306 | } |
307 | 307 | ||
308 | QList<Session> MainWindow::sessions() { | 308 | QList<Session> MainWindow::sessions() { |
309 | return m_sessions; | 309 | return m_sessions; |
310 | } | 310 | } |
311 | 311 | ||
312 | void MainWindow::slotNew() { | 312 | void MainWindow::slotNew() { |
313 | ProfileEditorDialog dlg(factory() ); | 313 | ProfileEditorDialog dlg(factory() ); |
314 | dlg.setCaption( tr("New Connection") ); | 314 | dlg.setCaption( tr("New Connection") ); |
315 | int ret = QPEApplication::execDialog( &dlg ); | 315 | int ret = QPEApplication::execDialog( &dlg ); |
316 | 316 | ||
317 | if ( ret == QDialog::Accepted ) { | 317 | if ( ret == QDialog::Accepted ) { |
318 | create( dlg.profile() ); | 318 | create( dlg.profile() ); |
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
322 | void MainWindow::slotRecordScript() { | 322 | void MainWindow::slotRecordScript() { |
323 | if (currentSession()) { | 323 | if (currentSession()) { |
324 | currentSession()->emulationHandler()->startRecording(); | 324 | currentSession()->emulationHandler()->startRecording(); |
325 | m_saveScript->setEnabled(true); | 325 | m_saveScript->setEnabled(true); |
326 | m_recordScript->setEnabled(false); | 326 | m_recordScript->setEnabled(false); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | 329 | ||
330 | void MainWindow::slotSaveScript() { | 330 | void MainWindow::slotSaveScript() { |
331 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { | 331 | if (currentSession() && currentSession()->emulationHandler()->isRecording()) { |
332 | QMap<QString, QStringList> map; | 332 | QMap<QString, QStringList> map; |
333 | QStringList text; | 333 | QStringList text; |
334 | text << "text/plain"; | 334 | text << "text/plain"; |
335 | map.insert(tr("Script"), text ); | 335 | map.insert(tr("Script"), text ); |
336 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 336 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
337 | if (!filename.isEmpty()) { | 337 | if (!filename.isEmpty()) { |
338 | QFileInfo info(filename); | 338 | QFileInfo info(filename); |
339 | if (info.extension(FALSE) != "script") | 339 | if (info.extension(FALSE) != "script") |
340 | filename += ".script"; | 340 | filename += ".script"; |
341 | DocLnk nf; | 341 | DocLnk nf; |
342 | nf.setType("text/plain"); | 342 | nf.setType("text/plain"); |
343 | nf.setFile(filename); | 343 | nf.setFile(filename); |
344 | nf.setName(info.fileName()); | 344 | nf.setName(info.fileName()); |
345 | FileManager fm; | 345 | FileManager fm; |
346 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); | 346 | fm.saveFile(nf, currentSession()->emulationHandler()->script()->script()); |
347 | currentSession()->emulationHandler()->clearScript(); | 347 | currentSession()->emulationHandler()->clearScript(); |
348 | m_saveScript->setEnabled(false); | 348 | m_saveScript->setEnabled(false); |
349 | m_recordScript->setEnabled(true); | 349 | m_recordScript->setEnabled(true); |
350 | populateScripts(); | 350 | populateScripts(); |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | void MainWindow::slotRunScript(int id) { | 355 | void MainWindow::slotRunScript(int id) { |
356 | if (currentSession()) { | 356 | if (currentSession()) { |
357 | int index = m_scriptsPop->indexOf(id); | 357 | int index = m_scriptsPop->indexOf(id); |
358 | DocLnk *lnk = m_scriptsData.at(index); | 358 | DocLnk *lnk = m_scriptsData.at(index); |
359 | QString filePath = lnk->file(); | 359 | QString filePath = lnk->file(); |
360 | Script script(filePath); | 360 | Script script(filePath); |
361 | currentSession()->emulationHandler()->runScript(&script); | 361 | currentSession()->emulationHandler()->runScript(&script); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | 364 | ||
365 | void MainWindow::slotConnect() { | 365 | void MainWindow::slotConnect() { |
366 | if ( currentSession() ) { | 366 | if ( currentSession() ) { |
367 | bool ret = currentSession()->layer()->open(); | 367 | bool ret = currentSession()->layer()->open(); |
368 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), | 368 | if(!ret) QMessageBox::warning(currentSession()->widgetStack(), |
369 | QObject::tr("Failed"), | 369 | QObject::tr("Failed"), |
370 | QObject::tr("Connecting failed for this session.")); | 370 | QObject::tr("Connecting failed for this session.")); |
371 | else { | 371 | else { |
372 | m_connect->setEnabled( false ); | 372 | m_connect->setEnabled( false ); |
373 | m_disconnect->setEnabled( true ); | 373 | m_disconnect->setEnabled( true ); |
374 | 374 | ||
375 | // if it does not support file transfer, disable the menu entry | 375 | // if it does not support file transfer, disable the menu entry |
376 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 376 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
377 | m_transfer->setEnabled( false ); | 377 | m_transfer->setEnabled( false ); |
378 | } else { | 378 | } else { |
379 | m_transfer->setEnabled( true ); | 379 | m_transfer->setEnabled( true ); |
380 | } | 380 | } |
381 | 381 | ||
382 | m_recordScript->setEnabled( true ); | 382 | m_recordScript->setEnabled( true ); |
383 | m_scripts->setItemEnabled(m_runScript_id, true); | 383 | m_scripts->setItemEnabled(m_runScript_id, true); |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | 387 | ||
388 | void MainWindow::slotDisconnect() { | 388 | void MainWindow::slotDisconnect() { |
389 | if ( currentSession() ) { | 389 | if ( currentSession() ) { |
390 | currentSession()->layer()->close(); | 390 | currentSession()->layer()->close(); |
391 | m_connect->setEnabled( true ); | 391 | m_connect->setEnabled( true ); |
392 | m_disconnect->setEnabled( false ); | 392 | m_disconnect->setEnabled( false ); |
393 | m_transfer->setEnabled( false ); | 393 | m_transfer->setEnabled( false ); |
394 | m_recordScript->setEnabled( false); | 394 | m_recordScript->setEnabled( false); |
395 | m_saveScript->setEnabled( false ); | 395 | m_saveScript->setEnabled( false ); |
396 | m_scripts->setItemEnabled(m_runScript_id, false); | 396 | m_scripts->setItemEnabled(m_runScript_id, false); |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | void MainWindow::slotTerminate() { | 400 | void MainWindow::slotTerminate() { |
401 | if ( currentSession() ) | 401 | if ( currentSession() ) |
402 | currentSession()->layer()->close(); | 402 | currentSession()->layer()->close(); |
403 | 403 | ||
404 | slotClose(); | 404 | slotClose(); |
405 | /* FIXME move to the next session */ | 405 | /* FIXME move to the next session */ |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | 409 | ||
410 | 410 | ||
411 | 411 | ||
412 | 412 | ||
413 | void MainWindow::slotQuickLaunch() { | 413 | void MainWindow::slotQuickLaunch() { |
414 | Profile prof = manager()->profile( "default" ); | 414 | Profile prof = manager()->profile( "default" ); |
415 | if ( prof.name() == "default" ) { | 415 | if ( prof.name() == "default" ) { |
416 | create( prof ); | 416 | create( prof ); |
417 | } else { | 417 | } else { |
418 | Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); | 418 | Profile newProf = Profile( "default", "console", "default" , 0, 3, 0 ); |
419 | newProf.setAutoConnect( true ); | 419 | newProf.setAutoConnect( true ); |
420 | create( newProf ); | 420 | create( newProf ); |
421 | slotSaveSession(); | 421 | slotSaveSession(); |
422 | } | 422 | } |
423 | 423 | ||
424 | } | 424 | } |
425 | 425 | ||
426 | void MainWindow::slotConfigure() { | 426 | void MainWindow::slotConfigure() { |
427 | ConfigDialog conf( manager()->all(), factory() ); | 427 | ConfigDialog conf( manager()->all(), factory() ); |
428 | 428 | ||
429 | int ret = QPEApplication::execDialog( &conf ); | 429 | int ret = QPEApplication::execDialog( &conf ); |
430 | 430 | ||
431 | if ( QDialog::Accepted == ret ) { | 431 | if ( QDialog::Accepted == ret ) { |
432 | manager()->setProfiles( conf.list() ); | 432 | manager()->setProfiles( conf.list() ); |
433 | manager()->save(); | 433 | manager()->save(); |
434 | populateProfiles(); | 434 | populateProfiles(); |
435 | } | 435 | } |
436 | } | 436 | } |
437 | /* | 437 | /* |
438 | * we will remove | 438 | * we will remove |
439 | * this window from the tabwidget | 439 | * this window from the tabwidget |
440 | * remove it from the list | 440 | * remove it from the list |
441 | * delete it | 441 | * delete it |
442 | * and set the currentSession() | 442 | * and set the currentSession() |
443 | */ | 443 | */ |
444 | void MainWindow::slotClose() { | 444 | void MainWindow::slotClose() { |
445 | if (!currentSession() ) | 445 | if (!currentSession() ) |
446 | return; | 446 | return; |
447 | 447 | ||
448 | Session* ses = currentSession(); | 448 | Session* ses = currentSession(); |
449 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); | 449 | qWarning("removing! currentSession %s", currentSession()->name().latin1() ); |
450 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ | 450 | /* set to NULL to be safe, if its needed slotSessionChanged resets it automatically */ |
451 | m_curSession = NULL; | 451 | m_curSession = NULL; |
452 | tabWidget()->remove( /*currentSession()*/ses ); | 452 | tabWidget()->remove( /*currentSession()*/ses ); |
453 | /*it's autodelete */ | 453 | /*it's autodelete */ |
454 | m_sessions.remove( ses ); | 454 | m_sessions.remove( ses ); |
455 | qWarning("after remove!!"); | 455 | qWarning("after remove!!"); |
456 | 456 | ||
457 | if (!currentSession() ) { | 457 | if (!currentSession() ) { |
458 | m_connect->setEnabled( false ); | 458 | m_connect->setEnabled( false ); |
459 | m_disconnect->setEnabled( false ); | 459 | m_disconnect->setEnabled( false ); |
460 | m_terminate->setEnabled( false ); | 460 | m_terminate->setEnabled( false ); |
461 | m_transfer->setEnabled( false ); | 461 | m_transfer->setEnabled( false ); |
462 | m_recordScript->setEnabled( false ); | 462 | m_recordScript->setEnabled( false ); |
463 | m_saveScript->setEnabled( false ); | 463 | m_saveScript->setEnabled( false ); |
464 | m_scripts->setItemEnabled(m_runScript_id, false); | 464 | m_scripts->setItemEnabled(m_runScript_id, false); |
465 | m_fullscreen->setEnabled( false ); | 465 | m_fullscreen->setEnabled( false ); |
466 | m_wrap->setEnabled( false ); | 466 | m_wrap->setEnabled( false ); |
467 | m_closewindow->setEnabled( false ); | 467 | m_closewindow->setEnabled( false ); |
468 | } | 468 | } |
469 | 469 | ||
470 | m_kb->loadDefaults(); | 470 | m_kb->loadDefaults(); |
471 | } | 471 | } |
472 | 472 | ||
473 | /* | 473 | /* |
474 | * We will get the name | 474 | * We will get the name |
475 | * Then the profile | 475 | * Then the profile |
476 | * and then we will make a profile | 476 | * and then we will make a profile |
477 | */ | 477 | */ |
478 | void MainWindow::slotProfile( int id) { | 478 | void MainWindow::slotProfile( int id) { |
479 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); | 479 | Profile prof = manager()->profile( m_sessionsPop->text( id) ); |
480 | create( prof ); | 480 | create( prof ); |
481 | } | 481 | } |
482 | 482 | ||
483 | 483 | ||
484 | 484 | ||
485 | void MainWindow::create( const Profile& prof ) { | 485 | void MainWindow::create( const Profile& prof ) { |
486 | if(m_curSession) | 486 | if(m_curSession) |
487 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 487 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
488 | 488 | ||
489 | Session *ses = manager()->fromProfile( prof, tabWidget() ); | 489 | Session *ses = manager()->fromProfile( prof, tabWidget() ); |
490 | 490 | ||
491 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) | 491 | if((!ses) || (!ses->layer()) || (!ses->widgetStack())) |
492 | { | 492 | { |
493 | QMessageBox::warning(this, | 493 | QMessageBox::warning(this, |
494 | QObject::tr("Session failed"), | 494 | QObject::tr("Session failed"), |
495 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); | 495 | QObject::tr("<qt>Cannot open session: Not all components were found.</qt>")); |
496 | //if(ses) delete ses; | 496 | //if(ses) delete ses; |
497 | return; | 497 | return; |
498 | } | 498 | } |
499 | 499 | ||
500 | m_sessions.append( ses ); | 500 | m_sessions.append( ses ); |
501 | tabWidget()->add( ses ); | 501 | tabWidget()->add( ses ); |
502 | tabWidget()->repaint(); | 502 | tabWidget()->repaint(); |
503 | m_curSession = ses; | 503 | m_curSession = ses; |
504 | 504 | ||
505 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it | 505 | // dicide if its a local term ( then no connction and no tranfer), maybe make a wrapper method out of it |
506 | m_connect->setEnabled( true ); | 506 | m_connect->setEnabled( true ); |
507 | m_disconnect->setEnabled( false ); | 507 | m_disconnect->setEnabled( false ); |
508 | m_terminate->setEnabled( true ); | 508 | m_terminate->setEnabled( true ); |
509 | m_fullscreen->setEnabled( true ); | 509 | m_fullscreen->setEnabled( true ); |
510 | m_wrap->setEnabled( true ); | 510 | m_wrap->setEnabled( true ); |
511 | m_closewindow->setEnabled( true ); | 511 | m_closewindow->setEnabled( true ); |
512 | m_transfer->setEnabled( false ); | 512 | m_transfer->setEnabled( false ); |
513 | m_recordScript->setEnabled( false ); | 513 | m_recordScript->setEnabled( false ); |
514 | m_saveScript->setEnabled( false ); | 514 | m_saveScript->setEnabled( false ); |
515 | m_scripts->setItemEnabled(m_runScript_id, false); | 515 | m_scripts->setItemEnabled(m_runScript_id, false); |
516 | 516 | ||
517 | // is io_layer wants direct connection, then autoconnect | 517 | // is io_layer wants direct connection, then autoconnect |
518 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { | 518 | //if ( ( m_curSession->layer() )->supports()[0] == 1 ) { |
519 | if (prof.autoConnect()) { | 519 | if (prof.autoConnect()) { |
520 | slotConnect(); | 520 | slotConnect(); |
521 | } | 521 | } |
522 | 522 | ||
523 | 523 | ||
524 | QWidget *w = currentSession()->widget(); | 524 | QWidget *w = currentSession()->widget(); |
525 | if(w) w->setFocus(); | 525 | if(w) w->setFocus(); |
526 | 526 | ||
527 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 527 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
528 | m_isWrapped = true; | 528 | m_isWrapped = true; |
529 | } else { | 529 | } else { |
530 | m_isWrapped = false; | 530 | m_isWrapped = false; |
531 | } | 531 | } |
532 | 532 | ||
533 | m_kb->load(currentSession()->profile()); | 533 | m_kb->load(currentSession()->profile()); |
534 | } | 534 | } |
535 | 535 | ||
536 | void MainWindow::slotTransfer() | 536 | void MainWindow::slotTransfer() |
537 | { | 537 | { |
538 | if ( currentSession() ) { | 538 | if ( currentSession() ) { |
539 | Session *mysession = currentSession(); | 539 | Session *mysession = currentSession(); |
540 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); | 540 | TransferDialog dlg(/*mysession->widgetStack()*/this, this); |
541 | mysession->setTransferDialog(&dlg); | 541 | mysession->setTransferDialog(&dlg); |
542 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); | 542 | //dlg.reparent(mysession->widgetStack(), QPoint(0, 0)); |
543 | //dlg.showMaximized(); | 543 | //dlg.showMaximized(); |
544 | currentSession()->widgetStack()->addWidget(&dlg, -1); | 544 | currentSession()->widgetStack()->addWidget(&dlg, -1); |
545 | dlg.show(); | 545 | dlg.show(); |
546 | //dlg.exec(); | 546 | //dlg.exec(); |
547 | while(dlg.isRunning()) qApp->processEvents(); | 547 | while(dlg.isRunning()) qApp->processEvents(); |
548 | mysession->setTransferDialog(0l); | 548 | mysession->setTransferDialog(0l); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | void MainWindow::slotOpenKeb(bool state) { | 553 | void MainWindow::slotOpenKeb(bool state) { |
554 | 554 | ||
555 | if (state) m_keyBar->show(); | 555 | if (state) m_keyBar->show(); |
556 | else m_keyBar->hide(); | 556 | else m_keyBar->hide(); |
557 | 557 | ||
558 | } | 558 | } |
559 | 559 | ||
560 | 560 | ||
561 | void MainWindow::slotOpenButtons( bool state ) { | 561 | void MainWindow::slotOpenButtons( bool state ) { |
562 | 562 | ||
563 | if ( state ) { | 563 | if ( state ) { |
564 | m_buttonBar->show(); | 564 | m_buttonBar->show(); |
565 | } else { | 565 | } else { |
566 | m_buttonBar->hide(); | 566 | m_buttonBar->hide(); |
567 | } | 567 | } |
568 | } | 568 | } |
569 | 569 | ||
570 | 570 | ||
571 | 571 | ||
572 | void MainWindow::slotSessionChanged( Session* ses ) { | 572 | void MainWindow::slotSessionChanged( Session* ses ) { |
573 | qWarning("changed!"); | 573 | qWarning("changed!"); |
574 | 574 | ||
575 | if(m_curSession) | 575 | if(m_curSession) |
576 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); | 576 | if(m_curSession->transferDialog()) m_curSession->transferDialog()->hide(); |
577 | if(ses) | 577 | if(ses) |
578 | if(ses->transferDialog()) ses->transferDialog()->show(); | 578 | if(ses->transferDialog()) ses->transferDialog()->show(); |
579 | 579 | ||
580 | if ( ses ) { | 580 | if ( ses ) { |
581 | m_curSession = ses; | 581 | m_curSession = ses; |
582 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); | 582 | qDebug(QString("is connected : %1").arg( m_curSession->layer()->isConnected() ) ); |
583 | if ( m_curSession->layer()->isConnected() ) { | 583 | if ( m_curSession->layer()->isConnected() ) { |
584 | m_connect->setEnabled( false ); | 584 | m_connect->setEnabled( false ); |
585 | m_disconnect->setEnabled( true ); | 585 | m_disconnect->setEnabled( true ); |
586 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); | 586 | m_recordScript->setEnabled(!m_curSession->emulationHandler()->isRecording()); |
587 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); | 587 | m_saveScript->setEnabled(m_curSession->emulationHandler()->isRecording()); |
588 | m_scripts->setItemEnabled(m_runScript_id, true); | 588 | m_scripts->setItemEnabled(m_runScript_id, true); |
589 | } else { | 589 | } else { |
590 | m_connect->setEnabled( true ); | 590 | m_connect->setEnabled( true ); |
591 | m_disconnect->setEnabled( false ); | 591 | m_disconnect->setEnabled( false ); |
592 | m_recordScript->setEnabled( false ); | 592 | m_recordScript->setEnabled( false ); |
593 | m_saveScript->setEnabled( false ); | 593 | m_saveScript->setEnabled( false ); |
594 | m_scripts->setItemEnabled(m_runScript_id, false); | 594 | m_scripts->setItemEnabled(m_runScript_id, false); |
595 | } | 595 | } |
596 | 596 | ||
597 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { | 597 | if ( ( m_curSession->layer() )->supports()[1] == 0 ) { |
598 | m_transfer->setEnabled( false ); | 598 | m_transfer->setEnabled( false ); |
599 | } else { | 599 | } else { |
600 | m_transfer->setEnabled( true ); | 600 | m_transfer->setEnabled( true ); |
601 | } | 601 | } |
602 | 602 | ||
603 | QWidget *w = m_curSession->widget(); | 603 | QWidget *w = m_curSession->widget(); |
604 | if(w) w->setFocus(); | 604 | if(w) w->setFocus(); |
605 | 605 | ||
606 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ | 606 | if(currentSession()->profile().readNumEntry("Wrap", 80)){ |
607 | m_isWrapped = true; | 607 | m_isWrapped = true; |
608 | } else { | 608 | } else { |
609 | m_isWrapped = false; | 609 | m_isWrapped = false; |
610 | } | 610 | } |
611 | 611 | ||
612 | m_kb->load(currentSession()->profile()); | 612 | m_kb->load(currentSession()->profile()); |
613 | } | 613 | } |
614 | } | 614 | } |
615 | 615 | ||
616 | void MainWindow::slotWrap() | 616 | void MainWindow::slotWrap() |
617 | { | 617 | { |
618 | if(m_curSession) | 618 | if(m_curSession) |
619 | { | 619 | { |
620 | EmulationHandler *e = m_curSession->emulationHandler(); | 620 | EmulationHandler *e = m_curSession->emulationHandler(); |
621 | if(e) | 621 | if(e) |
622 | { | 622 | { |
623 | if(m_isWrapped) | 623 | if(m_isWrapped) |
624 | { | 624 | { |
625 | e->setWrap(80); | 625 | e->setWrap(80); |
626 | m_isWrapped = false; | 626 | m_isWrapped = false; |
627 | } | 627 | } |
628 | else | 628 | else |
629 | { | 629 | { |
630 | e->setWrap(0); | 630 | e->setWrap(0); |
631 | m_isWrapped = true; | 631 | m_isWrapped = true; |
632 | } | 632 | } |
633 | } | 633 | } |
634 | } | 634 | } |
635 | } | 635 | } |
636 | 636 | ||
637 | void MainWindow::slotFullscreen() { | 637 | void MainWindow::slotFullscreen() { |
638 | 638 | ||
639 | 639 | ||
640 | 640 | ||
641 | if ( m_isFullscreen ) { | 641 | if ( m_isFullscreen ) { |
642 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); | 642 | ( m_curSession->widgetStack() )->reparent( savedParentFullscreen, 0, QPoint(0,0), true ); |
643 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); | 643 | ( m_curSession->widgetStack() )->resize( savedParentFullscreen->width(), savedParentFullscreen->height() ); |
644 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); | 644 | ( m_curSession->emulationHandler() )->cornerButton()->hide(); |
645 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 645 | disconnect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
646 | 646 | ||
647 | } else { | 647 | } else { |
648 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); | 648 | savedParentFullscreen = ( m_curSession->widgetStack() )->parentWidget(); |
649 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); | 649 | ( m_curSession->widgetStack() )->setFrameStyle( QFrame::NoFrame ); |
650 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop | 650 | ( m_curSession->widgetStack() )->reparent( 0, WStyle_Tool | WStyle_Customize | WStyle_StaysOnTop |
651 | , QPoint(0,0), false ); | 651 | , QPoint(0,0), false ); |
652 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); | 652 | ( m_curSession->widgetStack() )->resize( qApp->desktop()->width(), qApp->desktop()->height() ); |
653 | ( m_curSession->widgetStack() )->setFocus(); | 653 | ( m_curSession->widgetStack() )->setFocus(); |
654 | ( m_curSession->widgetStack() )->show(); | 654 | ( m_curSession->widgetStack() )->show(); |
655 | 655 | ||
656 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); | 656 | ( ( m_curSession->emulationHandler() )->cornerButton() )->show(); |
657 | 657 | ||
658 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); | 658 | connect( ( m_curSession->emulationHandler() )->cornerButton(), SIGNAL( pressed() ), this, SLOT( slotFullscreen() ) ); |
659 | } | 659 | } |
660 | 660 | ||
661 | m_isFullscreen = !m_isFullscreen; | 661 | m_isFullscreen = !m_isFullscreen; |
662 | } | 662 | } |
663 | 663 | ||
664 | 664 | ||
665 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { | 665 | void MainWindow::slotKeyReceived(FKey k, ushort, ushort, bool pressed) { |
666 | 666 | ||
667 | if ( m_curSession ) { | 667 | if ( m_curSession ) { |
668 | 668 | ||
669 | QEvent::Type state; | 669 | QEvent::Type state; |
670 | 670 | ||
671 | if (pressed) state = QEvent::KeyPress; | 671 | if (pressed) state = QEvent::KeyPress; |
672 | else state = QEvent::KeyRelease; | 672 | else state = QEvent::KeyRelease; |
673 | 673 | ||
674 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); | 674 | QKeyEvent ke(state, k.qcode, k.unicode, 0, QString(QChar(k.unicode))); |
675 | 675 | ||
676 | // is this the best way to do this? cant figure out any other way to work | 676 | // is this the best way to do this? cant figure out any other way to work |
677 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); | 677 | QApplication::sendEvent((QObject *)m_curSession->widget(), &ke); |
678 | ke.ignore(); | 678 | ke.ignore(); |
679 | } | 679 | } |
680 | } | 680 | } |
681 | void MainWindow::slotCopy() { | 681 | void MainWindow::slotCopy() { |
682 | if (!currentSession() ) return; | 682 | if (!currentSession() ) return; |
683 | currentSession()->emulationHandler()->copy(); | 683 | currentSession()->emulationHandler()->copy(); |
684 | } | 684 | } |
685 | void MainWindow::slotPaste() { | 685 | void MainWindow::slotPaste() { |
686 | if (!currentSession() ) return; | 686 | if (!currentSession() ) return; |
687 | currentSession()->emulationHandler()->paste(); | 687 | currentSession()->emulationHandler()->paste(); |
688 | } | 688 | } |
689 | 689 | ||
690 | /* | 690 | /* |
691 | * Save the session | 691 | * Save the session |
692 | */ | 692 | */ |
693 | 693 | ||
694 | void MainWindow::slotSaveSession() { | 694 | void MainWindow::slotSaveSession() { |
695 | if (!currentSession() ) { | 695 | if (!currentSession() ) { |
696 | QMessageBox::information(this, tr("Save Connection"), | 696 | QMessageBox::information(this, tr("Save Connection"), |
697 | tr("<qt>There is no Connection.</qt>"), 1 ); | 697 | tr("<qt>There is no Connection.</qt>"), 1 ); |
698 | return; | 698 | return; |
699 | } | 699 | } |
700 | manager()->add( currentSession()->profile() ); | 700 | manager()->add( currentSession()->profile() ); |
701 | manager()->save(); | 701 | manager()->save(); |
702 | populateProfiles(); | 702 | populateProfiles(); |
703 | } | 703 | } |
704 | void MainWindow::slotSaveHistory() { | 704 | void MainWindow::slotSaveHistory() { |
705 | QMap<QString, QStringList> map; | 705 | QMap<QString, QStringList> map; |
706 | QStringList text; | 706 | QStringList text; |
707 | text << "text/plain"; | 707 | text << "text/plain"; |
708 | map.insert(tr("History"), text ); | 708 | map.insert(tr("History"), text ); |
709 | QString filename = OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); | 709 | QString filename = Opie::OFileDialog::getSaveFileName(2, QPEApplication::documentDir(), QString::null, map); |
710 | if (filename.isEmpty() ) return; | 710 | if (filename.isEmpty() ) return; |
711 | 711 | ||
712 | QFileInfo info(filename); | 712 | QFileInfo info(filename); |
713 | 713 | ||
714 | DocLnk nf; | 714 | DocLnk nf; |
715 | nf.setType("text/plain"); | 715 | nf.setType("text/plain"); |
716 | nf.setFile(filename); | 716 | nf.setFile(filename); |
717 | nf.setName(info.fileName()); | 717 | nf.setName(info.fileName()); |
718 | 718 | ||
719 | 719 | ||
720 | QFile file(filename); | 720 | QFile file(filename); |
721 | file.open(IO_WriteOnly ); | 721 | file.open(IO_WriteOnly ); |
722 | QTextStream str(&file ); | 722 | QTextStream str(&file ); |
723 | if ( currentSession() ) | 723 | if ( currentSession() ) |
724 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); | 724 | currentSession()->emulationHandler()->emulation()->streamHistory(&str); |
725 | 725 | ||
726 | file.close(); | 726 | file.close(); |
727 | nf.writeLink(); | 727 | nf.writeLink(); |
728 | } | 728 | } |
diff --git a/noncore/apps/opie-console/opie-console.control b/noncore/apps/opie-console/opie-console.control index 5548baf..a7ff1f3 100644 --- a/noncore/apps/opie-console/opie-console.control +++ b/noncore/apps/opie-console/opie-console.control | |||
@@ -1,10 +1,10 @@ | |||
1 | Package: opie-console | 1 | Package: opie-console |
2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* | 2 | Files: bin/opie-console apps/Applications/opie-console.desktop pics/console/* |
3 | Priority: optional | 3 | Priority: optional |
4 | Section: opie/applications | 4 | Section: opie/applications |
5 | Maintainer: Opie Team <opie@handhelds.org> | 5 | Maintainer: Opie Team <opie@handhelds.org> |
6 | Architecture: arm | 6 | Architecture: arm |
7 | Version: 0.6-$SUB_VERSION | 7 | Version: 0.6-$SUB_VERSION |
8 | Depends: qpe-base, libopie1, opie-console-help-en, lrzsz, opie-keytabs | 8 | Depends: qpe-base, libopiecore2, libopieui2, opie-console-help-en, lrzsz, opie-keytabs |
9 | License: GPL | 9 | License: GPL |
10 | Description: Opie terminal app | 10 | Description: Opie terminal app |
diff --git a/noncore/apps/opie-console/opie-console.pro b/noncore/apps/opie-console/opie-console.pro index ccf2e08..d3d7b25 100644 --- a/noncore/apps/opie-console/opie-console.pro +++ b/noncore/apps/opie-console/opie-console.pro | |||
@@ -1,76 +1,76 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | TMAKE_CXXFLAGS+= -DHAVE_OPENPTY | 2 | TMAKE_CXXFLAGS += -DHAVE_OPENPTY |
3 | CONFIG += qt warn_on release | 3 | CONFIG += qt warn_on release |
4 | #CONFIG = qt debug | 4 | #CONFIG = qt debug |
5 | DESTDIR = $(OPIEDIR)/bin | 5 | DESTDIR = $(OPIEDIR)/bin |
6 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ | 6 | HEADERS = io_layer.h io_serial.h io_irda.h io_bt.h io_modem.h \ |
7 | file_layer.h filetransfer.h \ | 7 | file_layer.h filetransfer.h \ |
8 | metafactory.h \ | 8 | metafactory.h \ |
9 | session.h \ | 9 | session.h \ |
10 | mainwindow.h \ | 10 | mainwindow.h \ |
11 | profile.h \ | 11 | profile.h \ |
12 | profileconfig.h \ | 12 | profileconfig.h \ |
13 | profilemanager.h \ | 13 | profilemanager.h \ |
14 | tabwidget.h \ | 14 | tabwidget.h \ |
15 | configdialog.h \ | 15 | configdialog.h \ |
16 | keytrans.h \ | 16 | keytrans.h \ |
17 | transferdialog.h \ | 17 | transferdialog.h \ |
18 | profiledialogwidget.h \ | 18 | profiledialogwidget.h \ |
19 | profileeditordialog.h \ | 19 | profileeditordialog.h \ |
20 | default.h \ | 20 | default.h \ |
21 | iolayerbase.h \ | 21 | iolayerbase.h \ |
22 | serialconfigwidget.h irdaconfigwidget.h \ | 22 | serialconfigwidget.h irdaconfigwidget.h \ |
23 | btconfigwidget.h modemconfigwidget.h \ | 23 | btconfigwidget.h modemconfigwidget.h \ |
24 | atconfigdialog.h dialdialog.h \ | 24 | atconfigdialog.h dialdialog.h \ |
25 | procctl.h \ | 25 | procctl.h \ |
26 | function_keyboard.h \ | 26 | function_keyboard.h \ |
27 | receive_layer.h filereceive.h \ | 27 | receive_layer.h filereceive.h \ |
28 | script.h \ | 28 | script.h \ |
29 | dialer.h \ | 29 | dialer.h \ |
30 | terminalwidget.h \ | 30 | terminalwidget.h \ |
31 | emulation_handler.h TECommon.h \ | 31 | emulation_handler.h TECommon.h \ |
32 | TEHistory.h TEScreen.h TEWidget.h \ | 32 | TEHistory.h TEScreen.h TEWidget.h \ |
33 | TEmuVt102.h TEmulation.h MyPty.h \ | 33 | TEmuVt102.h TEmulation.h MyPty.h \ |
34 | consoleconfigwidget.h | 34 | consoleconfigwidget.h |
35 | 35 | ||
36 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ | 36 | SOURCES = io_layer.cpp io_serial.cpp io_irda.cpp io_bt.cpp io_modem.cpp \ |
37 | file_layer.cpp filetransfer.cpp \ | 37 | file_layer.cpp filetransfer.cpp \ |
38 | main.cpp \ | 38 | main.cpp \ |
39 | metafactory.cpp \ | 39 | metafactory.cpp \ |
40 | session.cpp \ | 40 | session.cpp \ |
41 | mainwindow.cpp \ | 41 | mainwindow.cpp \ |
42 | profile.cpp \ | 42 | profile.cpp \ |
43 | profileconfig.cpp \ | 43 | profileconfig.cpp \ |
44 | profilemanager.cpp \ | 44 | profilemanager.cpp \ |
45 | tabwidget.cpp \ | 45 | tabwidget.cpp \ |
46 | configdialog.cpp \ | 46 | configdialog.cpp \ |
47 | keytrans.cpp \ | 47 | keytrans.cpp \ |
48 | transferdialog.cpp \ | 48 | transferdialog.cpp \ |
49 | profiledialogwidget.cpp \ | 49 | profiledialogwidget.cpp \ |
50 | profileeditordialog.cpp \ | 50 | profileeditordialog.cpp \ |
51 | iolayerbase.cpp \ | 51 | iolayerbase.cpp \ |
52 | serialconfigwidget.cpp irdaconfigwidget.cpp \ | 52 | serialconfigwidget.cpp irdaconfigwidget.cpp \ |
53 | btconfigwidget.cpp modemconfigwidget.cpp \ | 53 | btconfigwidget.cpp modemconfigwidget.cpp \ |
54 | atconfigdialog.cpp dialdialog.cpp \ | 54 | atconfigdialog.cpp dialdialog.cpp \ |
55 | default.cpp procctl.cpp \ | 55 | default.cpp procctl.cpp \ |
56 | function_keyboard.cpp \ | 56 | function_keyboard.cpp \ |
57 | receive_layer.cpp filereceive.cpp \ | 57 | receive_layer.cpp filereceive.cpp \ |
58 | script.cpp \ | 58 | script.cpp \ |
59 | dialer.cpp \ | 59 | dialer.cpp \ |
60 | terminalwidget.cpp \ | 60 | terminalwidget.cpp \ |
61 | emulation_handler.cpp TEHistory.cpp \ | 61 | emulation_handler.cpp TEHistory.cpp \ |
62 | TEScreen.cpp TEWidget.cpp \ | 62 | TEScreen.cpp TEWidget.cpp \ |
63 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ | 63 | TEmuVt102.cpp TEmulation.cpp MyPty.cpp \ |
64 | consoleconfigwidget.cpp | 64 | consoleconfigwidget.cpp |
65 | 65 | ||
66 | 66 | ||
67 | INTERFACES = configurebase.ui editbase.ui | 67 | INTERFACES = configurebase.ui editbase.ui |
68 | INCLUDEPATH += $(OPIEDIR)/include | 68 | INCLUDEPATH += $(OPIEDIR)/include |
69 | DEPENDPATH += $(OPIEDIR)/include | 69 | DEPENDPATH += $(OPIEDIR)/include |
70 | LIBS += -lqpe -lopie -lutil | 70 | LIBS += -lqpe -lopiecore2 -lopieui2 -lutil |
71 | TARGET = opie-console | 71 | TARGET = opie-console |
72 | 72 | ||
73 | 73 | ||
74 | 74 | ||
75 | 75 | ||
76 | include ( $(OPIEDIR)/include.pro ) | 76 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/opie-console/profileeditordialog.h b/noncore/apps/opie-console/profileeditordialog.h index c731747..97bd650 100644 --- a/noncore/apps/opie-console/profileeditordialog.h +++ b/noncore/apps/opie-console/profileeditordialog.h | |||
@@ -1,61 +1,61 @@ | |||
1 | #ifndef PROFILE_EDITOR_DIALOG | 1 | #ifndef PROFILE_EDITOR_DIALOG |
2 | #define PROFILE_EDITOR_DIALOG | 2 | #define PROFILE_EDITOR_DIALOG |
3 | 3 | ||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include <opie/otabwidget.h> | 5 | #include <opie2/otabwidget.h> |
6 | 6 | ||
7 | #include "profile.h" | 7 | #include "profile.h" |
8 | 8 | ||
9 | class MetaFactory; | 9 | class MetaFactory; |
10 | class EditBase; | 10 | class EditBase; |
11 | class QTabWidget; | 11 | class QTabWidget; |
12 | class QHBoxLayout; | 12 | class QHBoxLayout; |
13 | class QLineEdit; | 13 | class QLineEdit; |
14 | class QComboBox; | 14 | class QComboBox; |
15 | class QCheckBox; | 15 | class QCheckBox; |
16 | class QLabel; | 16 | class QLabel; |
17 | class QScrollView; | 17 | class QScrollView; |
18 | class ProfileDialogWidget; | 18 | class ProfileDialogWidget; |
19 | 19 | ||
20 | class ProfileEditorDialog : public QDialog { | 20 | class ProfileEditorDialog : public QDialog { |
21 | Q_OBJECT | 21 | Q_OBJECT |
22 | public: | 22 | public: |
23 | ProfileEditorDialog(MetaFactory* fact, | 23 | ProfileEditorDialog(MetaFactory* fact, |
24 | const Profile& prof ); | 24 | const Profile& prof ); |
25 | ProfileEditorDialog(MetaFactory* fact ); | 25 | ProfileEditorDialog(MetaFactory* fact ); |
26 | ~ProfileEditorDialog(); | 26 | ~ProfileEditorDialog(); |
27 | Profile profile()const; | 27 | Profile profile()const; |
28 | 28 | ||
29 | 29 | ||
30 | 30 | ||
31 | public slots: | 31 | public slots: |
32 | void accept(); | 32 | void accept(); |
33 | 33 | ||
34 | private slots: | 34 | private slots: |
35 | void slotConActivated(const QString& ); | 35 | void slotConActivated(const QString& ); |
36 | void slotTermActivated( const QString& ); | 36 | void slotTermActivated( const QString& ); |
37 | void slotKeyActivated(const QString&); | 37 | void slotKeyActivated(const QString&); |
38 | private: | 38 | private: |
39 | void initUI(); | 39 | void initUI(); |
40 | QString profName()const; | 40 | QString profName()const; |
41 | QCString profType()const; | 41 | QCString profType()const; |
42 | 42 | ||
43 | MetaFactory* m_fact; | 43 | MetaFactory* m_fact; |
44 | QHBoxLayout* m_lay; | 44 | QHBoxLayout* m_lay; |
45 | Profile m_prof; | 45 | Profile m_prof; |
46 | 46 | ||
47 | QLineEdit *m_name; | 47 | QLineEdit *m_name; |
48 | QComboBox *m_conCmb, *m_termCmb; | 48 | QComboBox *m_conCmb, *m_termCmb; |
49 | QCheckBox *m_autoConnect; | 49 | QCheckBox *m_autoConnect; |
50 | 50 | ||
51 | QScrollView *m_svCon, *m_svTerm; | 51 | QScrollView *m_svCon, *m_svTerm; |
52 | 52 | ||
53 | QWidget *m_tabCon, *m_tabTerm, *m_tabKey; | 53 | QWidget *m_tabCon, *m_tabTerm, *m_tabKey; |
54 | ProfileDialogWidget* m_con, *m_term, *m_key; | 54 | ProfileDialogWidget* m_con, *m_term, *m_key; |
55 | QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; | 55 | QHBoxLayout *m_layCon, *m_layTerm, *m_layKey; |
56 | OTabWidget *tabWidget; | 56 | OTabWidget *tabWidget; |
57 | QWidget *tabprof; | 57 | QWidget *tabprof; |
58 | int m_showconntab; | 58 | int m_showconntab; |
59 | }; | 59 | }; |
60 | 60 | ||
61 | #endif | 61 | #endif |
diff --git a/noncore/apps/opie-console/sz_transfer.cpp b/noncore/apps/opie-console/sz_transfer.cpp index 0a315cf..c47e73e 100644 --- a/noncore/apps/opie-console/sz_transfer.cpp +++ b/noncore/apps/opie-console/sz_transfer.cpp | |||
@@ -1,85 +1,84 @@ | |||
1 | 1 | ||
2 | #include "sz_transfer.h" | 2 | #include "sz_transfer.h" |
3 | #include <qfile.h> | 3 | #include <qfile.h> |
4 | #include <opie/oprocess.h> | ||
5 | #include <stdio.h> | 4 | #include <stdio.h> |
6 | #include <sys/termios.h> | 5 | #include <sys/termios.h> |
7 | 6 | ||
8 | 7 | ||
9 | 8 | ||
10 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) | 9 | SzTransfer::SzTransfer(Type t, IOLayer *layer) : FileTransferLayer(layer), m_t(t) |
11 | { | 10 | { |
12 | } | 11 | } |
13 | 12 | ||
14 | SzTransfer::~SzTransfer() { | 13 | SzTransfer::~SzTransfer() { |
15 | } | 14 | } |
16 | 15 | ||
17 | void SzTransfer::sendFile(const QFile& file) { | 16 | void SzTransfer::sendFile(const QFile& file) { |
18 | 17 | ||
19 | sendFile(file.name()); | 18 | sendFile(file.name()); |
20 | } | 19 | } |
21 | 20 | ||
22 | void SzTransfer::sendFile(const QString& file) { | 21 | void SzTransfer::sendFile(const QString& file) { |
23 | 22 | ||
24 | //setcbreak(2); /* raw no echo */ | 23 | //setcbreak(2); /* raw no echo */ |
25 | 24 | ||
26 | proc = new OProcess; | 25 | proc = new OProcess; |
27 | *proc << "sz"; | 26 | *proc << "sz"; |
28 | *proc << "-v" << "-v" << "-b" << file; | 27 | *proc << "-v" << "-v" << "-b" << file; |
29 | connect(proc, SIGNAL(processExited(OProcess *)), | 28 | connect(proc, SIGNAL(processExited(OProcess *)), |
30 | this, SLOT(sent())); | 29 | this, SLOT(sent())); |
31 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), | 30 | connect(proc, SIGNAL(receivedStdout(OProcess *, char *, int)), |
32 | this, SLOT(SzReceivedStdout(OProcess *, char *, int))); | 31 | this, SLOT(SzReceivedStdout(OProcess *, char *, int))); |
33 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), | 32 | connect(proc, SIGNAL(receivedStderr(OProcess *, char *, int)), |
34 | this, SLOT(SzReceivedStderr(OProcess *, char *, int))); | 33 | this, SLOT(SzReceivedStderr(OProcess *, char *, int))); |
35 | connect(layer(), SIGNAL(received(const QByteArray &)), | 34 | connect(layer(), SIGNAL(received(const QByteArray &)), |
36 | this, SLOT(receivedStdin(const QByteArray &))); | 35 | this, SLOT(receivedStdin(const QByteArray &))); |
37 | proc->start(OProcess::NotifyOnExit, OProcess::All); | 36 | proc->start(OProcess::NotifyOnExit, OProcess::All); |
38 | 37 | ||
39 | } | 38 | } |
40 | 39 | ||
41 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { | 40 | void SzTransfer::SzReceivedStdout(OProcess *, char *buffer, int buflen) { |
42 | 41 | ||
43 | qWarning("recieved from sz on stdout %d bytes", buflen); | 42 | qWarning("recieved from sz on stdout %d bytes", buflen); |
44 | 43 | ||
45 | QByteArray data(buflen); | 44 | QByteArray data(buflen); |
46 | data.fill(*buffer, buflen); | 45 | data.fill(*buffer, buflen); |
47 | for (uint i = 0; i < data.count(); i++ ) { | 46 | for (uint i = 0; i < data.count(); i++ ) { |
48 | printf("%c", buffer[i] ); | 47 | printf("%c", buffer[i] ); |
49 | } | 48 | } |
50 | printf("\n"); | 49 | printf("\n"); |
51 | 50 | ||
52 | // send out through the io layer | 51 | // send out through the io layer |
53 | layer()->send(data); | 52 | layer()->send(data); |
54 | } | 53 | } |
55 | 54 | ||
56 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { | 55 | void SzTransfer::SzReceivedStderr(OProcess *, char *buffer, int length) { |
57 | 56 | ||
58 | // parse and show data in a progress dialog/widget | 57 | // parse and show data in a progress dialog/widget |
59 | printf("stderr:\n"); | 58 | printf("stderr:\n"); |
60 | //for (int i = 0; i < length; i++) | 59 | //for (int i = 0; i < length; i++) |
61 | // printf("%c", buffer[i]); | 60 | // printf("%c", buffer[i]); |
62 | //printf("\n"); | 61 | //printf("\n"); |
63 | } | 62 | } |
64 | 63 | ||
65 | void SzTransfer::receivedStdin(const QByteArray &data) { | 64 | void SzTransfer::receivedStdin(const QByteArray &data) { |
66 | 65 | ||
67 | qWarning("recieved from io_serial %d bytes", data.size()); | 66 | qWarning("recieved from io_serial %d bytes", data.size()); |
68 | 67 | ||
69 | // recieved data from the io layer goes to sz | 68 | // recieved data from the io layer goes to sz |
70 | proc->writeStdin(data.data(), data.size()); | 69 | proc->writeStdin(data.data(), data.size()); |
71 | 70 | ||
72 | } | 71 | } |
73 | 72 | ||
74 | void SzTransfer::sent() { | 73 | void SzTransfer::sent() { |
75 | 74 | ||
76 | qWarning("sent file"); | 75 | qWarning("sent file"); |
77 | 76 | ||
78 | //setcbreak(0); /* default */ | 77 | //setcbreak(0); /* default */ |
79 | 78 | ||
80 | 79 | ||
81 | delete proc; | 80 | delete proc; |
82 | disconnect(layer(), SIGNAL(received(const QByteArray &)), | 81 | disconnect(layer(), SIGNAL(received(const QByteArray &)), |
83 | this, SLOT(receivedStdin(const QByteArray &))); | 82 | this, SLOT(receivedStdin(const QByteArray &))); |
84 | 83 | ||
85 | } | 84 | } |
diff --git a/noncore/apps/opie-console/sz_transfer.h b/noncore/apps/opie-console/sz_transfer.h index d3e6621..aa97c32 100644 --- a/noncore/apps/opie-console/sz_transfer.h +++ b/noncore/apps/opie-console/sz_transfer.h | |||
@@ -1,40 +1,40 @@ | |||
1 | #ifndef OPIE_FL_SZ_H | 1 | #ifndef OPIE_FL_SZ_H |
2 | #define OPIE_FL_SZ_H | 2 | #define OPIE_FL_SZ_H |
3 | 3 | ||
4 | #include "file_layer.h" | 4 | #include "file_layer.h" |
5 | #include <opie/oprocess.h> | 5 | #include <opie2/oprocess.h> |
6 | 6 | ||
7 | class SzTransfer : public FileTransferLayer { | 7 | class SzTransfer : public FileTransferLayer { |
8 | 8 | ||
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | enum Type { | 12 | enum Type { |
13 | SZ=0, | 13 | SZ=0, |
14 | SX, | 14 | SX, |
15 | SY | 15 | SY |
16 | }; | 16 | }; |
17 | 17 | ||
18 | SzTransfer( Type t, IOLayer * ); | 18 | SzTransfer( Type t, IOLayer * ); |
19 | ~SzTransfer(); | 19 | ~SzTransfer(); |
20 | 20 | ||
21 | public slots: | 21 | public slots: |
22 | /** | 22 | /** |
23 | * send a file over the layer | 23 | * send a file over the layer |
24 | */ | 24 | */ |
25 | void sendFile( const QString& file ) ; | 25 | void sendFile( const QString& file ) ; |
26 | void sendFile( const QFile& ); | 26 | void sendFile( const QFile& ); |
27 | void sent(); | 27 | void sent(); |
28 | 28 | ||
29 | private slots: | 29 | private slots: |
30 | void SzReceivedStdout(OProcess *, char *, int); | 30 | void SzReceivedStdout(OProcess *, char *, int); |
31 | void SzReceivedStderr(OProcess *, char *, int); | 31 | void SzReceivedStderr(OProcess *, char *, int); |
32 | void receivedStdin(const QByteArray &); | 32 | void receivedStdin(const QByteArray &); |
33 | 33 | ||
34 | private: | 34 | private: |
35 | OProcess *proc; | 35 | OProcess *proc; |
36 | Type m_t; | 36 | Type m_t; |
37 | 37 | ||
38 | }; | 38 | }; |
39 | 39 | ||
40 | #endif | 40 | #endif |
diff --git a/noncore/apps/opie-console/tabwidget.h b/noncore/apps/opie-console/tabwidget.h index cbaa0f1..98450a3 100644 --- a/noncore/apps/opie-console/tabwidget.h +++ b/noncore/apps/opie-console/tabwidget.h | |||
@@ -1,29 +1,29 @@ | |||
1 | #ifndef OPIE_TAB_WIDGET_H | 1 | #ifndef OPIE_TAB_WIDGET_H |
2 | #define OPIE_TAB_WIDGET_H | 2 | #define OPIE_TAB_WIDGET_H |
3 | 3 | ||
4 | #include <qmap.h> | 4 | #include <qmap.h> |
5 | #include <opie/otabwidget.h> | 5 | #include <opie2/otabwidget.h> |
6 | 6 | ||
7 | #include "session.h" | 7 | #include "session.h" |
8 | /** | 8 | /** |
9 | * This is our central tab widget | 9 | * This is our central tab widget |
10 | * we can add sessions here | 10 | * we can add sessions here |
11 | */ | 11 | */ |
12 | class TabWidget : public OTabWidget{ | 12 | class TabWidget : public OTabWidget{ |
13 | Q_OBJECT | 13 | Q_OBJECT |
14 | public: | 14 | public: |
15 | TabWidget(QWidget *parent, const char* name ); | 15 | TabWidget(QWidget *parent, const char* name ); |
16 | ~TabWidget(); | 16 | ~TabWidget(); |
17 | void add( Session* ); | 17 | void add( Session* ); |
18 | void remove( Session* ); | 18 | void remove( Session* ); |
19 | void setCurrent( Session* ); | 19 | void setCurrent( Session* ); |
20 | 20 | ||
21 | signals: | 21 | signals: |
22 | void activated(Session* ses ); | 22 | void activated(Session* ses ); |
23 | private slots: | 23 | private slots: |
24 | void slotCurChanged( QWidget* wid ); | 24 | void slotCurChanged( QWidget* wid ); |
25 | private: | 25 | private: |
26 | QMap<QWidget*, Session*> m_map; | 26 | QMap<QWidget*, Session*> m_map; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #endif | 29 | #endif |
diff --git a/noncore/apps/opie-console/test/console.pro b/noncore/apps/opie-console/test/console.pro index 7b4c310..624f381 100644 --- a/noncore/apps/opie-console/test/console.pro +++ b/noncore/apps/opie-console/test/console.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | #CONFIG = qt warn_on release | 2 | #CONFIG = qt warn_on release |
3 | CONFIG = qt debug | 3 | CONFIG = qt debug |
4 | #DESTDIR = $(OPIEDIR)/bin | 4 | #DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ | 5 | HEADERS = ../io_layer.h ../io_serial.h ../sz_transfer.h ../file_layer.h\ |
6 | senderui.h ../profile.h ../filetransfer.h ../procctl.h \ | 6 | senderui.h ../profile.h ../filetransfer.h ../procctl.h \ |
7 | ../filereceive.h ../receive_layer.h | 7 | ../filereceive.h ../receive_layer.h |
8 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ | 8 | SOURCES = ../io_layer.cpp ../io_serial.cpp \ |
9 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ | 9 | ../profile.cpp ../sz_transfer.cpp ../file_layer.cpp\ |
10 | main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp \ | 10 | main.cpp senderui.cpp ../filetransfer.cpp ../procctl.cpp \ |
11 | ../filereceive.cpp ../receive_layer.cpp | 11 | ../filereceive.cpp ../receive_layer.cpp |
12 | INTERFACES = sender.ui | 12 | INTERFACES = sender.ui |
13 | INCLUDEPATH += $(OPIEDIR)/include | 13 | INCLUDEPATH += $(OPIEDIR)/include |
14 | DEPENDPATH += $(OPIEDIR)/include | 14 | DEPENDPATH += $(OPIEDIR)/include |
15 | LIBS += -lqpe -lopie | 15 | LIBS += -lqpe -lopiecore2 |
16 | TARGET = test | 16 | TARGET = test |
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | include ( $(OPIEDIR)/include.pro ) | 21 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/noncore/apps/opie-console/test/senderui.cpp b/noncore/apps/opie-console/test/senderui.cpp index 4026808..4a7202d 100644 --- a/noncore/apps/opie-console/test/senderui.cpp +++ b/noncore/apps/opie-console/test/senderui.cpp | |||
@@ -1,77 +1,77 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include <stdio.h> | 2 | #include <stdio.h> |
3 | #include <fcntl.h> | 3 | #include <fcntl.h> |
4 | #include <sys/termios.h> | 4 | #include <sys/termios.h> |
5 | 5 | ||
6 | #include <qmultilineedit.h> | 6 | #include <qmultilineedit.h> |
7 | #include <qsocketnotifier.h> | 7 | #include <qsocketnotifier.h> |
8 | 8 | ||
9 | #include "../profile.h" | 9 | #include "../profile.h" |
10 | #include "../io_serial.h" | 10 | #include "../io_serial.h" |
11 | #include "../filetransfer.h" | 11 | #include "../filetransfer.h" |
12 | #include "../filereceive.h" | 12 | #include "../filereceive.h" |
13 | 13 | ||
14 | #include <opie/oprocess.h> | 14 | #include <opie2/oprocess.h> |
15 | 15 | ||
16 | #include "senderui.h" | 16 | #include "senderui.h" |
17 | 17 | ||
18 | SenderUI::SenderUI() | 18 | SenderUI::SenderUI() |
19 | : Sender() { | 19 | : Sender() { |
20 | 20 | ||
21 | /* we do that manually */ | 21 | /* we do that manually */ |
22 | Profile prof; | 22 | Profile prof; |
23 | QString str = "/dev/bty0"; | 23 | QString str = "/dev/bty0"; |
24 | prof.writeEntry("Device",str ); | 24 | prof.writeEntry("Device",str ); |
25 | prof.writeEntry("Baud", 19200 ); | 25 | prof.writeEntry("Baud", 19200 ); |
26 | 26 | ||
27 | qWarning("prof " + prof.readEntry("Device") + " " + str); | 27 | qWarning("prof " + prof.readEntry("Device") + " " + str); |
28 | ser = new IOSerial(prof); | 28 | ser = new IOSerial(prof); |
29 | connect(ser, SIGNAL(received(const QByteArray& ) ), | 29 | connect(ser, SIGNAL(received(const QByteArray& ) ), |
30 | this, SLOT(got(const QByteArray&) ) ); | 30 | this, SLOT(got(const QByteArray&) ) ); |
31 | 31 | ||
32 | if ( ser->open() ) | 32 | if ( ser->open() ) |
33 | qWarning("opened!!!"); | 33 | qWarning("opened!!!"); |
34 | else | 34 | else |
35 | qWarning("could not open"); | 35 | qWarning("could not open"); |
36 | 36 | ||
37 | 37 | ||
38 | } | 38 | } |
39 | SenderUI::~SenderUI() { | 39 | SenderUI::~SenderUI() { |
40 | 40 | ||
41 | } | 41 | } |
42 | void SenderUI::slotSendFile() { | 42 | void SenderUI::slotSendFile() { |
43 | 43 | ||
44 | sz = new FileTransfer(FileTransfer::SY, ser); | 44 | sz = new FileTransfer(FileTransfer::SY, ser); |
45 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); | 45 | sz->sendFile("/home/ich/bootopie-v06-13.jffs2"); |
46 | 46 | ||
47 | connect (sz, SIGNAL(sent()), | 47 | connect (sz, SIGNAL(sent()), |
48 | this, SLOT(fileTransComplete())); | 48 | this, SLOT(fileTransComplete())); |
49 | } | 49 | } |
50 | 50 | ||
51 | void SenderUI::slotSend() { | 51 | void SenderUI::slotSend() { |
52 | QCString str = MultiLineEdit1->text().utf8(); | 52 | QCString str = MultiLineEdit1->text().utf8(); |
53 | qWarning("sending: %s", str.data() ); | 53 | qWarning("sending: %s", str.data() ); |
54 | str = str.replace( QRegExp("\n"), "\r"); | 54 | str = str.replace( QRegExp("\n"), "\r"); |
55 | ser->send( str ); | 55 | ser->send( str ); |
56 | } | 56 | } |
57 | void SenderUI::got(const QByteArray& ar) { | 57 | void SenderUI::got(const QByteArray& ar) { |
58 | qWarning("got:"); | 58 | qWarning("got:"); |
59 | for ( uint i = 0; i < ar.count(); i++ ) { | 59 | for ( uint i = 0; i < ar.count(); i++ ) { |
60 | printf("%c", ar[i] ); | 60 | printf("%c", ar[i] ); |
61 | } | 61 | } |
62 | printf("\n"); | 62 | printf("\n"); |
63 | } | 63 | } |
64 | 64 | ||
65 | void SenderUI::fileTransComplete() { | 65 | void SenderUI::fileTransComplete() { |
66 | 66 | ||
67 | qWarning("file transfer complete"); | 67 | qWarning("file transfer complete"); |
68 | } | 68 | } |
69 | void SenderUI::send() { | 69 | void SenderUI::send() { |
70 | 70 | ||
71 | } | 71 | } |
72 | void SenderUI::slotRev(){ | 72 | void SenderUI::slotRev(){ |
73 | qWarning("Going to receive!"); | 73 | qWarning("Going to receive!"); |
74 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); | 74 | FileReceive *rev = new FileReceive( FileReceive::SZ, ser ); |
75 | rev->receive(); | 75 | rev->receive(); |
76 | 76 | ||
77 | } | 77 | } |
diff --git a/noncore/apps/opie-console/transferdialog.cpp b/noncore/apps/opie-console/transferdialog.cpp index 55dd748..30e7caf 100644 --- a/noncore/apps/opie-console/transferdialog.cpp +++ b/noncore/apps/opie-console/transferdialog.cpp | |||
@@ -1,275 +1,275 @@ | |||
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 <opie2/ofiledialog.h> |
12 | 12 | ||
13 | #include "metafactory.h" | 13 | #include "metafactory.h" |
14 | #include "mainwindow.h" | 14 | #include "mainwindow.h" |
15 | 15 | ||
16 | #include "transferdialog.h" | 16 | #include "transferdialog.h" |
17 | 17 | ||
18 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) | 18 | TransferDialog::TransferDialog(QWidget *parent, MainWindow *mainwindow, const char *) |
19 | : QDialog(parent, 0l, false), m_win(mainwindow) | 19 | : QDialog(parent, 0l, false), m_win(mainwindow) |
20 | { | 20 | { |
21 | m_lay = 0l; | 21 | m_lay = 0l; |
22 | m_recvlay = 0l; | 22 | m_recvlay = 0l; |
23 | QVBoxLayout *vbox, *vbox2; | 23 | QVBoxLayout *vbox, *vbox2; |
24 | QHBoxLayout *hbox, *hbox2, *hbox3; | 24 | QHBoxLayout *hbox, *hbox2, *hbox3; |
25 | QLabel *file, *mode, *progress, *status; | 25 | QLabel *file, *mode, *progress, *status; |
26 | QButtonGroup *group; | 26 | QButtonGroup *group; |
27 | QRadioButton *mode_send, *mode_receive; | 27 | QRadioButton *mode_send, *mode_receive; |
28 | 28 | ||
29 | m_autocleanup = 0; | 29 | m_autocleanup = 0; |
30 | m_running = true; | 30 | m_running = true; |
31 | 31 | ||
32 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); | 32 | group = new QButtonGroup(QObject::tr("Transfer mode"), this); |
33 | mode_send = new QRadioButton(QObject::tr("Send"), group); | 33 | mode_send = new QRadioButton(QObject::tr("Send"), group); |
34 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); | 34 | mode_receive = new QRadioButton(QObject::tr("Receive"), group); |
35 | group->insert(mode_send, id_send); | 35 | group->insert(mode_send, id_send); |
36 | group->insert(mode_receive, id_receive); | 36 | group->insert(mode_receive, id_receive); |
37 | vbox2 = new QVBoxLayout(group, 2); | 37 | vbox2 = new QVBoxLayout(group, 2); |
38 | vbox2->addSpacing(10); | 38 | vbox2->addSpacing(10); |
39 | hbox3 = new QHBoxLayout(vbox2, 2); | 39 | hbox3 = new QHBoxLayout(vbox2, 2); |
40 | hbox3->add(mode_send); | 40 | hbox3->add(mode_send); |
41 | hbox3->add(mode_receive); | 41 | hbox3->add(mode_receive); |
42 | mode_send->setChecked(true); | 42 | mode_send->setChecked(true); |
43 | m_transfermode = id_send; | 43 | m_transfermode = id_send; |
44 | 44 | ||
45 | file = new QLabel(QObject::tr("Send file"), this); | 45 | file = new QLabel(QObject::tr("Send file"), this); |
46 | mode = new QLabel(QObject::tr("Transfer protocol"), this); | 46 | mode = new QLabel(QObject::tr("Transfer protocol"), this); |
47 | progress = new QLabel(QObject::tr("Progress"), this); | 47 | progress = new QLabel(QObject::tr("Progress"), this); |
48 | status = new QLabel(QObject::tr("Status"), this); | 48 | status = new QLabel(QObject::tr("Status"), this); |
49 | 49 | ||
50 | statusbar = new QLabel(QObject::tr("Ready"), this); | 50 | statusbar = new QLabel(QObject::tr("Ready"), this); |
51 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); | 51 | statusbar->setFrameStyle(QFrame::Panel | QFrame::Sunken); |
52 | 52 | ||
53 | protocol = new QComboBox(this); | 53 | protocol = new QComboBox(this); |
54 | QStringList list = m_win->factory()->fileTransferLayers(); | 54 | QStringList list = m_win->factory()->fileTransferLayers(); |
55 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) | 55 | for (QStringList::Iterator it = list.begin(); it != list.end(); ++it) |
56 | protocol->insertItem((*it)); | 56 | protocol->insertItem((*it)); |
57 | 57 | ||
58 | filename = new QLineEdit(this); | 58 | filename = new QLineEdit(this); |
59 | 59 | ||
60 | progressbar = new QProgressBar(this); | 60 | progressbar = new QProgressBar(this); |
61 | progressbar->setProgress(0); | 61 | progressbar->setProgress(0); |
62 | 62 | ||
63 | selector = new QPushButton("...", this); | 63 | selector = new QPushButton("...", this); |
64 | ok = new QPushButton(QObject::tr("Start transfer"), this); | 64 | ok = new QPushButton(QObject::tr("Start transfer"), this); |
65 | cancel = new QPushButton(QObject::tr("Cancel"), this); | 65 | cancel = new QPushButton(QObject::tr("Cancel"), this); |
66 | 66 | ||
67 | vbox = new QVBoxLayout(this, 2); | 67 | vbox = new QVBoxLayout(this, 2); |
68 | vbox->add(group); | 68 | vbox->add(group); |
69 | vbox->add(file); | 69 | vbox->add(file); |
70 | hbox = new QHBoxLayout(vbox, 0); | 70 | hbox = new QHBoxLayout(vbox, 0); |
71 | hbox->add(filename); | 71 | hbox->add(filename); |
72 | hbox->add(selector); | 72 | hbox->add(selector); |
73 | vbox->add(mode); | 73 | vbox->add(mode); |
74 | vbox->add(protocol); | 74 | vbox->add(protocol); |
75 | vbox->add(progress); | 75 | vbox->add(progress); |
76 | vbox->add(progressbar); | 76 | vbox->add(progressbar); |
77 | vbox->add(status); | 77 | vbox->add(status); |
78 | vbox->add(statusbar); | 78 | vbox->add(statusbar); |
79 | vbox->addStretch(1); | 79 | vbox->addStretch(1); |
80 | hbox2 = new QHBoxLayout(vbox, 2); | 80 | hbox2 = new QHBoxLayout(vbox, 2); |
81 | hbox2->add(ok); | 81 | hbox2->add(ok); |
82 | hbox2->add(cancel); | 82 | hbox2->add(cancel); |
83 | 83 | ||
84 | setCaption(QObject::tr("File transfer")); | 84 | setCaption(QObject::tr("File transfer")); |
85 | show(); | 85 | show(); |
86 | 86 | ||
87 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); | 87 | connect(selector, SIGNAL(clicked()), SLOT(slotFilename())); |
88 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); | 88 | connect(ok, SIGNAL(clicked()), SLOT(slotTransfer())); |
89 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); | 89 | connect(cancel, SIGNAL(clicked()), SLOT(slotCancel())); |
90 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); | 90 | connect(group, SIGNAL(clicked(int)), SLOT(slotMode(int))); |
91 | } | 91 | } |
92 | 92 | ||
93 | TransferDialog::~TransferDialog() | 93 | TransferDialog::~TransferDialog() |
94 | { | 94 | { |
95 | } | 95 | } |
96 | 96 | ||
97 | void TransferDialog::slotFilename() | 97 | void TransferDialog::slotFilename() |
98 | { | 98 | { |
99 | QString f; | 99 | QString f; |
100 | 100 | ||
101 | f = OFileDialog::getOpenFileName(0); | 101 | f = Opie::OFileDialog::getOpenFileName(0); |
102 | if(!f.isNull()) filename->setText(f); | 102 | if(!f.isNull()) filename->setText(f); |
103 | } | 103 | } |
104 | 104 | ||
105 | void TransferDialog::slotTransfer() | 105 | void TransferDialog::slotTransfer() |
106 | { | 106 | { |
107 | if((m_transfermode == id_send) && (filename->text().isEmpty())) | 107 | if((m_transfermode == id_send) && (filename->text().isEmpty())) |
108 | { | 108 | { |
109 | QMessageBox::information(this, | 109 | QMessageBox::information(this, |
110 | QObject::tr("Attention"), | 110 | QObject::tr("Attention"), |
111 | QObject::tr("No file has been specified.")); | 111 | QObject::tr("No file has been specified.")); |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | 114 | ||
115 | ok->setEnabled(false); | 115 | ok->setEnabled(false); |
116 | 116 | ||
117 | cleanup(); | 117 | cleanup(); |
118 | m_autocleanup = 0; | 118 | m_autocleanup = 0; |
119 | 119 | ||
120 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); | 120 | if(m_transfermode == id_send) statusbar->setText(QObject::tr("Sending...")); |
121 | else statusbar->setText(QObject::tr("Receiving...")); | 121 | else statusbar->setText(QObject::tr("Receiving...")); |
122 | 122 | ||
123 | if(m_transfermode == id_send) | 123 | if(m_transfermode == id_send) |
124 | { | 124 | { |
125 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); | 125 | m_lay = m_win->factory()->newFileTransfer(protocol->currentText(), m_win->currentSession()->layer()); |
126 | m_lay->sendFile(filename->text()); | 126 | m_lay->sendFile(filename->text()); |
127 | 127 | ||
128 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 128 | connect(m_lay, SIGNAL(progress(const QString&, int, int, int, int, int)), |
129 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 129 | SLOT(slotProgress(const QString&, int, int, int, int, int))); |
130 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 130 | connect(m_lay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); |
131 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); | 131 | connect(m_lay, SIGNAL(sent()), SLOT(slotSent())); |
132 | } | 132 | } |
133 | else | 133 | else |
134 | { | 134 | { |
135 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); | 135 | m_recvlay = m_win->factory()->newReceive(protocol->currentText(), m_win->currentSession()->layer()); |
136 | m_recvlay->receive(); | 136 | m_recvlay->receive(); |
137 | 137 | ||
138 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), | 138 | connect(m_recvlay, SIGNAL(progress(const QString&, int, int, int, int, int)), |
139 | SLOT(slotProgress(const QString&, int, int, int, int, int))); | 139 | SLOT(slotProgress(const QString&, int, int, int, int, int))); |
140 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); | 140 | connect(m_recvlay, SIGNAL(error(int, const QString&)), SLOT(slotError(int, const QString&))); |
141 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); | 141 | connect(m_recvlay, SIGNAL(received(const QString&)), SLOT(slotReceived(const QString&))); |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | void TransferDialog::cleanup() | 145 | void TransferDialog::cleanup() |
146 | { | 146 | { |
147 | if(m_lay) | 147 | if(m_lay) |
148 | { | 148 | { |
149 | m_lay->cancel(); | 149 | m_lay->cancel(); |
150 | delete m_lay; | 150 | delete m_lay; |
151 | m_lay = 0l; | 151 | m_lay = 0l; |
152 | } | 152 | } |
153 | if(m_recvlay) | 153 | if(m_recvlay) |
154 | { | 154 | { |
155 | m_recvlay->cancel(); | 155 | m_recvlay->cancel(); |
156 | delete m_recvlay; | 156 | delete m_recvlay; |
157 | m_recvlay = 0l; | 157 | m_recvlay = 0l; |
158 | } | 158 | } |
159 | } | 159 | } |
160 | 160 | ||
161 | void TransferDialog::slotCancel() | 161 | void TransferDialog::slotCancel() |
162 | { | 162 | { |
163 | ok->setEnabled(true); | 163 | ok->setEnabled(true); |
164 | statusbar->setText(QObject::tr("Ready")); | 164 | statusbar->setText(QObject::tr("Ready")); |
165 | 165 | ||
166 | if((m_lay) || (m_recvlay)) | 166 | if((m_lay) || (m_recvlay)) |
167 | { | 167 | { |
168 | cleanup(); | 168 | cleanup(); |
169 | if(m_autocleanup) | 169 | if(m_autocleanup) |
170 | { | 170 | { |
171 | m_running = false; | 171 | m_running = false; |
172 | close(); | 172 | close(); |
173 | } | 173 | } |
174 | else | 174 | else |
175 | { | 175 | { |
176 | QMessageBox::information(this, | 176 | QMessageBox::information(this, |
177 | QObject::tr("Cancelled"), | 177 | QObject::tr("Cancelled"), |
178 | QObject::tr("The file transfer has been cancelled.")); | 178 | QObject::tr("The file transfer has been cancelled.")); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | else | 181 | else |
182 | { | 182 | { |
183 | m_running = false; | 183 | m_running = false; |
184 | close(); | 184 | close(); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) | 188 | void TransferDialog::slotProgress(const QString& , int progress, int , int , int, int ) |
189 | { | 189 | { |
190 | progressbar->setProgress(progress); | 190 | progressbar->setProgress(progress); |
191 | } | 191 | } |
192 | 192 | ||
193 | void TransferDialog::slotError(int error, const QString& ) | 193 | void TransferDialog::slotError(int error, const QString& ) |
194 | { | 194 | { |
195 | statusbar->setText(QObject::tr("Ready")); | 195 | statusbar->setText(QObject::tr("Ready")); |
196 | 196 | ||
197 | switch(error) | 197 | switch(error) |
198 | { | 198 | { |
199 | case FileTransferLayer::NotSupported: | 199 | case FileTransferLayer::NotSupported: |
200 | QMessageBox::critical(this, | 200 | QMessageBox::critical(this, |
201 | QObject::tr("Error"), | 201 | QObject::tr("Error"), |
202 | QObject::tr("Operation not supported.")); | 202 | QObject::tr("Operation not supported.")); |
203 | break; | 203 | break; |
204 | case FileTransferLayer::StartError: | 204 | case FileTransferLayer::StartError: |
205 | QMessageBox::critical(this, | 205 | QMessageBox::critical(this, |
206 | QObject::tr("Error"), | 206 | QObject::tr("Error"), |
207 | QObject::tr("Transfer could not be started.")); | 207 | QObject::tr("Transfer could not be started.")); |
208 | break; | 208 | break; |
209 | case FileTransferLayer::NoError: | 209 | case FileTransferLayer::NoError: |
210 | QMessageBox::critical(this, | 210 | QMessageBox::critical(this, |
211 | QObject::tr("Error"), | 211 | QObject::tr("Error"), |
212 | QObject::tr("No error.")); | 212 | QObject::tr("No error.")); |
213 | break; | 213 | break; |
214 | case FileTransferLayer::Undefined: | 214 | case FileTransferLayer::Undefined: |
215 | QMessageBox::critical(this, | 215 | QMessageBox::critical(this, |
216 | QObject::tr("Error"), | 216 | QObject::tr("Error"), |
217 | QObject::tr("Undefined error occured.")); | 217 | QObject::tr("Undefined error occured.")); |
218 | break; | 218 | break; |
219 | case FileTransferLayer::Incomplete: | 219 | case FileTransferLayer::Incomplete: |
220 | QMessageBox::critical(this, | 220 | QMessageBox::critical(this, |
221 | QObject::tr("Error"), | 221 | QObject::tr("Error"), |
222 | QObject::tr("Incomplete transfer.")); | 222 | QObject::tr("Incomplete transfer.")); |
223 | break; | 223 | break; |
224 | case FileTransferLayer::Unknown: | 224 | case FileTransferLayer::Unknown: |
225 | default: | 225 | default: |
226 | QMessageBox::critical(this, | 226 | QMessageBox::critical(this, |
227 | QObject::tr("Error"), | 227 | QObject::tr("Error"), |
228 | QObject::tr("Unknown error occured.")); | 228 | QObject::tr("Unknown error occured.")); |
229 | break; | 229 | break; |
230 | } | 230 | } |
231 | 231 | ||
232 | m_autocleanup = 1; | 232 | m_autocleanup = 1; |
233 | } | 233 | } |
234 | 234 | ||
235 | void TransferDialog::slotSent() | 235 | void TransferDialog::slotSent() |
236 | { | 236 | { |
237 | progressbar->setProgress(100); | 237 | progressbar->setProgress(100); |
238 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); | 238 | QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been sent.")); |
239 | ok->setEnabled(true); | 239 | ok->setEnabled(true); |
240 | progressbar->setProgress(0); | 240 | progressbar->setProgress(0); |
241 | statusbar->setText(QObject::tr("Ready")); | 241 | statusbar->setText(QObject::tr("Ready")); |
242 | m_autocleanup = 1; | 242 | m_autocleanup = 1; |
243 | } | 243 | } |
244 | 244 | ||
245 | void TransferDialog::slotReceived(const QString& ) | 245 | void TransferDialog::slotReceived(const QString& ) |
246 | { | 246 | { |
247 | progressbar->setProgress(100); | 247 | progressbar->setProgress(100); |
248 | QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); | 248 | QMessageBox::information(this, QObject::tr("Received"), QObject::tr("File has been received.")); |
249 | //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); | 249 | //QMessageBox::information(this, QObject::tr("Sent"), QObject::tr("File has been received as %1.").arg(file)); |
250 | ok->setEnabled(true); | 250 | ok->setEnabled(true); |
251 | progressbar->setProgress(0); | 251 | progressbar->setProgress(0); |
252 | statusbar->setText(QObject::tr("Ready")); | 252 | statusbar->setText(QObject::tr("Ready")); |
253 | m_autocleanup = 1; | 253 | m_autocleanup = 1; |
254 | } | 254 | } |
255 | 255 | ||
256 | void TransferDialog::slotMode(int id) | 256 | void TransferDialog::slotMode(int id) |
257 | { | 257 | { |
258 | if(id == id_send) | 258 | if(id == id_send) |
259 | { | 259 | { |
260 | selector->setEnabled(true); | 260 | selector->setEnabled(true); |
261 | filename->setEnabled(true); | 261 | filename->setEnabled(true); |
262 | } | 262 | } |
263 | else | 263 | else |
264 | { | 264 | { |
265 | selector->setEnabled(false); | 265 | selector->setEnabled(false); |
266 | filename->setEnabled(false); | 266 | filename->setEnabled(false); |
267 | } | 267 | } |
268 | m_transfermode = id; | 268 | m_transfermode = id; |
269 | } | 269 | } |
270 | 270 | ||
271 | bool TransferDialog::isRunning() | 271 | bool TransferDialog::isRunning() |
272 | { | 272 | { |
273 | return m_running; | 273 | return m_running; |
274 | } | 274 | } |
275 | 275 | ||