author | llornkcor <llornkcor> | 2003-05-29 01:18:11 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-05-29 01:18:11 (UTC) |
commit | 74f2f13e53b066eb461154f11f156bb4ce9c0646 (patch) (unidiff) | |
tree | 94c8a576edd980e294a50acb95f2fdc08e1e278c | |
parent | 52047fd3d3f30509d65834747c3a0c5c6760dc01 (diff) | |
download | opie-74f2f13e53b066eb461154f11f156bb4ce9c0646.zip opie-74f2f13e53b066eb461154f11f156bb4ce9c0646.tar.gz opie-74f2f13e53b066eb461154f11f156bb4ce9c0646.tar.bz2 |
fix tr and clean up compile
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp index cca0c26..21de4d2 100644 --- a/noncore/tools/formatter/formatter.cpp +++ b/noncore/tools/formatter/formatter.cpp | |||
@@ -18,17 +18,18 @@ | |||
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 | #include <qmultilineedit.h> | 22 | #include <qmultilineedit.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qlist.h> | ||
24 | #include <qstringlist.h> | 25 | #include <qstringlist.h> |
25 | #include <qdir.h> | 26 | #include <qdir.h> |
26 | #include <qfile.h> | 27 | #include <qfile.h> |
27 | 28 | ||
28 | #include <qtextstream.h> | 29 | #include <qtstream.h> |
29 | 30 | ||
30 | #include <qcombobox.h> | 31 | #include <qcombobox.h> |
31 | #include <qpopupmenu.h> | 32 | #include <qpopupmenu.h> |
32 | #include <qmessagebox.h> | 33 | #include <qmessagebox.h> |
33 | #include <qregexp.h> | 34 | #include <qregexp.h> |
34 | 35 | ||
@@ -50,13 +51,13 @@ | |||
50 | 51 | ||
51 | #define BLANK ' ' | 52 | #define BLANK ' ' |
52 | #define DELIMITER '#' | 53 | #define DELIMITER '#' |
53 | 54 | ||
54 | /* | 55 | /* |
55 | Blah blah blah blah */ | 56 | Blah blah blah blah */ |
56 | FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl ) | 57 | FormatterApp::FormatterApp( QWidget* parent, const char* name, bool , WFlags fl ) |
57 | : QMainWindow( parent, name, fl ) | 58 | : QMainWindow( parent, name, fl ) |
58 | // : QDialog( parent, name, modal, fl ) | 59 | // : QDialog( parent, name, modal, fl ) |
59 | { | 60 | { |
60 | if ( !name ) | 61 | if ( !name ) |
61 | setName( "FormatterApp" ); | 62 | setName( "FormatterApp" ); |
62 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 63 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -117,15 +118,15 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
117 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); | 118 | deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); |
118 | 119 | ||
119 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); | 120 | tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); |
120 | 121 | ||
121 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); | 122 | TextLabel5 = new QLabel( tab_2, "TextLabel5" ); |
122 | TextLabel5->setText( tr( "CAUTION:\n" | 123 | TextLabel5->setText( tr( "CAUTION:\n" |
123 | "Changing parameters on this \n" | 124 | "Changing parameters on this\n" |
124 | "page may cause your system \n" | 125 | "page may cause your system\n" |
125 | "to stop functioning properly!!" ) );//idiot message | 126 | "to stop functioning properly!" ) );//idiot message |
126 | 127 | ||
127 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); | 128 | tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); |
128 | 129 | ||
129 | editPushButton = new QPushButton( tab_2, "editPushButton" ); | 130 | editPushButton = new QPushButton( tab_2, "editPushButton" ); |
130 | editPushButton->setText( tr( "Edit fstab" ) ); | 131 | editPushButton->setText( tr( "Edit fstab" ) ); |
131 | editPushButton->setMaximumWidth(100); | 132 | editPushButton->setMaximumWidth(100); |
@@ -200,14 +201,20 @@ void FormatterApp::doFormat() { | |||
200 | umountS = "umount "; | 201 | umountS = "umount "; |
201 | remountS = "mount "; | 202 | remountS = "mount "; |
202 | // umountS = "/etc/sdcontrol compeject"; | 203 | // umountS = "/etc/sdcontrol compeject"; |
203 | // remountS = "/etc/sdcontrol insert"; | 204 | // remountS = "/etc/sdcontrol insert"; |
204 | } | 205 | } |
205 | 206 | ||
206 | switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText + | 207 | switch ( QMessageBox::warning(this,tr("Format?") |
207 | tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) { | 208 | , tr("Really format\n") +diskName+" "+ currentText + |
209 | tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) | ||
210 | ,tr("Yes") | ||
211 | ,tr("No") | ||
212 | ,0 | ||
213 | ,1 | ||
214 | ,1) ) { | ||
208 | case 0: { | 215 | case 0: { |
209 | if(fs == "vfat") | 216 | if(fs == "vfat") |
210 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; | 217 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; |
211 | else if(fs == "ext2") | 218 | else if(fs == "ext2") |
212 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; | 219 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; |
213 | else { | 220 | else { |
@@ -218,19 +225,21 @@ void FormatterApp::doFormat() { | |||
218 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 225 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
219 | outDlg->showMaximized(); | 226 | outDlg->showMaximized(); |
220 | outDlg->show(); | 227 | outDlg->show(); |
221 | qApp->processEvents(); | 228 | qApp->processEvents(); |
222 | FILE *fp; | 229 | FILE *fp; |
223 | char line[130]; | 230 | char line[130]; |
224 | outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); | 231 | |
232 | |||
233 | outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); | ||
225 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 234 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
226 | 235 | ||
227 | sleep(1); | 236 | sleep(1); |
228 | qDebug("Command is "+umountS); | 237 | qDebug("Command is "+umountS); |
229 | fp = popen( (const char *) umountS, "r"); | 238 | fp = popen( (const char *) umountS, "r"); |
230 | qDebug("%d", fp); | 239 | // qDebug("%d", fp); |
231 | if ( !fp ) { | 240 | if ( !fp ) { |
232 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); | 241 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); |
233 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 242 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
234 | pclose(fp); | 243 | pclose(fp); |
235 | return; | 244 | return; |
236 | } else { | 245 | } else { |
@@ -273,21 +282,21 @@ void FormatterApp::doFormat() { | |||
273 | } | 282 | } |
274 | } | 283 | } |
275 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); | 284 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); |
276 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 285 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
277 | pclose(fp); | 286 | pclose(fp); |
278 | 287 | ||
279 | outDlg->OutputEdit->append( tr("Trying to mount.") + currentText ); | 288 | outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); |
280 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 289 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
281 | fp = popen( (const char *) remountS, "r"); | 290 | fp = popen( (const char *) remountS, "r"); |
282 | if ( !fp) { | 291 | if ( !fp) { |
283 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); | 292 | qDebug("Could not execute '" + remountS + "'! err=%d\n" +(QString)strerror(errno), err); |
284 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); | 293 | QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); |
285 | 294 | ||
286 | } else { | 295 | } else { |
287 | outDlg->OutputEdit->append( currentText + tr("\nhas been successfully mounted.")); | 296 | outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); |
288 | while ( fgets( line, sizeof line, fp)) { | 297 | while ( fgets( line, sizeof line, fp)) { |
289 | QString lineStr = line; | 298 | QString lineStr = line; |
290 | lineStr=lineStr.left(lineStr.length()-1); | 299 | lineStr=lineStr.left(lineStr.length()-1); |
291 | outDlg->OutputEdit->append(lineStr); | 300 | outDlg->OutputEdit->append(lineStr); |
292 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 301 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
293 | } | 302 | } |
@@ -332,22 +341,22 @@ void FormatterApp::fillCombos() { | |||
332 | deviceComboBox->insertStringList( deviceList,-1); | 341 | deviceComboBox->insertStringList( deviceList,-1); |
333 | storageComboSelected(0); | 342 | storageComboSelected(0); |
334 | deviceComboSelected(0); | 343 | deviceComboSelected(0); |
335 | } | 344 | } |
336 | 345 | ||
337 | 346 | ||
338 | void FormatterApp::fsComboSelected(int index) { | 347 | void FormatterApp::fsComboSelected(int ) { |
339 | 348 | ||
340 | } | 349 | } |
341 | 350 | ||
342 | void FormatterApp::storageComboSelected(int index ) { | 351 | void FormatterApp::storageComboSelected(int index ) { |
343 | 352 | ||
344 | QString currentText = storageComboBox->text(index); | 353 | QString currentText = storageComboBox->text(index); |
345 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); | 354 | QString nameS = currentText.left( currentText.find("->",0,TRUE)); |
346 | 355 | ||
347 | TextLabel4->setText( tr( "Storage Type : ") + nameS ); | 356 | TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); |
348 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); | 357 | currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); |
349 | 358 | ||
350 | QString fsType = getFileSystemType((const QString &) currentText); | 359 | QString fsType = getFileSystemType((const QString &) currentText); |
351 | // qDebug(fsType); | 360 | // qDebug(fsType); |
352 | for(int i = 0; i < fileSystemsCombo->count(); i++) { | 361 | for(int i = 0; i < fileSystemsCombo->count(); i++) { |
353 | if( fsType == fileSystemsCombo->text(i)) | 362 | if( fsType == fileSystemsCombo->text(i)) |
@@ -388,13 +397,13 @@ void FormatterApp::deviceComboSelected(int index) { | |||
388 | 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); |
389 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); | 398 | avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); |
390 | } | 399 | } |
391 | } | 400 | } |
392 | fsType = getFileSystemType((const QString &)selectedText); | 401 | fsType = getFileSystemType((const QString &)selectedText); |
393 | 402 | ||
394 | TextLabel5->setText("Type: "+ nameS+"\nFormatted with "+ fsType + " \n" + totalS + usedS + avS); | 403 | TextLabel5->setText(tr("Type: %1\nFormatted with %1\n%1, %1, %1").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); |
395 | // storageComboSelected(0); | 404 | // storageComboSelected(0); |
396 | } | 405 | } |
397 | 406 | ||
398 | void FormatterApp::cleanUp() { | 407 | void FormatterApp::cleanUp() { |
399 | 408 | ||
400 | } | 409 | } |
@@ -560,15 +569,15 @@ bool FormatterApp::doFsck() { | |||
560 | 569 | ||
561 | bool FormatterApp::doFsckCheck() { | 570 | bool FormatterApp::doFsckCheck() { |
562 | 571 | ||
563 | return FALSE; | 572 | return FALSE; |
564 | } | 573 | } |
565 | 574 | ||
566 | int FormatterApp::formatCheck(const QString &deviceStr) { | 575 | int FormatterApp::formatCheck(const QString &) { |
567 | 576 | ||
568 | return -1; | 577 | return -1; |
569 | } | 578 | } |
570 | 579 | ||
571 | int FormatterApp::runCommand(const QString &command) { | 580 | int FormatterApp::runCommand(const QString &) { |
572 | 581 | ||
573 | return -1; | 582 | return -1; |
574 | } | 583 | } |