-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 151 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmbbase.ui | 20 |
2 files changed, 93 insertions, 78 deletions
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp index c1ee9a9..fbe1c5c 100644 --- a/noncore/net/opie-smb/qsmb.cpp +++ b/noncore/net/opie-smb/qsmb.cpp | |||
@@ -2,375 +2,372 @@ | |||
2 | #include <qpushbutton.h> | 2 | #include <qpushbutton.h> |
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | 4 | ||
5 | #include <string.h> | 5 | #include <string.h> |
6 | #include <qstring.h> | 6 | #include <qstring.h> |
7 | #include <qstringlist.h> | 7 | #include <qstringlist.h> |
8 | #include <qdir.h> | 8 | #include <qdir.h> |
9 | #include <qfileinfo.h> | 9 | #include <qfileinfo.h> |
10 | 10 | ||
11 | #include <qpe/process.h> | 11 | #include <qpe/process.h> |
12 | #include <qlabel.h> | 12 | #include <qlabel.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qcombobox.h> | 14 | #include <qcombobox.h> |
15 | #include <qstringlist.h> | 15 | #include <qstringlist.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qtextview.h> | 17 | #include <qtextview.h> |
18 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
19 | #include <qtextstream.h> | 19 | #include <qtextstream.h> |
20 | 20 | ||
21 | 21 | ||
22 | #include <pthread.h> | 22 | #include <pthread.h> |
23 | #include <signal.h> | 23 | #include <signal.h> |
24 | #include <ctype.h> | 24 | #include <ctype.h> |
25 | 25 | ||
26 | 26 | ||
27 | #include <netinet/in.h> | 27 | #include <netinet/in.h> |
28 | #include <arpa/inet.h> | 28 | #include <arpa/inet.h> |
29 | 29 | ||
30 | #include <rpc/clnt.h> | 30 | #include <rpc/clnt.h> |
31 | 31 | ||
32 | 32 | ||
33 | #include <opie2/odebug.h> | 33 | #include <opie2/odebug.h> |
34 | using namespace Opie::Core; | 34 | using namespace Opie::Core; |
35 | 35 | ||
36 | 36 | ||
37 | Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) | 37 | Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) |
38 | : FormQPESMBBase( parent, name, fl ) | 38 | : FormQPESMBBase( parent, name, fl ) |
39 | { | 39 | { |
40 | connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int))); | 40 | connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int))); |
41 | connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked())); | 41 | connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked())); |
42 | connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked())); | 42 | connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked())); |
43 | connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear())); | 43 | connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear())); |
44 | 44 | ||
45 | mountpt->insertItem("/mnt/samba1",-1); | 45 | mountpt->insertItem("/mnt/samba1",-1); |
46 | mountpt->insertItem("/mnt/samba2",-1); | 46 | mountpt->insertItem("/mnt/samba2",-1); |
47 | mountpt->insertItem("/mnt/samba3",-1); | 47 | mountpt->insertItem("/mnt/samba3",-1); |
48 | 48 | ||
49 | top_element = NULL; | 49 | top_element = NULL; |
50 | scanning = false; | 50 | scanning = false; |
51 | } | 51 | } |
52 | 52 | ||
53 | Qsmb::~Qsmb() | 53 | Qsmb::~Qsmb() |
54 | { | 54 | { |
55 | } | 55 | } |
56 | 56 | ||
57 | void Qsmb::clear() | 57 | void Qsmb::clear() |
58 | { | 58 | { |
59 | if (scanning) return; | 59 | if (scanning) return; |
60 | ListViewScan->clear(); | 60 | ListViewScan->clear(); |
61 | TextViewOutput->setText(""); | 61 | TextViewOutput->setText(""); |
62 | top_element = NULL; | 62 | top_element = NULL; |
63 | } | 63 | } |
64 | 64 | ||
65 | void Qsmb::scanClicked() | 65 | void Qsmb::scanClicked() |
66 | { | 66 | { |
67 | if (scanning) return; | 67 | if (scanning) return; |
68 | pthread_create(&tpid, NULL, runit, (void *)this); | 68 | pthread_create(&tpid, NULL, runit, (void *)this); |
69 | } | 69 | } |
70 | 70 | ||
71 | void Qsmb::DoItClicked() | 71 | void Qsmb::DoItClicked() |
72 | { | 72 | { |
73 | 73 | ||
74 | if(! ListViewScan->selectedItem()) { | 74 | if(! ListViewScan->selectedItem()) { |
75 | QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>")); | 75 | QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>")); |
76 | return; | 76 | return; |
77 | } | 77 | } |
78 | if (scanning) return; | 78 | if (scanning) return; |
79 | pthread_create(&tpid, NULL, runitm, (void *)this); | 79 | pthread_create(&tpid, NULL, runitm, (void *)this); |
80 | } | 80 | } |
81 | 81 | ||
82 | void* runit(void* arg) | 82 | void* runit(void* arg) |
83 | { | 83 | { |
84 | Qsmb* caller = (Qsmb*)arg; | 84 | Qsmb* caller = (Qsmb*)arg; |
85 | caller->scan(); | 85 | caller->scan(); |
86 | return(0); | 86 | return(0); |
87 | } | 87 | } |
88 | 88 | ||
89 | void* runitm(void* arg) | 89 | void* runitm(void* arg) |
90 | { | 90 | { |
91 | Qsmb* caller = (Qsmb*)arg; | 91 | Qsmb* caller = (Qsmb*)arg; |
92 | caller->DoIt(); | 92 | caller->DoIt(); |
93 | return(0); | 93 | return(0); |
94 | } | 94 | } |
95 | 95 | ||
96 | void Qsmb::scan() | 96 | void Qsmb::scan() |
97 | { | 97 | { |
98 | int i; | 98 | // int i; |
99 | 99 | ||
100 | if (scanning) return; | 100 | if (scanning) return; |
101 | scanning = true; | 101 | scanning = true; |
102 | 102 | ||
103 | QString match; | 103 | QString match; |
104 | QString cmd; | 104 | QString cmd; |
105 | LScan->setText("Scanning..."); | 105 | LScan->setText("Scanning..."); |
106 | qApp->processEvents(); | 106 | qApp->processEvents(); |
107 | 107 | ||
108 | sockaddr_in my_addr; | 108 | sockaddr_in my_addr; |
109 | get_myaddress( &my_addr); | 109 | get_myaddress( &my_addr); |
110 | 110 | ||
111 | QString ip = inet_ntoa( my_addr.sin_addr); | 111 | QString ip = inet_ntoa( my_addr.sin_addr); |
112 | owarn << "IP Address : " << ip<< oendl; | 112 | owarn << "IP Address : " << ip<< oendl; |
113 | 113 | ||
114 | match = ip.left(5); | 114 | match = ip.left(5); |
115 | 115 | ||
116 | QStringList ccmd; | 116 | QStringList ccmd; |
117 | TextViewOutput->append("smbfind"); | 117 | TextViewOutput->append("smbfind"); |
118 | 118 | ||
119 | QFile lmhosts("/etc/samba/lmhosts"); | 119 | QFile lmhosts("/etc/samba/lmhosts"); |
120 | QTextStream lms(&lmhosts); | 120 | QTextStream lms(&lmhosts); |
121 | lmhosts.open(IO_WriteOnly); | 121 | lmhosts.open(IO_WriteOnly); |
122 | lms << "127.0.0.1 localhost\n"; | 122 | lms << "127.0.0.1 localhost\n"; |
123 | 123 | ||
124 | /* parse output and display in ListViewScan */ | 124 | /* parse output and display in ListViewScan */ |
125 | ccmd = "smbfind"; | 125 | ccmd = "smbfind"; |
126 | owarn <<"cmd: " << ccmd << oendl; | ||
127 | runCommand(ccmd); | 126 | runCommand(ccmd); |
128 | 127 | ||
129 | QTextStream s(&out, IO_ReadOnly); | 128 | QTextStream s(&out, IO_ReadOnly); |
130 | 129 | ||
131 | while ( !s.atEnd() ) { | 130 | while ( !s.atEnd() ) { |
132 | QString ip_addr, host, output; | 131 | QString ip_addr, host, output; |
133 | QString tmp = s.readLine(); | 132 | QString tmp = s.readLine(); |
134 | bool ok; | 133 | bool ok; |
135 | tmp.left(1).toInt( &ok, 10 ); | 134 | tmp.left(1).toInt( &ok, 10 ); |
136 | if(ok) { | 135 | if(ok) { |
137 | QStringList token = QStringList::split(' ', tmp ); | 136 | QStringList token = QStringList::split(' ', tmp ); |
138 | ip_addr = token[0]; | 137 | ip_addr = token[0]; |
139 | host = token[1]; | 138 | host = token[1]; |
140 | CBHost->insertItem( host, -1); | 139 | CBHost->insertItem( host, -1); |
141 | lms << ip_addr+" "+host+"\n"; | 140 | lms << ip_addr+" "+host+"\n"; |
142 | } | 141 | } |
143 | } | 142 | } |
144 | lmhosts.close(); | 143 | lmhosts.close(); |
145 | 144 | ||
146 | TextViewOutput->append("\n\n============================================\n"); | 145 | TextViewOutput->append("\n\n============================================\n"); |
147 | LScan->setText(""); | 146 | LScan->setText(""); |
148 | scanning = false; | 147 | scanning = false; |
149 | } | 148 | } |
150 | 149 | ||
151 | void Qsmb::hostSelected(int index) | 150 | void Qsmb::hostSelected(int index) |
152 | { | 151 | { |
153 | owarn << "hostSelected" << oendl; | 152 | owarn << "hostSelected" << oendl; |
154 | int i; | ||
155 | |||
156 | QListViewItem *element; | 153 | QListViewItem *element; |
157 | QListViewItem *parent; | 154 | QListViewItem *parent; |
158 | 155 | ||
159 | QString text = CBHost->currentText(); | 156 | QString text = CBHost->currentText(); |
160 | 157 | ||
161 | if (scanning) return; | 158 | if (scanning) return; |
162 | scanning = true; | 159 | scanning = true; |
163 | 160 | ||
164 | QString cmd; | 161 | QString cmd; |
165 | char result[256]; | 162 | QStringList ccmd; |
166 | |||
167 | FILE *pipe; | ||
168 | 163 | ||
169 | LScan->setText("Scanning..."); | 164 | LScan->setText("Scanning..."); |
170 | 165 | ||
171 | if(username->text().isEmpty()) | 166 | ccmd << "/usr/bin/smbclient"; |
172 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N 2>&1 |grep Disk"; | 167 | ccmd << "-L"; |
173 | else | 168 | ccmd << CBHost->currentText(); |
174 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N -U "+username->text()+"\%"+password->text()+" 2>&1 |grep Disk"; | 169 | ccmd << "-N"; |
170 | |||
171 | if(username->text().isEmpty()) { | ||
172 | } else { | ||
173 | ccmd << "-U"; | ||
174 | ccmd << username->text()+"\%"+ password->text(); | ||
175 | } | ||
176 | runCommand(ccmd); | ||
177 | QTextStream s(&out, IO_ReadOnly); | ||
175 | 178 | ||
176 | // for(i = 0; i < 512; i++) { | 179 | while ( !s.atEnd() ) { |
177 | // if(cmd[i]==':') { | 180 | QString share; |
178 | // cmd[i]='%'; | 181 | QString comment; |
179 | // break; | 182 | QString tmp = s.readLine(); |
180 | // } | 183 | |
181 | // if(cmd[i]=='\0') | 184 | if( tmp.find("$") == -1 && tmp.find("Disk") != -1) { |
182 | // break; | 185 | QStringList token = QStringList::split(' ', tmp ); |
183 | // } | 186 | share = token[0]; |
187 | comment = token[2]; | ||
188 | element = new QListViewItem(ListViewScan,share, comment); | ||
189 | element->setOpen(true); | ||
190 | // top_element = element; | ||
191 | // parent = element; | ||
192 | } | ||
184 | 193 | ||
185 | owarn << "i="<< index << "cmd:" << cmd << oendl; | 194 | } |
195 | // owarn << "i="<< index << "cmd:" << cmd << oendl; | ||
186 | 196 | ||
187 | TextViewOutput->append(cmd); | 197 | TextViewOutput->append(cmd); |
188 | 198 | ||
189 | /* run smbclient & read output */ | 199 | /* run smbclient & read output */ |
190 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { | 200 | // if ((pipe = popen(cmd.latin1(), "r")) == NULL) { |
191 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 201 | // snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
192 | // cmd = "Error: Can't run "+cmd; | 202 | // // cmd = "Error: Can't run "+cmd; |
193 | TextViewOutput->append(result); | 203 | // TextViewOutput->append(result); |
194 | return; | 204 | // return; |
195 | } | 205 | // } |
196 | 206 | ||
197 | /* parse output and display in ListViewScan */ | 207 | /* parse output and display in ListViewScan */ |
198 | while(fgets(result, 256, pipe) != NULL) { | 208 | // while(fgets(result, 256, pipe) != NULL) { |
199 | /* put result into TextViewOutput */ | 209 | // /* put result into TextViewOutput */ |
200 | TextViewOutput->append(result); | 210 | // TextViewOutput->append(result); |
201 | 211 | ||
202 | if( strchr(result, '$') == NULL ) { | 212 | // if( strchr(result, '$') == NULL ) { |
203 | char share[256], *ptr1; | 213 | // char share[256], *ptr1; |
204 | 214 | ||
205 | strcpy(share,result); | 215 | // strcpy(share,result); |
206 | ptr1 = strchr(share,' '); | 216 | // ptr1 = strchr(share,' '); |
207 | share[ptr1 - share]='\0'; | 217 | // share[ptr1 - share]='\0'; |
208 | 218 | ||
209 | owarn<< "add share: " << share << oendl; | 219 | // owarn<< "add share: " << share << oendl; |
210 | 220 | ||
211 | if(top_element != NULL) { | 221 | // if(top_element != NULL) { |
212 | bool found = false; | 222 | // bool found = false; |
213 | element = top_element; | 223 | // element = top_element; |
214 | 224 | ||
215 | while(element != NULL && !found) { | 225 | // while(element != NULL && !found) { |
216 | if(strcmp( element->text(0).ascii(), share)==0) { | 226 | // if(strcmp( element->text(0).ascii(), share)==0) { |
217 | parent = element; | 227 | // parent = element; |
218 | found = true; | 228 | // found = true; |
219 | } | 229 | // } |
220 | element = element->nextSibling(); | 230 | // element = element->nextSibling(); |
221 | } | 231 | // } |
222 | 232 | ||
223 | if(!found) { | 233 | // if(!found) { |
224 | element = new QListViewItem(ListViewScan,share); | 234 | // element = new QListViewItem(ListViewScan,share); |
225 | element->setOpen(true); | 235 | // element->setOpen(true); |
226 | parent=element; | 236 | // parent=element; |
227 | } | 237 | // } |
228 | } else { | 238 | // } else { |
229 | element = new QListViewItem(ListViewScan,share); | 239 | // element = new QListViewItem(ListViewScan,share); |
230 | element->setOpen(true); | 240 | // element->setOpen(true); |
231 | top_element = element; | 241 | // top_element = element; |
232 | parent = element; | 242 | // parent = element; |
233 | } | 243 | // } |
234 | } | 244 | // } |
235 | } | 245 | // } |
236 | 246 | ||
237 | TextViewOutput->append("\n\n============================================\n"); | 247 | TextViewOutput->append("\n\n============================================\n"); |
238 | LScan->setText(""); | 248 | LScan->setText(""); |
239 | scanning = false; | 249 | scanning = false; |
240 | } | 250 | } |
241 | 251 | ||
242 | void Qsmb::DoIt() | 252 | void Qsmb::DoIt() |
243 | { | 253 | { |
244 | QListViewItem *element; | 254 | QListViewItem *element; |
245 | element = ListViewScan->selectedItem(); | 255 | element = ListViewScan->selectedItem(); |
246 | if(!element) { | 256 | if(!element) { |
247 | QMessageBox::warning(this, tr("Error!!"),tr("<p><b>No</b> share selected!!</p>")); | 257 | QMessageBox::warning(this, tr("Error!!"),tr("<p><b>No</b> share selected!!</p>")); |
248 | return; | 258 | return; |
249 | } | 259 | } |
250 | 260 | ||
251 | if (scanning) return; | 261 | if (scanning) return; |
252 | scanning = true; | 262 | scanning = true; |
253 | 263 | ||
254 | int i; | 264 | int i; |
255 | bool err = false; | 265 | bool err = false; |
256 | 266 | ||
257 | char share[512]; | 267 | char share[512]; |
258 | QString cmd; | 268 | QString cmd; |
259 | QString cmd2; | 269 | QString cmd2; |
260 | char result[256]; | 270 | char result[256]; |
261 | // QString result; | 271 | // QString result; |
262 | QString text = mountpt->currentText(); | 272 | QString text = mountpt->currentText(); |
263 | 273 | ||
264 | FILE *pipe,*pipe2; | 274 | FILE *pipe,*pipe2; |
265 | 275 | ||
266 | LScan->setText("Mounting..."); | 276 | LScan->setText("Mounting..."); |
267 | qApp->processEvents(); | 277 | qApp->processEvents(); |
268 | 278 | ||
269 | 279 | ||
270 | if(! QFileInfo(text).exists()) { | 280 | if(! QFileInfo(text).exists()) { |
271 | // /* make sure mount exists! */ | ||
272 | |||
273 | // cmd = "mkdir -p "+ text; | ||
274 | // owarn<<"cmd: "<< cmd << oendl; | ||
275 | // if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { | ||
276 | // snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | ||
277 | // TextViewOutput->append(result); | ||
278 | // return; | ||
279 | // } | ||
280 | // while(fgets(result, 256, pipe2) != NULL) { | ||
281 | // /* put result into TextViewOutput */ | ||
282 | // TextViewOutput->append(result); | ||
283 | // } | ||
284 | QStringList ccmd; | 281 | QStringList ccmd; |
285 | ccmd << "mkdir"; | 282 | ccmd << "mkdir"; |
286 | ccmd << "-p"; | 283 | ccmd << "-p"; |
287 | ccmd << text; | 284 | ccmd << text; |
288 | 285 | ||
289 | owarn<<"cmd: "<< ccmd << oendl; | 286 | owarn<<"cmd: "<< ccmd << oendl; |
290 | runCommand(ccmd); | 287 | runCommand(ccmd); |
291 | } | 288 | } |
292 | 289 | ||
293 | 290 | ||
294 | strcpy(share,(const char *)element->text(0)); | 291 | strcpy(share,(const char *)element->text(0)); |
295 | 292 | ||
296 | for(i = 0; i < 256; i++) { | 293 | for(i = 0; i < 256; i++) { |
297 | if(isalpha( share[i])) { | 294 | if(isalpha( share[i])) { |
298 | strcpy( share, share + i); | 295 | strcpy( share, share + i); |
299 | break; | 296 | break; |
300 | } | 297 | } |
301 | } | 298 | } |
302 | 299 | ||
303 | cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -o username="+username->text()+",password="+password->text(); | 300 | cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -o username="+username->text()+",password="+password->text(); |
304 | 301 | ||
305 | owarn << "cmd: " << cmd << oendl; | 302 | owarn << "cmd: " << cmd << oendl; |
306 | TextViewOutput->append(cmd.latin1()); | 303 | TextViewOutput->append(cmd.latin1()); |
307 | 304 | ||
308 | 305 | ||
309 | if(onbootBtn->isChecked()) { | 306 | if(onbootBtn->isChecked()) { |
310 | owarn << "Saving Setting permanently..." << oendl; | 307 | owarn << "Saving Setting permanently..." << oendl; |
311 | cmd2 = "echo '" + cmd + "'>/opt/QtPalmtop/etc/samba.env"; | 308 | cmd2 = "echo '" + cmd + "'>/opt/QtPalmtop/etc/samba.env"; |
312 | /* run command & read output */ | 309 | /* run command & read output */ |
313 | if ((pipe = popen(cmd2.latin1(), "r")) == NULL) { | 310 | if ((pipe = popen(cmd2.latin1(), "r")) == NULL) { |
314 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 311 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
315 | return; | 312 | return; |
316 | } | 313 | } |
317 | /* parse output and display in ListViewScan */ | 314 | /* parse output and display in ListViewScan */ |
318 | while(fgets(result, 256, pipe) != NULL) { | 315 | while(fgets(result, 256, pipe) != NULL) { |
319 | } | 316 | } |
320 | } | 317 | } |
321 | 318 | ||
322 | 319 | ||
323 | /* run command & read output */ | 320 | /* run command & read output */ |
324 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { | 321 | if ((pipe = popen(cmd.latin1(), "r")) == NULL) { |
325 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 322 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
326 | TextViewOutput->append(result); | 323 | TextViewOutput->append(result); |
327 | return; | 324 | return; |
328 | } | 325 | } |
329 | 326 | ||
330 | /* parse output and display in ListViewScan */ | 327 | /* parse output and display in ListViewScan */ |
331 | while(fgets(result, 256, pipe) != NULL) { | 328 | while(fgets(result, 256, pipe) != NULL) { |
332 | /* put result into TextViewOutput */ | 329 | /* put result into TextViewOutput */ |
333 | TextViewOutput->append(result); | 330 | TextViewOutput->append(result); |
334 | } | 331 | } |
335 | 332 | ||
336 | 333 | ||
337 | TextViewOutput->append("\n\n================CheckMounts==================\n"); | 334 | TextViewOutput->append("\n\n================CheckMounts==================\n"); |
338 | LScan->setText(""); | 335 | LScan->setText(""); |
339 | 336 | ||
340 | cmd = "/bin/mount 2>&1"; | 337 | cmd = "/bin/mount 2>&1"; |
341 | owarn << "cmd: " << cmd << oendl; | 338 | owarn << "cmd: " << cmd << oendl; |
342 | 339 | ||
343 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { | 340 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { |
344 | 341 | ||
345 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 342 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
346 | // result = "Error: Can't run "+ cmd; | 343 | // result = "Error: Can't run "+ cmd; |
347 | 344 | ||
348 | TextViewOutput->append(result); | 345 | TextViewOutput->append(result); |
349 | return; | 346 | return; |
350 | } | 347 | } |
351 | /* parse output and display in ListViewScan */ | 348 | /* parse output and display in ListViewScan */ |
352 | while(fgets(result, 256, pipe2) != NULL) { | 349 | while(fgets(result, 256, pipe2) != NULL) { |
353 | /* put result into TextViewOutput */ | 350 | /* put result into TextViewOutput */ |
354 | TextViewOutput->append(result); | 351 | TextViewOutput->append(result); |
355 | } | 352 | } |
356 | 353 | ||
357 | TextViewOutput->append("\n\n============================================\n"); | 354 | TextViewOutput->append("\n\n============================================\n"); |
358 | scanning = false; | 355 | scanning = false; |
359 | } | 356 | } |
360 | 357 | ||
361 | bool Qsmb::runCommand(const QStringList & command) { | 358 | bool Qsmb::runCommand(const QStringList & command) { |
362 | owarn << "runCommand " << command.join(" ") << oendl; | 359 | owarn << "runCommand " << command.join(" ") << oendl; |
363 | out = ""; | 360 | out = ""; |
364 | Process ipkg_status( command); | 361 | Process ipkg_status( command); |
365 | bool r = ipkg_status.exec("",out); | 362 | bool r = ipkg_status.exec("",out); |
366 | 363 | ||
367 | if(!r) { | 364 | if(!r) { |
368 | QMessageBox::warning(this, tr("Error!!"),tr("<p>"+out+"</p>")); | 365 | QMessageBox::warning(this, tr("Error!!"),tr("<p>"+out+"</p>")); |
369 | } | 366 | } |
370 | 367 | ||
371 | owarn << "Output " << out << oendl; | 368 | owarn << "Output " << out << oendl; |
372 | TextViewOutput->append(out.latin1()); | 369 | TextViewOutput->append(out.latin1()); |
373 | return r; | 370 | return r; |
374 | } | 371 | } |
375 | 372 | ||
376 | 373 | ||
diff --git a/noncore/net/opie-smb/qsmbbase.ui b/noncore/net/opie-smb/qsmbbase.ui index 35a1aec..3107929 100644 --- a/noncore/net/opie-smb/qsmbbase.ui +++ b/noncore/net/opie-smb/qsmbbase.ui | |||
@@ -1,224 +1,242 @@ | |||
1 | <!DOCTYPE UI><UI> | 1 | <!DOCTYPE UI><UI> |
2 | <class>FormQPESMBBase</class> | 2 | <class>FormQPESMBBase</class> |
3 | <widget> | 3 | <widget> |
4 | <class>QWidget</class> | 4 | <class>QWidget</class> |
5 | <property stdset="1"> | 5 | <property stdset="1"> |
6 | <name>name</name> | 6 | <name>name</name> |
7 | <cstring>FormQPESMBBase</cstring> | 7 | <cstring>FormQPESMBBase</cstring> |
8 | </property> | 8 | </property> |
9 | <property stdset="1"> | 9 | <property stdset="1"> |
10 | <name>geometry</name> | 10 | <name>geometry</name> |
11 | <rect> | 11 | <rect> |
12 | <x>0</x> | 12 | <x>0</x> |
13 | <y>0</y> | 13 | <y>0</y> |
14 | <width>254</width> | 14 | <width>250</width> |
15 | <height>352</height> | 15 | <height>352</height> |
16 | </rect> | 16 | </rect> |
17 | </property> | 17 | </property> |
18 | <property stdset="1"> | 18 | <property stdset="1"> |
19 | <name>font</name> | 19 | <name>font</name> |
20 | <font> | 20 | <font> |
21 | </font> | 21 | </font> |
22 | </property> | 22 | </property> |
23 | <property stdset="1"> | 23 | <property stdset="1"> |
24 | <name>caption</name> | 24 | <name>caption</name> |
25 | <string>Opie Smb</string> | 25 | <string>Opie Smb</string> |
26 | </property> | 26 | </property> |
27 | <property> | 27 | <property> |
28 | <name>layoutMargin</name> | 28 | <name>layoutMargin</name> |
29 | </property> | 29 | </property> |
30 | <property> | 30 | <property> |
31 | <name>layoutSpacing</name> | 31 | <name>layoutSpacing</name> |
32 | </property> | 32 | </property> |
33 | <grid> | 33 | <grid> |
34 | <property stdset="1"> | 34 | <property stdset="1"> |
35 | <name>margin</name> | 35 | <name>margin</name> |
36 | <number>0</number> | 36 | <number>0</number> |
37 | </property> | 37 | </property> |
38 | <property stdset="1"> | 38 | <property stdset="1"> |
39 | <name>spacing</name> | 39 | <name>spacing</name> |
40 | <number>2</number> | 40 | <number>2</number> |
41 | </property> | 41 | </property> |
42 | <widget row="0" column="0" > | 42 | <widget row="0" column="0" > |
43 | <class>QTabWidget</class> | 43 | <class>QTabWidget</class> |
44 | <property stdset="1"> | 44 | <property stdset="1"> |
45 | <name>name</name> | 45 | <name>name</name> |
46 | <cstring>TabWidget2</cstring> | 46 | <cstring>TabWidget2</cstring> |
47 | </property> | 47 | </property> |
48 | <property> | 48 | <property> |
49 | <name>layoutMargin</name> | 49 | <name>layoutMargin</name> |
50 | </property> | 50 | </property> |
51 | <property> | 51 | <property> |
52 | <name>layoutSpacing</name> | 52 | <name>layoutSpacing</name> |
53 | </property> | 53 | </property> |
54 | <widget> | 54 | <widget> |
55 | <class>QWidget</class> | 55 | <class>QWidget</class> |
56 | <property stdset="1"> | 56 | <property stdset="1"> |
57 | <name>name</name> | 57 | <name>name</name> |
58 | <cstring>tab</cstring> | 58 | <cstring>tab</cstring> |
59 | </property> | 59 | </property> |
60 | <attribute> | 60 | <attribute> |
61 | <name>title</name> | 61 | <name>title</name> |
62 | <string>Scan</string> | 62 | <string>Scan</string> |
63 | </attribute> | 63 | </attribute> |
64 | <grid> | 64 | <grid> |
65 | <property stdset="1"> | 65 | <property stdset="1"> |
66 | <name>margin</name> | 66 | <name>margin</name> |
67 | <number>2</number> | 67 | <number>2</number> |
68 | </property> | 68 | </property> |
69 | <property stdset="1"> | 69 | <property stdset="1"> |
70 | <name>spacing</name> | 70 | <name>spacing</name> |
71 | <number>0</number> | 71 | <number>0</number> |
72 | </property> | 72 | </property> |
73 | <widget row="1" column="0" rowspan="1" colspan="4" > | 73 | <widget row="1" column="0" rowspan="1" colspan="4" > |
74 | <class>QComboBox</class> | 74 | <class>QComboBox</class> |
75 | <property stdset="1"> | 75 | <property stdset="1"> |
76 | <name>name</name> | 76 | <name>name</name> |
77 | <cstring>CBHost</cstring> | 77 | <cstring>CBHost</cstring> |
78 | </property> | 78 | </property> |
79 | </widget> | 79 | </widget> |
80 | <widget row="4" column="1" rowspan="1" colspan="3" > | 80 | <widget row="4" column="1" rowspan="1" colspan="3" > |
81 | <class>QComboBox</class> | 81 | <class>QComboBox</class> |
82 | <property stdset="1"> | 82 | <property stdset="1"> |
83 | <name>name</name> | 83 | <name>name</name> |
84 | <cstring>mountpt</cstring> | 84 | <cstring>mountpt</cstring> |
85 | </property> | 85 | </property> |
86 | </widget> | 86 | </widget> |
87 | <widget row="0" column="3" > | 87 | <widget row="0" column="3" > |
88 | <class>QLabel</class> | 88 | <class>QLabel</class> |
89 | <property stdset="1"> | 89 | <property stdset="1"> |
90 | <name>name</name> | 90 | <name>name</name> |
91 | <cstring>LScan</cstring> | 91 | <cstring>LScan</cstring> |
92 | </property> | 92 | </property> |
93 | <property stdset="1"> | 93 | <property stdset="1"> |
94 | <name>text</name> | 94 | <name>text</name> |
95 | <string></string> | 95 | <string></string> |
96 | </property> | 96 | </property> |
97 | </widget> | 97 | </widget> |
98 | <widget row="4" column="0" > | 98 | <widget row="4" column="0" > |
99 | <class>QLabel</class> | 99 | <class>QLabel</class> |
100 | <property stdset="1"> | 100 | <property stdset="1"> |
101 | <name>name</name> | 101 | <name>name</name> |
102 | <cstring>textLabel1</cstring> | 102 | <cstring>textLabel1</cstring> |
103 | </property> | 103 | </property> |
104 | <property stdset="1"> | 104 | <property stdset="1"> |
105 | <name>text</name> | 105 | <name>text</name> |
106 | <string>mount pt:</string> | 106 | <string>mount pt:</string> |
107 | </property> | 107 | </property> |
108 | </widget> | 108 | </widget> |
109 | <widget row="2" column="0" rowspan="1" colspan="4" > | 109 | <widget row="2" column="0" rowspan="1" colspan="4" > |
110 | <class>QListView</class> | 110 | <class>QListView</class> |
111 | <column> | 111 | <column> |
112 | <property> | 112 | <property> |
113 | <name>text</name> | 113 | <name>text</name> |
114 | <string>Shares</string> | 114 | <string>Shares</string> |
115 | </property> | 115 | </property> |
116 | <property> | 116 | <property> |
117 | <name>clickable</name> | 117 | <name>clickable</name> |
118 | <bool>true</bool> | 118 | <bool>true</bool> |
119 | </property> | 119 | </property> |
120 | <property> | 120 | <property> |
121 | <name>resizeable</name> | 121 | <name>resizeable</name> |
122 | <bool>true</bool> | 122 | <bool>true</bool> |
123 | </property> | 123 | </property> |
124 | </column> | 124 | </column> |
125 | <column> | ||
126 | <property> | ||
127 | <name>text</name> | ||
128 | <string>Comment</string> | ||
129 | </property> | ||
130 | <property> | ||
131 | <name>clickable</name> | ||
132 | <bool>true</bool> | ||
133 | </property> | ||
134 | <property> | ||
135 | <name>resizeable</name> | ||
136 | <bool>true</bool> | ||
137 | </property> | ||
138 | </column> | ||
125 | <property stdset="1"> | 139 | <property stdset="1"> |
126 | <name>name</name> | 140 | <name>name</name> |
127 | <cstring>ListViewScan</cstring> | 141 | <cstring>ListViewScan</cstring> |
128 | </property> | 142 | </property> |
143 | <property stdset="1"> | ||
144 | <name>allColumnsShowFocus</name> | ||
145 | <bool>true</bool> | ||
146 | </property> | ||
129 | </widget> | 147 | </widget> |
130 | <widget row="0" column="0" rowspan="1" colspan="2" > | 148 | <widget row="0" column="0" rowspan="1" colspan="2" > |
131 | <class>QPushButton</class> | 149 | <class>QPushButton</class> |
132 | <property stdset="1"> | 150 | <property stdset="1"> |
133 | <name>name</name> | 151 | <name>name</name> |
134 | <cstring>BtnScan</cstring> | 152 | <cstring>BtnScan</cstring> |
135 | </property> | 153 | </property> |
136 | <property stdset="1"> | 154 | <property stdset="1"> |
137 | <name>text</name> | 155 | <name>text</name> |
138 | <string>&Scan</string> | 156 | <string>&Scan</string> |
139 | </property> | 157 | </property> |
140 | </widget> | 158 | </widget> |
141 | <widget row="0" column="2" > | 159 | <widget row="0" column="2" > |
142 | <class>QPushButton</class> | 160 | <class>QPushButton</class> |
143 | <property stdset="1"> | 161 | <property stdset="1"> |
144 | <name>name</name> | 162 | <name>name</name> |
145 | <cstring>BtnClear</cstring> | 163 | <cstring>BtnClear</cstring> |
146 | </property> | 164 | </property> |
147 | <property stdset="1"> | 165 | <property stdset="1"> |
148 | <name>text</name> | 166 | <name>text</name> |
149 | <string>&Clear</string> | 167 | <string>&Clear</string> |
150 | </property> | 168 | </property> |
151 | </widget> | 169 | </widget> |
152 | <widget row="3" column="0" rowspan="1" colspan="3" > | 170 | <widget row="3" column="0" rowspan="1" colspan="3" > |
153 | <class>QCheckBox</class> | 171 | <class>QCheckBox</class> |
154 | <property stdset="1"> | 172 | <property stdset="1"> |
155 | <name>name</name> | 173 | <name>name</name> |
156 | <cstring>onbootBtn</cstring> | 174 | <cstring>onbootBtn</cstring> |
157 | </property> | 175 | </property> |
158 | <property stdset="1"> | 176 | <property stdset="1"> |
159 | <name>text</name> | 177 | <name>text</name> |
160 | <string>Reconnect on boot</string> | 178 | <string>Reconnect on boot</string> |
161 | </property> | 179 | </property> |
162 | </widget> | 180 | </widget> |
163 | <widget row="5" column="0" rowspan="1" colspan="2" > | 181 | <widget row="5" column="0" rowspan="1" colspan="2" > |
164 | <class>QPushButton</class> | 182 | <class>QPushButton</class> |
165 | <property stdset="1"> | 183 | <property stdset="1"> |
166 | <name>name</name> | 184 | <name>name</name> |
167 | <cstring>DoItBtn</cstring> | 185 | <cstring>DoItBtn</cstring> |
168 | </property> | 186 | </property> |
169 | <property stdset="1"> | 187 | <property stdset="1"> |
170 | <name>text</name> | 188 | <name>text</name> |
171 | <string>&Login</string> | 189 | <string>&Login</string> |
172 | </property> | 190 | </property> |
173 | </widget> | 191 | </widget> |
174 | <widget row="5" column="2" rowspan="1" colspan="2" > | 192 | <widget row="5" column="2" rowspan="1" colspan="2" > |
175 | <class>QLayoutWidget</class> | 193 | <class>QLayoutWidget</class> |
176 | <property stdset="1"> | 194 | <property stdset="1"> |
177 | <name>name</name> | 195 | <name>name</name> |
178 | <cstring>Layout6</cstring> | 196 | <cstring>Layout6</cstring> |
179 | </property> | 197 | </property> |
180 | <grid> | 198 | <grid> |
181 | <property stdset="1"> | 199 | <property stdset="1"> |
182 | <name>margin</name> | 200 | <name>margin</name> |
183 | <number>0</number> | 201 | <number>0</number> |
184 | </property> | 202 | </property> |
185 | <property stdset="1"> | 203 | <property stdset="1"> |
186 | <name>spacing</name> | 204 | <name>spacing</name> |
187 | <number>6</number> | 205 | <number>6</number> |
188 | </property> | 206 | </property> |
189 | <widget row="1" column="0" > | 207 | <widget row="1" column="0" > |
190 | <class>QLayoutWidget</class> | 208 | <class>QLayoutWidget</class> |
191 | <property stdset="1"> | 209 | <property stdset="1"> |
192 | <name>name</name> | 210 | <name>name</name> |
193 | <cstring>Layout2</cstring> | 211 | <cstring>Layout2</cstring> |
194 | </property> | 212 | </property> |
195 | <hbox> | 213 | <hbox> |
196 | <property stdset="1"> | 214 | <property stdset="1"> |
197 | <name>margin</name> | 215 | <name>margin</name> |
198 | <number>0</number> | 216 | <number>0</number> |
199 | </property> | 217 | </property> |
200 | <property stdset="1"> | 218 | <property stdset="1"> |
201 | <name>spacing</name> | 219 | <name>spacing</name> |
202 | <number>6</number> | 220 | <number>6</number> |
203 | </property> | 221 | </property> |
204 | <widget> | 222 | <widget> |
205 | <class>QLabel</class> | 223 | <class>QLabel</class> |
206 | <property stdset="1"> | 224 | <property stdset="1"> |
207 | <name>name</name> | 225 | <name>name</name> |
208 | <cstring>pwdlabel</cstring> | 226 | <cstring>pwdlabel</cstring> |
209 | </property> | 227 | </property> |
210 | <property stdset="1"> | 228 | <property stdset="1"> |
211 | <name>text</name> | 229 | <name>text</name> |
212 | <string>password</string> | 230 | <string>password</string> |
213 | </property> | 231 | </property> |
214 | </widget> | 232 | </widget> |
215 | <widget> | 233 | <widget> |
216 | <class>QLineEdit</class> | 234 | <class>QLineEdit</class> |
217 | <property stdset="1"> | 235 | <property stdset="1"> |
218 | <name>name</name> | 236 | <name>name</name> |
219 | <cstring>password</cstring> | 237 | <cstring>password</cstring> |
220 | </property> | 238 | </property> |
221 | </widget> | 239 | </widget> |
222 | </hbox> | 240 | </hbox> |
223 | </widget> | 241 | </widget> |
224 | <widget row="0" column="0" > | 242 | <widget row="0" column="0" > |