-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 @@ +#include <qpe/process.h> #include <qlabel.h> @@ -35,7 +36,2 @@ Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) -//TODO configurable mount points - if(!QFileInfo("/mnt/samba1").exists()) system("mkdir /mnt/samba1"); - if(!QFileInfo("/mnt/samba2").exists()) system("mkdir /mnt/samba2"); - if(!QFileInfo("/mnt/samba2").exists()) system("mkdir /mnt/samba3"); - mountpt->insertItem("/mnt/samba1",-1); @@ -205,15 +201,15 @@ void Qsmb::hostSelected(int index) - if((const char *)username->text() == '\0') + if(username->text().isEmpty()) cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N 2>&1 |grep Disk"; else - cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N -U"+username->text()+":"+password->text()+" 2>&1 |grep Disk"; + cmd = "/usr/bin/smbclient -L //"+CBHost->currentText()+" -N -U "+username->text()+"\%"+password->text()+" 2>&1 |grep Disk"; - for(i = 0; i < 512; i++) { - if(cmd[i]==':') { - cmd[i]='%'; - break; - } - if(cmd[i]=='\0') - break; - } +// for(i = 0; i < 512; i++) { +// if(cmd[i]==':') { +// cmd[i]='%'; +// break; +// } +// if(cmd[i]=='\0') +// break; +// } @@ -302,9 +298,8 @@ void Qsmb::DoIt() - cmd = "mkdir -p "+ text; + if(! QFileInfo(text).exists()) { + cmd = "mkdir -p "+ text; owarn<<"cmd: "<< cmd << oendl; - /* make sure mount exists! */ if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { - snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); @@ -314,3 +309,2 @@ void Qsmb::DoIt() } - while(fgets(result, 256, pipe2) != NULL) { @@ -319,2 +313,3 @@ void Qsmb::DoIt() } + } @@ -330,12 +325,3 @@ void Qsmb::DoIt() - cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -U"+username->text()+":"+password->text(); - - for(i = 0; i < 512; i++) { - if(cmd[i]==':') { - cmd[i]='%'; - break; - } - if(cmd[i]=='\0') - break; - } + cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -o username="+username->text()+",password="+password->text(); @@ -402 +388,18 @@ void Qsmb::DoIt() } + +bool Qsmb::runCommand(const QStringList & command) { + owarn << "runCommand " << command.join(" ") << oendl; + out = ""; + Process ipkg_status( command); + bool r = ipkg_status.exec("",out); + + if(!r) { + QMessageBox::warning(this, tr("Error!!"),tr("<p>"+out+"</p>")); + } + + owarn << "Output " << out << oendl; + TextViewOutput->append(out.latin1()); + return r; +} + + 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: void DoItClicked(); + QString out; + bool runCommand(const QStringList &); + }; |