summaryrefslogtreecommitdiff
authorjosef <josef>2002-10-18 11:36:34 (UTC)
committer josef <josef>2002-10-18 11:36:34 (UTC)
commit24c0ae04669e94d554fe8ef49888ffb5a6a00656 (patch) (unidiff)
tree96e48d488555d789de7ac73797d016c7e8262956
parent3484cd354a54bcc20d389b123423028e09d884df (diff)
downloadopie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.zip
opie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.tar.gz
opie-24c0ae04669e94d554fe8ef49888ffb5a6a00656.tar.bz2
- increase dialog responsiveness
The higher the value (currently 100) is, the faster the modem dials, but lower values guarantee a smoother UI.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/opie-console/dialer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/noncore/apps/opie-console/dialer.cpp b/noncore/apps/opie-console/dialer.cpp
index 7bf9352..51d4093 100644
--- a/noncore/apps/opie-console/dialer.cpp
+++ b/noncore/apps/opie-console/dialer.cpp
@@ -211,56 +211,57 @@ qWarning("Sending: '%s'", m.latin1());
211 if(termination == "\n") m = m + "\n"; 211 if(termination == "\n") m = m + "\n";
212 else if(termination == "\r") m = m + "\r"; 212 else if(termination == "\r") m = m + "\r";
213 else m = m + "\r\n"; 213 else m = m + "\r\n";
214 214
215 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit())); 215 bytes = ::write(m_fd, m.local8Bit(), strlen(m.local8Bit()));
216 if(bytes < 0) 216 if(bytes < 0)
217 { 217 {
218 reset(); 218 reset();
219 } 219 }
220} 220}
221 221
222QString Dialer::receive() 222QString Dialer::receive()
223{ 223{
224 QString buf; 224 QString buf;
225 char buffer[1024]; 225 char buffer[1024];
226 int ret; 226 int ret;
227 227 int counter;
228 qApp->processEvents();
229 228
230 while(1) 229 while(1)
231 { 230 {
232 ret = ::read(m_fd, buffer, sizeof(buffer)); 231 ret = ::read(m_fd, buffer, sizeof(buffer));
233 232
234 if(ret > 0) 233 if(ret > 0)
235 { 234 {
236 for(int i = 0; i < ret; i++) 235 for(int i = 0; i < ret; i++)
237 buffer[i] = buffer[i] & 0x7F; 236 buffer[i] = buffer[i] & 0x7F;
238 buffer[ret] = 0; 237 buffer[ret] = 0;
239qWarning("Got: '%s'", buffer); 238qWarning("Got: '%s'", buffer);
240 buf.append(QString(buffer)); 239 buf.append(QString(buffer));
241 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY"))) 240 if(buf.contains("OK") || buf.contains("ERROR") || buf.contains("CONNECT") || (buf.contains("BUSY")))
242{ 241{
243qWarning("Receiving: '%s'", buf.latin1()); 242qWarning("Receiving: '%s'", buf.latin1());
244 return buf; 243 return buf;
245} 244}
246 } 245 }
247 else if(ret < 0) 246 else if(ret < 0)
248 { 247 {
249 if(errno != EAGAIN) reset(); 248 if(errno != EAGAIN) reset();
249 else if(!(counter++ % 100)) qApp->processEvents();
250 } 250 }
251 else if(!(counter++ % 100)) qApp->processEvents();
251 } 252 }
252 253
253 return QString::null; 254 return QString::null;
254} 255}
255 256
256void Dialer::switchState(int newstate) 257void Dialer::switchState(int newstate)
257{ 258{
258 int oldstate = state; 259 int oldstate = state;
259 state = newstate; 260 state = newstate;
260 261
261 switch(state) 262 switch(state)
262 { 263 {
263 case state_cancel: 264 case state_cancel:
264 status->setText(QObject::tr("Cancelling...")); 265 status->setText(QObject::tr("Cancelling..."));
265 progress->setProgress(0); 266 progress->setProgress(0);
266 break; 267 break;