summaryrefslogtreecommitdiff
authordrw <drw>2005-05-23 23:49:14 (UTC)
committer drw <drw>2005-05-23 23:49:14 (UTC)
commitf5d45036d2a444f9ee27311895c430babcf947e5 (patch) (unidiff)
tree69a1ba1227931cccce2d916c6e0fd7dcc6ccd003
parenta04b6cb80be1c2df466b69ed40450820056aff06 (diff)
downloadopie-f5d45036d2a444f9ee27311895c430babcf947e5.zip
opie-f5d45036d2a444f9ee27311895c430babcf947e5.tar.gz
opie-f5d45036d2a444f9ee27311895c430babcf947e5.tar.bz2
Remove unnecessary include and fix compiler warning
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/formatter/formatter.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/noncore/tools/formatter/formatter.cpp b/noncore/tools/formatter/formatter.cpp
index 642196e..2b8cca2 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -1,634 +1,633 @@
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/* OPIE */ 13/* OPIE */
14#include <opie2/odebug.h> 14#include <opie2/odebug.h>
15#include <qpe/qpeapplication.h> 15#include <qpe/qpeapplication.h>
16#include <qpe/resource.h>
17#include <qpe/config.h> 16#include <qpe/config.h>
18#include <qpe/mimetype.h> 17#include <qpe/mimetype.h>
19#include <qpe/qcopenvelope_qws.h> 18#include <qpe/qcopenvelope_qws.h>
20#include <qpe/storage.h> 19#include <qpe/storage.h>
21using namespace Opie::Core; 20using namespace Opie::Core;
22 21
23/* QT */ 22/* QT */
24#include <qmenubar.h> 23#include <qmenubar.h>
25#include <qmultilineedit.h> 24#include <qmultilineedit.h>
26#include <qstring.h> 25#include <qstring.h>
27#include <qlist.h> 26#include <qlist.h>
28#include <qstringlist.h> 27#include <qstringlist.h>
29#include <qdir.h> 28#include <qdir.h>
30#include <qfile.h> 29#include <qfile.h>
31#include <qtstream.h> 30#include <qtstream.h>
32#include <qcombobox.h> 31#include <qcombobox.h>
33#include <qpopupmenu.h> 32#include <qpopupmenu.h>
34#include <qmessagebox.h> 33#include <qmessagebox.h>
35#include <qregexp.h> 34#include <qregexp.h>
36#include <qlabel.h> 35#include <qlabel.h>
37#include <qlineedit.h> 36#include <qlineedit.h>
38#include <qpushbutton.h> 37#include <qpushbutton.h>
39#include <qtoolbar.h> 38#include <qtoolbar.h>
40#include <qtabwidget.h> 39#include <qtabwidget.h>
41#include <qwidget.h> 40#include <qwidget.h>
42#include <qlayout.h> 41#include <qlayout.h>
43#include <qvariant.h> 42#include <qvariant.h>
44 43
45/* STD */ 44/* STD */
46#include <unistd.h> 45#include <unistd.h>
47#include <stdio.h> 46#include <stdio.h>
48#include <stdlib.h> 47#include <stdlib.h>
49#include <sys/vfs.h> 48#include <sys/vfs.h>
50#include <mntent.h> 49#include <mntent.h>
51#include <string.h> 50#include <string.h>
52#include <errno.h> 51#include <errno.h>
53 52
54#define BLANK ' ' 53#define BLANK ' '
55#define DELIMITER '#' 54#define DELIMITER '#'
56 55
57/* 56/*
58 Blah blah blah blah */ 57 Blah blah blah blah */
59FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool modal ) 58FormatterApp::FormatterApp( QWidget* parent, const char* name, WFlags fl, bool /*modal*/ )
60 : QMainWindow( parent, name, fl ) 59 : QMainWindow( parent, name, fl )
61 // : QDialog( parent, name, modal, fl ) 60 // : QDialog( parent, name, modal, fl )
62{ 61{
63 if ( !name ) 62 if ( !name )
64 setName( "FormatterApp" ); 63 setName( "FormatterApp" );
65 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 64 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
66 65
67 setCaption( tr( "Formatter" ) ); 66 setCaption( tr( "Formatter" ) );
68 FormatterAppLayout = new QGridLayout( this ); 67 FormatterAppLayout = new QGridLayout( this );
69 FormatterAppLayout->setSpacing( 2); 68 FormatterAppLayout->setSpacing( 2);
70 FormatterAppLayout->setMargin( 2 ); 69 FormatterAppLayout->setMargin( 2 );
71 70
72 TabWidget = new QTabWidget( this, "TabWidget" ); 71 TabWidget = new QTabWidget( this, "TabWidget" );
73 72
74 tab = new QWidget( TabWidget, "tab" ); 73 tab = new QWidget( TabWidget, "tab" );
75 tabLayout = new QGridLayout( tab ); 74 tabLayout = new QGridLayout( tab );
76 tabLayout->setSpacing( 3); 75 tabLayout->setSpacing( 3);
77 tabLayout->setMargin( 2); 76 tabLayout->setMargin( 2);
78 77
79 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); 78 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" );
80 storageComboBox->setMaximumWidth(220); 79 storageComboBox->setMaximumWidth(220);
81 80
82 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); 81 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1);
83 82
84 TextLabel4 = new QLabel( tab, "TextLabel4" ); 83 TextLabel4 = new QLabel( tab, "TextLabel4" );
85 TextLabel4->setText( tr( "Storage Type" ) ); 84 TextLabel4->setText( tr( "Storage Type" ) );
86 85
87 tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1); 86 tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1);
88 87
89 TextLabel2 = new QLabel( tab, "TextLabel2" ); 88 TextLabel2 = new QLabel( tab, "TextLabel2" );
90 TextLabel2->setText( tr( "File Systems" ) ); 89 TextLabel2->setText( tr( "File Systems" ) );
91 90
92 tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); 91 tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1);
93 92
94 fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); 93 fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" );
95 fileSystemsCombo->setMaximumWidth(220); 94 fileSystemsCombo->setMaximumWidth(220);
96 95
97 tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); 96 tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1);
98 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 97 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
99 tabLayout->addItem( spacer, 2, 0 ); 98 tabLayout->addItem( spacer, 2, 0 );
100 99
101 formatPushButton = new QPushButton( tab, "formatPushButton" ); 100 formatPushButton = new QPushButton( tab, "formatPushButton" );
102 formatPushButton->setText( tr( "Format" ) ); 101 formatPushButton->setText( tr( "Format" ) );
103 formatPushButton->setMaximumWidth(170); 102 formatPushButton->setMaximumWidth(170);
104 103
105 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); 104 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1);
106 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 105 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
107 tabLayout->addItem( spacer_2, 5, 0 ); 106 tabLayout->addItem( spacer_2, 5, 0 );
108 107
109 TabWidget->insertTab( tab, tr( "Main" ) ); 108 TabWidget->insertTab( tab, tr( "Main" ) );
110 109
111 tab_2 = new QWidget( TabWidget, "tab_2" ); 110 tab_2 = new QWidget( TabWidget, "tab_2" );
112 tabLayout_2 = new QGridLayout( tab_2 ); 111 tabLayout_2 = new QGridLayout( tab_2 );
113 tabLayout_2->setSpacing(3); 112 tabLayout_2->setSpacing(3);
114 tabLayout_2->setMargin(2); 113 tabLayout_2->setMargin(2);
115 114
116 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); 115 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" );
117 116
118 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); 117 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1);
119 118
120 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); 119 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" );
121 120
122 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); 121 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1);
123 122
124 TextLabel5 = new QLabel( tab_2, "TextLabel5" ); 123 TextLabel5 = new QLabel( tab_2, "TextLabel5" );
125 TextLabel5->setText( tr( "CAUTION:\n" 124 TextLabel5->setText( tr( "CAUTION:\n"
126 "Changing parameters on this\n" 125 "Changing parameters on this\n"
127 "page may cause your system\n" 126 "page may cause your system\n"
128 "to stop functioning properly!" ) );//idiot message 127 "to stop functioning properly!" ) );//idiot message
129 128
130 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); 129 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1);
131 130
132 editPushButton = new QPushButton( tab_2, "editPushButton" ); 131 editPushButton = new QPushButton( tab_2, "editPushButton" );
133 editPushButton->setText( tr( "Edit fstab" ) ); 132 editPushButton->setText( tr( "Edit fstab" ) );
134 editPushButton->setMaximumWidth(100); 133 editPushButton->setMaximumWidth(100);
135 134
136 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); 135 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 );
137 136
138 fsckButton = new QPushButton( tab_2, "fsckPushButton" ); 137 fsckButton = new QPushButton( tab_2, "fsckPushButton" );
139 fsckButton->setText( tr( "Check Disk" ) ); 138 fsckButton->setText( tr( "Check Disk" ) );
140 fsckButton->setMaximumWidth(100); 139 fsckButton->setMaximumWidth(100);
141 140
142 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); 141 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1);
143 142
144 TextLabel3 = new QLabel( tab_2, "TextLabel3" ); 143 TextLabel3 = new QLabel( tab_2, "TextLabel3" );
145 TextLabel3->setText( tr( "Device" ) ); 144 TextLabel3->setText( tr( "Device" ) );
146 145
147 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); 146 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 );
148 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 147 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
149 tabLayout_2->addItem( spacer_3, 5, 0 ); 148 tabLayout_2->addItem( spacer_3, 5, 0 );
150 149
151 TextLabel1 = new QLabel( tab_2, "TextLabel1" ); 150 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
152 TextLabel1->setText( tr( "Mount Point" ) ); 151 TextLabel1->setText( tr( "Mount Point" ) );
153 152
154 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); 153 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 );
155 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 154 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
156 tabLayout_2->addItem( spacer_4, 2, 1 ); 155 tabLayout_2->addItem( spacer_4, 2, 1 );
157 TabWidget->insertTab( tab_2, tr( "Advanced" ) ); 156 TabWidget->insertTab( tab_2, tr( "Advanced" ) );
158 157
159 FormatterAppLayout->addWidget( TabWidget, 0, 1 ); 158 FormatterAppLayout->addWidget( TabWidget, 0, 1 );
160 159
161 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); 160 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) );
162 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); 161 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) );
163 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); 162 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) );
164 163
165 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) )); 164 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int) ));
166 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) )); 165 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int) ));
167 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) )); 166 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int) ));
168 167
169 168
170 fillCombos(); 169 fillCombos();
171} 170}
172 171
173FormatterApp::~FormatterApp() 172FormatterApp::~FormatterApp()
174{} 173{}
175 174
176void FormatterApp::doFormat() 175void FormatterApp::doFormat()
177{ 176{
178 int err=0; 177 int err=0;
179 Output *outDlg; 178 Output *outDlg;
180 QString umountS, remountS; 179 QString umountS, remountS;
181 QString text = storageComboBox->currentText(); 180 QString text = storageComboBox->currentText();
182 QString currentText = storageComboBox->currentText(); 181 QString currentText = storageComboBox->currentText();
183 QString cmd; 182 QString cmd;
184 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 183 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
185 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); 184 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE));
186 QString fs = fileSystemsCombo->currentText(); 185 QString fs = fileSystemsCombo->currentText();
187 186
188#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap 187#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap
189#else 188#else
190 currentText = diskDevice = "/dev/fd0"; 189 currentText = diskDevice = "/dev/fd0";
191 umountS = "umount -v /floppy 2>&1"; 190 umountS = "umount -v /floppy 2>&1";
192 remountS = "mount -v /floppy 2>&1"; 191 remountS = "mount -v /floppy 2>&1";
193#endif 192#endif
194 193
195 if( currentText.find("CF",0,TRUE) != -1) 194 if( currentText.find("CF",0,TRUE) != -1)
196 { 195 {
197 umountS = "umount "; 196 umountS = "umount ";
198 remountS = "mount "; 197 remountS = "mount ";
199 198
200 // umountS = "/sbin/cardctl eject"; 199 // umountS = "/sbin/cardctl eject";
201 // remountS = "/sbin/cardctl insert"; 200 // remountS = "/sbin/cardctl insert";
202 } 201 }
203 if( currentText.find("SD",0,TRUE) != -1) 202 if( currentText.find("SD",0,TRUE) != -1)
204 { 203 {
205 umountS = "umount "; 204 umountS = "umount ";
206 remountS = "mount "; 205 remountS = "mount ";
207 // umountS = "/etc/sdcontrol compeject"; 206 // umountS = "/etc/sdcontrol compeject";
208 // remountS = "/etc/sdcontrol insert"; 207 // remountS = "/etc/sdcontrol insert";
209 } 208 }
210 209
211 switch ( QMessageBox::warning(this,tr("Format?") 210 switch ( QMessageBox::warning(this,tr("Format?")
212 , tr("Really format\n") +diskName+" "+ currentText + 211 , tr("Really format\n") +diskName+" "+ currentText +
213 tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs ) 212 tr("\nwith %1 filesystem?\nYou will loose all data!!").arg( fs )
214 ,tr("Yes") 213 ,tr("Yes")
215 ,tr("No") 214 ,tr("No")
216 ,0 215 ,0
217 ,1 216 ,1
218 ,1) ) 217 ,1) )
219 { 218 {
220 case 0: 219 case 0:
221 { 220 {
222 if(fs == "vfat") 221 if(fs == "vfat")
223 cmd = "mkdosfs -v " + diskDevice+" 2>&1"; 222 cmd = "mkdosfs -v " + diskDevice+" 2>&1";
224 else if(fs == "ext2") 223 else if(fs == "ext2")
225 cmd = "mke2fs -v " + diskDevice+" 2>&1"; 224 cmd = "mke2fs -v " + diskDevice+" 2>&1";
226 else 225 else
227 { 226 {
228 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); 227 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok"));
229 break; 228 break;
230 } 229 }
231 // cmd = "ls -l"; 230 // cmd = "ls -l";
232 outDlg = new Output(this, tr("Formatter Output"),FALSE); 231 outDlg = new Output(this, tr("Formatter Output"),FALSE);
233 QPEApplication::showDialog( outDlg); 232 QPEApplication::showDialog( outDlg);
234 qApp->processEvents(); 233 qApp->processEvents();
235 FILE *fp; 234 FILE *fp;
236 char line[130]; 235 char line[130];
237 236
238 237
239 outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) ); 238 outDlg->OutputEdit->append( tr("Trying to umount %1.").arg( currentText) );
240 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 239 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
241 240
242 sleep(1); 241 sleep(1);
243 odebug << "Command is "+umountS << oendl; 242 odebug << "Command is "+umountS << oendl;
244 fp = popen( (const char *) umountS, "r"); 243 fp = popen( (const char *) umountS, "r");
245 // odebug << "" << fp << "" << oendl; 244 // odebug << "" << fp << "" << oendl;
246 if ( !fp ) 245 if ( !fp )
247 { 246 {
248 odebug << "Could not execute '" + umountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl; 247 odebug << "Could not execute '" + umountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
249 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 248 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
250 pclose(fp); 249 pclose(fp);
251 return; 250 return;
252 } 251 }
253 else 252 else
254 { 253 {
255 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 254 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
256 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 255 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
257 while ( fgets( line, sizeof line, fp)) 256 while ( fgets( line, sizeof line, fp))
258 { 257 {
259 if( ((QString)line).find("busy",0,TRUE) != -1) 258 if( ((QString)line).find("busy",0,TRUE) != -1)
260 { 259 {
261 odebug << "Could not find '" + umountS << oendl; 260 odebug << "Could not find '" + umountS << oendl;
262 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 261 QMessageBox::warning( this, tr("Formatter"), tr("Could not umount.\nDevice is busy!"), tr("&OK") );
263 pclose(fp); 262 pclose(fp);
264 return; 263 return;
265 } 264 }
266 else 265 else
267 { 266 {
268 QString lineStr = line; 267 QString lineStr = line;
269 lineStr=lineStr.left(lineStr.length()-1); 268 lineStr=lineStr.left(lineStr.length()-1);
270 outDlg->OutputEdit->append(lineStr); 269 outDlg->OutputEdit->append(lineStr);
271 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 270 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
272 } 271 }
273 } 272 }
274 } 273 }
275 pclose(fp); 274 pclose(fp);
276 275
277 odebug << "Command would be: "+cmd << oendl; 276 odebug << "Command would be: "+cmd << oendl;
278 outDlg->OutputEdit->append( tr("Trying to format.") ); 277 outDlg->OutputEdit->append( tr("Trying to format.") );
279 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 278 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
280 279
281 fp = popen( (const char *) cmd, "r"); 280 fp = popen( (const char *) cmd, "r");
282 while ( fgets( line, sizeof line, fp)) 281 while ( fgets( line, sizeof line, fp))
283 { 282 {
284 if( ((QString)line).find("No such device",0,TRUE) != -1) 283 if( ((QString)line).find("No such device",0,TRUE) != -1)
285 { 284 {
286 odebug << "No such device '" + umountS << oendl; 285 odebug << "No such device '" + umountS << oendl;
287 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 286 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
288 pclose(fp); 287 pclose(fp);
289 // outDlg->OutputEdit->append("No such device"); 288 // outDlg->OutputEdit->append("No such device");
290 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 289 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
291 return; 290 return;
292 } 291 }
293 else 292 else
294 { 293 {
295 QString lineStr = line; 294 QString lineStr = line;
296 lineStr=lineStr.left(lineStr.length()-1); 295 lineStr=lineStr.left(lineStr.length()-1);
297 outDlg->OutputEdit->append(lineStr); 296 outDlg->OutputEdit->append(lineStr);
298 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 297 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
299 } 298 }
300 } 299 }
301 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 300 outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
302 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 301 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
303 pclose(fp); 302 pclose(fp);
304 303
305 outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) ); 304 outDlg->OutputEdit->append( tr("Trying to mount %1.").arg( currentText) );
306 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 305 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
307 fp = popen( (const char *) remountS, "r"); 306 fp = popen( (const char *) remountS, "r");
308 if ( !fp) 307 if ( !fp)
309 { 308 {
310 odebug << "Could not execute '" + remountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl; 309 odebug << "Could not execute '" + remountS + "'! err=" << err << "\n" +(QString)strerror(errno) << oendl;
311 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") ); 310 QMessageBox::warning( this, tr("Formatter"), tr("Card mount failed!"), tr("&OK") );
312 311
313 } 312 }
314 else 313 else
315 { 314 {
316 outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText )); 315 outDlg->OutputEdit->append(tr("%1\nhas been successfully mounted.").arg( currentText ));
317 while ( fgets( line, sizeof line, fp)) 316 while ( fgets( line, sizeof line, fp))
318 { 317 {
319 QString lineStr = line; 318 QString lineStr = line;
320 lineStr=lineStr.left(lineStr.length()-1); 319 lineStr=lineStr.left(lineStr.length()-1);
321 outDlg->OutputEdit->append(lineStr); 320 outDlg->OutputEdit->append(lineStr);
322 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 321 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
323 } 322 }
324 } 323 }
325 pclose(fp); 324 pclose(fp);
326 sleep(1); 325 sleep(1);
327 326
328 outDlg->OutputEdit->append(tr("You can now close the output window.")); 327 outDlg->OutputEdit->append(tr("You can now close the output window."));
329 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 328 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
330 // outDlg->close(); 329 // outDlg->close();
331 // if(outDlg) 330 // if(outDlg)
332 // delete outDlg; 331 // delete outDlg;
333 } 332 }
334 break; 333 break;
335 }; 334 };
336} 335}
337 336
338bool FormatterApp::doFdisk() 337bool FormatterApp::doFdisk()
339{ 338{
340 return FALSE; 339 return FALSE;
341 340
342} 341}
343 342
344void FormatterApp::fillCombos() 343void FormatterApp::fillCombos()
345{ 344{
346 345
347 StorageInfo storageInfo; 346 StorageInfo storageInfo;
348 const QList<FileSystem> &fs = storageInfo.fileSystems(); 347 const QList<FileSystem> &fs = storageInfo.fileSystems();
349 QListIterator<FileSystem> it ( fs ); 348 QListIterator<FileSystem> it ( fs );
350 QString storage; 349 QString storage;
351 for( ; it.current(); ++it ) 350 for( ; it.current(); ++it )
352 { 351 {
353 const QString name = (*it)->name(); 352 const QString name = (*it)->name();
354 const QString path = (*it)->path(); 353 const QString path = (*it)->path();
355 const QString disk = (*it)->disk(); 354 const QString disk = (*it)->disk();
356 const QString options = (*it)->options(); 355 const QString options = (*it)->options();
357 if( name.find( tr("Internal"),0,TRUE) == -1) 356 if( name.find( tr("Internal"),0,TRUE) == -1)
358 { 357 {
359 storageComboBox->insertItem(name +" -> "+disk); 358 storageComboBox->insertItem(name +" -> "+disk);
360 } 359 }
361 // deviceComboBox->insertItem(disk); 360 // deviceComboBox->insertItem(disk);
362 } 361 }
363 parsetab("/etc/mtab"); 362 parsetab("/etc/mtab");
364 // parsetab("/etc/fstab"); 363 // parsetab("/etc/fstab");
365 fileSystemsCombo->insertStringList( fsList,-1); 364 fileSystemsCombo->insertStringList( fsList,-1);
366 deviceComboBox->insertStringList( deviceList,-1); 365 deviceComboBox->insertStringList( deviceList,-1);
367 storageComboSelected(0); 366 storageComboSelected(0);
368 deviceComboSelected(0); 367 deviceComboSelected(0);
369} 368}
370 369
371 370
372void FormatterApp::fsComboSelected(int ) 371void FormatterApp::fsComboSelected(int )
373{} 372{}
374 373
375void FormatterApp::storageComboSelected(int index ) 374void FormatterApp::storageComboSelected(int index )
376{ 375{
377 376
378 QString currentText = storageComboBox->text(index); 377 QString currentText = storageComboBox->text(index);
379 QString nameS = currentText.left( currentText.find("->",0,TRUE)); 378 QString nameS = currentText.left( currentText.find("->",0,TRUE));
380 379
381 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) ); 380 TextLabel4->setText( tr( "Storage Type: %1").arg( nameS) );
382 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 381 currentText = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
383 382
384 QString fsType = getFileSystemType((const QString &) currentText); 383 QString fsType = getFileSystemType((const QString &) currentText);
385 // odebug << fsType << oendl; 384 // odebug << fsType << oendl;
386 for(int i = 0; i < fileSystemsCombo->count(); i++) 385 for(int i = 0; i < fileSystemsCombo->count(); i++)
387 { 386 {
388 if( fsType == fileSystemsCombo->text(i)) 387 if( fsType == fileSystemsCombo->text(i))
389 fileSystemsCombo->setCurrentItem(i); 388 fileSystemsCombo->setCurrentItem(i);
390 } 389 }
391 // deviceComboSelected(index); 390 // deviceComboSelected(index);
392} 391}
393 392
394void FormatterApp::deviceComboSelected(int index) 393void FormatterApp::deviceComboSelected(int index)
395{ 394{
396 395
397 StorageInfo storageInfo; 396 StorageInfo storageInfo;
398 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText; 397 QString totalS, usedS, avS, diskS, nameS, fsType, selectedText;
399 398
400 selectedText = deviceComboBox->text(index); 399 selectedText = deviceComboBox->text(index);
401 400
402 const QList<FileSystem> &fs = storageInfo.fileSystems(); 401 const QList<FileSystem> &fs = storageInfo.fileSystems();
403 QListIterator<FileSystem> it ( fs ); 402 QListIterator<FileSystem> it ( fs );
404 QString storage; 403 QString storage;
405 for( ; it.current(); ++it ) 404 for( ; it.current(); ++it )
406 { 405 {
407 const QString name = (*it)->name(); 406 const QString name = (*it)->name();
408 const QString path = (*it)->path(); 407 const QString path = (*it)->path();
409 const QString disk = (*it)->disk(); 408 const QString disk = (*it)->disk();
410 // const QString options = (*it)->options(); 409 // const QString options = (*it)->options();
411 if( selectedText == disk) 410 if( selectedText == disk)
412 { 411 {
413 diskS = disk; nameS= name; 412 diskS = disk; nameS= name;
414 mountPointLineEdit->setText(path); 413 mountPointLineEdit->setText(path);
415 long mult = (*it)->blockSize() / 1024; 414 long mult = (*it)->blockSize() / 1024;
416 long div = 1024 / (*it)->blockSize(); 415 long div = 1024 / (*it)->blockSize();
417 if ( !mult ) mult = 1; 416 if ( !mult ) mult = 1;
418 if ( !div ) div = 1; 417 if ( !div ) div = 1;
419 long total = (*it)->totalBlocks() * mult / div; 418 long total = (*it)->totalBlocks() * mult / div;
420 long totalMb = total/1024; 419 long totalMb = total/1024;
421 long avail = (*it)->availBlocks() * mult / div; 420 long avail = (*it)->availBlocks() * mult / div;
422 long availMb = avail/1024; 421 long availMb = avail/1024;
423 long used = total - avail; 422 long used = total - avail;
424 long usedMb = used/1024; 423 long usedMb = used/1024;
425 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb ); 424 totalS.sprintf(tr("Total: %1 kB ( %d mB)\n").arg( total ), totalMb );
426 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb); 425 usedS.sprintf(tr("Used: %1 kB ( %d mB)\n").arg(used) ,usedMb);
427 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb ); 426 avS.sprintf( tr("Available: %1 kB ( %d mB)").arg(avail), availMb );
428 } 427 }
429 } 428 }
430 fsType = getFileSystemType((const QString &)selectedText); 429 fsType = getFileSystemType((const QString &)selectedText);
431 430
432 TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS )); 431 TextLabel5->setText(tr("Type: %1\nFormatted with %2\n%3, %4, %5").arg( nameS).arg( fsType).arg(totalS).arg( usedS).arg( avS ));
433 TextLabel5->setTextFormat( Qt::RichText ); 432 TextLabel5->setTextFormat( Qt::RichText );
434 // storageComboSelected(0); 433 // storageComboSelected(0);
435} 434}
436 435
437void FormatterApp::cleanUp() 436void FormatterApp::cleanUp()
438{} 437{}
439 438
440 439
441void FormatterApp::editFstab() 440void FormatterApp::editFstab()
442{ 441{
443 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)"); 442 QCopEnvelope e("QPE/Application/textedit","setDocument(QString)");
444 e << (const QString &)"/etc/fstab"; 443 e << (const QString &)"/etc/fstab";
445} 444}
446 445
447void FormatterApp::parsetab(const QString &fileName) 446void FormatterApp::parsetab(const QString &fileName)
448{ 447{
449 448
450 fileSystemTypeList.clear(); 449 fileSystemTypeList.clear();
451 fsList.clear(); 450 fsList.clear();
452 struct mntent *me; 451 struct mntent *me;
453 // if(fileName == "/etc/mtab") { 452 // if(fileName == "/etc/mtab") {
454 FILE *mntfp = setmntent( fileName.latin1(), "r" ); 453 FILE *mntfp = setmntent( fileName.latin1(), "r" );
455 if ( mntfp ) 454 if ( mntfp )
456 { 455 {
457 while ( (me = getmntent( mntfp )) != 0 ) 456 while ( (me = getmntent( mntfp )) != 0 )
458 { 457 {
459 QString deviceName = me->mnt_fsname; 458 QString deviceName = me->mnt_fsname;
460 QString filesystemType = me->mnt_type; 459 QString filesystemType = me->mnt_type;
461 if(deviceName != "none") 460 if(deviceName != "none")
462 { 461 {
463 if( fsList.contains(filesystemType) == 0 462 if( fsList.contains(filesystemType) == 0
464 & filesystemType.find("proc",0,TRUE) == -1 463 & filesystemType.find("proc",0,TRUE) == -1
465 & filesystemType.find("cramfs",0,TRUE) == -1 464 & filesystemType.find("cramfs",0,TRUE) == -1
466 & filesystemType.find("auto",0,TRUE) == -1) 465 & filesystemType.find("auto",0,TRUE) == -1)
467 fsList << filesystemType; 466 fsList << filesystemType;
468 deviceList << deviceName; 467 deviceList << deviceName;
469 odebug << deviceName+"::"+filesystemType << oendl; 468 odebug << deviceName+"::"+filesystemType << oendl;
470 fileSystemTypeList << deviceName+"::"+filesystemType; 469 fileSystemTypeList << deviceName+"::"+filesystemType;
471 } 470 }
472 } 471 }
473 } 472 }
474 endmntent( mntfp ); 473 endmntent( mntfp );
475 // } else if(fileName == "/etc/fstab") { 474 // } else if(fileName == "/etc/fstab") {
476 // QFile f("/etc/fstab"); 475 // QFile f("/etc/fstab");
477 // if ( f.open(IO_ReadOnly) ) { 476 // if ( f.open(IO_ReadOnly) ) {
478 // QTextStream t (&f); 477 // QTextStream t (&f);
479 // QString s; 478 // QString s;
480 // while (! t.eof()) { 479 // while (! t.eof()) {
481 // s=t.readLine(); 480 // s=t.readLine();
482 // s=s.simplifyWhiteSpace(); 481 // s=s.simplifyWhiteSpace();
483 // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { 482 // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) {
484 // // = me->mnt_fsname; 483 // // = me->mnt_fsname;
485 // QString filesystemType = me->mnt_type; 484 // QString filesystemType = me->mnt_type;
486 // QString deviceName = s.left(0,s.find(BLANK) ); 485 // QString deviceName = s.left(0,s.find(BLANK) );
487 // s=s.remove(0,s.find(BLANK)+1 ); // devicename 486 // s=s.remove(0,s.find(BLANK)+1 ); // devicename
488 487
489 // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint 488 // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint
490 // QStringt mountPoint= s.left(0,s.find(BLANK) ); 489 // QStringt mountPoint= s.left(0,s.find(BLANK) );
491 // s=s.remove(0,s.find(BLANK)+1 ); // fs 490 // s=s.remove(0,s.find(BLANK)+1 ); // fs
492 // QString filesystemType= s.left(0,s.find(BLANK) ); 491 // QString filesystemType= s.left(0,s.find(BLANK) );
493 // } 492 // }
494 // } 493 // }
495 // } 494 // }
496 // f.close(); 495 // f.close();
497 // } 496 // }
498} 497}
499 498
500QString FormatterApp::getFileSystemType(const QString &currentText) 499QString FormatterApp::getFileSystemType(const QString &currentText)
501{ 500{
502 501
503 parsetab("/etc/mtab"); //why did TT forget filesystem type? 502 parsetab("/etc/mtab"); //why did TT forget filesystem type?
504 503
505 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it ) 504 for ( QStringList::Iterator it = fileSystemTypeList.begin(); it != fileSystemTypeList.end(); ++it )
506 { 505 {
507 QString temp = (*it); 506 QString temp = (*it);
508 if( temp.find( currentText,0,TRUE) != -1) 507 if( temp.find( currentText,0,TRUE) != -1)
509 { 508 {
510 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2); 509 return temp.right( temp.length() - temp.find("::",0,TRUE) - 2);
511 // odebug << fsType << oendl; 510 // odebug << fsType << oendl;
512 } 511 }
513 } 512 }
514 return ""; 513 return "";
515} 514}
516 515
517bool FormatterApp::doFsck() 516bool FormatterApp::doFsck()
518{ 517{
519 518
520 Output *outDlg; 519 Output *outDlg;
521 QString selectedDevice; 520 QString selectedDevice;
522 // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) 521 // #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX)
523 selectedDevice = deviceComboBox->currentText(); 522 selectedDevice = deviceComboBox->currentText();
524 QString mountPoint = mountPointLineEdit->text(); 523 QString mountPoint = mountPointLineEdit->text();
525 QString umountS = "umount -v "+mountPoint+" 2>&1"; 524 QString umountS = "umount -v "+mountPoint+" 2>&1";
526 QString remountS = "mount -v "+mountPoint+" 2>&1"; 525 QString remountS = "mount -v "+mountPoint+" 2>&1";
527 // #else 526 // #else
528 // // for testing 527 // // for testing
529 // // currentText = diskDevice = "/dev/fd0"; 528 // // currentText = diskDevice = "/dev/fd0";
530 // QString umountS = "umount -v /floppy 2>&1"; 529 // QString umountS = "umount -v /floppy 2>&1";
531 // QString remountS = "mount -v /floppy 2>&1"; 530 // QString remountS = "mount -v /floppy 2>&1";
532 // selectedDevice ="/dev/fd0"; 531 // selectedDevice ="/dev/fd0";
533 532
534 // #endif 533 // #endif
535 534
536 QString fsType = getFileSystemType((const QString &)selectedDevice); 535 QString fsType = getFileSystemType((const QString &)selectedDevice);
537 QString cmd; 536 QString cmd;
538 odebug << selectedDevice +" "+ fsType << oendl; 537 odebug << selectedDevice +" "+ fsType << oendl;
539 if(fsType == "vfat") cmd = "dosfsck -vy "; 538 if(fsType == "vfat") cmd = "dosfsck -vy ";
540 if(fsType == "ext2") cmd = "e2fsck -cpvy "; 539 if(fsType == "ext2") cmd = "e2fsck -cpvy ";
541 cmd += selectedDevice + " 2>&1"; 540 cmd += selectedDevice + " 2>&1";
542 541
543 outDlg = new Output(this, tr("Formatter Output"),FALSE); 542 outDlg = new Output(this, tr("Formatter Output"),FALSE);
544 QPEApplication::showDialog( outDlg ); 543 QPEApplication::showDialog( outDlg );
545 qApp->processEvents(); 544 qApp->processEvents();
546 FILE *fp; 545 FILE *fp;
547 char line[130]; 546 char line[130];
548 outDlg->OutputEdit->append( tr("Trying to umount.")); 547 outDlg->OutputEdit->append( tr("Trying to umount."));
549 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 548 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
550 549
551 sleep(1); 550 sleep(1);
552 // odebug << "Command is "+umountS << oendl; 551 // odebug << "Command is "+umountS << oendl;
553 fp = popen( (const char *) umountS, "r"); 552 fp = popen( (const char *) umountS, "r");
554 // odebug << "" << fp << "" << oendl; 553 // odebug << "" << fp << "" << oendl;
555 if ( !fp ) 554 if ( !fp )
556 { 555 {
557 odebug << "Could not execute '" + umountS + "'!\n" +(QString)strerror(errno) << oendl; 556 odebug << "Could not execute '" + umountS + "'!\n" +(QString)strerror(errno) << oendl;
558 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); 557 QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") );
559 pclose(fp); 558 pclose(fp);
560 return false; 559 return false;
561 } 560 }
562 else 561 else
563 { 562 {
564 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); 563 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted."));
565 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 564 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
566 while ( fgets( line, sizeof line, fp)) 565 while ( fgets( line, sizeof line, fp))
567 { 566 {
568 if( ((QString)line).find("busy",0,TRUE) != -1) 567 if( ((QString)line).find("busy",0,TRUE) != -1)
569 { 568 {
570 odebug << "Could not find '" + umountS << oendl; 569 odebug << "Could not find '" + umountS << oendl;
571 QMessageBox::warning( this, tr("Formatter"), 570 QMessageBox::warning( this, tr("Formatter"),
572 tr("Could not umount.\nDevice is busy!"), tr("&OK") ); 571 tr("Could not umount.\nDevice is busy!"), tr("&OK") );
573 pclose(fp); 572 pclose(fp);
574 return false; 573 return false;
575 } 574 }
576 else 575 else
577 { 576 {
578 QString lineStr = line; 577 QString lineStr = line;
579 lineStr=lineStr.left(lineStr.length()-1); 578 lineStr=lineStr.left(lineStr.length()-1);
580 outDlg->OutputEdit->append(lineStr); 579 outDlg->OutputEdit->append(lineStr);
581 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 580 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
582 } 581 }
583 } 582 }
584 } 583 }
585 pclose(fp); 584 pclose(fp);
586 ///////////////////////////////////// 585 /////////////////////////////////////
587 fp = popen( (const char *) cmd, "r"); 586 fp = popen( (const char *) cmd, "r");
588 while ( fgets( line, sizeof line, fp)) 587 while ( fgets( line, sizeof line, fp))
589 { 588 {
590 if( ((QString)line).find("No such device",0,TRUE) != -1) 589 if( ((QString)line).find("No such device",0,TRUE) != -1)
591 { 590 {
592 odebug << "No such device '" + umountS << oendl; 591 odebug << "No such device '" + umountS << oendl;
593 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") ); 592 QMessageBox::warning( this, tr("Formatter"), tr("No such device!"), tr("&OK") );
594 pclose(fp); 593 pclose(fp);
595 // outDlg->OutputEdit->append("No such device"); 594 // outDlg->OutputEdit->append("No such device");
596 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 595 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
597 return false; 596 return false;
598 } 597 }
599 else 598 else
600 { 599 {
601 QString lineStr = line; 600 QString lineStr = line;
602 lineStr=lineStr.left(lineStr.length()-1); 601 lineStr=lineStr.left(lineStr.length()-1);
603 outDlg->OutputEdit->append(lineStr); 602 outDlg->OutputEdit->append(lineStr);
604 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 603 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
605 } 604 }
606 } 605 }
607 outDlg->OutputEdit->append(tr("You can now close the output window.")); 606 outDlg->OutputEdit->append(tr("You can now close the output window."));
608 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 607 outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
609 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted.")); 608 // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully formatted."));
610 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); 609 // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE);
611 pclose(fp); 610 pclose(fp);
612 611
613 ///////////////////////////////////////// 612 /////////////////////////////////////////
614 613
615 return true; 614 return true;
616} 615}
617 616
618bool FormatterApp::doFsckCheck() 617bool FormatterApp::doFsckCheck()
619{ 618{
620 619
621 return FALSE; 620 return FALSE;
622} 621}
623 622
624int FormatterApp::formatCheck(const QString &) 623int FormatterApp::formatCheck(const QString &)
625{ 624{
626 625
627 return -1; 626 return -1;
628} 627}
629 628
630int FormatterApp::runCommand(const QString &) 629int FormatterApp::runCommand(const QString &)
631{ 630{
632 631
633 return -1; 632 return -1;
634} 633}