summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-07-10 18:41:34 (UTC)
committer llornkcor <llornkcor>2002-07-10 18:41:34 (UTC)
commit01b04adb73c8bc49938b71a4bebe6fb6a5477f75 (patch) (unidiff)
tree1d9ba49cf5937d04cf203064b64472ddfb04cc82
parent729309f7875915b2617f99228b0a71464ecfe699 (diff)
downloadopie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.zip
opie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.tar.gz
opie-01b04adb73c8bc49938b71a4bebe6fb6a5477f75.tar.bz2
make compilable again
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/formatter/formatter.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 983459c..d52a4be 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -219,351 +219,351 @@ void FormatterApp::doFormat() {
219 outDlg->showMaximized(); 219 outDlg->showMaximized();
220 outDlg->show(); 220 outDlg->show();
221 qApp->processEvents(); 221 qApp->processEvents();
222 FILE *fp; 222 FILE *fp;
223 char line[130]; 223 char line[130];
224 outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); 224 outDlg->OutputEdit->append( tr("Trying to umount.") + currentText );
225 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 225 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
226 226
227 sleep(1); 227 sleep(1);
228 qDebug("Command is "+umountS); 228 qDebug("Command is "+umountS);
229 fp = popen( (const char *) umountS, "r"); 229 fp = popen( (const char *) umountS, "r");
230 qDebug("%d", fp); 230 qDebug("%d", fp);
231 if ( !fp ) { 231 if ( !fp ) {
232 qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); 232 qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err);
233 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 233 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
234 pclose(fp); 234 pclose(fp);
235 return; 235 return;
236 } else { 236 } else {
237// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 237// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
238// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 238// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
239 while ( fgets( line, sizeof line, fp)) { 239 while ( fgets( line, sizeof line, fp)) {
240 if( ((QString)line).find("busy",0,TRUE) != -1) { 240 if( ((QString)line).find("busy",0,TRUE) != -1) {
241 qDebug("Could not find '" + umountS); 241 qDebug("Could not find '" + umountS);
242 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 242 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
243 pclose(fp); 243 pclose(fp);
244 return; 244 return;
245 } else { 245 } else {
246 QString lineStr = line; 246 QString lineStr = line;
247 lineStr=lineStr.left(lineStr.length()-1); 247 lineStr=lineStr.left(lineStr.length()-1);
248 outDlg->OutputEdit->append(lineStr); 248 outDlg->OutputEdit->append(lineStr);
249 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 249 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
250 } 250 }
251 } 251 }
252 } 252 }
253 pclose(fp); 253 pclose(fp);
254 254
255 qDebug("Command would be: "+cmd); 255 qDebug("Command would be: "+cmd);
256 outDlg->OutputEdit->append( tr("Trying to format.") ); 256 outDlg->OutputEdit->append( tr("Trying to format.") );
257 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 257 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
258 258
259 fp = popen( (const char *) cmd, "r"); 259 fp = popen( (const char *) cmd, "r");
260 while ( fgets( line, sizeof line, fp)) { 260 while ( fgets( line, sizeof line, fp)) {
261 if( ((QString)line).find("No such device",0,TRUE) != -1) { 261 if( ((QString)line).find("No such device",0,TRUE) != -1) {
262 qDebug("No such device '" + umountS); 262 qDebug("No such device '" + umountS);
263 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 263 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
264 pclose(fp); 264 pclose(fp);
265// outDlg->OutputEdit->append("No such device"); 265// outDlg->OutputEdit->append("No such device");
266// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 266// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
267 return; 267 return;
268 } else { 268 } else {
269 QString lineStr = line; 269 QString lineStr = line;
270 lineStr=lineStr.left(lineStr.length()-1); 270 lineStr=lineStr.left(lineStr.length()-1);
271 outDlg->OutputEdit->append(lineStr); 271 outDlg->OutputEdit->append(lineStr);
272 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 272 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
273 } 273 }
274 } 274 }
275 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 275 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
276 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 276 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
277 pclose(fp); 277 pclose(fp);
278 278
279 outDlg->OutputEdit->append( tr("Trying to mount.") + currentText ); 279 outDlg->OutputEdit->append( tr("Trying to mount.") + currentText );
280 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 280 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
281 fp = popen( (const char *) remountS, "r"); 281 fp = popen( (const char *) remountS, "r");
282 if ( !fp) { 282 if ( !fp) {
283 qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); 283 qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err);
284 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); 284 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") );
285 285
286 } else { 286 } else {
287 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully mounted.")); 287 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully mounted."));
288 while ( fgets( line, sizeof line, fp)) { 288 while ( fgets( line, sizeof line, fp)) {
289 QString lineStr = line; 289 QString lineStr = line;
290 lineStr=lineStr.left(lineStr.length()-1); 290 lineStr=lineStr.left(lineStr.length()-1);
291 outDlg->OutputEdit->append(lineStr); 291 outDlg->OutputEdit->append(lineStr);
292 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 292 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
293 } 293 }
294 } 294 }
295 pclose(fp); 295 pclose(fp);
296 sleep(1); 296 sleep(1);
297 297
298 outDlg->OutputEdit->append(tr("You can now close the output window.")); 298 outDlg->OutputEdit->append(tr("You can now close the output window."));
299 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 299 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
300// outDlg->close(); 300// outDlg->close();
301// if(outDlg) 301// if(outDlg)
302// delete outDlg; 302// delete outDlg;
303 } 303 }
304 break; 304 break;
305 }; 305 };
306} 306}
307 307
308bool FormatterApp::doFdisk() { 308bool FormatterApp::doFdisk() {
309 return FALSE; 309 return FALSE;
310 310
311} 311}
312 312
313void FormatterApp::fillCombos() { 313void FormatterApp::fillCombos() {
314 314
315 StorageInfo storageInfo; 315 StorageInfo storageInfo;
316 const QList<FileSystem> &fs = storageInfo.fileSystems(); 316 const QList<FileSystem> &fs = storageInfo.fileSystems();
317 QListIterator<FileSystem> it ( fs ); 317 QListIterator<FileSystem> it ( fs );
318 QString storage; 318 QString storage;
319 for( ; it.current(); ++it ){ 319 for( ; it.current(); ++it ){
320 const QString name = (*it)->name(); 320 const QString name = (*it)->name();
321 const QString path = (*it)->path(); 321 const QString path = (*it)->path();
322 const QString disk = (*it)->disk(); 322 const QString disk = (*it)->disk();
323 const QString options = (*it)->options(); 323 const QString options = (*it)->options();
324 if( name.find( tr("Internal"),0,TRUE) == -1) { 324 if( name.find( tr("Internal"),0,TRUE) == -1) {
325 storageComboBox->insertItem(name +" -> "+disk); 325 storageComboBox->insertItem(name +" -> "+disk);
326 } 326 }
327// deviceComboBox->insertItem(disk); 327// deviceComboBox->insertItem(disk);
328 } 328 }
329 parsetab("/etc/mtab"); 329 parsetab("/etc/mtab");
330// parsetab("/etc/fstab"); 330// parsetab("/etc/fstab");
331 fileSystemsCombo->insertStringList( fsList,-1); 331 fileSystemsCombo->insertStringList( fsList,-1);
332 deviceComboBox->insertStringList( deviceList,-1); 332 deviceComboBox->insertStringList( deviceList,-1);
333 storageComboSelected(0); 333 storageComboSelected(0);
334 deviceComboSelected(0); 334 deviceComboSelected(0);
335} 335}
336 336
337 337
338void FormatterApp::fsComboSelected(int index) { 338void FormatterApp::fsComboSelected(int index) {
339 339
340} 340}
341 341
342void FormatterApp::storageComboSelected(int index ) { 342void FormatterApp::storageComboSelected(int index ) {
343 343
344 QString currentText = storageComboBox->text(index); 344 QString currentText = storageComboBox->text(index);
345 QString nameS = currentText.left( currentText.find("->",0,TRUE)); 345 QString nameS = currentText.left( currentText.find("->",0,TRUE));
346 346
347 TextLabel4->setText( tr( "Storage Type : ") + nameS ); 347 TextLabel4->setText( tr( "Storage Type : ") + nameS );
348 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 348 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
349 349
350 QString fsType = getFileSystemType((const QString &) currentText); 350 QString fsType = getFileSystemType((const QString &) currentText);
351// qDebug(fsType); 351// qDebug(fsType);
352 for(int i = 0; i < fileSystemsCombo->count(); i++) { 352 for(int i = 0; i < fileSystemsCombo->count(); i++) {
353 if( fsType == fileSystemsCombo->text(i)) 353 if( fsType == fileSystemsCombo->text(i))
354 fileSystemsCombo->setCurrentItem(i); 354 fileSystemsCombo->setCurrentItem(i);
355 } 355 }
356// deviceComboSelected(index); 356// deviceComboSelected(index);
357} 357}
358 358
359void FormatterApp::deviceComboSelected(int index) { 359void FormatterApp::deviceComboSelected(int index) {
360 360
361 StorageInfo storageInfo; 361 StorageInfo storageInfo;
362 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; 362 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText;
363 363
364 selectedText = deviceComboBox->text(index); 364 selectedText = deviceComboBox->text(index);
365 365
366 const QList<FileSystem> &fs = storageInfo.fileSystems(); 366 const QList<FileSystem> &fs = storageInfo.fileSystems();
367 QListIterator<FileSystem> it ( fs ); 367 QListIterator<FileSystem> it ( fs );
368 QString storage; 368 QString storage;
369 for( ; it.current(); ++it ){ 369 for( ; it.current(); ++it ){
370 const QString name = (*it)->name(); 370 const QString name = (*it)->name();
371 const QString path = (*it)->path(); 371 const QString path = (*it)->path();
372 const QString disk = (*it)->disk(); 372 const QString disk = (*it)->disk();
373// const QString options = (*it)->options(); 373// const QString options = (*it)->options();
374 if( selectedText == disk) { 374 if( selectedText == disk) {
375 diskS = disk; nameS= name; 375 diskS = disk; nameS= name;
376 mountPointLineEdit->setText(path); 376 mountPointLineEdit->setText(path);
377 long mult = (*it)->blockSize() / 1024; 377 long mult = (*it)->blockSize() / 1024;
378 long div = 1024 / (*it)->blockSize(); 378 long div = 1024 / (*it)->blockSize();
379 if ( !mult ) mult = 1; 379 if ( !mult ) mult = 1;
380 if ( !div ) div = 1; 380 if ( !div ) div = 1;
381 long total = (*it)->totalBlocks() * mult / div; 381 long total = (*it)->totalBlocks() * mult / div;
382 long totalMb = total/1024; 382 long totalMb = total/1024;
383 long avail = (*it)->availBlocks() * mult / div; 383 long avail = (*it)->availBlocks() * mult / div;
384 long availMb = avail/1024; 384 long availMb = avail/1024;
385 long used = total - avail; 385 long used = total - avail;
386 long usedMb = used/1024; 386 long usedMb = used/1024;
387 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); 387 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb );
388 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); 388 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb);
389 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); 389 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb );
390 } 390 }
391 } 391 }
392 fsType = getFileSystemType((const QString &)selectedText); 392 fsType = getFileSystemType((const QString &)selectedText);
393 393
394 TextLabel5->setText("Type: "+ nameS+" Formatted with "+ fsType + " \n" + totalS + usedS + avS); 394 TextLabel5->setText("Type: "+ nameS+" Formatted with "+ fsType + " \n" + totalS + usedS + avS);
395// storageComboSelected(0); 395// storageComboSelected(0);
396} 396}
397 397
398void FormatterApp::cleanUp() { 398void FormatterApp::cleanUp() {
399 399
400} 400}
401 401
402 402
403void FormatterApp::editFstab() { 403void FormatterApp::editFstab() {
404 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); 404 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
405 e << (const QString &)"/etc/fstab"; 405 e << (const QString &)"/etc/fstab";
406} 406}
407 407
408void FormatterApp::parsetab(const QString &fileName) { 408void FormatterApp::parsetab(const QString &fileName) {
409 409
410 fileSystemTypeList.clear(); 410 fileSystemTypeList.clear();
411 fsList.clear(); 411 fsList.clear();
412 struct mntent *me; 412 struct mntent *me;
413// if(fileName == "/etc/mtab") { 413// if(fileName == "/etc/mtab") {
414 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 414 FILE *mntfp = setmntent( fileName.latin1(), "r" );
415 if ( mntfp ) { 415 if ( mntfp ) {
416 while ( (me = getmntent( mntfp )) != 0 ) { 416 while ( (me = getmntent( mntfp )) != 0 ) {
417 QString deviceName = me->mnt_fsname; 417 QString deviceName = me->mnt_fsname;
418 QString filesystemType = me->mnt_type; 418 QString filesystemType = me->mnt_type;
419 if(deviceName != "none") { 419 if(deviceName != "none") {
420 if( fsList.contains(filesystemType) == 0 420 if( fsList.contains(filesystemType) == 0
421 & filesystemType.find("proc",0,TRUE) == -1 421 & filesystemType.find("proc",0,TRUE) == -1
422 & filesystemType.find("cramfs",0,TRUE) == -1 422 & filesystemType.find("cramfs",0,TRUE) == -1
423 & filesystemType.find("auto",0,TRUE) == -1) 423 & filesystemType.find("auto",0,TRUE) == -1)
424 fsList << filesystemType; 424 fsList << filesystemType;
425 deviceList << deviceName; 425 deviceList << deviceName;
426 qDebug(deviceName+"::"+filesystemType); 426 qDebug(deviceName+"::"+filesystemType);
427 fileSystemTypeList << deviceName+"::"+filesystemType; 427 fileSystemTypeList << deviceName+"::"+filesystemType;
428 } 428 }
429 } 429 }
430 } 430 }
431 endmntent( mntfp ); 431 endmntent( mntfp );
432// } else if(fileName == "/etc/fstab") { 432// } else if(fileName == "/etc/fstab") {
433// QFile f("/etc/fstab"); 433// QFile f("/etc/fstab");
434// if ( f.open(IO_ReadOnly) ) { 434// if ( f.open(IO_ReadOnly) ) {
435// QTextStream t (&f); 435// QTextStream t (&f);
436// QString s; 436// QString s;
437// while (! t.eof()) { 437// while (! t.eof()) {
438// s=t.readLine(); 438// s=t.readLine();
439// s=s.simplifyWhiteSpace(); 439// s=s.simplifyWhiteSpace();
440// if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { 440// if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) {
441// // = me->mnt_fsname; 441// // = me->mnt_fsname;
442// QString filesystemType = me->mnt_type; 442// QString filesystemType = me->mnt_type;
443// QString deviceName = s.left(0,s.find(BLANK) ); 443// QString deviceName = s.left(0,s.find(BLANK) );
444// s=s.remove(0,s.find(BLANK)+1 ); // devicename 444// s=s.remove(0,s.find(BLANK)+1 ); // devicename
445 445
446// s=s.remove(0,s.find(BLANK)+1 ); // mountpoint 446// s=s.remove(0,s.find(BLANK)+1 ); // mountpoint
447// QStringt mountPoint= s.left(0,s.find(BLANK) ); 447// QStringt mountPoint= s.left(0,s.find(BLANK) );
448// s=s.remove(0,s.find(BLANK)+1 ); // fs 448// s=s.remove(0,s.find(BLANK)+1 ); // fs
449// QString filesystemType= s.left(0,s.find(BLANK) ); 449// QString filesystemType= s.left(0,s.find(BLANK) );
450// } 450// }
451// } 451// }
452// } 452// }
453// f.close(); 453// f.close();
454// } 454// }
455} 455}
456 456
457QString FormatterApp::getFileSystemType(const QString &currentText) { 457QString FormatterApp::getFileSystemType(const QString &currentText) {
458 458
459 parsetab("/etc/mtab"); //why did TT forget filesystem type? 459 parsetab("/etc/mtab"); //why did TT forget filesystem type?
460 460
461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 461 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
462 QString temp = (*it); 462 QString temp = (*it);
463 if( temp.find( currentText,0,TRUE) != -1) { 463 if( temp.find( currentText,0,TRUE) != -1) {
464 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 464 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
465// qDebug(fsType); 465// qDebug(fsType);
466 } 466 }
467 } 467 }
468 return ""; 468 return "";
469} 469}
470 470
471bool FormatterApp::doFsck() { 471bool FormatterApp::doFsck() {
472 472
473 Output *outDlg; 473 Output *outDlg;
474 QString selectedDevice; 474 QString selectedDevice;
475#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // lets test on something cheap 475//f defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // lets test on something cheap
476 selectedDevice = deviceComboBox->currentText(); 476 selectedDevice = deviceComboBox->currentText();
477#else 477//#else
478// currentText = diskDevice = "/dev/fd0"; 478// currentText = diskDevice = "/dev/fd0";
479 QString umountS = "umount -v /floppy 2>&1"; 479 QString umountS = "umount -v /floppy 2>&1";
480 QString remountS = "mount -v /floppy 2>&1"; 480 QString remountS = "mount -v /floppy 2>&1";
481 selectedDevice ="/dev/fd0"; 481 selectedDevice ="/dev/fd0";
482 482
483#endif 483//#endif
484 484
485 QString fsType = getFileSystemType((const QString &)selectedDevice); 485 QString fsType = getFileSystemType((const QString &)selectedDevice);
486 QString cmd; 486 QString cmd;
487 qDebug( selectedDevice +" "+ fsType); 487 qDebug( selectedDevice +" "+ fsType);
488 if(fsType == "vfat") cmd = "dosfsck -vy "; 488 if(fsType == "vfat") cmd = "dosfsck -vy ";
489 if(fsType == "ext2") cmd = "e2fsck -cpvy "; 489 if(fsType == "ext2") cmd = "e2fsck -cpvy ";
490 cmd += selectedDevice + " 2>&1"; 490 cmd += selectedDevice + " 2>&1";
491 491
492 outDlg = new Output(this, tr("Formatter Output"),FALSE); 492 outDlg = new Output(this, tr("Formatter Output"),FALSE);
493 outDlg->showMaximized(); 493 outDlg->showMaximized();
494 outDlg->show(); 494 outDlg->show();
495 qApp->processEvents(); 495 qApp->processEvents();
496 FILE *fp; 496 FILE *fp;
497 char line[130]; 497 char line[130];
498 outDlg->OutputEdit->append( tr("Trying to umount.")); 498 outDlg->OutputEdit->append( tr("Trying to umount."));
499 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 499 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
500 500
501 sleep(1); 501 sleep(1);
502// qDebug("Command is "+umountS); 502// qDebug("Command is "+umountS);
503 fp = popen( (const char *) umountS, "r"); 503 fp = popen( (const char *) umountS, "r");
504// qDebug("%d", fp); 504// qDebug("%d", fp);
505 if ( !fp ) { 505 if ( !fp ) {
506 qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); 506 qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno));
507 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 507 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
508 pclose(fp); 508 pclose(fp);
509 return false; 509 return false;
510 } else { 510 } else {
511// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 511// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
512// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 512// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
513 while ( fgets( line, sizeof line, fp)) { 513 while ( fgets( line, sizeof line, fp)) {
514 if( ((QString)line).find("busy",0,TRUE) != -1) { 514 if( ((QString)line).find("busy",0,TRUE) != -1) {
515 qDebug("Could not find '" + umountS); 515 qDebug("Could not find '" + umountS);
516 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 516 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
517 pclose(fp); 517 pclose(fp);
518 return false; 518 return false;
519 } else { 519 } else {
520 QString lineStr = line; 520 QString lineStr = line;
521 lineStr=lineStr.left(lineStr.length()-1); 521 lineStr=lineStr.left(lineStr.length()-1);
522 outDlg->OutputEdit->append(lineStr); 522 outDlg->OutputEdit->append(lineStr);
523 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 523 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
524 } 524 }
525 } 525 }
526 } 526 }
527 pclose(fp); 527 pclose(fp);
528///////////////////////////////////// 528/////////////////////////////////////
529 fp = popen( (const char *) cmd, "r"); 529 fp = popen( (const char *) cmd, "r");
530 while ( fgets( line, sizeof line, fp)) { 530 while ( fgets( line, sizeof line, fp)) {
531 if( ((QString)line).find("No such device",0,TRUE) != -1) { 531 if( ((QString)line).find("No such device",0,TRUE) != -1) {
532 qDebug("No such device '" + umountS); 532 qDebug("No such device '" + umountS);
533 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 533 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
534 pclose(fp); 534 pclose(fp);
535// outDlg->OutputEdit->append("No such device"); 535// outDlg->OutputEdit->append("No such device");
536// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 536// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
537 return false; 537 return false;
538 } else { 538 } else {
539 QString lineStr = line; 539 QString lineStr = line;
540 lineStr=lineStr.left(lineStr.length()-1); 540 lineStr=lineStr.left(lineStr.length()-1);
541 outDlg->OutputEdit->append(lineStr); 541 outDlg->OutputEdit->append(lineStr);
542 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 542 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
543 } 543 }
544 } 544 }
545 outDlg->OutputEdit->append(tr("You can now close the output window.")); 545 outDlg->OutputEdit->append(tr("You can now close the output window."));
546 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 546 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
547// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 547// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
548// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 548// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
549 pclose(fp); 549 pclose(fp);
550 550
551///////////////////////////////////////// 551/////////////////////////////////////////
552 552
553 return true; 553 return true;
554} 554}
555 555
556bool FormatterApp::doFsckCheck() { 556bool FormatterApp::doFsckCheck() {
557 557
558 return FALSE; 558 return FALSE;
559} 559}
560 560
561int FormatterApp::formatCheck(const QString &deviceStr) { 561int FormatterApp::formatCheck(const QString &deviceStr) {
562 562
563 return -1; 563 return -1;
564} 564}
565 565
566int FormatterApp::runCommand(const QString &command) { 566int FormatterApp::runCommand(const QString &command) {
567 567
568 return -1; 568 return -1;
569} 569}