author | ar <ar> | 2004-02-21 19:09:12 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 19:09:12 (UTC) |
commit | c7e563cbb26c20807e66dd4284d1ce9cbf8e1419 (patch) (side-by-side diff) | |
tree | e55119af88abe930c1ce492f30efb72c929a730c /noncore/tools/formatter/formatter.cpp | |
parent | 536f271b1e6a1d1886e96a28524a3503c4c38c4e (diff) | |
download | opie-c7e563cbb26c20807e66dd4284d1ce9cbf8e1419.zip opie-c7e563cbb26c20807e66dd4284d1ce9cbf8e1419.tar.gz opie-c7e563cbb26c20807e66dd4284d1ce9cbf8e1419.tar.bz2 |
improve support for BigScreen
Diffstat (limited to 'noncore/tools/formatter/formatter.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 174 |
1 files changed, 111 insertions, 63 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 @@ -12,3 +12,3 @@ -#include <qmenubar.h> +/* OPIE */ #include <qpe/qpetoolbar.h> @@ -21,2 +21,4 @@ +/* QT */ +#include <qmenubar.h> #include <qmultilineedit.h> @@ -27,5 +29,3 @@ #include <qfile.h> - #include <qtstream.h> - #include <qcombobox.h> @@ -34,3 +34,2 @@ #include <qregexp.h> - #include <qlabel.h> @@ -43,2 +42,3 @@ +/* STD */ #include <unistd.h> @@ -170,7 +170,7 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool -FormatterApp::~FormatterApp() { - -} +FormatterApp::~FormatterApp() +{} -void FormatterApp::doFormat() { +void FormatterApp::doFormat() +{ int err=0; @@ -192,3 +192,4 @@ void FormatterApp::doFormat() { - if( currentText.find("CF",0,TRUE) != -1) { + if( currentText.find("CF",0,TRUE) != -1) + { umountS = "umount "; @@ -199,3 +200,4 @@ void FormatterApp::doFormat() { } - if( currentText.find("SD",0,TRUE) != -1) { + if( currentText.find("SD",0,TRUE) != -1) + { umountS = "umount "; @@ -213,4 +215,6 @@ void FormatterApp::doFormat() { ,1 - ,1) ) { - case 0: { + ,1) ) + { + case 0: + { if(fs == "vfat") @@ -219,3 +223,4 @@ void FormatterApp::doFormat() { cmd = "mke2fs -v " + diskDevice+" 2>&1"; - else { + else + { QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); @@ -225,4 +230,3 @@ void FormatterApp::doFormat() { outDlg = new Output(this, tr("Formatter Output"),FALSE); - outDlg->showMaximized(); - outDlg->show(); + QPEApplication::showDialog( outDlg); qApp->processEvents(); @@ -239,3 +243,4 @@ void FormatterApp::doFormat() { // qDebug("%d", fp); - if ( !fp ) { + if ( !fp ) + { qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); @@ -244,7 +249,11 @@ void FormatterApp::doFormat() { return; - } else { + } + else + { // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); - while ( fgets( line, sizeof line, fp)) { - if( ((QString)line).find("busy",0,TRUE) != -1) { + while ( fgets( line, sizeof line, fp)) + { + if( ((QString)line).find("busy",0,TRUE) != -1) + { qDebug("Could not find '" + umountS); @@ -253,3 +262,5 @@ void FormatterApp::doFormat() { return; - } else { + } + else + { QString lineStr = line; @@ -268,4 +279,6 @@ void FormatterApp::doFormat() { fp = popen( (const char *) cmd, "r"); - while ( fgets( line, sizeof line, fp)) { - if( ((QString)line).find("No such device",0,TRUE) != -1) { + while ( fgets( line, sizeof line, fp)) + { + if( ((QString)line).find("No such device",0,TRUE) != -1) + { qDebug("No such device '" + umountS); @@ -276,3 +289,5 @@ void FormatterApp::doFormat() { return; - } else { + } + else + { QString lineStr = line; @@ -290,3 +305,4 @@ void FormatterApp::doFormat() { fp = popen( (const char *) remountS, "r"); - if ( !fp) { + if ( !fp) + { qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); @@ -294,5 +310,8 @@ void FormatterApp::doFormat() { - } else { + } + else + { outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); - while ( fgets( line, sizeof line, fp)) { + while ( fgets( line, sizeof line, fp)) + { QString lineStr = line; @@ -316,3 +335,4 @@ void FormatterApp::doFormat() { -bool FormatterApp::doFdisk() { +bool FormatterApp::doFdisk() +{ return FALSE; @@ -321,3 +341,4 @@ bool FormatterApp::doFdisk() { -void FormatterApp::fillCombos() { +void FormatterApp::fillCombos() +{ @@ -327,3 +348,4 @@ void FormatterApp::fillCombos() { QString storage; - for( ; it.current(); ++it ){ + for( ; it.current(); ++it ) + { const QString name = (*it)->name(); @@ -332,3 +354,4 @@ void FormatterApp::fillCombos() { const QString options = (*it)->options(); - if( name.find( tr("Internal"),0,TRUE) == -1) { + if( name.find( tr("Internal"),0,TRUE) == -1) + { storageComboBox->insertItem(name +" -> "+disk); @@ -346,7 +369,7 @@ void FormatterApp::fillCombos() { -void FormatterApp::fsComboSelected(int ) { +void FormatterApp::fsComboSelected(int ) +{} -} - -void FormatterApp::storageComboSelected(int index ) { +void FormatterApp::storageComboSelected(int index ) +{ @@ -360,3 +383,4 @@ void FormatterApp::storageComboSelected(int index ) { // qDebug(fsType); - for(int i = 0; i < fileSystemsCombo->count(); i++) { + for(int i = 0; i < fileSystemsCombo->count(); i++) + { if( fsType == fileSystemsCombo->text(i)) @@ -367,3 +391,4 @@ void FormatterApp::storageComboSelected(int index ) { -void FormatterApp::deviceComboSelected(int index) { +void FormatterApp::deviceComboSelected(int index) +{ @@ -377,3 +402,4 @@ void FormatterApp::deviceComboSelected(int index) { QString storage; - for( ; it.current(); ++it ){ + for( ; it.current(); ++it ) + { const QString name = (*it)->name(); @@ -382,3 +408,4 @@ void FormatterApp::deviceComboSelected(int index) { // const QString options = (*it)->options(); - if( selectedText == disk) { + if( selectedText == disk) + { diskS = disk; nameS= name; @@ -407,8 +434,8 @@ void FormatterApp::deviceComboSelected(int index) { -void FormatterApp::cleanUp() { - -} +void FormatterApp::cleanUp() +{} -void FormatterApp::editFstab() { +void FormatterApp::editFstab() +{ QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); @@ -417,3 +444,4 @@ void FormatterApp::editFstab() { -void FormatterApp::parsetab(const QString &fileName) { +void FormatterApp::parsetab(const QString &fileName) +{ @@ -424,7 +452,10 @@ void FormatterApp::parsetab(const QString &fileName) { FILE *mntfp = setmntent( fileName.latin1(), "r" ); - if ( mntfp ) { - while ( (me = getmntent( mntfp )) != 0 ) { + if ( mntfp ) + { + while ( (me = getmntent( mntfp )) != 0 ) + { QString deviceName = me->mnt_fsname; QString filesystemType = me->mnt_type; - if(deviceName != "none") { + if(deviceName != "none") + { if( fsList.contains(filesystemType) == 0 @@ -466,3 +497,4 @@ void FormatterApp::parsetab(const QString &fileName) { -QString FormatterApp::getFileSystemType(const QString ¤tText) { +QString FormatterApp::getFileSystemType(const QString ¤tText) +{ @@ -470,5 +502,7 @@ QString FormatterApp::getFileSystemType(const QString ¤tText) { - for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) { + for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) + { QString temp = (*it); - if( temp.find( currentText,0,TRUE) != -1) { + if( temp.find( currentText,0,TRUE) != -1) + { return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); @@ -480,3 +514,4 @@ QString FormatterApp::getFileSystemType(const QString ¤tText) { -bool FormatterApp::doFsck() { +bool FormatterApp::doFsck() +{ @@ -506,4 +541,3 @@ bool FormatterApp::doFsck() { outDlg = new Output(this, tr("Formatter Output"),FALSE); - outDlg->showMaximized(); - outDlg->show(); + QPEApplication::showDialog( outDlg ); qApp->processEvents(); @@ -518,3 +552,4 @@ bool FormatterApp::doFsck() { // qDebug("%d", fp); - if ( !fp ) { + if ( !fp ) + { qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); @@ -523,7 +558,11 @@ bool FormatterApp::doFsck() { return false; - } else { + } + else + { // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); - while ( fgets( line, sizeof line, fp)) { - if( ((QString)line).find("busy",0,TRUE) != -1) { + while ( fgets( line, sizeof line, fp)) + { + if( ((QString)line).find("busy",0,TRUE) != -1) + { qDebug("Could not find '" + umountS); @@ -533,3 +572,5 @@ bool FormatterApp::doFsck() { return false; - } else { + } + else + { QString lineStr = line; @@ -544,4 +585,6 @@ bool FormatterApp::doFsck() { fp = popen( (const char *) cmd, "r"); - while ( fgets( line, sizeof line, fp)) { - if( ((QString)line).find("No such device",0,TRUE) != -1) { + while ( fgets( line, sizeof line, fp)) + { + if( ((QString)line).find("No such device",0,TRUE) != -1) + { qDebug("No such device '" + umountS); @@ -552,3 +595,5 @@ bool FormatterApp::doFsck() { return false; - } else { + } + else + { QString lineStr = line; @@ -570,3 +615,4 @@ bool FormatterApp::doFsck() { -bool FormatterApp::doFsckCheck() { +bool FormatterApp::doFsckCheck() +{ @@ -575,3 +621,4 @@ bool FormatterApp::doFsckCheck() { -int FormatterApp::formatCheck(const QString &) { +int FormatterApp::formatCheck(const QString &) +{ @@ -580,3 +627,4 @@ int FormatterApp::formatCheck(const QString &) { -int FormatterApp::runCommand(const QString &) { +int FormatterApp::runCommand(const QString &) +{ |