-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 174 | ||||
-rw-r--r-- | noncore/tools/opie-sh/opie-sh.cpp | 20 | ||||
-rw-r--r-- | noncore/tools/remote/learntab.cpp | 11 | ||||
-rw-r--r-- | noncore/tools/remote/remote.cpp | 10 |
4 files changed, 138 insertions, 77 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index 532ee40..e869317 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -5,47 +5,47 @@ | |||
5 | ** by: L. J. Potter | 5 | ** by: L. J. Potter |
6 | ** | 6 | ** |
7 | ****************************************************************************/ | 7 | ****************************************************************************/ |
8 | 8 | ||
9 | #include "formatter.h" | 9 | #include "formatter.h" |
10 | #include "inputDialog.h" | 10 | #include "inputDialog.h" |
11 | #include "output.h" | 11 | #include "output.h" |
12 | 12 | ||
13 | #include <qmenubar.h> | 13 | /* OPIE */ |
14 | #include <qpe/qpetoolbar.h> | 14 | #include <qpe/qpetoolbar.h> |
15 | #include <qpe/qpeapplication.h> | 15 | #include <qpe/qpeapplication.h> |
16 | #include <qpe/resource.h> | 16 | #include <qpe/resource.h> |
17 | #include <qpe/config.h> | 17 | #include <qpe/config.h> |
18 | #include <qpe/mimetype.h> | 18 | #include <qpe/mimetype.h> |
19 | #include <qpe/qcopenvelope_qws.h> | 19 | #include <qpe/qcopenvelope_qws.h> |
20 | #include <qpe/storage.h> | 20 | #include <qpe/storage.h> |
21 | 21 | ||
22 | /* QT */ | ||
23 | #include <qmenubar.h> | ||
22 | #include <qmultilineedit.h> | 24 | #include <qmultilineedit.h> |
23 | #include <qstring.h> | 25 | #include <qstring.h> |
24 | #include <qlist.h> | 26 | #include <qlist.h> |
25 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
26 | #include <qdir.h> | 28 | #include <qdir.h> |
27 | #include <qfile.h> | 29 | #include <qfile.h> |
28 | |||
29 | #include <qtstream.h> | 30 | #include <qtstream.h> |
30 | |||
31 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
32 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
33 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | |||
36 | #include <qlabel.h> | 35 | #include <qlabel.h> |
37 | #include <qlineedit.h> | 36 | #include <qlineedit.h> |
38 | #include <qpushbutton.h> | 37 | #include <qpushbutton.h> |
39 | #include <qtabwidget.h> | 38 | #include <qtabwidget.h> |
40 | #include <qwidget.h> | 39 | #include <qwidget.h> |
41 | #include <qlayout.h> | 40 | #include <qlayout.h> |
42 | #include <qvariant.h> | 41 | #include <qvariant.h> |
43 | 42 | ||
43 | /* STD */ | ||
44 | #include <unistd.h> | 44 | #include <unistd.h> |
45 | #include <stdio.h> | 45 | #include <stdio.h> |
46 | #include <stdlib.h> | 46 | #include <stdlib.h> |
47 | #include <sys/vfs.h> | 47 | #include <sys/vfs.h> |
48 | #include <mntent.h> | 48 | #include <mntent.h> |
49 | #include <string.h> | 49 | #include <string.h> |
50 | #include <errno.h> | 50 | #include <errno.h> |
51 | 51 | ||
@@ -163,21 +163,21 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool | |||
163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); | 163 | connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); |
164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); | 164 | connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); |
165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); | 165 | connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); |
166 | 166 | ||
167 | 167 | ||
168 | fillCombos(); | 168 | fillCombos(); |
169 | } | 169 | } |
170 | 170 | ||
171 | FormatterApp::~FormatterApp() { | 171 | FormatterApp::~FormatterApp() |
172 | 172 | {} | |
173 | } | ||
174 | 173 | ||
175 | void FormatterApp::doFormat() { | 174 | void FormatterApp::doFormat() |
175 | { | ||
176 | int err=0; | 176 | int err=0; |
177 | Output *outDlg; | 177 | Output *outDlg; |
178 | QString umountS, remountS; | 178 | QString umountS, remountS; |
179 | QString text = storageComboBox->currentText(); | 179 | QString text = storageComboBox->currentText(); |
180 | QString currentText = storageComboBox->currentText(); | 180 | QString currentText = storageComboBox->currentText(); |
181 | QString cmd; | 181 | QString cmd; |
182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 182 | QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); | 183 | QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); |
@@ -185,121 +185,140 @@ void FormatterApp::doFormat() { | |||
185 | 185 | ||
186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap | 186 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap |
187 | #else | 187 | #else |
188 | currentText = diskDevice = "/dev/fd0"; | 188 | currentText = diskDevice = "/dev/fd0"; |
189 | umountS = "umount -v /floppy 2>&1"; | 189 | umountS = "umount -v /floppy 2>&1"; |
190 | remountS = "mount -v /floppy 2>&1"; | 190 | remountS = "mount -v /floppy 2>&1"; |
191 | #endif | 191 | #endif |
192 | 192 | ||
193 | if( currentText.find("CF",0,TRUE) != -1) { | 193 | if( currentText.find("CF",0,TRUE) != -1) |
194 | { | ||
194 | umountS = "umount "; | 195 | umountS = "umount "; |
195 | remountS = "mount "; | 196 | remountS = "mount "; |
196 | 197 | ||
197 | // umountS = "/sbin/cardctl eject"; | 198 | // umountS = "/sbin/cardctl eject"; |
198 | // remountS = "/sbin/cardctl insert"; | 199 | // remountS = "/sbin/cardctl insert"; |
199 | } | 200 | } |
200 | if( currentText.find("SD",0,TRUE) != -1) { | 201 | if( currentText.find("SD",0,TRUE) != -1) |
202 | { | ||
201 | umountS = "umount "; | 203 | umountS = "umount "; |
202 | remountS = "mount "; | 204 | remountS = "mount "; |
203 | // umountS = "/etc/sdcontrol compeject"; | 205 | // umountS = "/etc/sdcontrol compeject"; |
204 | // remountS = "/etc/sdcontrol insert"; | 206 | // remountS = "/etc/sdcontrol insert"; |
205 | } | 207 | } |
206 | 208 | ||
207 | switch ( QMessageBox::warning(this,tr("Format?") | 209 | switch ( QMessageBox::warning(this,tr("Format?") |
208 | , tr("Really format\n") +diskName+" "+ currentText + | 210 | , tr("Really format\n") +diskName+" "+ currentText + |
209 | tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) | 211 | tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) |
210 | ,tr("Yes") | 212 | ,tr("Yes") |
211 | ,tr("No") | 213 | ,tr("No") |
212 | ,0 | 214 | ,0 |
213 | ,1 | 215 | ,1 |
214 | ,1) ) { | 216 | ,1) ) |
215 | case 0: { | 217 | { |
218 | case 0: | ||
219 | { | ||
216 | if(fs == "vfat") | 220 | if(fs == "vfat") |
217 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; | 221 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; |
218 | else if(fs == "ext2") | 222 | else if(fs == "ext2") |
219 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; | 223 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; |
220 | else { | 224 | else |
225 | { | ||
221 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); | 226 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); |
222 | break; | 227 | break; |
223 | } | 228 | } |
224 | // cmd = "ls -l"; | 229 | // cmd = "ls -l"; |
225 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 230 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
226 | outDlg->showMaximized(); | 231 | QPEApplication::showDialog( outDlg); |
227 | outDlg->show(); | ||
228 | qApp->processEvents(); | 232 | qApp->processEvents(); |
229 | FILE *fp; | 233 | FILE *fp; |
230 | char line[130]; | 234 | char line[130]; |
231 | 235 | ||
232 | 236 | ||
233 | outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); | 237 | outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); |
234 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 238 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
235 | 239 | ||
236 | sleep(1); | 240 | sleep(1); |
237 | qDebug("Command is "+umountS); | 241 | qDebug("Command is "+umountS); |
238 | fp = popen( (const char *) umountS, "r"); | 242 | fp = popen( (const char *) umountS, "r"); |
239 | // qDebug("%d", fp); | 243 | // qDebug("%d", fp); |
240 | if ( !fp ) { | 244 | if ( !fp ) |
245 | { | ||
241 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); | 246 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); |
242 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 247 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
243 | pclose(fp); | 248 | pclose(fp); |
244 | return; | 249 | return; |
245 | } else { | 250 | } |
251 | else | ||
252 | { | ||
246 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 253 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
247 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 254 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
248 | while ( fgets( line, sizeof line, fp)) { | 255 | while ( fgets( line, sizeof line, fp)) |
249 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 256 | { |
257 | if( ((QString)line).find("busy",0,TRUE) != -1) | ||
258 | { | ||
250 | qDebug("Could not find '" + umountS); | 259 | qDebug("Could not find '" + umountS); |
251 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 260 | QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
252 | pclose(fp); | 261 | pclose(fp); |
253 | return; | 262 | return; |
254 | } else { | 263 | } |
264 | else | ||
265 | { | ||
255 | QString lineStr = line; | 266 | QString lineStr = line; |
256 | lineStr=lineStr.left(lineStr.length()-1); | 267 | lineStr=lineStr.left(lineStr.length()-1); |
257 | outDlg->OutputEdit->append(lineStr); | 268 | outDlg->OutputEdit->append(lineStr); |
258 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 269 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
259 | } | 270 | } |
260 | } | 271 | } |
261 | } | 272 | } |
262 | pclose(fp); | 273 | pclose(fp); |
263 | 274 | ||
264 | qDebug("Command would be: "+cmd); | 275 | qDebug("Command would be: "+cmd); |
265 | outDlg->OutputEdit->append( tr("Trying to format.") ); | 276 | outDlg->OutputEdit->append( tr("Trying to format.") ); |
266 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 277 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
267 | 278 | ||
268 | fp = popen( (const char *) cmd, "r"); | 279 | fp = popen( (const char *) cmd, "r"); |
269 | while ( fgets( line, sizeof line, fp)) { | 280 | while ( fgets( line, sizeof line, fp)) |
270 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 281 | { |
282 | if( ((QString)line).find("No such device",0,TRUE) != -1) | ||
283 | { | ||
271 | qDebug("No such device '" + umountS); | 284 | qDebug("No such device '" + umountS); |
272 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 285 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
273 | pclose(fp); | 286 | pclose(fp); |
274 | // outDlg->OutputEdit->append("No such device"); | 287 | // outDlg->OutputEdit->append("No such device"); |
275 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 288 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
276 | return; | 289 | return; |
277 | } else { | 290 | } |
291 | else | ||
292 | { | ||
278 | QString lineStr = line; | 293 | QString lineStr = line; |
279 | lineStr=lineStr.left(lineStr.length()-1); | 294 | lineStr=lineStr.left(lineStr.length()-1); |
280 | outDlg->OutputEdit->append(lineStr); | 295 | outDlg->OutputEdit->append(lineStr); |
281 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 296 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
282 | } | 297 | } |
283 | } | 298 | } |
284 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 299 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
285 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 300 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
286 | pclose(fp); | 301 | pclose(fp); |
287 | 302 | ||
288 | outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); | 303 | outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); |
289 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 304 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
290 | fp = popen( (const char *) remountS, "r"); | 305 | fp = popen( (const char *) remountS, "r"); |
291 | if ( !fp) { | 306 | if ( !fp) |
307 | { | ||
292 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); | 308 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); |
293 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); | 309 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); |
294 | 310 | ||
295 | } else { | 311 | } |
312 | else | ||
313 | { | ||
296 | outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); | 314 | outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); |
297 | while ( fgets( line, sizeof line, fp)) { | 315 | while ( fgets( line, sizeof line, fp)) |
316 | { | ||
298 | QString lineStr = line; | 317 | QString lineStr = line; |
299 | lineStr=lineStr.left(lineStr.length()-1); | 318 | lineStr=lineStr.left(lineStr.length()-1); |
300 | outDlg->OutputEdit->append(lineStr); | 319 | outDlg->OutputEdit->append(lineStr); |
301 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 320 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
302 | } | 321 | } |
303 | } | 322 | } |
304 | pclose(fp); | 323 | pclose(fp); |
305 | sleep(1); | 324 | sleep(1); |
@@ -309,83 +328,91 @@ void FormatterApp::doFormat() { | |||
309 | // outDlg->close(); | 328 | // outDlg->close(); |
310 | // if(outDlg) | 329 | // if(outDlg) |
311 | // delete outDlg; | 330 | // delete outDlg; |
312 | } | 331 | } |
313 | break; | 332 | break; |
314 | }; | 333 | }; |
315 | } | 334 | } |
316 | 335 | ||
317 | bool FormatterApp::doFdisk() { | 336 | bool FormatterApp::doFdisk() |
337 | { | ||
318 | return FALSE; | 338 | return FALSE; |
319 | 339 | ||
320 | } | 340 | } |
321 | 341 | ||
322 | void FormatterApp::fillCombos() { | 342 | void FormatterApp::fillCombos() |
343 | { | ||
323 | 344 | ||
324 | StorageInfo storageInfo; | 345 | StorageInfo storageInfo; |
325 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 346 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
326 | QListIterator<FileSystem> it ( fs ); | 347 | QListIterator<FileSystem> it ( fs ); |
327 | QString storage; | 348 | QString storage; |
328 | for( ; it.current(); ++it ){ | 349 | for( ; it.current(); ++it ) |
350 | { | ||
329 | const QString name = (*it)->name(); | 351 | const QString name = (*it)->name(); |
330 | const QString path = (*it)->path(); | 352 | const QString path = (*it)->path(); |
331 | const QString disk = (*it)->disk(); | 353 | const QString disk = (*it)->disk(); |
332 | const QString options = (*it)->options(); | 354 | const QString options = (*it)->options(); |
333 | if( name.find( tr("Internal"),0,TRUE) == -1) { | 355 | if( name.find( tr("Internal"),0,TRUE) == -1) |
356 | { | ||
334 | storageComboBox->insertItem(name +" -> "+disk); | 357 | storageComboBox->insertItem(name +" -> "+disk); |
335 | } | 358 | } |
336 | // deviceComboBox->insertItem(disk); | 359 | // deviceComboBox->insertItem(disk); |
337 | } | 360 | } |
338 | parsetab("/etc/mtab"); | 361 | parsetab("/etc/mtab"); |
339 | // parsetab("/etc/fstab"); | 362 | // parsetab("/etc/fstab"); |
340 | fileSystemsCombo->insertStringList( fsList,-1); | 363 | fileSystemsCombo->insertStringList( fsList,-1); |
341 | deviceComboBox->insertStringList( deviceList,-1); | 364 | deviceComboBox->insertStringList( deviceList,-1); |
342 | storageComboSelected(0); | 365 | storageComboSelected(0); |
343 | deviceComboSelected(0); | 366 | deviceComboSelected(0); |
344 | } | 367 | } |
345 | 368 | ||
346 | 369 | ||
347 | void FormatterApp::fsComboSelected(int ) { | 370 | void FormatterApp::fsComboSelected(int ) |
371 | {} | ||
348 | 372 | ||
349 | } | 373 | void FormatterApp::storageComboSelected(int index ) |
350 | 374 | { | |
351 | void FormatterApp::storageComboSelected(int index ) { | ||
352 | 375 | ||
353 | QString currentText = storageComboBox->text(index); | 376 | QString currentText = storageComboBox->text(index); |
354 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); | 377 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); |
355 | 378 | ||
356 | TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); | 379 | TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); |
357 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 380 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
358 | 381 | ||
359 | QString fsType = getFileSystemType((const QString &) currentText); | 382 | QString fsType = getFileSystemType((const QString &) currentText); |
360 | // qDebug(fsType); | 383 | // qDebug(fsType); |
361 | for(int i = 0; i < fileSystemsCombo->count(); i++) { | 384 | for(int i = 0; i < fileSystemsCombo->count(); i++) |
385 | { | ||
362 | if( fsType == fileSystemsCombo->text(i)) | 386 | if( fsType == fileSystemsCombo->text(i)) |
363 | fileSystemsCombo->setCurrentItem(i); | 387 | fileSystemsCombo->setCurrentItem(i); |
364 | } | 388 | } |
365 | // deviceComboSelected(index); | 389 | // deviceComboSelected(index); |
366 | } | 390 | } |
367 | 391 | ||
368 | void FormatterApp::deviceComboSelected(int index) { | 392 | void FormatterApp::deviceComboSelected(int index) |
393 | { | ||
369 | 394 | ||
370 | StorageInfo storageInfo; | 395 | StorageInfo storageInfo; |
371 | QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; | 396 | QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; |
372 | 397 | ||
373 | selectedText = deviceComboBox->text(index); | 398 | selectedText = deviceComboBox->text(index); |
374 | 399 | ||
375 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 400 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
376 | QListIterator<FileSystem> it ( fs ); | 401 | QListIterator<FileSystem> it ( fs ); |
377 | QString storage; | 402 | QString storage; |
378 | for( ; it.current(); ++it ){ | 403 | for( ; it.current(); ++it ) |
404 | { | ||
379 | const QString name = (*it)->name(); | 405 | const QString name = (*it)->name(); |
380 | const QString path = (*it)->path(); | 406 | const QString path = (*it)->path(); |
381 | const QString disk = (*it)->disk(); | 407 | const QString disk = (*it)->disk(); |
382 | // const QString options = (*it)->options(); | 408 | // const QString options = (*it)->options(); |
383 | if( selectedText == disk) { | 409 | if( selectedText == disk) |
410 | { | ||
384 | diskS = disk; nameS= name; | 411 | diskS = disk; nameS= name; |
385 | mountPointLineEdit->setText(path); | 412 | mountPointLineEdit->setText(path); |
386 | long mult = (*it)->blockSize() / 1024; | 413 | long mult = (*it)->blockSize() / 1024; |
387 | long div = 1024 / (*it)->blockSize(); | 414 | long div = 1024 / (*it)->blockSize(); |
388 | if ( !mult ) mult = 1; | 415 | if ( !mult ) mult = 1; |
389 | if ( !div ) div = 1; | 416 | if ( !div ) div = 1; |
390 | long total = (*it)->totalBlocks() * mult / div; | 417 | long total = (*it)->totalBlocks() * mult / div; |
391 | long totalMb = total/1024; | 418 | long totalMb = total/1024; |
@@ -400,38 +427,42 @@ void FormatterApp::deviceComboSelected(int index) { | |||
400 | } | 427 | } |
401 | fsType = getFileSystemType((const QString &)selectedText); | 428 | fsType = getFileSystemType((const QString &)selectedText); |
402 | 429 | ||
403 | TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); | 430 | TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); |
404 | TextLabel5->setTextFormat( Qt::RichText ); | 431 | TextLabel5->setTextFormat( Qt::RichText ); |
405 | // storageComboSelected(0); | 432 | // storageComboSelected(0); |
406 | } | 433 | } |
407 | 434 | ||
408 | void FormatterApp::cleanUp() { | 435 | void FormatterApp::cleanUp() |
409 | 436 | {} | |
410 | } | ||
411 | 437 | ||
412 | 438 | ||
413 | void FormatterApp::editFstab() { | 439 | void FormatterApp::editFstab() |
440 | { | ||
414 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); | 441 | QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); |
415 | e << (const QString &)"/etc/fstab"; | 442 | e << (const QString &)"/etc/fstab"; |
416 | } | 443 | } |
417 | 444 | ||
418 | void FormatterApp::parsetab(const QString &fileName) { | 445 | void FormatterApp::parsetab(const QString &fileName) |
446 | { | ||
419 | 447 | ||
420 | fileSystemTypeList.clear(); | 448 | fileSystemTypeList.clear(); |
421 | fsList.clear(); | 449 | fsList.clear(); |
422 | struct mntent *me; | 450 | struct mntent *me; |
423 | // if(fileName == "/etc/mtab") { | 451 | // if(fileName == "/etc/mtab") { |
424 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); | 452 | FILE *mntfp = setmntent( fileName.latin1(), "r" ); |
425 | if ( mntfp ) { | 453 | if ( mntfp ) |
426 | while ( (me = getmntent( mntfp )) != 0 ) { | 454 | { |
455 | while ( (me = getmntent( mntfp )) != 0 ) | ||
456 | { | ||
427 | QString deviceName = me->mnt_fsname; | 457 | QString deviceName = me->mnt_fsname; |
428 | QString filesystemType = me->mnt_type; | 458 | QString filesystemType = me->mnt_type; |
429 | if(deviceName != "none") { | 459 | if(deviceName != "none") |
460 | { | ||
430 | if( fsList.contains(filesystemType) == 0 | 461 | if( fsList.contains(filesystemType) == 0 |
431 | & filesystemType.find("proc",0,TRUE) == -1 | 462 | & filesystemType.find("proc",0,TRUE) == -1 |
432 | & filesystemType.find("cramfs",0,TRUE) == -1 | 463 | & filesystemType.find("cramfs",0,TRUE) == -1 |
433 | & filesystemType.find("auto",0,TRUE) == -1) | 464 | & filesystemType.find("auto",0,TRUE) == -1) |
434 | fsList << filesystemType; | 465 | fsList << filesystemType; |
435 | deviceList << deviceName; | 466 | deviceList << deviceName; |
436 | qDebug(deviceName+"::"+filesystemType); | 467 | qDebug(deviceName+"::"+filesystemType); |
437 | fileSystemTypeList << deviceName+"::"+filesystemType; | 468 | fileSystemTypeList << deviceName+"::"+filesystemType; |
@@ -459,31 +490,35 @@ void FormatterApp::parsetab(const QString &fileName) { | |||
459 | // QString filesystemType= s.left(0,s.find(BLANK) ); | 490 | // QString filesystemType= s.left(0,s.find(BLANK) ); |
460 | // } | 491 | // } |
461 | // } | 492 | // } |
462 | // } | 493 | // } |
463 | // f.close(); | 494 | // f.close(); |
464 | // } | 495 | // } |
465 | } | 496 | } |
466 | 497 | ||
467 | QString FormatterApp::getFileSystemType(const QString ¤tText) { | 498 | QString FormatterApp::getFileSystemType(const QString ¤tText) |
499 | { | ||
468 | 500 | ||
469 | parsetab("/etc/mtab"); //why did TT forget filesystem type? | 501 | parsetab("/etc/mtab"); //why did TT forget filesystem type? |
470 | 502 | ||
471 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { | 503 | for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) |
504 | { | ||
472 | QString temp = (*it); | 505 | QString temp = (*it); |
473 | if( temp.find( currentText,0,TRUE) != -1) { | 506 | if( temp.find( currentText,0,TRUE) != -1) |
507 | { | ||
474 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); | 508 | return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); |
475 | // qDebug(fsType); | 509 | // qDebug(fsType); |
476 | } | 510 | } |
477 | } | 511 | } |
478 | return ""; | 512 | return ""; |
479 | } | 513 | } |
480 | 514 | ||
481 | bool FormatterApp::doFsck() { | 515 | bool FormatterApp::doFsck() |
516 | { | ||
482 | 517 | ||
483 | Output *outDlg; | 518 | Output *outDlg; |
484 | QString selectedDevice; | 519 | QString selectedDevice; |
485 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) | 520 | // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
486 | selectedDevice = deviceComboBox->currentText(); | 521 | selectedDevice = deviceComboBox->currentText(); |
487 | QString mountPoint = mountPointLineEdit->text(); | 522 | QString mountPoint = mountPointLineEdit->text(); |
488 | QString umountS = "umount -v "+mountPoint+" 2>&1"; | 523 | QString umountS = "umount -v "+mountPoint+" 2>&1"; |
489 | QString remountS = "mount -v "+mountPoint+" 2>&1"; | 524 | QString remountS = "mount -v "+mountPoint+" 2>&1"; |
@@ -499,63 +534,73 @@ bool FormatterApp::doFsck() { | |||
499 | QString fsType = getFileSystemType((const QString &)selectedDevice); | 534 | QString fsType = getFileSystemType((const QString &)selectedDevice); |
500 | QString cmd; | 535 | QString cmd; |
501 | qDebug( selectedDevice +" "+ fsType); | 536 | qDebug( selectedDevice +" "+ fsType); |
502 | if(fsType == "vfat") cmd = "dosfsck -vy "; | 537 | if(fsType == "vfat") cmd = "dosfsck -vy "; |
503 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; | 538 | if(fsType == "ext2") cmd = "e2fsck -cpvy "; |
504 | cmd += selectedDevice + " 2>&1"; | 539 | cmd += selectedDevice + " 2>&1"; |
505 | 540 | ||
506 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 541 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
507 | outDlg->showMaximized(); | 542 | QPEApplication::showDialog( outDlg ); |
508 | outDlg->show(); | ||
509 | qApp->processEvents(); | 543 | qApp->processEvents(); |
510 | FILE *fp; | 544 | FILE *fp; |
511 | char line[130]; | 545 | char line[130]; |
512 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 546 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
513 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 547 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
514 | 548 | ||
515 | sleep(1); | 549 | sleep(1); |
516 | // qDebug("Command is "+umountS); | 550 | // qDebug("Command is "+umountS); |
517 | fp = popen( (const char *) umountS, "r"); | 551 | fp = popen( (const char *) umountS, "r"); |
518 | // qDebug("%d", fp); | 552 | // qDebug("%d", fp); |
519 | if ( !fp ) { | 553 | if ( !fp ) |
554 | { | ||
520 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 555 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
521 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 556 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
522 | pclose(fp); | 557 | pclose(fp); |
523 | return false; | 558 | return false; |
524 | } else { | 559 | } |
560 | else | ||
561 | { | ||
525 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 562 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
526 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 563 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
527 | while ( fgets( line, sizeof line, fp)) { | 564 | while ( fgets( line, sizeof line, fp)) |
528 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 565 | { |
566 | if( ((QString)line).find("busy",0,TRUE) != -1) | ||
567 | { | ||
529 | qDebug("Could not find '" + umountS); | 568 | qDebug("Could not find '" + umountS); |
530 | QMessageBox::warning( this, tr("Formatter"), | 569 | QMessageBox::warning( this, tr("Formatter"), |
531 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 570 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
532 | pclose(fp); | 571 | pclose(fp); |
533 | return false; | 572 | return false; |
534 | } else { | 573 | } |
574 | else | ||
575 | { | ||
535 | QString lineStr = line; | 576 | QString lineStr = line; |
536 | lineStr=lineStr.left(lineStr.length()-1); | 577 | lineStr=lineStr.left(lineStr.length()-1); |
537 | outDlg->OutputEdit->append(lineStr); | 578 | outDlg->OutputEdit->append(lineStr); |
538 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 579 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
539 | } | 580 | } |
540 | } | 581 | } |
541 | } | 582 | } |
542 | pclose(fp); | 583 | pclose(fp); |
543 | ///////////////////////////////////// | 584 | ///////////////////////////////////// |
544 | fp = popen( (const char *) cmd, "r"); | 585 | fp = popen( (const char *) cmd, "r"); |
545 | while ( fgets( line, sizeof line, fp)) { | 586 | while ( fgets( line, sizeof line, fp)) |
546 | if( ((QString)line).find("No such device",0,TRUE) != -1) { | 587 | { |
588 | if( ((QString)line).find("No such device",0,TRUE) != -1) | ||
589 | { | ||
547 | qDebug("No such device '" + umountS); | 590 | qDebug("No such device '" + umountS); |
548 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); | 591 | QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); |
549 | pclose(fp); | 592 | pclose(fp); |
550 | // outDlg->OutputEdit->append("No such device"); | 593 | // outDlg->OutputEdit->append("No such device"); |
551 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 594 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
552 | return false; | 595 | return false; |
553 | } else { | 596 | } |
597 | else | ||
598 | { | ||
554 | QString lineStr = line; | 599 | QString lineStr = line; |
555 | lineStr=lineStr.left(lineStr.length()-1); | 600 | lineStr=lineStr.left(lineStr.length()-1); |
556 | outDlg->OutputEdit->append(lineStr); | 601 | outDlg->OutputEdit->append(lineStr); |
557 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 602 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
558 | } | 603 | } |
559 | } | 604 | } |
560 | outDlg->OutputEdit->append(tr("You can now close the output window.")); | 605 | outDlg->OutputEdit->append(tr("You can now close the output window.")); |
561 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 606 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
@@ -563,22 +608,25 @@ bool FormatterApp::doFsck() { | |||
563 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 608 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
564 | pclose(fp); | 609 | pclose(fp); |
565 | 610 | ||
566 | ///////////////////////////////////////// | 611 | ///////////////////////////////////////// |
567 | 612 | ||
568 | return true; | 613 | return true; |
569 | } | 614 | } |
570 | 615 | ||
571 | bool FormatterApp::doFsckCheck() { | 616 | bool FormatterApp::doFsckCheck() |
617 | { | ||
572 | 618 | ||
573 | return FALSE; | 619 | return FALSE; |
574 | } | 620 | } |
575 | 621 | ||
576 | int FormatterApp::formatCheck(const QString &) { | 622 | int FormatterApp::formatCheck(const QString &) |
623 | { | ||
577 | 624 | ||
578 | return -1; | 625 | return -1; |
579 | } | 626 | } |
580 | 627 | ||
581 | int FormatterApp::runCommand(const QString &) { | 628 | int FormatterApp::runCommand(const QString &) |
629 | { | ||
582 | 630 | ||
583 | return -1; | 631 | return -1; |
584 | } | 632 | } |
diff --git a/noncore/tools/opie-sh/opie-sh.cpp b/noncore/tools/opie-sh/opie-sh.cpp index a353d3f..7d54a03 100644 --- a/noncore/tools/opie-sh/opie-sh.cpp +++ b/noncore/tools/opie-sh/opie-sh.cpp | |||
@@ -9,27 +9,33 @@ version. | |||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | |||
18 | #include "mbox.h" | ||
19 | #include "fviewer.h" | ||
20 | #include "inputdialog.h" | ||
21 | |||
22 | /* OPIE */ | ||
23 | #include <qpe/qpeapplication.h> | ||
24 | |||
25 | /* QT */ | ||
17 | #include <qstring.h> | 26 | #include <qstring.h> |
18 | #include <qstringlist.h> | 27 | #include <qstringlist.h> |
19 | #include <qpe/qpeapplication.h> | ||
20 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
21 | #include <qwidget.h> | 29 | #include <qwidget.h> |
22 | 30 | ||
31 | /* STD */ | ||
23 | #include <stdio.h> | 32 | #include <stdio.h> |
24 | 33 | ||
25 | #include "mbox.h" | ||
26 | #include "fviewer.h" | ||
27 | #include "inputdialog.h" | ||
28 | 34 | ||
29 | int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) | 35 | int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) |
30 | { | 36 | { |
31 | int i, type=0; | 37 | int i, type=0; |
32 | QString button0Text, button1Text, button2Text, string, title; | 38 | QString button0Text, button1Text, button2Text, string, title; |
33 | bool full=true; | 39 | bool full=true; |
34 | 40 | ||
35 | for(i=0; i<argc; i++) | 41 | for(i=0; i<argc; i++) |
@@ -79,17 +85,17 @@ int myMessageBox(int wi, int h, QWidget *w, int argc, QStringList args) | |||
79 | full = false; | 85 | full = false; |
80 | } | 86 | } |
81 | } | 87 | } |
82 | 88 | ||
83 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); | 89 | MBox *mbox = new MBox(wi, h, (int)type, title, string, &button0Text, &button1Text, &button2Text, w, (QString)"messagebox"); |
84 | if(full) | 90 | if(full) |
85 | { | 91 | { |
86 | w->setCaption(title); | 92 | w->setCaption(title); |
87 | w->showMaximized(); | 93 | QPEApplication::showWidget( w ); |
88 | } | 94 | } |
89 | //mbox->show(); | 95 | //mbox->show(); |
90 | switch(mbox->exec() ) | 96 | switch(mbox->exec() ) |
91 | { | 97 | { |
92 | case 0: | 98 | case 0: |
93 | return -1; | 99 | return -1; |
94 | case 1: | 100 | case 1: |
95 | return -1; | 101 | return -1; |
@@ -156,17 +162,17 @@ int fileviewer(QPEApplication *a, int argc, QStringList args) | |||
156 | 162 | ||
157 | if(args[i] == "-t") | 163 | if(args[i] == "-t") |
158 | { | 164 | { |
159 | title = args[i+1]; | 165 | title = args[i+1]; |
160 | } | 166 | } |
161 | } | 167 | } |
162 | FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); | 168 | FViewer *fview = new FViewer(icon, filename, title, 0, (QString) "fileviewer"); |
163 | a->setMainWidget(fview); | 169 | a->setMainWidget(fview); |
164 | fview->showMaximized(); | 170 | QPEApplication::showWidget( fview ); |
165 | return a->exec(); | 171 | return a->exec(); |
166 | } | 172 | } |
167 | 173 | ||
168 | int input(int wi, int h, QWidget *w, int argc, QStringList args) | 174 | int input(int wi, int h, QWidget *w, int argc, QStringList args) |
169 | { | 175 | { |
170 | int i, type = 0; | 176 | int i, type = 0; |
171 | QString title, label, filename; | 177 | QString title, label, filename; |
172 | bool edit=false, full=true; | 178 | bool edit=false, full=true; |
@@ -220,17 +226,17 @@ int input(int wi, int h, QWidget *w, int argc, QStringList args) | |||
220 | { | 226 | { |
221 | full = false; | 227 | full = false; |
222 | } | 228 | } |
223 | } | 229 | } |
224 | InputDialog *id = new InputDialog(wi, h, type, label, title, filename, edit, w); | 230 | InputDialog *id = new InputDialog(wi, h, type, label, title, filename, edit, w); |
225 | if(full) | 231 | if(full) |
226 | { | 232 | { |
227 | w->setCaption(title); | 233 | w->setCaption(title); |
228 | w->showMaximized(); | 234 | QPEApplication::showWidget( w ); |
229 | } | 235 | } |
230 | if( id->exec() == 1) | 236 | if( id->exec() == 1) |
231 | { | 237 | { |
232 | printf("%s\n", id->getString().latin1()); | 238 | printf("%s\n", id->getString().latin1()); |
233 | return 0; | 239 | return 0; |
234 | } | 240 | } |
235 | else | 241 | else |
236 | { | 242 | { |
diff --git a/noncore/tools/remote/learntab.cpp b/noncore/tools/remote/learntab.cpp index 7582161..335a3e9 100644 --- a/noncore/tools/remote/learntab.cpp +++ b/noncore/tools/remote/learntab.cpp | |||
@@ -11,16 +11,19 @@ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "learntab.h" | 17 | #include "learntab.h" |
18 | 18 | ||
19 | /* OPIE */ | ||
20 | #include <qpe/qpeapplication.h> | ||
21 | |||
19 | LearnTab::LearnTab(QWidget *parent, const char *name):QWidget(parent,name) | 22 | LearnTab::LearnTab(QWidget *parent, const char *name):QWidget(parent,name) |
20 | { | 23 | { |
21 | QVBoxLayout *layout = new QVBoxLayout(this); | 24 | QVBoxLayout *layout = new QVBoxLayout(this); |
22 | QHBoxLayout *bottomLayout = new QHBoxLayout(this); | 25 | QHBoxLayout *bottomLayout = new QHBoxLayout(this); |
23 | 26 | ||
24 | layout->insertSpacing(0,5); | 27 | layout->insertSpacing(0,5); |
25 | remotesBox = new QListBox(this, "remotesBox"); | 28 | remotesBox = new QListBox(this, "remotesBox"); |
26 | layout->insertWidget(0, remotesBox, 1); | 29 | layout->insertWidget(0, remotesBox, 1); |
@@ -45,26 +48,24 @@ LearnTab::LearnTab(QWidget *parent, const char *name):QWidget(parent,name) | |||
45 | connect(edit, SIGNAL(clicked()), this, SLOT(edit()) ); | 48 | connect(edit, SIGNAL(clicked()), this, SLOT(edit()) ); |
46 | connect(del, SIGNAL(clicked()), this, SLOT(del()) ); | 49 | connect(del, SIGNAL(clicked()), this, SLOT(del()) ); |
47 | } | 50 | } |
48 | 51 | ||
49 | void LearnTab::add() | 52 | void LearnTab::add() |
50 | { | 53 | { |
51 | printf("LearnTab::add: add pressed\n"); | 54 | printf("LearnTab::add: add pressed\n"); |
52 | RecordDialog *dialog = new RecordDialog(this); | 55 | RecordDialog *dialog = new RecordDialog(this); |
53 | dialog->showMaximized(); | 56 | QPEApplication::showDialog( dialog ); |
54 | } | 57 | } |
55 | 58 | ||
56 | void LearnTab::edit() | 59 | void LearnTab::edit() |
57 | { | 60 | {} |
58 | } | ||
59 | 61 | ||
60 | void LearnTab::del() | 62 | void LearnTab::del() |
61 | { | 63 | {} |
62 | } | ||
63 | 64 | ||
64 | QStringList LearnTab::getRemotes() | 65 | QStringList LearnTab::getRemotes() |
65 | { | 66 | { |
66 | const char write_buffer[] = "LIST\n"; | 67 | const char write_buffer[] = "LIST\n"; |
67 | const char *readbuffer; | 68 | const char *readbuffer; |
68 | int i, numlines; | 69 | int i, numlines; |
69 | QStringList list; | 70 | QStringList list; |
70 | 71 | ||
diff --git a/noncore/tools/remote/remote.cpp b/noncore/tools/remote/remote.cpp index 7972def..638629f 100644 --- a/noncore/tools/remote/remote.cpp +++ b/noncore/tools/remote/remote.cpp | |||
@@ -9,33 +9,39 @@ version. | |||
9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the | 9 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the |
10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General | 10 | implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
11 | Public License for more details. | 11 | Public License for more details. |
12 | 12 | ||
13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free | 13 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free |
14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 14 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "mainview.h" | ||
18 | |||
19 | /* OPIE */ | ||
17 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
18 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
19 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | |||
24 | /* QT */ | ||
20 | #include <qpushbutton.h> | 25 | #include <qpushbutton.h> |
21 | #include <qtabwidget.h> | 26 | #include <qtabwidget.h> |
22 | #include <qlayout.h> | 27 | #include <qlayout.h> |
23 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
24 | #include <qpaintdevice.h> | 29 | #include <qpaintdevice.h> |
25 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | |||
32 | /* STD */ | ||
26 | #include <sys/socket.h> | 33 | #include <sys/socket.h> |
27 | #include <sys/types.h> | 34 | #include <sys/types.h> |
28 | #include <sys/un.h> | 35 | #include <sys/un.h> |
29 | #include <unistd.h> | 36 | #include <unistd.h> |
30 | #include <stdio.h> | 37 | #include <stdio.h> |
31 | #include <signal.h> | 38 | #include <signal.h> |
32 | 39 | ||
33 | #include "mainview.h" | ||
34 | 40 | ||
35 | /*void reconnect(int &fd) | 41 | /*void reconnect(int &fd) |
36 | { | 42 | { |
37 | //struct sockaddr_un addr; | 43 | //struct sockaddr_un addr; |
38 | 44 | ||
39 | addr.sun_family=AF_UNIX; | 45 | addr.sun_family=AF_UNIX; |
40 | strcpy(addr.sun_path,"/dev/lircd"); | 46 | strcpy(addr.sun_path,"/dev/lircd"); |
41 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | 47 | fd = socket(AF_UNIX, SOCK_STREAM, 0); |
@@ -90,11 +96,11 @@ int main( int argc, char **argv ) | |||
90 | // QMessageBox::NoIcon, | 96 | // QMessageBox::NoIcon, |
91 | // QMessageBox::Ok, | 97 | // QMessageBox::Ok, |
92 | // QMessageBox::NoButton, | 98 | // QMessageBox::NoButton, |
93 | // QMessageBox::NoButton); | 99 | // QMessageBox::NoButton); |
94 | //mbtest->exec(); | 100 | //mbtest->exec(); |
95 | 101 | ||
96 | a.setMainWidget( &w ); | 102 | a.setMainWidget( &w ); |
97 | w.setIRSocket(fd); | 103 | w.setIRSocket(fd); |
98 | w.showMaximized(); | 104 | QPEApplication::showWidget( &w ); |
99 | return a.exec(); | 105 | return a.exec(); |
100 | } | 106 | } |