author | llornkcor <llornkcor> | 2005-08-15 06:45:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-15 06:45:15 (UTC) |
commit | fb0e4444f79ad253998f1a2e5c706e3fcf29ad08 (patch) (unidiff) | |
tree | fba795d9d82f0e7002b7711a72ed1bac5d2522a4 /noncore | |
parent | 1dc2675c1bf557ba0032781535faf033809bae48 (diff) | |
download | opie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.zip opie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.tar.gz opie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.tar.bz2 |
cleanup. fix
-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 61 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmb.h | 3 |
2 files changed, 35 insertions, 29 deletions
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp index 880573b..8aa4987 100644 --- a/noncore/net/opie-smb/qsmb.cpp +++ b/noncore/net/opie-smb/qsmb.cpp | |||
@@ -9,2 +9,3 @@ | |||
9 | 9 | ||
10 | #include <qpe/process.h> | ||
10 | #include <qlabel.h> | 11 | #include <qlabel.h> |
@@ -35,7 +36,2 @@ Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) | |||
35 | 36 | ||
36 | //TODO configurable mount points | ||
37 | if(!QFileInfo("/mnt/samba1").exists()) system("mkdir /mnt/samba1"); | ||
38 | if(!QFileInfo("/mnt/samba2").exists()) system("mkdir /mnt/samba2"); | ||
39 | if(!QFileInfo("/mnt/samba2").exists()) system("mkdir /mnt/samba3"); | ||
40 | |||
41 | mountpt->insertItem("/mnt/samba1",-1); | 37 | mountpt->insertItem("/mnt/samba1",-1); |
@@ -205,15 +201,15 @@ void Qsmb::hostSelected(int index) | |||
205 | 201 | ||
206 | if((const char *)username->text() == '\0') | 202 | if(username->text().isEmpty()) |
207 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N 2>&1 |grep Disk"; | 203 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N 2>&1 |grep Disk"; |
208 | else | 204 | else |
209 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N -U"+username->text()+":"+password->text()+" 2>&1 |grep Disk"; | 205 | cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N -U "+username->text()+"\%"+password->text()+" 2>&1 |grep Disk"; |
210 | 206 | ||
211 | for(i = 0; i < 512; i++) { | 207 | // for(i = 0; i < 512; i++) { |
212 | if(cmd[i]==':') { | 208 | // if(cmd[i]==':') { |
213 | cmd[i]='%'; | 209 | // cmd[i]='%'; |
214 | break; | 210 | // break; |
215 | } | 211 | // } |
216 | if(cmd[i]=='\0') | 212 | // if(cmd[i]=='\0') |
217 | break; | 213 | // break; |
218 | } | 214 | // } |
219 | 215 | ||
@@ -302,9 +298,8 @@ void Qsmb::DoIt() | |||
302 | 298 | ||
303 | cmd = "mkdir -p "+ text; | ||
304 | 299 | ||
300 | if(! QFileInfo(text).exists()) { | ||
301 | cmd = "mkdir -p "+ text; | ||
305 | owarn<<"cmd: "<< cmd << oendl; | 302 | owarn<<"cmd: "<< cmd << oendl; |
306 | |||
307 | /* make sure mount exists! */ | 303 | /* make sure mount exists! */ |
308 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { | 304 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { |
309 | |||
310 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | 305 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); |
@@ -314,3 +309,2 @@ void Qsmb::DoIt() | |||
314 | } | 309 | } |
315 | |||
316 | while(fgets(result, 256, pipe2) != NULL) { | 310 | while(fgets(result, 256, pipe2) != NULL) { |
@@ -319,2 +313,3 @@ void Qsmb::DoIt() | |||
319 | } | 313 | } |
314 | } | ||
320 | 315 | ||
@@ -330,12 +325,3 @@ void Qsmb::DoIt() | |||
330 | 325 | ||
331 | cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -U"+username->text()+":"+password->text(); | 326 | cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -o username="+username->text()+",password="+password->text(); |
332 | |||
333 | for(i = 0; i < 512; i++) { | ||
334 | if(cmd[i]==':') { | ||
335 | cmd[i]='%'; | ||
336 | break; | ||
337 | } | ||
338 | if(cmd[i]=='\0') | ||
339 | break; | ||
340 | } | ||
341 | 327 | ||
@@ -402 +388,18 @@ void Qsmb::DoIt() | |||
402 | } | 388 | } |
389 | |||
390 | bool Qsmb::runCommand(const QStringList & command) { | ||
391 | owarn << "runCommand " << command.join(" ") << oendl; | ||
392 | out = ""; | ||
393 | Process ipkg_status( command); | ||
394 | bool r = ipkg_status.exec("",out); | ||
395 | |||
396 | if(!r) { | ||
397 | QMessageBox::warning(this, tr("Error!!"),tr("<p>"+out+"</p>")); | ||
398 | } | ||
399 | |||
400 | owarn << "Output " << out << oendl; | ||
401 | TextViewOutput->append(out.latin1()); | ||
402 | return r; | ||
403 | } | ||
404 | |||
405 | |||
diff --git a/noncore/net/opie-smb/qsmb.h b/noncore/net/opie-smb/qsmb.h index 8fefe91..b406a1e 100644 --- a/noncore/net/opie-smb/qsmb.h +++ b/noncore/net/opie-smb/qsmb.h | |||
@@ -34,2 +34,5 @@ public slots: | |||
34 | void DoItClicked(); | 34 | void DoItClicked(); |
35 | QString out; | ||
36 | bool runCommand(const QStringList &); | ||
37 | |||
35 | }; | 38 | }; |