-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 83 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmb.h | 11 |
2 files changed, 50 insertions, 44 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 | ||
@@ -301,19 +297,18 @@ void Qsmb::DoIt() | |||
301 | qApp->processEvents(); | 297 | qApp->processEvents(); |
302 | |||
303 | cmd = "mkdir -p "+ text; | ||
304 | |||
305 | owarn<<"cmd: "<< cmd << oendl; | ||
306 | 298 | ||
307 | /* make sure mount exists! */ | ||
308 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { | ||
309 | |||
310 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | ||
311 | // result = "Error: Can't run " + cmd; | ||
312 | TextViewOutput->append(result); | ||
313 | return; | ||
314 | } | ||
315 | 299 | ||
316 | while(fgets(result, 256, pipe2) != NULL) { | 300 | if(! QFileInfo(text).exists()) { |
317 | /* put result into TextViewOutput */ | 301 | cmd = "mkdir -p "+ text; |
318 | TextViewOutput->append(result); | 302 | owarn<<"cmd: "<< cmd << oendl; |
303 | /* make sure mount exists! */ | ||
304 | if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { | ||
305 | snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); | ||
306 | // result = "Error: Can't run " + cmd; | ||
307 | TextViewOutput->append(result); | ||
308 | return; | ||
309 | } | ||
310 | while(fgets(result, 256, pipe2) != NULL) { | ||
311 | /* put result into TextViewOutput */ | ||
312 | TextViewOutput->append(result); | ||
313 | } | ||
319 | } | 314 | } |
@@ -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 | |||
@@ -30,6 +30,9 @@ private: | |||
30 | public slots: | 30 | public slots: |
31 | void clear(); | 31 | void clear(); |
32 | void scanClicked(); | 32 | void scanClicked(); |
33 | void hostSelected(int); | 33 | void hostSelected(int); |
34 | void DoItClicked(); | 34 | void DoItClicked(); |
35 | QString out; | ||
36 | bool runCommand(const QStringList &); | ||
37 | |||
35 | }; | 38 | }; |