-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp index 7f3ae89..d35e09a 100644 --- a/noncore/net/opie-smb/qsmb.cpp +++ b/noncore/net/opie-smb/qsmb.cpp | |||
@@ -41,12 +41,13 @@ Qsmb::Qsmb( QWidget* parent, const char* name, WFlags 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 | connect(ListViewScan, SIGNAL(clicked(QListViewItem*)), this, SLOT(TextViewClicked(QListViewItem*))); | ||
47 | 48 | ||
48 | mountpt->setEditable(true); | 49 | mountpt->setEditable(true); |
49 | mountpt->insertItem("/mnt/samba1",-1); | 50 | mountpt->insertItem("/mnt/samba1",-1); |
50 | mountpt->insertItem("/mnt/samba2",-1); | 51 | mountpt->insertItem("/mnt/samba2",-1); |
51 | mountpt->insertItem("/mnt/samba3",-1); | 52 | mountpt->insertItem("/mnt/samba3",-1); |
52 | 53 | ||
@@ -350,23 +351,27 @@ void Qsmb::DoIt() | |||
350 | 351 | ||
351 | scanning = false; | 352 | scanning = false; |
352 | } | 353 | } |
353 | 354 | ||
354 | void Qsmb::umountIt() | 355 | void Qsmb::umountIt() |
355 | { | 356 | { |
357 | QListViewItem *element; | ||
358 | element = ListViewScan->selectedItem(); | ||
359 | if(!element) { | ||
360 | return; | ||
361 | } | ||
362 | |||
356 | QString mount = mountpt->currentText(); | 363 | QString mount = mountpt->currentText(); |
357 | if(!isMounted(mount)) { | 364 | if(!isMounted(mount)) { |
358 | qWarning(mount +" is not mounted"); | 365 | qWarning(mount +" is not mounted"); |
359 | TextViewOutput->append(mount +" is not mounted"); | 366 | TextViewOutput->append(mount +" is not mounted"); |
360 | return; | 367 | return; |
361 | } | 368 | } |
362 | 369 | ||
363 | QStringList ccmd; | 370 | QStringList ccmd; |
364 | QString share; | 371 | QString share; |
365 | QListViewItem *element; | ||
366 | element = ListViewScan->selectedItem(); | ||
367 | share = element->text(0); | 372 | share = element->text(0); |
368 | qWarning("selected share is "+share); | 373 | qWarning("selected share is "+share); |
369 | 374 | ||
370 | if(mount.left(1) != "/") | 375 | if(mount.left(1) != "/") |
371 | mount = QDir::currentDirPath()+"/"+mount; | 376 | mount = QDir::currentDirPath()+"/"+mount; |
372 | mount = mount.stripWhiteSpace(); | 377 | mount = mount.stripWhiteSpace(); |
@@ -432,6 +437,16 @@ QString Qsmb::getMount(const QString &shareName) | |||
432 | mount = mountDir; | 437 | mount = mountDir; |
433 | } | 438 | } |
434 | } | 439 | } |
435 | endmntent( mntfp ); | 440 | endmntent( mntfp ); |
436 | return mount; | 441 | return mount; |
437 | } | 442 | } |
443 | |||
444 | void Qsmb::TextViewClicked(QListViewItem* item) | ||
445 | { | ||
446 | if(item == NULL) return; | ||
447 | |||
448 | QString text = item->text(2); | ||
449 | qWarning(text); | ||
450 | if( !text.isEmpty()) | ||
451 | mountpt->insertItem(text,0); | ||
452 | } | ||