summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-08-16 08:48:50 (UTC)
committer llornkcor <llornkcor>2005-08-16 08:48:50 (UTC)
commite49f60f79b86a6feb3cae4bc33c19123deec4eb3 (patch) (unidiff)
tree0dbfa09072fcdd70f19a06ac93ad8f3f97b2978c
parent373b2f0bdc2be62c6e275c74488a8921d03fc299 (diff)
downloadopie-e49f60f79b86a6feb3cae4bc33c19123deec4eb3.zip
opie-e49f60f79b86a6feb3cae4bc33c19123deec4eb3.tar.gz
opie-e49f60f79b86a6feb3cae4bc33c19123deec4eb3.tar.bz2
remove last popen. add umount.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opie-smb/qsmb.cpp198
-rw-r--r--noncore/net/opie-smb/qsmb.h22
-rw-r--r--noncore/net/opie-smb/qsmbbase.ui59
3 files changed, 170 insertions, 109 deletions
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp
index 422b9f3..b978b46 100644
--- a/noncore/net/opie-smb/qsmb.cpp
+++ b/noncore/net/opie-smb/qsmb.cpp
@@ -1,374 +1,408 @@
1#include "qsmb.h" 1#include "qsmb.h"
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#include <qtabwidget.h>
10 11
11#include <qpe/process.h> 12#include <qpe/process.h>
12#include <qlabel.h> 13#include <qlabel.h>
13#include <qlineedit.h> 14#include <qlineedit.h>
14#include <qcombobox.h> 15#include <qcombobox.h>
15#include <qstringlist.h> 16#include <qstringlist.h>
16#include <qcheckbox.h> 17#include <qcheckbox.h>
17#include <qtextview.h> 18#include <qtextview.h>
18#include <qmessagebox.h> 19#include <qmessagebox.h>
19#include <qtextstream.h> 20#include <qtextstream.h>
20 21
21 22
22#include <pthread.h> 23#include <pthread.h>
23#include <signal.h> 24#include <signal.h>
24#include <ctype.h> 25#include <ctype.h>
25 26
26 27
27#include <netinet/in.h> 28#include <netinet/in.h>
28#include <arpa/inet.h> 29#include <arpa/inet.h>
29
30#include <rpc/clnt.h> 30#include <rpc/clnt.h>
31 31
32#include <sys/vfs.h>
33#include <mntent.h>
32 34
33#include <opie2/odebug.h> 35// #include <opie2/odebug.h>
34using namespace Opie::Core; 36// using namespace Opie::Core;
35 37
36 38
37Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) 39Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl )
38 : FormQPESMBBase( parent, name, fl ) 40 : FormQPESMBBase( parent, name, fl )
39{ 41{
40 connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int))); 42 connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int)));
41 connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked())); 43 connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked()));
44 connect(UnmountBtn, SIGNAL(clicked()), this, SLOT(umountIt()));
42 connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked())); 45 connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked()));
43 connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear())); 46 connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear()));
44 47
48 mountpt->setEditable(true);
45 mountpt->insertItem("/mnt/samba1",-1); 49 mountpt->insertItem("/mnt/samba1",-1);
46 mountpt->insertItem("/mnt/samba2",-1); 50 mountpt->insertItem("/mnt/samba2",-1);
47 mountpt->insertItem("/mnt/samba3",-1); 51 mountpt->insertItem("/mnt/samba3",-1);
48 52
53// TextViewOutput
54
49 top_element = NULL; 55 top_element = NULL;
50 scanning = false; 56 scanning = false;
51} 57}
52 58
53Qsmb::~Qsmb() 59Qsmb::~Qsmb()
54{ 60{
55} 61}
56 62
57void Qsmb::clear() 63void Qsmb::clear()
58{ 64{
59 if (scanning) return; 65 if (scanning) return;
60 ListViewScan->clear(); 66 ListViewScan->clear();
61 TextViewOutput->setText(""); 67 TextViewOutput->setText("");
62 top_element = NULL; 68 top_element = NULL;
63} 69}
64 70
65void Qsmb::scanClicked() 71void Qsmb::scanClicked()
66{ 72{
67 if (scanning) return; 73 if (scanning) return;
68 pthread_create(&tpid, NULL, runit, (void *)this); 74 pthread_create(&tpid, NULL, runit, (void *)this);
69} 75}
70 76
71void Qsmb::DoItClicked() 77void Qsmb::DoItClicked()
72{ 78{
73 79
74 if(! ListViewScan->selectedItem()) { 80 if( !ListViewScan->selectedItem()) {
75 QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>")); 81 QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>"));
76 return; 82 return;
77 } 83 }
78 if (scanning) return; 84 if (scanning) return;
79 pthread_create(&tpid, NULL, runitm, (void *)this); 85 pthread_create(&tpid, NULL, runitm, (void *)this);
80} 86}
81 87
82void* runit(void* arg) 88void* runit(void* arg)
83{ 89{
84 Qsmb* caller = (Qsmb*)arg; 90 Qsmb* caller = (Qsmb*)arg;
85 caller->scan(); 91 caller->scan();
86 return(0); 92 return(0);
87} 93}
88 94
89void* runitm(void* arg) 95void* runitm(void* arg)
90{ 96{
91 Qsmb* caller = (Qsmb*)arg; 97 Qsmb* caller = (Qsmb*)arg;
92 caller->DoIt(); 98 caller->DoIt();
93 return(0); 99 return(0);
94} 100}
95 101
96void Qsmb::scan() 102void Qsmb::scan()
97{ 103{
98// int i;
99
100 if (scanning) return; 104 if (scanning) return;
101 scanning = true; 105 scanning = true;
102 106
103 QString match; 107 QString match;
104 QString cmd; 108 QString cmd;
105 LScan->setText("Scanning..."); 109 LScan->setText("Scanning...");
106 qApp->processEvents(); 110 qApp->processEvents();
107 111
108 sockaddr_in my_addr; 112 sockaddr_in my_addr;
109 get_myaddress( &my_addr); 113 get_myaddress( &my_addr);
110 114
111 QString ip = inet_ntoa( my_addr.sin_addr); 115 QString ip = inet_ntoa( my_addr.sin_addr);
112 owarn << "IP Address : " << ip<< oendl; 116 qWarning("IP Address : "+ip);
113 117
114 match = ip.left(5); 118 match = ip.left(5);
115 119
116 QStringList ccmd; 120 QStringList ccmd;
117 TextViewOutput->append("smbfind"); 121 TextViewOutput->append("smbfind");
118 122
119 QFile lmhosts("/etc/samba/lmhosts"); 123 QFile lmhosts("/etc/samba/lmhosts");
120 QTextStream lms(&lmhosts); 124 QTextStream lms(&lmhosts);
121 lmhosts.open(IO_WriteOnly); 125 lmhosts.open(IO_WriteOnly);
122 lms << "127.0.0.1 localhost\n"; 126 lms << "127.0.0.1 localhost\n";
123 127
124 /* parse output and display in ListViewScan */ 128 /* parse output and display in ListViewScan */
125 ccmd = "smbfind"; 129 ccmd = "smbfind";
126 runCommand(ccmd); 130 runCommand(ccmd);
127 131
128 QTextStream s(&out, IO_ReadOnly); 132 QTextStream s(&out, IO_ReadOnly);
129 133
130 while ( !s.atEnd() ) { 134 while ( !s.atEnd() ) {
131 QString ip_addr, host, output; 135 QString ip_addr, host, output;
132 QString tmp = s.readLine(); 136 QString tmp = s.readLine();
133 bool ok; 137 bool ok;
134 tmp.left(1).toInt( &ok, 10 ); 138 tmp.left(1).toInt( &ok, 10 );
135 if(ok) { 139 if(ok) {
136 QStringList token = QStringList::split(' ', tmp ); 140 QStringList token = QStringList::split(' ', tmp );
137 ip_addr = token[0]; 141 ip_addr = token[0];
138 host = token[1]; 142 host = token[1];
139 CBHost->insertItem( host, -1); 143 CBHost->insertItem( host, -1);
140 lms << ip_addr+" "+host+"\n"; 144 lms << ip_addr+" "+host+"\n";
141 } 145 }
142 } 146 }
143 lmhosts.close(); 147 lmhosts.close();
144 148
145 TextViewOutput->append("\n\n============================================\n"); 149 TextViewOutput->append("\n\n============================================\n");
146 LScan->setText(""); 150 LScan->setText("");
147 scanning = false; 151 scanning = false;
148} 152}
149 153
150void Qsmb::hostSelected(int index) 154void Qsmb::hostSelected(int /*index*/ )
151{ 155{
152 owarn << "hostSelected" << oendl;
153 QListViewItem *element; 156 QListViewItem *element;
154 QListViewItem *parent; 157// QListViewItem *parent;
155 158
156 QString text = CBHost->currentText(); 159 QString text = CBHost->currentText();
160 ListViewScan->clear();
157 161
158 if (scanning) return; 162 if (scanning) return;
159 scanning = true; 163 scanning = true;
160 164
161 QString cmd; 165 QString cmd;
162 QStringList ccmd; 166 QStringList ccmd;
163 167
164 LScan->setText("Scanning..."); 168 LScan->setText("Scanning...");
165 169
166 ccmd << "/usr/bin/smbclient"; 170 ccmd << "/usr/bin/smbclient";
167 ccmd << "-L"; 171 ccmd << "-L";
168 ccmd << CBHost->currentText(); 172 ccmd << CBHost->currentText();
169 ccmd << "-N"; 173 ccmd << "-N";
170 174
171 if(username->text().isEmpty()) { 175 if(username->text().isEmpty()) {
172 //do nothing 176 //do nothing
173 } else { 177 } else {
174 ccmd << "-U"; 178 ccmd << "-U";
175 ccmd << username->text()+"\%"+ password->text(); 179 ccmd << username->text()+"\%"+ password->text();
176 } 180 }
177 runCommand(ccmd); 181 runCommand(ccmd);
178 QTextStream s(&out, IO_ReadOnly); 182 QTextStream s(&out, IO_ReadOnly);
179 183
180 while ( !s.atEnd() ) { 184 while ( !s.atEnd() ) {
181 QString share; 185 QString share;
182 QString comment; 186 QString comment;
183 QString tmp = s.readLine(); 187 QString tmp = s.readLine();
184 188
185 if( tmp.find("$") == -1 && tmp.find("Disk") != -1) { 189 if( tmp.find("$") == -1 && tmp.find("Disk") != -1) {
186 QStringList token = QStringList::split(' ', tmp ); 190 QStringList token = QStringList::split(' ', tmp );
187 share = token[0]; 191 share = token[0];
188 comment = token[2]; 192 comment = token[2];
189 element = new QListViewItem(ListViewScan,share, comment); 193 share = share.stripWhiteSpace();
194 comment = comment.stripWhiteSpace();
195 element = new QListViewItem(ListViewScan, share, comment);
190 element->setOpen(true); 196 element->setOpen(true);
191// top_element = element; 197// top_element = element;
192// parent = element; 198// parent = element;
193 } 199 }
194 200
195 } 201 }
196// owarn << "i="<< index << "cmd:" << cmd << oendl; 202// owarn << "i="<< index << "cmd:" << cmd << oendl;
197 203
198 TextViewOutput->append(cmd); 204 TextViewOutput->append(cmd);
199 205
200 /* run smbclient & read output */ 206 /* run smbclient & read output */
201// if ((pipe = popen(cmd.latin1(), "r")) == NULL) { 207// if ((pipe = popen(cmd.latin1(), "r")) == NULL) {
202// snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); 208// snprintf(result, 256, "Error: Can't run %s", cmd.latin1());
203// // cmd = "Error: Can't run "+cmd; 209// // cmd = "Error: Can't run "+cmd;
204// TextViewOutput->append(result); 210// TextViewOutput->append(result);
205// return; 211// return;
206// } 212// }
207 213
208 /* parse output and display in ListViewScan */ 214 /* parse output and display in ListViewScan */
209// while(fgets(result, 256, pipe) != NULL) { 215// while(fgets(result, 256, pipe) != NULL) {
210// /* put result into TextViewOutput */ 216// /* put result into TextViewOutput */
211// TextViewOutput->append(result); 217// TextViewOutput->append(result);
212 218
213// if( strchr(result, '$') == NULL ) { 219// if( strchr(result, '$') == NULL ) {
214// char share[256], *ptr1; 220// char share[256], *ptr1;
215 221
216// strcpy(share,result); 222// strcpy(share,result);
217// ptr1 = strchr(share,' '); 223// ptr1 = strchr(share,' ');
218// share[ptr1 - share]='\0'; 224// share[ptr1 - share]='\0';
219 225
220// owarn<< "add share: " << share << oendl; 226// owarn<< "add share: " << share << oendl;
221 227
222// if(top_element != NULL) { 228// if(top_element != NULL) {
223// bool found = false; 229// bool found = false;
224// element = top_element; 230// element = top_element;
225 231
226// while(element != NULL && !found) { 232// while(element != NULL && !found) {
227// if(strcmp( element->text(0).ascii(), share)==0) { 233// if(strcmp( element->text(0).ascii(), share)==0) {
228// parent = element; 234// parent = element;
229// found = true; 235// found = true;
230// } 236// }
231// element = element->nextSibling(); 237// element = element->nextSibling();
232// } 238// }
233 239
234// if(!found) { 240// if(!found) {
235// element = new QListViewItem(ListViewScan,share); 241// element = new QListViewItem(ListViewScan,share);
236// element->setOpen(true); 242// element->setOpen(true);
237// parent=element; 243// parent=element;
238// } 244// }
239// } else { 245// } else {
240// element = new QListViewItem(ListViewScan,share); 246// element = new QListViewItem(ListViewScan,share);
241// element->setOpen(true); 247// element->setOpen(true);
242// top_element = element; 248// top_element = element;
243// parent = element; 249// parent = element;
244// } 250// }
245// } 251// }
246// } 252// }
247 253
248 TextViewOutput->append("\n\n============================================\n"); 254 TextViewOutput->append("\n\n============================================\n");
249 LScan->setText(""); 255 LScan->setText("");
250 scanning = false; 256 scanning = false;
251} 257}
252 258
259
253void Qsmb::DoIt() 260void Qsmb::DoIt()
254{ 261{
262
255 QListViewItem *element; 263 QListViewItem *element;
256 element = ListViewScan->selectedItem(); 264 element = ListViewScan->selectedItem();
257 if(!element) { 265 if(!element) {
258 QMessageBox::warning(this, tr("Error!!"),tr("<p><b>No</b> share selected!!</p>"));
259 return; 266 return;
260 } 267 }
261 268
262 if (scanning) return; 269 if (scanning) return;
263 scanning = true; 270 scanning = true;
264 271
265 int i; 272 QString mount = mountpt->currentText();
266 bool err = false; 273 if(isMounted(mount)) {
274 qWarning(mount +" is already mounted");
275 TextViewOutput->append(mount +" is already mounted");
276 return;
277 }
278
279 bool noerr = false;
267 280
268 char share[512]; 281 QString share;
269 QString cmd; 282 QString cmd;
270 QString cmd2; 283 QString cmd2;
271 char result[256];
272// QString result;
273 QString text = mountpt->currentText(); 284 QString text = mountpt->currentText();
274 285 QStringList ccmd;
275 FILE *pipe,*pipe2;
276 286
277 LScan->setText("Mounting..."); 287 LScan->setText("Mounting...");
278 qApp->processEvents(); 288 qApp->processEvents();
279 289
280 290 if( !QFileInfo(text).exists()) {
281 if(! QFileInfo(text).exists()) {
282 QStringList ccmd;
283 ccmd << "mkdir"; 291 ccmd << "mkdir";
284 ccmd << "-p"; 292 ccmd << "-p";
285 ccmd << text; 293 ccmd << text;
286 294
287 owarn<<"cmd: "<< ccmd << oendl; 295 qWarning( "cmd: "+ ccmd.join(" "));
288 runCommand(ccmd); 296 runCommand(ccmd);
289 } 297 }
290 298
299 share = element->text(0);
300 qWarning("selected share is "+share);
291 301
292 strcpy(share,(const char *)element->text(0)); 302 QString service = CBHost->currentText();
293 303 service = service.stripWhiteSpace();
294 for(i = 0; i < 256; i++) { 304 if(mount.left(1) != "/")
295 if(isalpha( share[i])) { 305 mount = QDir::currentDirPath()+"/"+mount;
296 strcpy( share, share + i); 306 mount = mount.stripWhiteSpace();
297 break; 307 ccmd.clear();
298 } 308
299 } 309 ccmd << "/usr/bin/smbmount";
300 310 ccmd << "//"+ service+"/"+share;
301 cmd = "/usr/bin/smbmount //"+CBHost->currentText()+"/"+share+" "+mountpt->currentText()+" -o username="+username->text()+",password="+password->text(); 311 ccmd << mount;
302 312 ccmd << "-o";
303 owarn << "cmd: " << cmd << oendl; 313 ccmd << "username="+username->text()+",password="+password->text()+"";
304 TextViewOutput->append(cmd.latin1());
305 314
315 TextViewOutput->append(ccmd.join(" ").latin1());
306 316
307 if(onbootBtn->isChecked()) { 317 if(onbootBtn->isChecked()) {
308 owarn << "Saving Setting permanently..." << oendl; 318 qWarning("Saving Setting permanently...");
309 cmd2 = "echo '" + cmd + "'>/opt/QtPalmtop/etc/samba.env"; 319 QFile sambenv("/opt/QtPalmtop/etc/samba.env");
310 /* run command & read output */ 320 QTextStream smbv(&sambenv);
311 if ((pipe = popen(cmd2.latin1(), "r")) == NULL) { 321 sambenv.open(IO_WriteOnly);
312 snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); 322 smbv << ccmd.join(" ") ;
313 return; 323 sambenv.close();
314 }
315 /* parse output and display in ListViewScan */
316 while(fgets(result, 256, pipe) != NULL) {
317 }
318 }
319
320
321 /* run command & read output */
322 if ((pipe = popen(cmd.latin1(), "r")) == NULL) {
323 snprintf(result, 256, "Error: Can't run %s", cmd.latin1());
324 TextViewOutput->append(result);
325 return;
326 }
327
328 /* parse output and display in ListViewScan */
329 while(fgets(result, 256, pipe) != NULL) {
330 /* put result into TextViewOutput */
331 TextViewOutput->append(result);
332 } 324 }
333 325
326 noerr = runCommand(ccmd);
334 327
335 TextViewOutput->append("\n\n================CheckMounts==================\n");
336 LScan->setText(""); 328 LScan->setText("");
337 329
338 cmd = "/bin/mount 2>&1"; 330 if(noerr) {
339 owarn << "cmd: " << cmd << oendl; 331 element->setText(2, mount);
340 332 TextViewOutput->append("\n\n================CheckMounts==================\n");
341 if ((pipe2 = popen(cmd.latin1(), "r")) == NULL) { 333 ccmd = "/bin/mount";
334 runCommand(ccmd);
335 TextViewOutput->append("\n\n============================================\n");
336 qApp->processEvents();
337 } else {
338 //do nothing
339 }
342 340
343 snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); 341 scanning = false;
344// result = "Error: Can't run "+ cmd; 342}
345 343
346 TextViewOutput->append(result); 344void Qsmb::umountIt()
345{
346 QString mount = mountpt->currentText();
347 if(!isMounted(mount)) {
348 qWarning(mount +" is not mounted");
349 TextViewOutput->append(mount +" is not mounted");
347 return; 350 return;
348 } 351 }
349 /* parse output and display in ListViewScan */
350 while(fgets(result, 256, pipe2) != NULL) {
351 /* put result into TextViewOutput */
352 TextViewOutput->append(result);
353 }
354 352
355 TextViewOutput->append("\n\n============================================\n"); 353 QStringList ccmd;
356 scanning = false; 354 QString share;
355 QListViewItem *element;
356 element = ListViewScan->selectedItem();
357 share = element->text(0);
358 qWarning("selected share is "+share);
359
360 if(mount.left(1) != "/")
361 mount = QDir::currentDirPath()+"/"+mount;
362 mount = mount.stripWhiteSpace();
363
364 ccmd << "/usr/bin/smbumount";
365 ccmd << mount;
366 runCommand(ccmd);
367
368 element->setText(2, "");
369
370 ccmd = "/bin/mount";
371 runCommand(ccmd);
357} 372}
358 373
359bool Qsmb::runCommand(const QStringList & command) { 374bool Qsmb::runCommand(const QStringList & command) {
360 owarn << "runCommand " << command.join(" ") << oendl; 375 qWarning( "runCommand " + command.join(" ") );
376 TextViewOutput->append(command.join(" "));
361 out = ""; 377 out = "";
362 Process ipkg_status( command); 378 Process ipkg_status( command);
363 bool r = ipkg_status.exec("",out); 379 bool r = ipkg_status.exec("",out);
364 380
365 if(!r) { 381 qWarning("result is %d"+ r );
366 QMessageBox::warning(this, tr("Error!!"),tr("<p>"+out+"</p>")); 382 qWarning("Output " + out );
367 } 383 TextViewOutput->append(out);
368 384
369 owarn << "Output " << out << oendl; 385//very hacky
370 TextViewOutput->append(out.latin1()); 386 if(out.find("failed") !=-1) {
387 r = false;
388 }
371 return r; 389 return r;
372} 390}
373 391
374 392
393bool Qsmb::isMounted(const QString &mountPoint) {
394 struct mntent *me;
395 bool mounted = false;
396 FILE *mntfp = setmntent( "/etc/mtab", "r" );
397 if ( mntfp ){
398 while ( (me = getmntent( mntfp )) != 0 ) {
399 QString deviceName = me->mnt_fsname;
400 QString mountDir = me->mnt_dir;
401 QString fsType = me->mnt_type;
402 if( fsType == "smbfs" && mountDir.find(mountPoint) !=-1)
403 mounted = true;
404 }
405 }
406 endmntent( mntfp );
407 return mounted;
408}
diff --git a/noncore/net/opie-smb/qsmb.h b/noncore/net/opie-smb/qsmb.h
index b406a1e..fba94d0 100644
--- a/noncore/net/opie-smb/qsmb.h
+++ b/noncore/net/opie-smb/qsmb.h
@@ -1,42 +1,44 @@
1#ifndef QSMB_H 1#ifndef QSMB_H
2#define QSMB_H 2#define QSMB_H
3 3
4#include "qsmbbase.h" 4#include "qsmbbase.h"
5 5
6#include <stdlib.h> 6#include <stdlib.h>
7#include <stdlib.h> 7#include <stdlib.h>
8#include <stdio.h> 8#include <stdio.h>
9 9
10#include <qlistview.h> 10#include <qlistview.h>
11#include <pthread.h> 11#include <pthread.h>
12 12
13class Qsmb : public FormQPESMBBase 13class Qsmb : public FormQPESMBBase
14{ 14{
15 Q_OBJECT 15 Q_OBJECT
16 16
17public: 17public:
18 static QString appName() { return QString::fromLatin1("opie-smb"); } 18 static QString appName() { return QString::fromLatin1("opie-smb"); }
19 Qsmb( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 19 Qsmb( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
20 ~Qsmb(); 20 ~Qsmb();
21 void scan(); 21 void scan();
22 void DoIt(); 22 void DoIt();
23 23
24private: 24private:
25 QListViewItem *top_element; 25 QListViewItem *top_element;
26 QComboBox *hosts; 26 QComboBox *hosts;
27 pthread_t tpid; 27 pthread_t tpid;
28 bool scanning; 28 bool scanning;
29 bool isMounted(const QString &);
29 30
30public slots: 31public slots:
31 void clear(); 32 void clear();
32 void scanClicked(); 33 void scanClicked();
33 void hostSelected(int); 34 void hostSelected(int);
34 void DoItClicked(); 35 void DoItClicked();
36 void umountIt();
35 QString out; 37 QString out;
36 bool runCommand(const QStringList &); 38 bool runCommand(const QStringList &);
37 39
38}; 40};
39void* runit(void *arg); 41void* runit(void *arg);
40void* runitm(void *arg); 42void* runitm(void *arg);
41 43
42#endif // QSMB_H 44#endif // QSMB_H
diff --git a/noncore/net/opie-smb/qsmbbase.ui b/noncore/net/opie-smb/qsmbbase.ui
index 297eb2a..4692282 100644
--- a/noncore/net/opie-smb/qsmbbase.ui
+++ b/noncore/net/opie-smb/qsmbbase.ui
@@ -1,316 +1,341 @@
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>250</width> 14 <width>259</width>
15 <height>352</height> 15 <height>395</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>2</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> 125 <column>
126 <property> 126 <property>
127 <name>text</name> 127 <name>text</name>
128 <string>Comment</string> 128 <string>Comment</string>
129 </property> 129 </property>
130 <property> 130 <property>
131 <name>clickable</name> 131 <name>clickable</name>
132 <bool>true</bool> 132 <bool>true</bool>
133 </property> 133 </property>
134 <property> 134 <property>
135 <name>resizeable</name> 135 <name>resizeable</name>
136 <bool>true</bool> 136 <bool>true</bool>
137 </property> 137 </property>
138 </column> 138 </column>
139 <column>
140 <property>
141 <name>text</name>
142 <string>Mount</string>
143 </property>
144 <property>
145 <name>clickable</name>
146 <bool>true</bool>
147 </property>
148 <property>
149 <name>resizeable</name>
150 <bool>true</bool>
151 </property>
152 </column>
139 <property stdset="1"> 153 <property stdset="1">
140 <name>name</name> 154 <name>name</name>
141 <cstring>ListViewScan</cstring> 155 <cstring>ListViewScan</cstring>
142 </property> 156 </property>
143 <property stdset="1"> 157 <property stdset="1">
144 <name>allColumnsShowFocus</name> 158 <name>allColumnsShowFocus</name>
145 <bool>true</bool> 159 <bool>true</bool>
146 </property> 160 </property>
147 </widget> 161 </widget>
148 <widget row="0" column="0" rowspan="1" colspan="2" > 162 <widget row="0" column="0" rowspan="1" colspan="2" >
149 <class>QPushButton</class> 163 <class>QPushButton</class>
150 <property stdset="1"> 164 <property stdset="1">
151 <name>name</name> 165 <name>name</name>
152 <cstring>BtnScan</cstring> 166 <cstring>BtnScan</cstring>
153 </property> 167 </property>
154 <property stdset="1"> 168 <property stdset="1">
155 <name>text</name> 169 <name>text</name>
156 <string>&amp;Scan</string> 170 <string>&amp;Scan</string>
157 </property> 171 </property>
158 </widget> 172 </widget>
159 <widget row="0" column="2" > 173 <widget row="0" column="2" >
160 <class>QPushButton</class> 174 <class>QPushButton</class>
161 <property stdset="1"> 175 <property stdset="1">
162 <name>name</name> 176 <name>name</name>
163 <cstring>BtnClear</cstring> 177 <cstring>BtnClear</cstring>
164 </property> 178 </property>
165 <property stdset="1"> 179 <property stdset="1">
166 <name>text</name> 180 <name>text</name>
167 <string>&amp;Clear</string> 181 <string>&amp;Clear</string>
168 </property> 182 </property>
169 </widget> 183 </widget>
170 <widget row="3" column="0" rowspan="1" colspan="3" > 184 <widget row="3" column="0" rowspan="1" colspan="3" >
171 <class>QCheckBox</class> 185 <class>QCheckBox</class>
172 <property stdset="1"> 186 <property stdset="1">
173 <name>name</name> 187 <name>name</name>
174 <cstring>onbootBtn</cstring> 188 <cstring>onbootBtn</cstring>
175 </property> 189 </property>
176 <property stdset="1"> 190 <property stdset="1">
177 <name>text</name> 191 <name>text</name>
178 <string>Reconnect on boot</string> 192 <string>Reconnect on boot</string>
179 </property> 193 </property>
180 </widget> 194 </widget>
181 <widget row="5" column="0" rowspan="1" colspan="2" > 195 <widget row="5" column="2" rowspan="2" colspan="2" >
182 <class>QPushButton</class>
183 <property stdset="1">
184 <name>name</name>
185 <cstring>DoItBtn</cstring>
186 </property>
187 <property stdset="1">
188 <name>text</name>
189 <string>&amp;Mount</string>
190 </property>
191 </widget>
192 <widget row="5" column="2" rowspan="1" colspan="2" >
193 <class>QLayoutWidget</class> 196 <class>QLayoutWidget</class>
194 <property stdset="1"> 197 <property stdset="1">
195 <name>name</name> 198 <name>name</name>
196 <cstring>Layout6</cstring> 199 <cstring>Layout6</cstring>
197 </property> 200 </property>
198 <grid> 201 <grid>
199 <property stdset="1"> 202 <property stdset="1">
200 <name>margin</name> 203 <name>margin</name>
201 <number>0</number> 204 <number>0</number>
202 </property> 205 </property>
203 <property stdset="1"> 206 <property stdset="1">
204 <name>spacing</name> 207 <name>spacing</name>
205 <number>6</number> 208 <number>6</number>
206 </property> 209 </property>
207 <widget row="1" column="0" > 210 <widget row="1" column="0" >
208 <class>QLayoutWidget</class> 211 <class>QLayoutWidget</class>
209 <property stdset="1"> 212 <property stdset="1">
210 <name>name</name> 213 <name>name</name>
211 <cstring>Layout2</cstring> 214 <cstring>Layout2</cstring>
212 </property> 215 </property>
213 <hbox> 216 <hbox>
214 <property stdset="1"> 217 <property stdset="1">
215 <name>margin</name> 218 <name>margin</name>
216 <number>0</number> 219 <number>0</number>
217 </property> 220 </property>
218 <property stdset="1"> 221 <property stdset="1">
219 <name>spacing</name> 222 <name>spacing</name>
220 <number>6</number> 223 <number>6</number>
221 </property> 224 </property>
222 <widget> 225 <widget>
223 <class>QLabel</class> 226 <class>QLabel</class>
224 <property stdset="1"> 227 <property stdset="1">
225 <name>name</name> 228 <name>name</name>
226 <cstring>pwdlabel</cstring> 229 <cstring>pwdlabel</cstring>
227 </property> 230 </property>
228 <property stdset="1"> 231 <property stdset="1">
229 <name>text</name> 232 <name>text</name>
230 <string>password</string> 233 <string>password</string>
231 </property> 234 </property>
232 </widget> 235 </widget>
233 <widget> 236 <widget>
234 <class>QLineEdit</class> 237 <class>QLineEdit</class>
235 <property stdset="1"> 238 <property stdset="1">
236 <name>name</name> 239 <name>name</name>
237 <cstring>password</cstring> 240 <cstring>password</cstring>
238 </property> 241 </property>
239 </widget> 242 </widget>
240 </hbox> 243 </hbox>
241 </widget> 244 </widget>
242 <widget row="0" column="0" > 245 <widget row="0" column="0" >
243 <class>QLayoutWidget</class> 246 <class>QLayoutWidget</class>
244 <property stdset="1"> 247 <property stdset="1">
245 <name>name</name> 248 <name>name</name>
246 <cstring>Layout5</cstring> 249 <cstring>Layout5</cstring>
247 </property> 250 </property>
248 <hbox> 251 <hbox>
249 <property stdset="1"> 252 <property stdset="1">
250 <name>margin</name> 253 <name>margin</name>
251 <number>0</number> 254 <number>0</number>
252 </property> 255 </property>
253 <property stdset="1"> 256 <property stdset="1">
254 <name>spacing</name> 257 <name>spacing</name>
255 <number>6</number> 258 <number>6</number>
256 </property> 259 </property>
257 <widget> 260 <widget>
258 <class>QLabel</class> 261 <class>QLabel</class>
259 <property stdset="1"> 262 <property stdset="1">
260 <name>name</name> 263 <name>name</name>
261 <cstring>usrlabel</cstring> 264 <cstring>usrlabel</cstring>
262 </property> 265 </property>
263 <property stdset="1"> 266 <property stdset="1">
264 <name>text</name> 267 <name>text</name>
265 <string>username</string> 268 <string>username</string>
266 </property> 269 </property>
267 </widget> 270 </widget>
268 <widget> 271 <widget>
269 <class>QLineEdit</class> 272 <class>QLineEdit</class>
270 <property stdset="1"> 273 <property stdset="1">
271 <name>name</name> 274 <name>name</name>
272 <cstring>username</cstring> 275 <cstring>username</cstring>
273 </property> 276 </property>
274 </widget> 277 </widget>
275 </hbox> 278 </hbox>
276 </widget> 279 </widget>
277 </grid> 280 </grid>
278 </widget> 281 </widget>
282 <widget row="6" column="0" rowspan="1" colspan="2" >
283 <class>QPushButton</class>
284 <property stdset="1">
285 <name>name</name>
286 <cstring>UnmountBtn</cstring>
287 </property>
288 <property stdset="1">
289 <name>text</name>
290 <string>&amp;Umount</string>
291 </property>
292 </widget>
293 <widget row="5" column="0" rowspan="1" colspan="2" >
294 <class>QPushButton</class>
295 <property stdset="1">
296 <name>name</name>
297 <cstring>DoItBtn</cstring>
298 </property>
299 <property stdset="1">
300 <name>text</name>
301 <string>&amp;Mount</string>
302 </property>
303 </widget>
279 </grid> 304 </grid>
280 </widget> 305 </widget>
281 <widget> 306 <widget>
282 <class>QWidget</class> 307 <class>QWidget</class>
283 <property stdset="1"> 308 <property stdset="1">
284 <name>name</name> 309 <name>name</name>
285 <cstring>tab</cstring> 310 <cstring>tab</cstring>
286 </property> 311 </property>
287 <attribute> 312 <attribute>
288 <name>title</name> 313 <name>title</name>
289 <string>SMB Output</string> 314 <string>SMB Output</string>
290 </attribute> 315 </attribute>
291 <grid> 316 <grid>
292 <property stdset="1"> 317 <property stdset="1">
293 <name>margin</name> 318 <name>margin</name>
294 <number>11</number> 319 <number>2</number>
295 </property> 320 </property>
296 <property stdset="1"> 321 <property stdset="1">
297 <name>spacing</name> 322 <name>spacing</name>
298 <number>6</number> 323 <number>2</number>
299 </property> 324 </property>
300 <widget row="0" column="0" > 325 <widget row="0" column="0" >
301 <class>QTextView</class> 326 <class>QTextView</class>
302 <property stdset="1"> 327 <property stdset="1">
303 <name>name</name> 328 <name>name</name>
304 <cstring>TextViewOutput</cstring> 329 <cstring>TextViewOutput</cstring>
305 </property> 330 </property>
306 <property stdset="1"> 331 <property stdset="1">
307 <name>textFormat</name> 332 <name>textFormat</name>
308 <enum>PlainText</enum> 333 <enum>PlainText</enum>
309 </property> 334 </property>
310 </widget> 335 </widget>
311 </grid> 336 </grid>
312 </widget> 337 </widget>
313 </widget> 338 </widget>
314 </grid> 339 </grid>
315</widget> 340</widget>
316</UI> 341</UI>