-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 6 | ||||
-rw-r--r-- | noncore/settings/sound/soundsettings.cpp | 2 | ||||
-rw-r--r-- | noncore/tools/formatter/formatter.cpp | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 0ec6fad..d4396d2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -248,116 +248,116 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
248 | 248 | ||
249 | QFont f; | 249 | QFont f; |
250 | f.setPixelSize( 20 ); | 250 | f.setPixelSize( 20 ); |
251 | f.setBold( TRUE ); | 251 | f.setBold( TRUE ); |
252 | p.setFont( f ); | 252 | p.setFont( f ); |
253 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 253 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
254 | 254 | ||
255 | for ( unsigned int i = 0; i < 10; i++ ) { | 255 | for ( unsigned int i = 0; i < 10; i++ ) { |
256 | if ( v > i ) { | 256 | if ( v > i ) { |
257 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 257 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
258 | } else { | 258 | } else { |
259 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 259 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | } else { | 262 | } else { |
263 | w = videoUI()->width(); | 263 | w = videoUI()->width(); |
264 | h = videoUI()->height(); | 264 | h = videoUI()->height(); |
265 | 265 | ||
266 | if ( drawnOnScreenDisplay ) { | 266 | if ( drawnOnScreenDisplay ) { |
267 | if ( onScreenDisplayVolume > v ) { | 267 | if ( onScreenDisplayVolume > v ) { |
268 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 268 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | drawnOnScreenDisplay = TRUE; | 271 | drawnOnScreenDisplay = TRUE; |
272 | onScreenDisplayVolume = v; | 272 | onScreenDisplayVolume = v; |
273 | QPainter p( videoUI() ); | 273 | QPainter p( videoUI() ); |
274 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 274 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
275 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 275 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
276 | 276 | ||
277 | QFont f; | 277 | QFont f; |
278 | f.setPixelSize( 20 ); | 278 | f.setPixelSize( 20 ); |
279 | f.setBold( TRUE ); | 279 | f.setBold( TRUE ); |
280 | p.setFont( f ); | 280 | p.setFont( f ); |
281 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 281 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
282 | 282 | ||
283 | for ( unsigned int i = 0; i < 10; i++ ) { | 283 | for ( unsigned int i = 0; i < 10; i++ ) { |
284 | if ( v > i ) { | 284 | if ( v > i ) { |
285 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 285 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
286 | } else { | 286 | } else { |
287 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 287 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
288 | } | 288 | } |
289 | } | 289 | } |
290 | } | 290 | } |
291 | } | 291 | } |
292 | 292 | ||
293 | 293 | ||
294 | void MediaPlayer::blank( bool b ) { | 294 | void MediaPlayer::blank( bool b ) { |
295 | fd=open("/dev/fb0",O_RDWR); | 295 | fd=open("/dev/fb0",O_RDWR); |
296 | #ifdef QT_QWS_EBX | 296 | #ifdef QT_QWS_SL5XXX |
297 | fl= open( "/dev/fl", O_RDWR ); | 297 | fl= open( "/dev/fl", O_RDWR ); |
298 | #endif | 298 | #endif |
299 | if (fd != -1) { | 299 | if (fd != -1) { |
300 | if ( b ) { | 300 | if ( b ) { |
301 | qDebug("do blanking"); | 301 | qDebug("do blanking"); |
302 | #ifdef QT_QWS_EBX | 302 | #ifdef QT_QWS_SL5XXX |
303 | ioctl( fd, FBIOBLANK, 1 ); | 303 | ioctl( fd, FBIOBLANK, 1 ); |
304 | if(fl !=-1) { | 304 | if(fl !=-1) { |
305 | ioctl( fl, 2 ); | 305 | ioctl( fl, 2 ); |
306 | ::close(fl); | 306 | ::close(fl); |
307 | } | 307 | } |
308 | #else | 308 | #else |
309 | ioctl( fd, FBIOBLANK, 3 ); | 309 | ioctl( fd, FBIOBLANK, 3 ); |
310 | #endif | 310 | #endif |
311 | isBlanked = TRUE; | 311 | isBlanked = TRUE; |
312 | } else { | 312 | } else { |
313 | qDebug("do unblanking"); | 313 | qDebug("do unblanking"); |
314 | ioctl( fd, FBIOBLANK, 0); | 314 | ioctl( fd, FBIOBLANK, 0); |
315 | #ifdef QT_QWS_EBX | 315 | #ifdef QT_QWS_SL5XXX |
316 | if(fl != -1) { | 316 | if(fl != -1) { |
317 | ioctl( fl, 1); | 317 | ioctl( fl, 1); |
318 | ::close(fl); | 318 | ::close(fl); |
319 | } | 319 | } |
320 | #endif | 320 | #endif |
321 | isBlanked = FALSE; | 321 | isBlanked = FALSE; |
322 | } | 322 | } |
323 | close( fd ); | 323 | close( fd ); |
324 | } else { | 324 | } else { |
325 | qDebug("<< /dev/fb0 could not be opened >>"); | 325 | qDebug("<< /dev/fb0 could not be opened >>"); |
326 | } | 326 | } |
327 | } | 327 | } |
328 | 328 | ||
329 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 329 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
330 | switch ( e->key() ) { | 330 | switch ( e->key() ) { |
331 | ////////////////////////////// Zaurus keys | 331 | ////////////////////////////// Zaurus keys |
332 | case Key_Home: | 332 | case Key_Home: |
333 | break; | 333 | break; |
334 | case Key_F9: //activity | 334 | case Key_F9: //activity |
335 | break; | 335 | break; |
336 | case Key_F10: //contacts | 336 | case Key_F10: //contacts |
337 | break; | 337 | break; |
338 | case Key_F11: //menu | 338 | case Key_F11: //menu |
339 | break; | 339 | break; |
340 | case Key_F12: //home | 340 | case Key_F12: //home |
341 | qDebug("Blank here"); | 341 | qDebug("Blank here"); |
342 | // mediaPlayerState->toggleBlank(); | 342 | // mediaPlayerState->toggleBlank(); |
343 | break; | 343 | break; |
344 | case Key_F13: //mail | 344 | case Key_F13: //mail |
345 | qDebug("Blank here"); | 345 | qDebug("Blank here"); |
346 | // mediaPlayerState->toggleBlank(); | 346 | // mediaPlayerState->toggleBlank(); |
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | void MediaPlayer::cleanUp() {// this happens on closing | 351 | void MediaPlayer::cleanUp() {// this happens on closing |
352 | Config cfg( "OpiePlayer" ); | 352 | Config cfg( "OpiePlayer" ); |
353 | mediaPlayerState.writeConfig( cfg ); | 353 | mediaPlayerState.writeConfig( cfg ); |
354 | playList.writeDefaultPlaylist( ); | 354 | playList.writeDefaultPlaylist( ); |
355 | 355 | ||
356 | // QPEApplication::grabKeyboard(); | 356 | // QPEApplication::grabKeyboard(); |
357 | // QPEApplication::ungrabKeyboard(); | 357 | // QPEApplication::ungrabKeyboard(); |
358 | } | 358 | } |
359 | 359 | ||
360 | void MediaPlayer::recreateAudioAndVideoWidgets() const | 360 | void MediaPlayer::recreateAudioAndVideoWidgets() const |
361 | { | 361 | { |
362 | delete m_skinLoader; | 362 | delete m_skinLoader; |
363 | 363 | ||
diff --git a/noncore/settings/sound/soundsettings.cpp b/noncore/settings/sound/soundsettings.cpp index dd341c0..afcdd49 100644 --- a/noncore/settings/sound/soundsettings.cpp +++ b/noncore/settings/sound/soundsettings.cpp | |||
@@ -24,97 +24,97 @@ | |||
24 | #include <qpe/qpeapplication.h> | 24 | #include <qpe/qpeapplication.h> |
25 | #include <qpe/config.h> | 25 | #include <qpe/config.h> |
26 | #include <qpe/qcopenvelope_qws.h> | 26 | #include <qpe/qcopenvelope_qws.h> |
27 | #include <qpe/storage.h> | 27 | #include <qpe/storage.h> |
28 | 28 | ||
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | #include <qslider.h> | 31 | #include <qslider.h> |
32 | #include <qcheckbox.h> | 32 | #include <qcheckbox.h> |
33 | #include <qlineedit.h> | 33 | #include <qlineedit.h> |
34 | #include <qcombobox.h> | 34 | #include <qcombobox.h> |
35 | #include <qlabel.h> | 35 | #include <qlabel.h> |
36 | 36 | ||
37 | #include <sys/utsname.h> | 37 | #include <sys/utsname.h> |
38 | #include <sys/time.h> | 38 | #include <sys/time.h> |
39 | #include <sys/types.h> | 39 | #include <sys/types.h> |
40 | #include <unistd.h> | 40 | #include <unistd.h> |
41 | #include <stdio.h> | 41 | #include <stdio.h> |
42 | #include <sys/stat.h> | 42 | #include <sys/stat.h> |
43 | 43 | ||
44 | 44 | ||
45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) | 45 | SoundSettings::SoundSettings( QWidget* parent, const char* objname, WFlags fl ) |
46 | : SoundSettingsBase( parent, objname, TRUE, fl ) | 46 | : SoundSettingsBase( parent, objname, TRUE, fl ) |
47 | { | 47 | { |
48 | keyReset=FALSE; | 48 | keyReset=FALSE; |
49 | noWarning=false; | 49 | noWarning=false; |
50 | Config config( "qpe"); | 50 | Config config( "qpe"); |
51 | config.setGroup( "Volume" ); | 51 | config.setGroup( "Volume" ); |
52 | Config cfg("Vmemo"); | 52 | Config cfg("Vmemo"); |
53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 53 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); | 54 | AlertCheckBox->setChecked(cfg.readBoolEntry("Alert")); |
55 | 55 | ||
56 | cfg.setGroup("Record"); | 56 | cfg.setGroup("Record"); |
57 | int rate=config.readNumEntry("SampleRate", 22050); | 57 | int rate=config.readNumEntry("SampleRate", 22050); |
58 | if(rate == 8000) | 58 | if(rate == 8000) |
59 | sampleRate->setCurrentItem(0); | 59 | sampleRate->setCurrentItem(0); |
60 | else if(rate == 11025) | 60 | else if(rate == 11025) |
61 | sampleRate->setCurrentItem(1); | 61 | sampleRate->setCurrentItem(1); |
62 | else if(rate == 22050) | 62 | else if(rate == 22050) |
63 | sampleRate->setCurrentItem(2); | 63 | sampleRate->setCurrentItem(2); |
64 | else if(rate == 33075) | 64 | else if(rate == 33075) |
65 | sampleRate->setCurrentItem(3); | 65 | sampleRate->setCurrentItem(3); |
66 | else if(rate==44100) | 66 | else if(rate==44100) |
67 | sampleRate->setCurrentItem(4); | 67 | sampleRate->setCurrentItem(4); |
68 | 68 | ||
69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); | 69 | stereoCheckBox->setChecked(cfg.readNumEntry("Stereo", 0)); |
70 | //TODO hide if zaurus- mono only | 70 | //TODO hide if zaurus- mono only |
71 | 71 | ||
72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_EBX) | 72 | #if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) |
73 | //since ipaq and zaurus have particular | 73 | //since ipaq and zaurus have particular |
74 | //devices | 74 | //devices |
75 | bool systemZaurus=FALSE; | 75 | bool systemZaurus=FALSE; |
76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ | 76 | struct utsname name; /* check for embedix kernel running on the zaurus*/ |
77 | if (uname(&name) != -1) {// TODO change this here,... | 77 | if (uname(&name) != -1) {// TODO change this here,... |
78 | QString release=name.release; | 78 | QString release=name.release; |
79 | if( release.find("embedix",0,TRUE) != -1) { | 79 | if( release.find("embedix",0,TRUE) != -1) { |
80 | qDebug("IS System Zaurus"); | 80 | qDebug("IS System Zaurus"); |
81 | systemZaurus=TRUE; | 81 | systemZaurus=TRUE; |
82 | } | 82 | } |
83 | } | 83 | } |
84 | if(!systemZaurus) { | 84 | if(!systemZaurus) { |
85 | stereoCheckBox->setChecked(TRUE); | 85 | stereoCheckBox->setChecked(TRUE); |
86 | } | 86 | } |
87 | stereoCheckBox->setEnabled(FALSE); | 87 | stereoCheckBox->setEnabled(FALSE); |
88 | sixteenBitCheckBox->setEnabled(FALSE); | 88 | sixteenBitCheckBox->setEnabled(FALSE); |
89 | #else | 89 | #else |
90 | #endif | 90 | #endif |
91 | int sRate=cfg.readNumEntry("SizeLimit", 30); | 91 | int sRate=cfg.readNumEntry("SizeLimit", 30); |
92 | qDebug("%d",sRate); | 92 | qDebug("%d",sRate); |
93 | 93 | ||
94 | if(sRate ==30) | 94 | if(sRate ==30) |
95 | timeLimitComboBox->setCurrentItem(0); | 95 | timeLimitComboBox->setCurrentItem(0); |
96 | else if(sRate==20) | 96 | else if(sRate==20) |
97 | timeLimitComboBox->setCurrentItem(1); | 97 | timeLimitComboBox->setCurrentItem(1); |
98 | else if(sRate == 15) | 98 | else if(sRate == 15) |
99 | timeLimitComboBox->setCurrentItem(2); | 99 | timeLimitComboBox->setCurrentItem(2); |
100 | else if(sRate == 10) | 100 | else if(sRate == 10) |
101 | timeLimitComboBox->setCurrentItem(3); | 101 | timeLimitComboBox->setCurrentItem(3); |
102 | else if(sRate == 5) | 102 | else if(sRate == 5) |
103 | timeLimitComboBox->setCurrentItem(4); | 103 | timeLimitComboBox->setCurrentItem(4); |
104 | else | 104 | else |
105 | timeLimitComboBox->setCurrentItem(5); | 105 | timeLimitComboBox->setCurrentItem(5); |
106 | 106 | ||
107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); | 107 | sixteenBitCheckBox->setChecked(cfg.readNumEntry("SixteenBit", 1)); |
108 | 108 | ||
109 | cfg.setGroup("Defaults"); | 109 | cfg.setGroup("Defaults"); |
110 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); | 110 | keyComboBox->setCurrentItem(cfg.readNumEntry("toggleKey") ); |
111 | 111 | ||
112 | updateStorageCombo(); | 112 | updateStorageCombo(); |
113 | connect( LocationComboBox,SIGNAL(activated(const QString &)), this, | 113 | connect( LocationComboBox,SIGNAL(activated(const QString &)), this, |
114 | SLOT( setLocation(const QString &))); | 114 | SLOT( setLocation(const QString &))); |
115 | connect( keyComboBox,SIGNAL(activated( int)), this, | 115 | connect( keyComboBox,SIGNAL(activated( int)), this, |
116 | SLOT( setKeyButton( int))); | 116 | SLOT( setKeyButton( int))); |
117 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, | 117 | connect( timeLimitComboBox,SIGNAL(activated( const QString &)), this, |
118 | SLOT( setSizeLimitButton(const QString &))); | 118 | SLOT( setSizeLimitButton(const QString &))); |
119 | connect( restartCheckBox,SIGNAL( toggled( bool)), this, | 119 | connect( restartCheckBox,SIGNAL( toggled( bool)), this, |
120 | SLOT( restartOpie( bool))); | 120 | SLOT( restartOpie( bool))); |
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 | |||
@@ -138,97 +138,97 @@ FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFla | |||
138 | fsckButton->setMaximumWidth(100); | 138 | fsckButton->setMaximumWidth(100); |
139 | 139 | ||
140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); | 140 | tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); |
141 | 141 | ||
142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); | 142 | TextLabel3 = new QLabel( tab_2, "TextLabel3" ); |
143 | TextLabel3->setText( tr( "Device" ) ); | 143 | TextLabel3->setText( tr( "Device" ) ); |
144 | 144 | ||
145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); | 145 | tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); |
146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 146 | QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
147 | tabLayout_2->addItem( spacer_3, 5, 0 ); | 147 | tabLayout_2->addItem( spacer_3, 5, 0 ); |
148 | 148 | ||
149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); | 149 | TextLabel1 = new QLabel( tab_2, "TextLabel1" ); |
150 | TextLabel1->setText( tr( "Mount Point" ) ); | 150 | TextLabel1->setText( tr( "Mount Point" ) ); |
151 | 151 | ||
152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); | 152 | tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); |
153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); | 153 | QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); |
154 | tabLayout_2->addItem( spacer_4, 2, 1 ); | 154 | tabLayout_2->addItem( spacer_4, 2, 1 ); |
155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); | 155 | TabWidget->insertTab( tab_2, tr( "Advanced" ) ); |
156 | 156 | ||
157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); | 157 | FormatterAppLayout->addWidget( TabWidget, 0, 1 ); |
158 | 158 | ||
159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); | 159 | connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); |
160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); | 160 | connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); |
161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); | 161 | connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); |
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 | ||
171 | FormatterApp::~FormatterApp() { | 171 | FormatterApp::~FormatterApp() { |
172 | 172 | ||
173 | } | 173 | } |
174 | 174 | ||
175 | void FormatterApp::doFormat() { | 175 | void 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") |
211 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; | 211 | cmd = "mkdosfs -v " + diskDevice+" 2>&1"; |
212 | else if(fs == "ext2") | 212 | else if(fs == "ext2") |
213 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; | 213 | cmd = "mke2fs -v " + diskDevice+" 2>&1"; |
214 | else { | 214 | else { |
215 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); | 215 | QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); |
216 | break; | 216 | break; |
217 | } | 217 | } |
218 | // cmd = "ls -l"; | 218 | // cmd = "ls -l"; |
219 | outDlg = new Output(this, tr("Formatter Output"),FALSE); | 219 | outDlg = new Output(this, tr("Formatter Output"),FALSE); |
220 | outDlg->showMaximized(); | 220 | outDlg->showMaximized(); |
221 | outDlg->show(); | 221 | outDlg->show(); |
222 | qApp->processEvents(); | 222 | qApp->processEvents(); |
223 | FILE *fp; | 223 | FILE *fp; |
224 | char line[130]; | 224 | char line[130]; |
225 | outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); | 225 | outDlg->OutputEdit->append( tr("Trying to umount.") + currentText ); |
226 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 226 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
227 | 227 | ||
228 | sleep(1); | 228 | sleep(1); |
229 | qDebug("Command is "+umountS); | 229 | qDebug("Command is "+umountS); |
230 | fp = popen( (const char *) umountS, "r"); | 230 | fp = popen( (const char *) umountS, "r"); |
231 | qDebug("%d", fp); | 231 | qDebug("%d", fp); |
232 | if ( !fp ) { | 232 | if ( !fp ) { |
233 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); | 233 | qDebug("Could not execute '" + umountS + "'! err=%d\n" +(QString)strerror(errno), err); |
234 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 234 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
@@ -428,97 +428,97 @@ void FormatterApp::parsetab(const QString &fileName) { | |||
428 | fileSystemTypeList << deviceName+"::"+filesystemType; | 428 | fileSystemTypeList << deviceName+"::"+filesystemType; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | } | 431 | } |
432 | endmntent( mntfp ); | 432 | endmntent( mntfp ); |
433 | // } else if(fileName == "/etc/fstab") { | 433 | // } else if(fileName == "/etc/fstab") { |
434 | // QFile f("/etc/fstab"); | 434 | // QFile f("/etc/fstab"); |
435 | // if ( f.open(IO_ReadOnly) ) { | 435 | // if ( f.open(IO_ReadOnly) ) { |
436 | // QTextStream t (&f); | 436 | // QTextStream t (&f); |
437 | // QString s; | 437 | // QString s; |
438 | // while (! t.eof()) { | 438 | // while (! t.eof()) { |
439 | // s=t.readLine(); | 439 | // s=t.readLine(); |
440 | // s=s.simplifyWhiteSpace(); | 440 | // s=s.simplifyWhiteSpace(); |
441 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { | 441 | // if ( (!s.isEmpty() ) && (s.find(" ")!=0) ) { |
442 | // // = me->mnt_fsname; | 442 | // // = me->mnt_fsname; |
443 | // QString filesystemType = me->mnt_type; | 443 | // QString filesystemType = me->mnt_type; |
444 | // QString deviceName = s.left(0,s.find(BLANK) ); | 444 | // QString deviceName = s.left(0,s.find(BLANK) ); |
445 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename | 445 | // s=s.remove(0,s.find(BLANK)+1 ); // devicename |
446 | 446 | ||
447 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint | 447 | // s=s.remove(0,s.find(BLANK)+1 ); // mountpoint |
448 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); | 448 | // QStringt mountPoint= s.left(0,s.find(BLANK) ); |
449 | // s=s.remove(0,s.find(BLANK)+1 ); // fs | 449 | // s=s.remove(0,s.find(BLANK)+1 ); // fs |
450 | // QString filesystemType= s.left(0,s.find(BLANK) ); | 450 | // QString filesystemType= s.left(0,s.find(BLANK) ); |
451 | // } | 451 | // } |
452 | // } | 452 | // } |
453 | // } | 453 | // } |
454 | // f.close(); | 454 | // f.close(); |
455 | // } | 455 | // } |
456 | } | 456 | } |
457 | 457 | ||
458 | QString FormatterApp::getFileSystemType(const QString ¤tText) { | 458 | QString FormatterApp::getFileSystemType(const QString ¤tText) { |
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 | ||
472 | bool FormatterApp::doFsck() { | 472 | bool 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(); |
501 | FILE *fp; | 501 | FILE *fp; |
502 | char line[130]; | 502 | char line[130]; |
503 | outDlg->OutputEdit->append( tr("Trying to umount.")); | 503 | outDlg->OutputEdit->append( tr("Trying to umount.")); |
504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 504 | outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
505 | 505 | ||
506 | sleep(1); | 506 | sleep(1); |
507 | // qDebug("Command is "+umountS); | 507 | // qDebug("Command is "+umountS); |
508 | fp = popen( (const char *) umountS, "r"); | 508 | fp = popen( (const char *) umountS, "r"); |
509 | // qDebug("%d", fp); | 509 | // qDebug("%d", fp); |
510 | if ( !fp ) { | 510 | if ( !fp ) { |
511 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); | 511 | qDebug("Could not execute '" + umountS + "'!\n" +(QString)strerror(errno)); |
512 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); | 512 | QMessageBox::warning( this, tr("Formatter"), tr("umount failed!"), tr("&OK") ); |
513 | pclose(fp); | 513 | pclose(fp); |
514 | return false; | 514 | return false; |
515 | } else { | 515 | } else { |
516 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); | 516 | // outDlg->OutputEdit->append( currentText + tr("\nhas been successfully umounted.")); |
517 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); | 517 | // outDlg->OutputEdit->setCursorPosition(outDlg->OutputEdit->numLines() + 1,0,FALSE); |
518 | while ( fgets( line, sizeof line, fp)) { | 518 | while ( fgets( line, sizeof line, fp)) { |
519 | if( ((QString)line).find("busy",0,TRUE) != -1) { | 519 | if( ((QString)line).find("busy",0,TRUE) != -1) { |
520 | qDebug("Could not find '" + umountS); | 520 | qDebug("Could not find '" + umountS); |
521 | QMessageBox::warning( this, tr("Formatter"), | 521 | QMessageBox::warning( this, tr("Formatter"), |
522 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); | 522 | tr("Could not umount.\nDevice is busy!"), tr("&OK") ); |
523 | pclose(fp); | 523 | pclose(fp); |
524 | return false; | 524 | return false; |