summaryrefslogtreecommitdiff
path: root/noncore/tools/formatter/formatter.cpp
Unidiff
Diffstat (limited to 'noncore/tools/formatter/formatter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/formatter/formatter.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 21de4d2..49f6355 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -379,49 +379,50 @@ void FormatterApp::deviceComboSelected(int index) {
379 const QString name = (*it)->name(); 379 const QString name = (*it)->name();
380 const QString path = (*it)->path(); 380 const QString path = (*it)->path();
381 const QString disk = (*it)->disk(); 381 const QString disk = (*it)->disk();
382// const QString options = (*it)->options(); 382// const QString options = (*it)->options();
383 if( selectedText == disk) { 383 if( selectedText == disk) {
384 diskS = disk; nameS= name; 384 diskS = disk; nameS= name;
385 mountPointLineEdit->setText(path); 385 mountPointLineEdit->setText(path);
386 long mult = (*it)->blockSize() / 1024; 386 long mult = (*it)->blockSize() / 1024;
387 long div = 1024 / (*it)->blockSize(); 387 long div = 1024 / (*it)->blockSize();
388 if ( !mult ) mult = 1; 388 if ( !mult ) mult = 1;
389 if ( !div ) div = 1; 389 if ( !div ) div = 1;
390 long total = (*it)->totalBlocks() * mult / div; 390 long total = (*it)->totalBlocks() * mult / div;
391 long totalMb = total/1024; 391 long totalMb = total/1024;
392 long avail = (*it)->availBlocks() * mult / div; 392 long avail = (*it)->availBlocks() * mult / div;
393 long availMb = avail/1024; 393 long availMb = avail/1024;
394 long used = total - avail; 394 long used = total - avail;
395 long usedMb = used/1024; 395 long usedMb = used/1024;
396 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); 396 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb );
397 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); 397 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb);
398 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); 398 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb );
399 } 399 }
400 } 400 }
401 fsType = getFileSystemType((const QString &)selectedText); 401 fsType = getFileSystemType((const QString &)selectedText);
402 402
403 TextLabel5->setText(tr("Type: %1\nFormatted with %1\n%1, %1, %1").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); 403 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 );
404// storageComboSelected(0); 405// storageComboSelected(0);
405} 406}
406 407
407void FormatterApp::cleanUp() { 408void FormatterApp::cleanUp() {
408 409
409} 410}
410 411
411 412
412void FormatterApp::editFstab() { 413void FormatterApp::editFstab() {
413 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); 414 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
414 e << (const QString &)"/etc/fstab"; 415 e << (const QString &)"/etc/fstab";
415} 416}
416 417
417void FormatterApp::parsetab(const QString &fileName) { 418void FormatterApp::parsetab(const QString &fileName) {
418 419
419 fileSystemTypeList.clear(); 420 fileSystemTypeList.clear();
420 fsList.clear(); 421 fsList.clear();
421 struct mntent *me; 422 struct mntent *me;
422// if(fileName == "/etc/mtab") { 423// if(fileName == "/etc/mtab") {
423 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 424 FILE *mntfp = setmntent( fileName.latin1(), "r" );
424 if ( mntfp ) { 425 if ( mntfp ) {
425 while ( (me = getmntent( mntfp )) != 0 ) { 426 while ( (me = getmntent( mntfp )) != 0 ) {
426 QString deviceName = me->mnt_fsname; 427 QString deviceName = me->mnt_fsname;
427 QString filesystemType = me->mnt_type; 428 QString filesystemType = me->mnt_type;