summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2005-08-16 10:22:06 (UTC)
committer llornkcor <llornkcor>2005-08-16 10:22:06 (UTC)
commite68f54c2f00d8e7a8e753722a50b47484c1124ee (patch) (unidiff)
treefc2076fbc51424f59d10ad1e88e3bdbb2ed78411
parentdd4792fe0ac89205e7d7a7e38f3d4350e19f25d7 (diff)
downloadopie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.zip
opie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.tar.gz
opie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.tar.bz2
proper opie header and maintainter
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opie-smb/opie-smb.control2
-rw-r--r--noncore/net/opie-smb/qsmb.cpp28
-rw-r--r--noncore/net/opie-smb/qsmb.h28
3 files changed, 57 insertions, 1 deletions
diff --git a/noncore/net/opie-smb/opie-smb.control b/noncore/net/opie-smb/opie-smb.control
index fc8c316..2ec46be 100644
--- a/noncore/net/opie-smb/opie-smb.control
+++ b/noncore/net/opie-smb/opie-smb.control
@@ -1,11 +1,11 @@
1Package: opie-smb 1Package: opie-smb
2Files: plugins/application/libopie-smb.so* bin/opie-smb bin/smbfind pics/opie-smb apps/Applications/opie-smb.desktop 2Files: plugins/application/libopie-smb.so* bin/opie-smb bin/smbfind pics/opie-smb apps/Applications/opie-smb.desktop
3Version: $QPE_VERSION$EXTRAVERSION 3Version: $QPE_VERSION$EXTRAVERSION
4Architecture: arm 4Architecture: arm
5Arch: arm 5Arch: arm
6Maintainer: Kurt Korbatits (support@midget.net.au) 6Maintainer: ljp <lpotter@trolltech.com>
7Section: Network 7Section: Network
8Priority: optional 8Priority: optional
9Description: Gui front end for samba utilities. 9Description: Gui front end for samba utilities.
10Source: 10Source:
11Depends: smbclient 11Depends: smbclient
diff --git a/noncore/net/opie-smb/qsmb.cpp b/noncore/net/opie-smb/qsmb.cpp
index d35e09a..d74f240 100644
--- a/noncore/net/opie-smb/qsmb.cpp
+++ b/noncore/net/opie-smb/qsmb.cpp
@@ -1,384 +1,412 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002-2005 Kurt Korbatits <support@midget.net.au>
4           .>+-= Copyright (c) 2005 L. Potter <lpotter@trolltech.com>
5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.BIN.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
1#include "qsmb.h" 29#include "qsmb.h"
2#include <qpushbutton.h> 30#include <qpushbutton.h>
3#include <qpe/qpeapplication.h> 31#include <qpe/qpeapplication.h>
4 32
5#include <string.h> 33#include <string.h>
6#include <qstring.h> 34#include <qstring.h>
7#include <qstringlist.h> 35#include <qstringlist.h>
8#include <qdir.h> 36#include <qdir.h>
9#include <qfileinfo.h> 37#include <qfileinfo.h>
10#include <qtabwidget.h> 38#include <qtabwidget.h>
11 39
12#include <qpe/process.h> 40#include <qpe/process.h>
13#include <qlabel.h> 41#include <qlabel.h>
14#include <qlineedit.h> 42#include <qlineedit.h>
15#include <qcombobox.h> 43#include <qcombobox.h>
16#include <qstringlist.h> 44#include <qstringlist.h>
17#include <qcheckbox.h> 45#include <qcheckbox.h>
18#include <qtextview.h> 46#include <qtextview.h>
19#include <qmessagebox.h> 47#include <qmessagebox.h>
20#include <qtextstream.h> 48#include <qtextstream.h>
21 49
22 50
23#include <pthread.h> 51#include <pthread.h>
24#include <signal.h> 52#include <signal.h>
25#include <ctype.h> 53#include <ctype.h>
26 54
27 55
28#include <netinet/in.h> 56#include <netinet/in.h>
29#include <arpa/inet.h> 57#include <arpa/inet.h>
30#include <rpc/clnt.h> 58#include <rpc/clnt.h>
31 59
32#include <sys/vfs.h> 60#include <sys/vfs.h>
33#include <mntent.h> 61#include <mntent.h>
34 62
35// #include <opie2/odebug.h> 63// #include <opie2/odebug.h>
36// using namespace Opie::Core; 64// using namespace Opie::Core;
37 65
38 66
39Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) 67Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl )
40 : FormQPESMBBase( parent, name, fl ) 68 : FormQPESMBBase( parent, name, fl )
41{ 69{
42 connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int))); 70 connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int)));
43 connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked())); 71 connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked()));
44 connect(UnmountBtn, SIGNAL(clicked()), this, SLOT(umountIt())); 72 connect(UnmountBtn, SIGNAL(clicked()), this, SLOT(umountIt()));
45 connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked())); 73 connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked()));
46 connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear())); 74 connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear()));
47 connect(ListViewScan, SIGNAL(clicked(QListViewItem*)), this, SLOT(TextViewClicked(QListViewItem*))); 75 connect(ListViewScan, SIGNAL(clicked(QListViewItem*)), this, SLOT(TextViewClicked(QListViewItem*)));
48 76
49 mountpt->setEditable(true); 77 mountpt->setEditable(true);
50 mountpt->insertItem("/mnt/samba1",-1); 78 mountpt->insertItem("/mnt/samba1",-1);
51 mountpt->insertItem("/mnt/samba2",-1); 79 mountpt->insertItem("/mnt/samba2",-1);
52 mountpt->insertItem("/mnt/samba3",-1); 80 mountpt->insertItem("/mnt/samba3",-1);
53 81
54 setTabOrder(BtnScan, username); 82 setTabOrder(BtnScan, username);
55 setTabOrder(username, password); 83 setTabOrder(username, password);
56 setTabOrder(password, CBHost); 84 setTabOrder(password, CBHost);
57 setTabOrder(CBHost, TextViewOutput); 85 setTabOrder(CBHost, TextViewOutput);
58 setTabOrder(TextViewOutput, mountpt); 86 setTabOrder(TextViewOutput, mountpt);
59 setTabOrder(mountpt, DoItBtn); 87 setTabOrder(mountpt, DoItBtn);
60 setTabOrder(DoItBtn, UnmountBtn); 88 setTabOrder(DoItBtn, UnmountBtn);
61 89
62 top_element = NULL; 90 top_element = NULL;
63 scanning = false; 91 scanning = false;
64} 92}
65 93
66Qsmb::~Qsmb() 94Qsmb::~Qsmb()
67{ 95{
68} 96}
69 97
70void Qsmb::clear() 98void Qsmb::clear()
71{ 99{
72 if (scanning) return; 100 if (scanning) return;
73 ListViewScan->clear(); 101 ListViewScan->clear();
74 TextViewOutput->setText(""); 102 TextViewOutput->setText("");
75 CBHost->clear(); 103 CBHost->clear();
76 top_element = NULL; 104 top_element = NULL;
77} 105}
78 106
79void Qsmb::scanClicked() 107void Qsmb::scanClicked()
80{ 108{
81 if (scanning) return; 109 if (scanning) return;
82 pthread_create(&tpid, NULL, runit, (void *)this); 110 pthread_create(&tpid, NULL, runit, (void *)this);
83} 111}
84 112
85void Qsmb::DoItClicked() 113void Qsmb::DoItClicked()
86{ 114{
87 115
88 if( !ListViewScan->selectedItem()) { 116 if( !ListViewScan->selectedItem()) {
89 QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>")); 117 QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>"));
90 return; 118 return;
91 } 119 }
92 if (scanning) return; 120 if (scanning) return;
93 pthread_create(&tpid, NULL, runitm, (void *)this); 121 pthread_create(&tpid, NULL, runitm, (void *)this);
94} 122}
95 123
96void* runit(void* arg) 124void* runit(void* arg)
97{ 125{
98 Qsmb* caller = (Qsmb*)arg; 126 Qsmb* caller = (Qsmb*)arg;
99 caller->scan(); 127 caller->scan();
100 return(0); 128 return(0);
101} 129}
102 130
103void* runitm(void* arg) 131void* runitm(void* arg)
104{ 132{
105 Qsmb* caller = (Qsmb*)arg; 133 Qsmb* caller = (Qsmb*)arg;
106 caller->DoIt(); 134 caller->DoIt();
107 return(0); 135 return(0);
108} 136}
109 137
110void Qsmb::scan() 138void Qsmb::scan()
111{ 139{
112 clear(); 140 clear();
113// if (scanning) return; 141// if (scanning) return;
114 scanning = true; 142 scanning = true;
115 143
116 QString match; 144 QString match;
117 QString cmd; 145 QString cmd;
118 LScan->setText("Scanning..."); 146 LScan->setText("Scanning...");
119 qApp->processEvents(); 147 qApp->processEvents();
120 148
121 sockaddr_in my_addr; 149 sockaddr_in my_addr;
122 get_myaddress( &my_addr); 150 get_myaddress( &my_addr);
123 151
124 QString ip = inet_ntoa( my_addr.sin_addr); 152 QString ip = inet_ntoa( my_addr.sin_addr);
125 qWarning("IP Address : "+ip); 153 qWarning("IP Address : "+ip);
126 154
127 match = ip.left(5); 155 match = ip.left(5);
128 156
129 QStringList ccmd; 157 QStringList ccmd;
130 TextViewOutput->append("smbfind"); 158 TextViewOutput->append("smbfind");
131 159
132 QFile lmhosts("/etc/samba/lmhosts"); 160 QFile lmhosts("/etc/samba/lmhosts");
133 QTextStream lms(&lmhosts); 161 QTextStream lms(&lmhosts);
134 lmhosts.open(IO_WriteOnly); 162 lmhosts.open(IO_WriteOnly);
135 lms << "127.0.0.1 localhost\n"; 163 lms << "127.0.0.1 localhost\n";
136 164
137 /* parse output and display in ListViewScan */ 165 /* parse output and display in ListViewScan */
138 ccmd = "smbfind"; 166 ccmd = "smbfind";
139 runCommand(ccmd); 167 runCommand(ccmd);
140 168
141 QTextStream s(&out, IO_ReadOnly); 169 QTextStream s(&out, IO_ReadOnly);
142 170
143 while ( !s.atEnd() ) { 171 while ( !s.atEnd() ) {
144 QString ip_addr, host, output; 172 QString ip_addr, host, output;
145 QString tmp = s.readLine(); 173 QString tmp = s.readLine();
146 bool ok; 174 bool ok;
147 tmp.left(1).toInt( &ok, 10 ); 175 tmp.left(1).toInt( &ok, 10 );
148 if(ok) { 176 if(ok) {
149 QStringList token = QStringList::split(' ', tmp ); 177 QStringList token = QStringList::split(' ', tmp );
150 ip_addr = token[0]; 178 ip_addr = token[0];
151 host = token[1]; 179 host = token[1];
152 CBHost->insertItem( host, -1); 180 CBHost->insertItem( host, -1);
153 lms << ip_addr+" "+host+"\n"; 181 lms << ip_addr+" "+host+"\n";
154 } 182 }
155 } 183 }
156 lmhosts.close(); 184 lmhosts.close();
157 185
158 TextViewOutput->append("\n\n============================================\n"); 186 TextViewOutput->append("\n\n============================================\n");
159 LScan->setText(""); 187 LScan->setText("");
160 scanning = false; 188 scanning = false;
161} 189}
162 190
163void Qsmb::hostSelected(int /*index*/ ) 191void Qsmb::hostSelected(int /*index*/ )
164{ 192{
165 QListViewItem *element; 193 QListViewItem *element;
166// QListViewItem *parent; 194// QListViewItem *parent;
167 195
168 QString text = CBHost->currentText(); 196 QString text = CBHost->currentText();
169 ListViewScan->clear(); 197 ListViewScan->clear();
170 198
171 if (scanning) return; 199 if (scanning) return;
172 scanning = true; 200 scanning = true;
173 201
174 QString cmd; 202 QString cmd;
175 QStringList ccmd; 203 QStringList ccmd;
176 204
177 LScan->setText("Scanning..."); 205 LScan->setText("Scanning...");
178 206
179 ccmd << "/usr/bin/smbclient"; 207 ccmd << "/usr/bin/smbclient";
180 ccmd << "-L"; 208 ccmd << "-L";
181 ccmd << CBHost->currentText(); 209 ccmd << CBHost->currentText();
182 ccmd << "-N"; 210 ccmd << "-N";
183 211
184 if(username->text().isEmpty()) { 212 if(username->text().isEmpty()) {
185 //do nothing 213 //do nothing
186 } else { 214 } else {
187 ccmd << "-U"; 215 ccmd << "-U";
188 ccmd << username->text()+"\%"+ password->text(); 216 ccmd << username->text()+"\%"+ password->text();
189 } 217 }
190 runCommand(ccmd); 218 runCommand(ccmd);
191 QTextStream s(&out, IO_ReadOnly); 219 QTextStream s(&out, IO_ReadOnly);
192 220
193 while ( !s.atEnd() ) { 221 while ( !s.atEnd() ) {
194 QString share; 222 QString share;
195 QString comment; 223 QString comment;
196 QString mount; 224 QString mount;
197 QString tmp = s.readLine(); 225 QString tmp = s.readLine();
198 226
199 if( tmp.find("$") == -1 && tmp.find("Disk") != -1) { 227 if( tmp.find("$") == -1 && tmp.find("Disk") != -1) {
200 QStringList token = QStringList::split(' ', tmp ); 228 QStringList token = QStringList::split(' ', tmp );
201 share = token[0]; 229 share = token[0];
202 comment = token[2]; 230 comment = token[2];
203 share = share.stripWhiteSpace(); 231 share = share.stripWhiteSpace();
204 comment = comment.stripWhiteSpace(); 232 comment = comment.stripWhiteSpace();
205// if(isMounted(share)) 233// if(isMounted(share))
206 234
207 mount = getMount(share); 235 mount = getMount(share);
208 element = new QListViewItem(ListViewScan, share, comment, mount); 236 element = new QListViewItem(ListViewScan, share, comment, mount);
209 element->setOpen(true); 237 element->setOpen(true);
210// top_element = element; 238// top_element = element;
211// parent = element; 239// parent = element;
212 } 240 }
213 241
214 } 242 }
215// owarn << "i="<< index << "cmd:" << cmd << oendl; 243// owarn << "i="<< index << "cmd:" << cmd << oendl;
216 244
217 TextViewOutput->append(cmd); 245 TextViewOutput->append(cmd);
218 246
219 /* run smbclient & read output */ 247 /* run smbclient & read output */
220// if ((pipe = popen(cmd.latin1(), "r")) == NULL) { 248// if ((pipe = popen(cmd.latin1(), "r")) == NULL) {
221// snprintf(result, 256, "Error: Can't run %s", cmd.latin1()); 249// snprintf(result, 256, "Error: Can't run %s", cmd.latin1());
222// // cmd = "Error: Can't run "+cmd; 250// // cmd = "Error: Can't run "+cmd;
223// TextViewOutput->append(result); 251// TextViewOutput->append(result);
224// return; 252// return;
225// } 253// }
226 254
227 /* parse output and display in ListViewScan */ 255 /* parse output and display in ListViewScan */
228// while(fgets(result, 256, pipe) != NULL) { 256// while(fgets(result, 256, pipe) != NULL) {
229// /* put result into TextViewOutput */ 257// /* put result into TextViewOutput */
230// TextViewOutput->append(result); 258// TextViewOutput->append(result);
231 259
232// if( strchr(result, '$') == NULL ) { 260// if( strchr(result, '$') == NULL ) {
233// char share[256], *ptr1; 261// char share[256], *ptr1;
234 262
235// strcpy(share,result); 263// strcpy(share,result);
236// ptr1 = strchr(share,' '); 264// ptr1 = strchr(share,' ');
237// share[ptr1 - share]='\0'; 265// share[ptr1 - share]='\0';
238 266
239// owarn<< "add share: " << share << oendl; 267// owarn<< "add share: " << share << oendl;
240 268
241// if(top_element != NULL) { 269// if(top_element != NULL) {
242// bool found = false; 270// bool found = false;
243// element = top_element; 271// element = top_element;
244 272
245// while(element != NULL && !found) { 273// while(element != NULL && !found) {
246// if(strcmp( element->text(0).ascii(), share)==0) { 274// if(strcmp( element->text(0).ascii(), share)==0) {
247// parent = element; 275// parent = element;
248// found = true; 276// found = true;
249// } 277// }
250// element = element->nextSibling(); 278// element = element->nextSibling();
251// } 279// }
252 280
253// if(!found) { 281// if(!found) {
254// element = new QListViewItem(ListViewScan,share); 282// element = new QListViewItem(ListViewScan,share);
255// element->setOpen(true); 283// element->setOpen(true);
256// parent=element; 284// parent=element;
257// } 285// }
258// } else { 286// } else {
259// element = new QListViewItem(ListViewScan,share); 287// element = new QListViewItem(ListViewScan,share);
260// element->setOpen(true); 288// element->setOpen(true);
261// top_element = element; 289// top_element = element;
262// parent = element; 290// parent = element;
263// } 291// }
264// } 292// }
265// } 293// }
266 294
267 TextViewOutput->append("\n\n============================================\n"); 295 TextViewOutput->append("\n\n============================================\n");
268 LScan->setText(""); 296 LScan->setText("");
269 scanning = false; 297 scanning = false;
270} 298}
271 299
272 300
273void Qsmb::DoIt() 301void Qsmb::DoIt()
274{ 302{
275 303
276 QListViewItem *element; 304 QListViewItem *element;
277 element = ListViewScan->selectedItem(); 305 element = ListViewScan->selectedItem();
278 if(!element) { 306 if(!element) {
279 return; 307 return;
280 } 308 }
281 309
282 if (scanning) return; 310 if (scanning) return;
283 scanning = true; 311 scanning = true;
284 312
285 QString mount = mountpt->currentText(); 313 QString mount = mountpt->currentText();
286 if(isMounted(mount)) { 314 if(isMounted(mount)) {
287 qWarning(mount +" is already mounted"); 315 qWarning(mount +" is already mounted");
288 TextViewOutput->append(mount +" is already mounted"); 316 TextViewOutput->append(mount +" is already mounted");
289 return; 317 return;
290 } 318 }
291 319
292 bool noerr = false; 320 bool noerr = false;
293 321
294 QString share; 322 QString share;
295 QString cmd; 323 QString cmd;
296 QString cmd2; 324 QString cmd2;
297 QString text = mountpt->currentText(); 325 QString text = mountpt->currentText();
298 QStringList ccmd; 326 QStringList ccmd;
299 327
300 LScan->setText("Mounting..."); 328 LScan->setText("Mounting...");
301 qApp->processEvents(); 329 qApp->processEvents();
302 330
303 if( !QFileInfo(text).exists()) { 331 if( !QFileInfo(text).exists()) {
304 ccmd << "mkdir"; 332 ccmd << "mkdir";
305 ccmd << "-p"; 333 ccmd << "-p";
306 ccmd << text; 334 ccmd << text;
307 335
308 qWarning( "cmd: "+ ccmd.join(" ")); 336 qWarning( "cmd: "+ ccmd.join(" "));
309 runCommand(ccmd); 337 runCommand(ccmd);
310 } 338 }
311 339
312 share = element->text(0); 340 share = element->text(0);
313 qWarning("selected share is "+share); 341 qWarning("selected share is "+share);
314 342
315 QString service = CBHost->currentText(); 343 QString service = CBHost->currentText();
316 service = service.stripWhiteSpace(); 344 service = service.stripWhiteSpace();
317 if(mount.left(1) != "/") 345 if(mount.left(1) != "/")
318 mount = QDir::currentDirPath()+"/"+mount; 346 mount = QDir::currentDirPath()+"/"+mount;
319 mount = mount.stripWhiteSpace(); 347 mount = mount.stripWhiteSpace();
320 ccmd.clear(); 348 ccmd.clear();
321 349
322 ccmd << "/usr/bin/smbmount"; 350 ccmd << "/usr/bin/smbmount";
323 ccmd << "//"+ service+"/"+share; 351 ccmd << "//"+ service+"/"+share;
324 ccmd << mount; 352 ccmd << mount;
325 ccmd << "-o"; 353 ccmd << "-o";
326 ccmd << "username="+username->text()+",password="+password->text()+""; 354 ccmd << "username="+username->text()+",password="+password->text()+"";
327 355
328 if(onbootBtn->isChecked()) { 356 if(onbootBtn->isChecked()) {
329 qWarning("Saving Setting permanently..."); 357 qWarning("Saving Setting permanently...");
330 QFile sambenv("/opt/QtPalmtop/etc/samba.env"); 358 QFile sambenv("/opt/QtPalmtop/etc/samba.env");
331 QTextStream smbv(&sambenv); 359 QTextStream smbv(&sambenv);
332 sambenv.open(IO_WriteOnly); 360 sambenv.open(IO_WriteOnly);
333 smbv << ccmd.join(" ") ; 361 smbv << ccmd.join(" ") ;
334 sambenv.close(); 362 sambenv.close();
335 } 363 }
336 364
337 noerr = runCommand(ccmd); 365 noerr = runCommand(ccmd);
338 366
339 LScan->setText(""); 367 LScan->setText("");
340 368
341 if(noerr && isMounted(mount)) { 369 if(noerr && isMounted(mount)) {
342 element->setText(2, mount); 370 element->setText(2, mount);
343 TextViewOutput->append("\n\n================CheckMounts==================\n"); 371 TextViewOutput->append("\n\n================CheckMounts==================\n");
344 ccmd = "/bin/mount"; 372 ccmd = "/bin/mount";
345 runCommand(ccmd); 373 runCommand(ccmd);
346 TextViewOutput->append("\n\n============================================\n"); 374 TextViewOutput->append("\n\n============================================\n");
347 qApp->processEvents(); 375 qApp->processEvents();
348 } else { 376 } else {
349 //do nothing 377 //do nothing
350 } 378 }
351 379
352 scanning = false; 380 scanning = false;
353} 381}
354 382
355void Qsmb::umountIt() 383void Qsmb::umountIt()
356{ 384{
357 QListViewItem *element; 385 QListViewItem *element;
358 element = ListViewScan->selectedItem(); 386 element = ListViewScan->selectedItem();
359 if(!element) { 387 if(!element) {
360 return; 388 return;
361 } 389 }
362 390
363 QString mount = mountpt->currentText(); 391 QString mount = mountpt->currentText();
364 if(!isMounted(mount)) { 392 if(!isMounted(mount)) {
365 qWarning(mount +" is not mounted"); 393 qWarning(mount +" is not mounted");
366 TextViewOutput->append(mount +" is not mounted"); 394 TextViewOutput->append(mount +" is not mounted");
367 return; 395 return;
368 } 396 }
369 397
370 QStringList ccmd; 398 QStringList ccmd;
371 QString share; 399 QString share;
372 share = element->text(0); 400 share = element->text(0);
373 qWarning("selected share is "+share); 401 qWarning("selected share is "+share);
374 402
375 if(mount.left(1) != "/") 403 if(mount.left(1) != "/")
376 mount = QDir::currentDirPath()+"/"+mount; 404 mount = QDir::currentDirPath()+"/"+mount;
377 mount = mount.stripWhiteSpace(); 405 mount = mount.stripWhiteSpace();
378 406
379 ccmd << "/usr/bin/smbumount"; 407 ccmd << "/usr/bin/smbumount";
380 ccmd << mount; 408 ccmd << mount;
381 runCommand(ccmd); 409 runCommand(ccmd);
382 410
383 element->setText(2, ""); 411 element->setText(2, "");
384 412
diff --git a/noncore/net/opie-smb/qsmb.h b/noncore/net/opie-smb/qsmb.h
index 175b2c3..7908837 100644
--- a/noncore/net/opie-smb/qsmb.h
+++ b/noncore/net/opie-smb/qsmb.h
@@ -1,49 +1,77 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002-2005 Kurt Korbatits <support@midget.net.au>
4           .>+-= Copyright (c) 2005 L. Potter <lpotter@trolltech.com>
5 _;:,     .>    :=|. This program is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU General Public
8.="- .-=="i,     .._ License as published by the Free Software
9 - .   .-<_>     .<> Foundation; either version 2 of the License,
10     ._= =}       : or (at your option) any later version.
11    .%`+i>       _;_.
12    .i_,=:_.      -<s. This program is distributed in the hope that
13     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
14    : ..    .:,     . . . without even the implied warranty of
15    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
16  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
17..}^=.=       =       ; General Public License for more
18++=   -.     .`     .: details.
19 :     =  ...= . :.=-
20 -.   .:....=;==+<; You should have received a copy of the GNU
21  -_. . .   )=.  = General Public License along with
22    --        :-=` this library; see the file COPYING.BIN.
23 If not, write to the Free Software Foundation,
24 Inc., 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
1#ifndef QSMB_H 29#ifndef QSMB_H
2#define QSMB_H 30#define QSMB_H
3 31
4#include "qsmbbase.h" 32#include "qsmbbase.h"
5 33
6#include <stdlib.h> 34#include <stdlib.h>
7#include <stdlib.h> 35#include <stdlib.h>
8#include <stdio.h> 36#include <stdio.h>
9 37
10#include <qlistview.h> 38#include <qlistview.h>
11#include <pthread.h> 39#include <pthread.h>
12 40
13#include <qlistview.h> 41#include <qlistview.h>
14 42
15class Qsmb : public FormQPESMBBase 43class Qsmb : public FormQPESMBBase
16{ 44{
17 Q_OBJECT 45 Q_OBJECT
18 46
19public: 47public:
20 static QString appName() { return QString::fromLatin1("opie-smb"); } 48 static QString appName() { return QString::fromLatin1("opie-smb"); }
21 Qsmb( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); 49 Qsmb( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
22 ~Qsmb(); 50 ~Qsmb();
23 void scan(); 51 void scan();
24 void DoIt(); 52 void DoIt();
25 53
26private: 54private:
27 QListViewItem *top_element; 55 QListViewItem *top_element;
28 QComboBox *hosts; 56 QComboBox *hosts;
29 pthread_t tpid; 57 pthread_t tpid;
30 bool scanning; 58 bool scanning;
31 bool isMounted(const QString &); 59 bool isMounted(const QString &);
32 QString getMount(const QString &); 60 QString getMount(const QString &);
33 61
34public slots: 62public slots:
35 void clear(); 63 void clear();
36 void scanClicked(); 64 void scanClicked();
37 void hostSelected(int); 65 void hostSelected(int);
38 void DoItClicked(); 66 void DoItClicked();
39 void umountIt(); 67 void umountIt();
40 QString out; 68 QString out;
41 bool runCommand(const QStringList &); 69 bool runCommand(const QStringList &);
42 70
43private slots: 71private slots:
44 void TextViewClicked(QListViewItem*); 72 void TextViewClicked(QListViewItem*);
45}; 73};
46void* runit(void *arg); 74void* runit(void *arg);
47void* runitm(void *arg); 75void* runitm(void *arg);
48 76
49#endif // QSMB_H 77#endif // QSMB_H