summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-05-26 14:08:02 (UTC)
committer llornkcor <llornkcor>2003-05-26 14:08:02 (UTC)
commit304b92e24c7a7da309977cd996fc89848d8899dc (patch) (unidiff)
tree7af2aa9a9f8a00dfc710c3a80fdb5b4e42728929
parent8689d97f101fdf799e401aae8e7d1653cd3dc9bd (diff)
downloadopie-304b92e24c7a7da309977cd996fc89848d8899dc.zip
opie-304b92e24c7a7da309977cd996fc89848d8899dc.tar.gz
opie-304b92e24c7a7da309977cd996fc89848d8899dc.tar.bz2
fix complie
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 79a7f9e..cca0c26 100644
--- a/noncore/tools/formatter/formatter.cpp
+++ b/noncore/tools/formatter/formatter.cpp
@@ -1,221 +1,220 @@
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>
25#include <qstringlist.h> 24#include <qstringlist.h>
26#include <qdir.h> 25#include <qdir.h>
27#include <qfile.h> 26#include <qfile.h>
28 27
29#include <qtstream.h> 28#include <qtextstream.h>
30 29
31#include <qcombobox.h> 30#include <qcombobox.h>
32#include <qpopupmenu.h> 31#include <qpopupmenu.h>
33#include <qmessagebox.h> 32#include <qmessagebox.h>
34#include <qregexp.h> 33#include <qregexp.h>
35 34
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 <qtabwidget.h> 38#include <qtabwidget.h>
40#include <qwidget.h> 39#include <qwidget.h>
41#include <qlayout.h> 40#include <qlayout.h>
42#include <qvariant.h> 41#include <qvariant.h>
43 42
44#include <unistd.h> 43#include <unistd.h>
45#include <stdio.h> 44#include <stdio.h>
46#include <stdlib.h> 45#include <stdlib.h>
47#include <sys/vfs.h> 46#include <sys/vfs.h>
48#include <mntent.h> 47#include <mntent.h>
49#include <string.h> 48#include <string.h>
50#include <errno.h> 49#include <errno.h>
51 50
52#define BLANK ' ' 51#define BLANK ' '
53#define DELIMITER '#' 52#define DELIMITER '#'
54 53
55/* 54/*
56 Blah blah blah blah */ 55 Blah blah blah blah */
57FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl ) 56FormatterApp::FormatterApp( QWidget* parent, const char* name, bool modal, WFlags fl )
58 : QMainWindow( parent, name, fl ) 57 : QMainWindow( parent, name, fl )
59// : QDialog( parent, name, modal, fl ) 58// : QDialog( parent, name, modal, fl )
60{ 59{
61 if ( !name ) 60 if ( !name )
62 setName( "FormatterApp" ); 61 setName( "FormatterApp" );
63 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 62 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
64 63
65 setCaption( tr( "Formatter" ) ); 64 setCaption( tr( "Formatter" ) );
66 FormatterAppLayout = new QGridLayout( this ); 65 FormatterAppLayout = new QGridLayout( this );
67 FormatterAppLayout->setSpacing( 2); 66 FormatterAppLayout->setSpacing( 2);
68 FormatterAppLayout->setMargin( 2 ); 67 FormatterAppLayout->setMargin( 2 );
69 68
70 TabWidget = new QTabWidget( this, "TabWidget" ); 69 TabWidget = new QTabWidget( this, "TabWidget" );
71 70
72 tab = new QWidget( TabWidget, "tab" ); 71 tab = new QWidget( TabWidget, "tab" );
73 tabLayout = new QGridLayout( tab ); 72 tabLayout = new QGridLayout( tab );
74 tabLayout->setSpacing( 3); 73 tabLayout->setSpacing( 3);
75 tabLayout->setMargin( 2); 74 tabLayout->setMargin( 2);
76 75
77 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" ); 76 storageComboBox = new QComboBox( FALSE, tab, "storageComboBox" );
78 storageComboBox->setMaximumWidth(220); 77 storageComboBox->setMaximumWidth(220);
79 78
80 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1); 79 tabLayout->addMultiCellWidget( storageComboBox, 0, 0, 0, 1);
81 80
82 TextLabel4 = new QLabel( tab, "TextLabel4" ); 81 TextLabel4 = new QLabel( tab, "TextLabel4" );
83 TextLabel4->setText( tr( "Storage Type" ) ); 82 TextLabel4->setText( tr( "Storage Type" ) );
84 83
85 tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1); 84 tabLayout->addMultiCellWidget( TextLabel4, 1, 1, 0, 1);
86 85
87 TextLabel2 = new QLabel( tab, "TextLabel2" ); 86 TextLabel2 = new QLabel( tab, "TextLabel2" );
88 TextLabel2->setText( tr( "File Systems" ) ); 87 TextLabel2->setText( tr( "File Systems" ) );
89 88
90 tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1); 89 tabLayout->addMultiCellWidget( TextLabel2, 4, 4, 0, 1);
91 90
92 fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" ); 91 fileSystemsCombo = new QComboBox( FALSE, tab, "fileSystemsCombo" );
93 fileSystemsCombo->setMaximumWidth(220); 92 fileSystemsCombo->setMaximumWidth(220);
94 93
95 tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1); 94 tabLayout->addMultiCellWidget( fileSystemsCombo, 3, 3, 0, 1);
96 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 95 QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
97 tabLayout->addItem( spacer, 2, 0 ); 96 tabLayout->addItem( spacer, 2, 0 );
98 97
99 formatPushButton = new QPushButton( tab, "formatPushButton" ); 98 formatPushButton = new QPushButton( tab, "formatPushButton" );
100 formatPushButton->setText( tr( "Format" ) ); 99 formatPushButton->setText( tr( "Format" ) );
101 formatPushButton->setMaximumWidth(170); 100 formatPushButton->setMaximumWidth(170);
102 101
103 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1); 102 tabLayout->addMultiCellWidget( formatPushButton, 6, 6, 0, 1);
104 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum ); 103 QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Minimum );
105 tabLayout->addItem( spacer_2, 5, 0 ); 104 tabLayout->addItem( spacer_2, 5, 0 );
106 105
107 TabWidget->insertTab( tab, tr( "Main" ) ); 106 TabWidget->insertTab( tab, tr( "Main" ) );
108 107
109 tab_2 = new QWidget( TabWidget, "tab_2" ); 108 tab_2 = new QWidget( TabWidget, "tab_2" );
110 tabLayout_2 = new QGridLayout( tab_2 ); 109 tabLayout_2 = new QGridLayout( tab_2 );
111 tabLayout_2->setSpacing(3); 110 tabLayout_2->setSpacing(3);
112 tabLayout_2->setMargin(2); 111 tabLayout_2->setMargin(2);
113 112
114 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" ); 113 mountPointLineEdit = new QLineEdit( tab_2, "mountPointLineEdit" );
115 114
116 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1); 115 tabLayout_2->addMultiCellWidget( mountPointLineEdit, 0, 0, 0, 1);
117 116
118 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" ); 117 deviceComboBox = new QComboBox( FALSE, tab_2, "deviceComboBox" );
119 118
120 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1); 119 tabLayout_2->addMultiCellWidget( deviceComboBox, 3, 3, 0, 1);
121 120
122 TextLabel5 = new QLabel( tab_2, "TextLabel5" ); 121 TextLabel5 = new QLabel( tab_2, "TextLabel5" );
123 TextLabel5->setText( tr( "CAUTION:\n" 122 TextLabel5->setText( tr( "CAUTION:\n"
124 "Changing parameters on this \n" 123 "Changing parameters on this \n"
125 "page may cause your system \n" 124 "page may cause your system \n"
126 "to stop functioning properly!!" ) );//idiot message 125 "to stop functioning properly!!" ) );//idiot message
127 126
128 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1); 127 tabLayout_2->addMultiCellWidget( TextLabel5, 6, 6, 0, 1);
129 128
130 editPushButton = new QPushButton( tab_2, "editPushButton" ); 129 editPushButton = new QPushButton( tab_2, "editPushButton" );
131 editPushButton->setText( tr( "Edit fstab" ) ); 130 editPushButton->setText( tr( "Edit fstab" ) );
132 editPushButton->setMaximumWidth(100); 131 editPushButton->setMaximumWidth(100);
133 132
134 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 ); 133 tabLayout_2->addMultiCellWidget( editPushButton, 7, 7, 0, 0 );
135 134
136 fsckButton = new QPushButton( tab_2, "fsckPushButton" ); 135 fsckButton = new QPushButton( tab_2, "fsckPushButton" );
137 fsckButton->setText( tr( "Check Disk" ) ); 136 fsckButton->setText( tr( "Check Disk" ) );
138 fsckButton->setMaximumWidth(100); 137 fsckButton->setMaximumWidth(100);
139 138
140 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1); 139 tabLayout_2->addMultiCellWidget( fsckButton, 7, 7, 1, 1);
141 140
142 TextLabel3 = new QLabel( tab_2, "TextLabel3" ); 141 TextLabel3 = new QLabel( tab_2, "TextLabel3" );
143 TextLabel3->setText( tr( "Device" ) ); 142 TextLabel3->setText( tr( "Device" ) );
144 143
145 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 ); 144 tabLayout_2->addMultiCellWidget( TextLabel3, 4, 4, 0, 1 );
146 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 145 QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
147 tabLayout_2->addItem( spacer_3, 5, 0 ); 146 tabLayout_2->addItem( spacer_3, 5, 0 );
148 147
149 TextLabel1 = new QLabel( tab_2, "TextLabel1" ); 148 TextLabel1 = new QLabel( tab_2, "TextLabel1" );
150 TextLabel1->setText( tr( "Mount Point" ) ); 149 TextLabel1->setText( tr( "Mount Point" ) );
151 150
152 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 ); 151 tabLayout_2->addMultiCellWidget( TextLabel1, 1, 1, 0, 1 );
153 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); 152 QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
154 tabLayout_2->addItem( spacer_4, 2, 1 ); 153 tabLayout_2->addItem( spacer_4, 2, 1 );
155 TabWidget->insertTab( tab_2, tr( "Advanced" ) ); 154 TabWidget->insertTab( tab_2, tr( "Advanced" ) );
156 155
157 FormatterAppLayout->addWidget( TabWidget, 0, 1 ); 156 FormatterAppLayout->addWidget( TabWidget, 0, 1 );
158 157
159 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) ); 158 connect( formatPushButton ,SIGNAL(released()),this,SLOT( doFormat()) );
160 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) ); 159 connect( editPushButton ,SIGNAL(released()),this,SLOT( editFstab()) );
161 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) ); 160 connect( fsckButton ,SIGNAL(released()),this,SLOT( doFsck()) );
162 161
163 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) )); 162 connect( fileSystemsCombo,SIGNAL(activated(int)),this,SLOT( fsComboSelected(int ) ));
164 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) )); 163 connect( storageComboBox,SIGNAL(activated(int)),this,SLOT( storageComboSelected(int ) ));
165 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) )); 164 connect( deviceComboBox,SIGNAL(activated(int)),this,SLOT( deviceComboSelected(int ) ));
166 165
167 166
168 fillCombos(); 167 fillCombos();
169} 168}
170 169
171FormatterApp::~FormatterApp() { 170FormatterApp::~FormatterApp() {
172 171
173} 172}
174 173
175void FormatterApp::doFormat() { 174void FormatterApp::doFormat() {
176 int err=0; 175 int err=0;
177 Output *outDlg; 176 Output *outDlg;
178 QString umountS, remountS; 177 QString umountS, remountS;
179 QString text = storageComboBox->currentText(); 178 QString text = storageComboBox->currentText();
180 QString currentText = storageComboBox->currentText(); 179 QString currentText = storageComboBox->currentText();
181 QString cmd; 180 QString cmd;
182 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4); 181 QString diskDevice = currentText.right( currentText.length() - currentText.find(" -> ",0,TRUE) - 4);
183 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE)); 182 QString diskName = currentText.left(currentText.find(" -> ",0,TRUE));
184 QString fs = fileSystemsCombo->currentText(); 183 QString fs = fileSystemsCombo->currentText();
185 184
186#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap 185#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) // lets test on something cheap
187#else 186#else
188 currentText = diskDevice = "/dev/fd0"; 187 currentText = diskDevice = "/dev/fd0";
189 umountS = "umount -v /floppy 2>&1"; 188 umountS = "umount -v /floppy 2>&1";
190 remountS = "mount -v /floppy 2>&1"; 189 remountS = "mount -v /floppy 2>&1";
191#endif 190#endif
192 191
193 if( currentText.find("CF",0,TRUE) != -1) { 192 if( currentText.find("CF",0,TRUE) != -1) {
194 umountS = "umount "; 193 umountS = "umount ";
195 remountS = "mount "; 194 remountS = "mount ";
196 195
197// umountS = "/sbin/cardctl eject"; 196// umountS = "/sbin/cardctl eject";
198// remountS = "/sbin/cardctl insert"; 197// remountS = "/sbin/cardctl insert";
199 } 198 }
200 if( currentText.find("SD",0,TRUE) != -1) { 199 if( currentText.find("SD",0,TRUE) != -1) {
201 umountS = "umount "; 200 umountS = "umount ";
202 remountS = "mount "; 201 remountS = "mount ";
203// umountS = "/etc/sdcontrol compeject"; 202// umountS = "/etc/sdcontrol compeject";
204// remountS = "/etc/sdcontrol insert"; 203// remountS = "/etc/sdcontrol insert";
205 } 204 }
206 205
207 switch ( QMessageBox::warning(this,tr("Format?!?"),tr("Really format\n") +diskName+" "+ currentText + 206 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) ) { 207 tr("\nwith ") + fs + tr(" filesystem?!?\nYou will loose all data!!"),tr("Yes"),tr("No"),0,1,1) ) {
209 case 0: { 208 case 0: {
210 if(fs == "vfat") 209 if(fs == "vfat")
211 cmd = "mkdosfs -v " + diskDevice+" 2>&1"; 210 cmd = "mkdosfs -v " + diskDevice+" 2>&1";
212 else if(fs == "ext2") 211 else if(fs == "ext2")
213 cmd = "mke2fs -v " + diskDevice+" 2>&1"; 212 cmd = "mke2fs -v " + diskDevice+" 2>&1";
214 else { 213 else {
215 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok")); 214 QMessageBox::warning(this, tr("Formatter"),tr("Could not format.\nUnknown type"), tr("Ok"));
216 break; 215 break;
217 } 216 }
218// cmd = "ls -l"; 217// cmd = "ls -l";
219 outDlg = new Output(this, tr("Formatter Output"),FALSE); 218 outDlg = new Output(this, tr("Formatter Output"),FALSE);
220 outDlg->showMaximized(); 219 outDlg->showMaximized();
221 outDlg->show(); 220 outDlg->show();