summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-08-15 06:45:15 (UTC)
committer llornkcor <llornkcor>2005-08-15 06:45:15 (UTC)
commitfb0e4444f79ad253998f1a2e5c706e3fcf29ad08 (patch) (side-by-side diff)
treefba795d9d82f0e7002b7711a72ed1bac5d2522a4
parent1dc2675c1bf557ba0032781535faf033809bae48 (diff)
downloadopie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.zip
opie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.tar.gz
opie-fb0e4444f79ad253998f1a2e5c706e3fcf29ad08.tar.bz2
cleanup. fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opie-smb/qsmb.cpp83
-rw-r--r--noncore/net/opie-smb/qsmb.h11
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
@@ -8,4 +8,5 @@
#include <qfileinfo.h>
+#include <qpe/process.h>
#include <qlabel.h>
#include <qlineedit.h>
@@ -34,9 +35,4 @@ Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl )
connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear()));
-//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);
mountpt->insertItem("/mnt/samba2",-1);
@@ -204,17 +200,17 @@ void Qsmb::hostSelected(int index)
LScan->setText("Scanning...");
- 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;
+// }
owarn << "i="<< index << "cmd:" << cmd << oendl;
@@ -300,21 +296,20 @@ void Qsmb::DoIt()
LScan->setText("Mounting...");
qApp->processEvents();
-
- 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());
- // result = "Error: Can't run " + cmd;
- TextViewOutput->append(result);
- return;
- }
- while(fgets(result, 256, pipe2) != NULL) {
- /* put result into TextViewOutput */
- TextViewOutput->append(result);
+ 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());
+ // result = "Error: Can't run " + cmd;
+ TextViewOutput->append(result);
+ return;
+ }
+ while(fgets(result, 256, pipe2) != NULL) {
+ /* put result into TextViewOutput */
+ TextViewOutput->append(result);
+ }
}
@@ -329,14 +324,5 @@ 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();
owarn << "cmd: " << cmd << oendl;
@@ -401,2 +387,19 @@ void Qsmb::DoIt()
scanning = false;
}
+
+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
@@ -29,8 +29,11 @@ private:
public slots:
- void clear();
- void scanClicked();
- void hostSelected(int);
- void DoItClicked();
+ void clear();
+ void scanClicked();
+ void hostSelected(int);
+ void DoItClicked();
+ QString out;
+ bool runCommand(const QStringList &);
+
};
void* runit(void *arg);