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