author | llornkcor <llornkcor> | 2005-08-16 10:22:06 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2005-08-16 10:22:06 (UTC) |
commit | e68f54c2f00d8e7a8e753722a50b47484c1124ee (patch) (side-by-side diff) | |
tree | fc2076fbc51424f59d10ad1e88e3bdbb2ed78411 | |
parent | dd4792fe0ac89205e7d7a7e38f3d4350e19f25d7 (diff) | |
download | opie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.zip opie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.tar.gz opie-e68f54c2f00d8e7a8e753722a50b47484c1124ee.tar.bz2 |
proper opie header and maintainter
-rw-r--r-- | noncore/net/opie-smb/opie-smb.control | 2 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmb.cpp | 28 | ||||
-rw-r--r-- | noncore/net/opie-smb/qsmb.h | 28 |
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 @@ Package: opie-smb Files: plugins/application/libopie-smb.so* bin/opie-smb bin/smbfind pics/opie-smb apps/Applications/opie-smb.desktop Version: $QPE_VERSION$EXTRAVERSION Architecture: arm Arch: arm -Maintainer: Kurt Korbatits (support@midget.net.au) +Maintainer: ljp <lpotter@trolltech.com> Section: Network Priority: optional Description: Gui front end for samba utilities. Source: Depends: 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,192 +1,220 @@ +/* + =. This file is part of the OPIE Project + .=l. Copyright (c) 2002-2005 Kurt Korbatits <support@midget.net.au> + .>+-= Copyright (c) 2005 L. Potter <lpotter@trolltech.com> + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = General Public License along with + -- :-=` this library; see the file COPYING.BIN. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + #include "qsmb.h" #include <qpushbutton.h> #include <qpe/qpeapplication.h> #include <string.h> #include <qstring.h> #include <qstringlist.h> #include <qdir.h> #include <qfileinfo.h> #include <qtabwidget.h> #include <qpe/process.h> #include <qlabel.h> #include <qlineedit.h> #include <qcombobox.h> #include <qstringlist.h> #include <qcheckbox.h> #include <qtextview.h> #include <qmessagebox.h> #include <qtextstream.h> #include <pthread.h> #include <signal.h> #include <ctype.h> #include <netinet/in.h> #include <arpa/inet.h> #include <rpc/clnt.h> #include <sys/vfs.h> #include <mntent.h> // #include <opie2/odebug.h> // using namespace Opie::Core; Qsmb::Qsmb( QWidget* parent, const char* name, WFlags fl ) : FormQPESMBBase( parent, name, fl ) { connect(CBHost, SIGNAL(activated(int)), this, SLOT(hostSelected(int))); connect(DoItBtn, SIGNAL(clicked()), this, SLOT(DoItClicked())); connect(UnmountBtn, SIGNAL(clicked()), this, SLOT(umountIt())); connect(BtnScan, SIGNAL(clicked()), this, SLOT(scanClicked())); connect(BtnClear, SIGNAL(clicked()), this, SLOT(clear())); connect(ListViewScan, SIGNAL(clicked(QListViewItem*)), this, SLOT(TextViewClicked(QListViewItem*))); mountpt->setEditable(true); mountpt->insertItem("/mnt/samba1",-1); mountpt->insertItem("/mnt/samba2",-1); mountpt->insertItem("/mnt/samba3",-1); setTabOrder(BtnScan, username); setTabOrder(username, password); setTabOrder(password, CBHost); setTabOrder(CBHost, TextViewOutput); setTabOrder(TextViewOutput, mountpt); setTabOrder(mountpt, DoItBtn); setTabOrder(DoItBtn, UnmountBtn); top_element = NULL; scanning = false; } Qsmb::~Qsmb() { } void Qsmb::clear() { if (scanning) return; ListViewScan->clear(); TextViewOutput->setText(""); CBHost->clear(); top_element = NULL; } void Qsmb::scanClicked() { if (scanning) return; pthread_create(&tpid, NULL, runit, (void *)this); } void Qsmb::DoItClicked() { if( !ListViewScan->selectedItem()) { QMessageBox::warning(this, tr("Error"),tr("<p>No share selected!</p>")); return; } if (scanning) return; pthread_create(&tpid, NULL, runitm, (void *)this); } void* runit(void* arg) { Qsmb* caller = (Qsmb*)arg; caller->scan(); return(0); } void* runitm(void* arg) { Qsmb* caller = (Qsmb*)arg; caller->DoIt(); return(0); } void Qsmb::scan() { clear(); // if (scanning) return; scanning = true; QString match; QString cmd; LScan->setText("Scanning..."); qApp->processEvents(); sockaddr_in my_addr; get_myaddress( &my_addr); QString ip = inet_ntoa( my_addr.sin_addr); qWarning("IP Address : "+ip); match = ip.left(5); QStringList ccmd; TextViewOutput->append("smbfind"); QFile lmhosts("/etc/samba/lmhosts"); QTextStream lms(&lmhosts); lmhosts.open(IO_WriteOnly); lms << "127.0.0.1 localhost\n"; /* parse output and display in ListViewScan */ ccmd = "smbfind"; runCommand(ccmd); QTextStream s(&out, IO_ReadOnly); while ( !s.atEnd() ) { QString ip_addr, host, output; QString tmp = s.readLine(); bool ok; tmp.left(1).toInt( &ok, 10 ); if(ok) { QStringList token = QStringList::split(' ', tmp ); ip_addr = token[0]; host = token[1]; CBHost->insertItem( host, -1); lms << ip_addr+" "+host+"\n"; } } lmhosts.close(); TextViewOutput->append("\n\n============================================\n"); LScan->setText(""); scanning = false; } void Qsmb::hostSelected(int /*index*/ ) { QListViewItem *element; // QListViewItem *parent; QString text = CBHost->currentText(); ListViewScan->clear(); if (scanning) return; scanning = true; QString cmd; QStringList ccmd; LScan->setText("Scanning..."); ccmd << "/usr/bin/smbclient"; ccmd << "-L"; ccmd << CBHost->currentText(); ccmd << "-N"; if(username->text().isEmpty()) { //do nothing } else { ccmd << "-U"; ccmd << username->text()+"\%"+ password->text(); } runCommand(ccmd); QTextStream s(&out, IO_ReadOnly); 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 @@ +/* + =. This file is part of the OPIE Project + .=l. Copyright (c) 2002-2005 Kurt Korbatits <support@midget.net.au> + .>+-= Copyright (c) 2005 L. Potter <lpotter@trolltech.com> + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = General Public License along with + -- :-=` this library; see the file COPYING.BIN. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + #ifndef QSMB_H #define QSMB_H #include "qsmbbase.h" #include <stdlib.h> #include <stdlib.h> #include <stdio.h> #include <qlistview.h> #include <pthread.h> #include <qlistview.h> class Qsmb : public FormQPESMBBase { Q_OBJECT public: static QString appName() { return QString::fromLatin1("opie-smb"); } Qsmb( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); ~Qsmb(); void scan(); void DoIt(); private: QListViewItem *top_element; QComboBox *hosts; pthread_t tpid; bool scanning; bool isMounted(const QString &); QString getMount(const QString &); public slots: void clear(); void scanClicked(); void hostSelected(int); void DoItClicked(); void umountIt(); QString out; bool runCommand(const QStringList &); private slots: void TextViewClicked(QListViewItem*); }; void* runit(void *arg); void* runitm(void *arg); #endif // QSMB_H |