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.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index f275fbe..79a7f9e 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -162,49 +162,49 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla
162 162
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
171FormatterApp::~FormatterApp() { 171FormatterApp::~FormatterApp() {
172 172
173} 173}
174 174
175void FormatterApp::doFormat() { 175void FormatterApp::doFormat() {
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));
184 QString fs = fileSystemsCombo->currentText(); 184 QString fs = fileSystemsCombo->currentText();
185 185
186#if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) // 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 umountS = "umount "; 194 umountS = "umount ";
195 remountS = "mount "; 195 remountS = "mount ";
196 196
197// umountS = "/sbin/cardctl eject"; 197// umountS = "/sbin/cardctl eject";
198// remountS = "/sbin/cardctl insert"; 198// remountS = "/sbin/cardctl insert";
199 } 199 }
200 if( currentText.find("SD",0,TRUE) != -1) { 200 if( currentText.find("SD",0,TRUE) != -1) {
201 umountS = "umount "; 201 umountS = "umount ";
202 remountS = "mount "; 202 remountS = "mount ";
203// umountS = "/etc/sdcontrol compeject"; 203// umountS = "/etc/sdcontrol compeject";
204// remountS = "/etc/sdcontrol insert"; 204// remountS = "/etc/sdcontrol insert";
205 } 205 }
206 206
207 switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText + 207 switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText +
208 tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) { 208 tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) {
209 case 0: { 209 case 0: {
210 if(fs == "vfat") 210 if(fs == "vfat")
@@ -452,49 +452,49 @@ void FormatterApp::parsetab(const QString &fileName) {
452// } 452// }
453// } 453// }
454// f.close(); 454// f.close();
455// } 455// }
456} 456}
457 457
458QString FormatterApp::getFileSystemType(const QString &currentText) { 458QString FormatterApp::getFileSystemType(const QString &currentText) {
459 459
460 parsetab("/etc/mtab"); //why did TT forget filesystem type? 460 parsetab("/etc/mtab"); //why did TT forget filesystem type?
461 461
462 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { 462 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) {
463 QString temp = (*it); 463 QString temp = (*it);
464 if( temp.find( currentText,0,TRUE) != -1) { 464 if( temp.find( currentText,0,TRUE) != -1) {
465 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 465 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
466// qDebug(fsType); 466// qDebug(fsType);
467 } 467 }
468 } 468 }
469 return ""; 469 return "";
470} 470}
471 471
472bool FormatterApp::doFsck() { 472bool FormatterApp::doFsck() {
473 473
474 Output *outDlg; 474 Output *outDlg;
475 QString selectedDevice; 475 QString selectedDevice;
476// #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) 476// #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
477 selectedDevice = deviceComboBox->currentText(); 477 selectedDevice = deviceComboBox->currentText();
478 QString mountPoint = mountPointLineEdit->text(); 478 QString mountPoint = mountPointLineEdit->text();
479 QString umountS = "umount -v "+mountPoint+" 2>&1"; 479 QString umountS = "umount -v "+mountPoint+" 2>&1";
480 QString remountS = "mount -v "+mountPoint+" 2>&1"; 480 QString remountS = "mount -v "+mountPoint+" 2>&1";
481// #else 481// #else
482// // for testing 482// // for testing
483// // currentText = diskDevice = "/dev/fd0"; 483// // currentText = diskDevice = "/dev/fd0";
484// QString umountS = "umount -v /floppy 2>&1"; 484// QString umountS = "umount -v /floppy 2>&1";
485// QString remountS = "mount -v /floppy 2>&1"; 485// QString remountS = "mount -v /floppy 2>&1";
486// selectedDevice ="/dev/fd0"; 486// selectedDevice ="/dev/fd0";
487 487
488// #endif 488// #endif
489 489
490 QString fsType = getFileSystemType((const QString &)selectedDevice); 490 QString fsType = getFileSystemType((const QString &)selectedDevice);
491 QString cmd; 491 QString cmd;
492 qDebug( selectedDevice +" "+ fsType); 492 qDebug( selectedDevice +" "+ fsType);
493 if(fsType == "vfat") cmd = "dosfsck -vy "; 493 if(fsType == "vfat") cmd = "dosfsck -vy ";
494 if(fsType == "ext2") cmd = "e2fsck -cpvy "; 494 if(fsType == "ext2") cmd = "e2fsck -cpvy ";
495 cmd += selectedDevice + " 2>&1"; 495 cmd += selectedDevice + " 2>&1";
496 496
497 outDlg = new Output(this, tr("Formatter Output"),FALSE); 497 outDlg = new Output(this, tr("Formatter Output"),FALSE);
498 outDlg->showMaximized(); 498 outDlg->showMaximized();
499 outDlg->show(); 499 outDlg->show();
500 qApp->processEvents(); 500 qApp->processEvents();