summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-05-29 01:18:11 (UTC)
committer llornkcor <llornkcor>2003-05-29 01:18:11 (UTC)
commit74f2f13e53b066eb461154f11f156bb4ce9c0646 (patch) (unidiff)
tree94c8a576edd980e294a50acb95f2fdc08e1e278c
parent52047fd3d3f30509d65834747c3a0c5c6760dc01 (diff)
downloadopie-74f2f13e53b066eb461154f11f156bb4ce9c0646.zip
opie-74f2f13e53b066eb461154f11f156bb4ce9c0646.tar.gz
opie-74f2f13e53b066eb461154f11f156bb4ce9c0646.tar.bz2
fix tr and clean up compile
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/formatter/formatter.cpp41
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
@@ -1,80 +1,81 @@
1/**************************************************************************** 1/****************************************************************************
2 ** formatter.cpp 2 ** formatter.cpp
3 ** 3 **
4 ** Copyright: Thu Apr 11 11:01:13 2002 4 ** Copyright: Thu Apr 11 11:01:13 2002
5 ** by: L. J. Potter 5 ** by: L. J. Potter
6 ** 6 **
7 ****************************************************************************/ 7 ****************************************************************************/
8 8
9#include "formatter.h" 9#include "formatter.h"
10#include "inputDialog.h" 10#include "inputDialog.h"
11#include "output.h" 11#include "output.h"
12 12
13#include <qpe/qpemenubar.h> 13#include <qpe/qpemenubar.h>
14#include <qpe/qpetoolbar.h> 14#include <qpe/qpetoolbar.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/resource.h> 16#include <qpe/resource.h>
17#include <qpe/config.h> 17#include <qpe/config.h>
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
35#include <qlabel.h> 36#include <qlabel.h>
36#include <qlineedit.h> 37#include <qlineedit.h>
37#include <qpushbutton.h> 38#include <qpushbutton.h>
38#include <qtabwidget.h> 39#include <qtabwidget.h>
39#include <qwidget.h> 40#include <qwidget.h>
40#include <qlayout.h> 41#include <qlayout.h>
41#include <qvariant.h> 42#include <qvariant.h>
42 43
43#include <unistd.h> 44#include <unistd.h>
44#include <stdio.h> 45#include <stdio.h>
45#include <stdlib.h> 46#include <stdlib.h>
46#include <sys/vfs.h> 47#include <sys/vfs.h>
47#include <mntent.h> 48#include <mntent.h>
48#include <string.h> 49#include <string.h>
49#include <errno.h> 50#include <errno.h>
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 */
56FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl ) 57FormatterApp::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()) );
63 64
64 setCaption( tr( "Formatter" ) ); 65 setCaption( tr( "Formatter" ) );
65 FormatterAppLayout = new QGridLayout( this ); 66 FormatterAppLayout = new QGridLayout( this );
66 FormatterAppLayout->setSpacing( 2); 67 FormatterAppLayout->setSpacing( 2);
67 FormatterAppLayout->setMargin( 2 ); 68 FormatterAppLayout->setMargin( 2 );
68 69
69 TabWidget = new QTabWidget( this, "TabWidget" ); 70 TabWidget = new QTabWidget( this, "TabWidget" );
70 71
71 tab = new QWidget( TabWidget, "tab" ); 72 tab = new QWidget( TabWidget, "tab" );
72 tabLayout = new QGridLayout( tab ); 73 tabLayout = new QGridLayout( tab );
73 tabLayout->setSpacing( 3); 74 tabLayout->setSpacing( 3);
74 tabLayout->setMargin( 2); 75 tabLayout->setMargin( 2);
75 76
76 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); 77 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" );
77 storageComboBox->setMaximumWidth(220); 78 storageComboBox->setMaximumWidth(220);
78 79
79 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); 80 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1);
80 81
@@ -99,51 +100,51 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla
99 formatPushButton->setText( tr( "Format" ) ); 100 formatPushButton->setText( tr( "Format" ) );
100 formatPushButton->setMaximumWidth(170); 101 formatPushButton->setMaximumWidth(170);
101 102
102 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); 103 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1);
103 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 104 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
104 tabLayout->addItem( spacer_2, 5, 0 ); 105 tabLayout->addItem( spacer_2, 5, 0 );
105 106
106 TabWidget->insertTab( tab, tr( "Main" ) ); 107 TabWidget->insertTab( tab, tr( "Main" ) );
107 108
108 tab_2 = new QWidget( TabWidget, "tab_2" ); 109 tab_2 = new QWidget( TabWidget, "tab_2" );
109 tabLayout_2 = new QGridLayout( tab_2 ); 110 tabLayout_2 = new QGridLayout( tab_2 );
110 tabLayout_2->setSpacing(3); 111 tabLayout_2->setSpacing(3);
111 tabLayout_2->setMargin(2); 112 tabLayout_2->setMargin(2);
112 113
113 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); 114 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" );
114 115
115 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); 116 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1);
116 117
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);
132 133
133 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); 134 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 );
134 135
135 fsckButton = new QPushButton( tab_2, "fsckPushButton" ); 136 fsckButton = new QPushButton( tab_2, "fsckPushButton" );
136 fsckButton->setText( tr( "Check Disk" ) ); 137 fsckButton->setText( tr( "Check Disk" ) );
137 fsckButton->setMaximumWidth(100); 138 fsckButton->setMaximumWidth(100);
138 139
139 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); 140 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1);
140 141
141 TextLabel3 = new QLabel( tab_2, "TextLabel3" ); 142 TextLabel3 = new QLabel( tab_2, "TextLabel3" );
142 TextLabel3->setText( tr( "Device" ) ); 143 TextLabel3->setText( tr( "Device" ) );
143 144
144 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); 145 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 );
145 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 146 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
146 tabLayout_2->addItem( spacer_3, 5, 0 ); 147 tabLayout_2->addItem( spacer_3, 5, 0 );
147 148
148 TextLabel1 = new QLabel( tab_2, "TextLabel1" ); 149 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
149 TextLabel1->setText( tr( "Mount Point" ) ); 150 TextLabel1->setText( tr( "Mount Point" ) );
@@ -182,130 +183,138 @@ void FormatterApp::doFormat() {
182 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); 183 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE));
183 QString fs = fileSystemsCombo->currentText(); 184 QString fs = fileSystemsCombo->currentText();
184 185
185#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap 186#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap
186#else 187#else
187 currentText = diskDevice = "/dev/fd0"; 188 currentText = diskDevice = "/dev/fd0";
188 umountS = "umount -v /floppy 2>&1"; 189 umountS = "umount -v /floppy 2>&1";
189 remountS = "mount -v /floppy 2>&1"; 190 remountS = "mount -v /floppy 2>&1";
190#endif 191#endif
191 192
192 if( currentText.find("CF",0,TRUE) != -1) { 193 if( currentText.find("CF",0,TRUE) != -1) {
193 umountS = "umount "; 194 umountS = "umount ";
194 remountS = "mount "; 195 remountS = "mount ";
195 196
196// umountS = "/sbin/cardctl eject"; 197// umountS = "/sbin/cardctl eject";
197// remountS = "/sbin/cardctl insert"; 198// remountS = "/sbin/cardctl insert";
198 } 199 }
199 if( currentText.find("SD",0,TRUE) != -1) { 200 if( currentText.find("SD",0,TRUE) != -1) {
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 {
214 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); 221 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok"));
215 break; 222 break;
216 } 223 }
217// cmd = "ls -l"; 224// cmd = "ls -l";
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 {
237// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 246// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
238// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 247// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
239 while ( fgets( line, sizeof line, fp)) { 248 while ( fgets( line, sizeof line, fp)) {
240 if( ((QString)line).find("busy",0,TRUE) != -1) { 249 if( ((QString)line).find("busy",0,TRUE) != -1) {
241 qDebug("Could not find '" + umountS); 250 qDebug("Could not find '" + umountS);
242 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 251 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
243 pclose(fp); 252 pclose(fp);
244 return; 253 return;
245 } else { 254 } else {
246 QString lineStr = line; 255 QString lineStr = line;
247 lineStr=lineStr.left(lineStr.length()-1); 256 lineStr=lineStr.left(lineStr.length()-1);
248 outDlg->OutputEdit->append(lineStr); 257 outDlg->OutputEdit->append(lineStr);
249 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 258 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
250 } 259 }
251 } 260 }
252 } 261 }
253 pclose(fp); 262 pclose(fp);
254 263
255 qDebug("Command would be: "+cmd); 264 qDebug("Command would be: "+cmd);
256 outDlg->OutputEdit->append( tr("Trying to format.") ); 265 outDlg->OutputEdit->append( tr("Trying to format.") );
257 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 266 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
258 267
259 fp = popen( (const char *) cmd, "r"); 268 fp = popen( (const char *) cmd, "r");
260 while ( fgets( line, sizeof line, fp)) { 269 while ( fgets( line, sizeof line, fp)) {
261 if( ((QString)line).find("No such device",0,TRUE) != -1) { 270 if( ((QString)line).find("No such device",0,TRUE) != -1) {
262 qDebug("No such device '" + umountS); 271 qDebug("No such device '" + umountS);
263 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 272 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
264 pclose(fp); 273 pclose(fp);
265// outDlg->OutputEdit->append("No such device"); 274// outDlg->OutputEdit->append("No such device");
266// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 275// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
267 return; 276 return;
268 } else { 277 } else {
269 QString lineStr = line; 278 QString lineStr = line;
270 lineStr=lineStr.left(lineStr.length()-1); 279 lineStr=lineStr.left(lineStr.length()-1);
271 outDlg->OutputEdit->append(lineStr); 280 outDlg->OutputEdit->append(lineStr);
272 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 281 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
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 }
294 } 303 }
295 pclose(fp); 304 pclose(fp);
296 sleep(1); 305 sleep(1);
297 306
298 outDlg->OutputEdit->append(tr("You can now close the output window.")); 307 outDlg->OutputEdit->append(tr("You can now close the output window."));
299 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 308 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
300// outDlg->close(); 309// outDlg->close();
301// if(outDlg) 310// if(outDlg)
302// delete outDlg; 311// delete outDlg;
303 } 312 }
304 break; 313 break;
305 }; 314 };
306} 315}
307 316
308bool FormatterApp::doFdisk() { 317bool FormatterApp::doFdisk() {
309 return FALSE; 318 return FALSE;
310 319
311} 320}
@@ -314,105 +323,105 @@ void FormatterApp::fillCombos() {
314 323
315 StorageInfo storageInfo; 324 StorageInfo storageInfo;
316 const QList<FileSystem> &fs = storageInfo.fileSystems(); 325 const QList<FileSystem> &fs = storageInfo.fileSystems();
317 QListIterator<FileSystem> it ( fs ); 326 QListIterator<FileSystem> it ( fs );
318 QString storage; 327 QString storage;
319 for( ; it.current(); ++it ){ 328 for( ; it.current(); ++it ){
320 const QString name = (*it)->name(); 329 const QString name = (*it)->name();
321 const QString path = (*it)->path(); 330 const QString path = (*it)->path();
322 const QString disk = (*it)->disk(); 331 const QString disk = (*it)->disk();
323 const QString options = (*it)->options(); 332 const QString options = (*it)->options();
324 if( name.find( tr("Internal"),0,TRUE) == -1) { 333 if( name.find( tr("Internal"),0,TRUE) == -1) {
325 storageComboBox->insertItem(name +" -> "+disk); 334 storageComboBox->insertItem(name +" -> "+disk);
326 } 335 }
327// deviceComboBox->insertItem(disk); 336// deviceComboBox->insertItem(disk);
328 } 337 }
329 parsetab("/etc/mtab"); 338 parsetab("/etc/mtab");
330// parsetab("/etc/fstab"); 339// parsetab("/etc/fstab");
331 fileSystemsCombo->insertStringList( fsList,-1); 340 fileSystemsCombo->insertStringList( fsList,-1);
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
338void FormatterApp::fsComboSelected(int index) { 347void FormatterApp::fsComboSelected(int ) {
339 348
340} 349}
341 350
342void FormatterApp::storageComboSelected(int index ) { 351void 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))
354 fileSystemsCombo->setCurrentItem(i); 363 fileSystemsCombo->setCurrentItem(i);
355 } 364 }
356// deviceComboSelected(index); 365// deviceComboSelected(index);
357} 366}
358 367
359void FormatterApp::deviceComboSelected(int index) { 368void FormatterApp::deviceComboSelected(int index) {
360 369
361 StorageInfo storageInfo; 370 StorageInfo storageInfo;
362 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; 371 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText;
363 372
364 selectedText = deviceComboBox->text(index); 373 selectedText = deviceComboBox->text(index);
365 374
366 const QList<FileSystem> &fs = storageInfo.fileSystems(); 375 const QList<FileSystem> &fs = storageInfo.fileSystems();
367 QListIterator<FileSystem> it ( fs ); 376 QListIterator<FileSystem> it ( fs );
368 QString storage; 377 QString storage;
369 for( ; it.current(); ++it ){ 378 for( ; it.current(); ++it ){
370 const QString name = (*it)->name(); 379 const QString name = (*it)->name();
371 const QString path = (*it)->path(); 380 const QString path = (*it)->path();
372 const QString disk = (*it)->disk(); 381 const QString disk = (*it)->disk();
373// const QString options = (*it)->options(); 382// const QString options = (*it)->options();
374 if( selectedText == disk) { 383 if( selectedText == disk) {
375 diskS = disk; nameS= name; 384 diskS = disk; nameS= name;
376 mountPointLineEdit->setText(path); 385 mountPointLineEdit->setText(path);
377 long mult = (*it)->blockSize() / 1024; 386 long mult = (*it)->blockSize() / 1024;
378 long div = 1024 / (*it)->blockSize(); 387 long div = 1024 / (*it)->blockSize();
379 if ( !mult ) mult = 1; 388 if ( !mult ) mult = 1;
380 if ( !div ) div = 1; 389 if ( !div ) div = 1;
381 long total = (*it)->totalBlocks() * mult / div; 390 long total = (*it)->totalBlocks() * mult / div;
382 long totalMb = total/1024; 391 long totalMb = total/1024;
383 long avail = (*it)->availBlocks() * mult / div; 392 long avail = (*it)->availBlocks() * mult / div;
384 long availMb = avail/1024; 393 long availMb = avail/1024;
385 long used = total - avail; 394 long used = total - avail;
386 long usedMb = used/1024; 395 long usedMb = used/1024;
387 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 );
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
398void FormatterApp::cleanUp() { 407void FormatterApp::cleanUp() {
399 408
400} 409}
401 410
402 411
403void FormatterApp::editFstab() { 412void FormatterApp::editFstab() {
404 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); 413 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
405 e << (const QString &)"/etc/fstab"; 414 e << (const QString &)"/etc/fstab";
406} 415}
407 416
408void FormatterApp::parsetab(const QString &fileName) { 417void FormatterApp::parsetab(const QString &fileName) {
409 418
410 fileSystemTypeList.clear(); 419 fileSystemTypeList.clear();
411 fsList.clear(); 420 fsList.clear();
412 struct mntent *me; 421 struct mntent *me;
413// if(fileName == "/etc/mtab") { 422// if(fileName == "/etc/mtab") {
414 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 423 FILE *mntfp = setmntent( fileName.latin1(), "r" );
415 if ( mntfp ) { 424 if ( mntfp ) {
416 while ( (me = getmntent( mntfp )) != 0 ) { 425 while ( (me = getmntent( mntfp )) != 0 ) {
417 QString deviceName = me->mnt_fsname; 426 QString deviceName = me->mnt_fsname;
418 QString filesystemType = me->mnt_type; 427 QString filesystemType = me->mnt_type;
@@ -542,33 +551,33 @@ bool FormatterApp::doFsck() {
542 return false; 551 return false;
543 } else { 552 } else {
544 QString lineStr = line; 553 QString lineStr = line;
545 lineStr=lineStr.left(lineStr.length()-1); 554 lineStr=lineStr.left(lineStr.length()-1);
546 outDlg->OutputEdit->append(lineStr); 555 outDlg->OutputEdit->append(lineStr);
547 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 556 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
548 } 557 }
549 } 558 }
550 outDlg->OutputEdit->append(tr("You can now close the output window.")); 559 outDlg->OutputEdit->append(tr("You can now close the output window."));
551 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 560 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
552// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 561// outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
553// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 562// outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
554 pclose(fp); 563 pclose(fp);
555 564
556///////////////////////////////////////// 565/////////////////////////////////////////
557 566
558 return true; 567 return true;
559} 568}
560 569
561bool FormatterApp::doFsckCheck() { 570bool FormatterApp::doFsckCheck() {
562 571
563 return FALSE; 572 return FALSE;
564} 573}
565 574
566int FormatterApp::formatCheck(const QString &deviceStr) { 575int FormatterApp::formatCheck(const QString &) {
567 576
568 return -1; 577 return -1;
569} 578}
570 579
571int FormatterApp::runCommand(const QString &command) { 580int FormatterApp::runCommand(const QString &) {
572 581
573 return -1; 582 return -1;
574} 583}