19 files changed, 34 insertions, 6 deletions
diff --git a/libopie2/opiepim/config.in b/libopie2/opiepim/config.in index 33ef9b2..8ac8ad6 100644 --- a/libopie2/opiepim/config.in +++ b/libopie2/opiepim/config.in @@ -1,21 +1,21 @@ config LIBOPIE2PIM boolean "libopie2pim (pim related classes)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIEDB2 comment "libopie2pim needs a libqpe and libopie2core" depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE ) config SQL_PIM_BACKEND boolean "Enable SQL Backend for libopie2pim" default n help This adds the SQL-Support, using SQLite. Which database is used by the backends is defined by the file "pimaccess.conf" in the directory "Settings". There currently do exist to groups "[contact]" and "[todo]". You can select the used backend by the variable "usebackend=<type>", where <type> is "sql" or "xml". "xml" is the default ! Important: The SQLite-library "libsqlite.so" must be installed ! depends ( LIBOPIE2DB ) comment "SQL-Support needs libopie2db (and libsqlite)" depends !( LIBOPIE2DB ) diff --git a/library/qlibrary_unix.cpp b/library/qlibrary_unix.cpp index ff69286..2181153 100644 --- a/library/qlibrary_unix.cpp +++ b/library/qlibrary_unix.cpp @@ -138,106 +138,106 @@ bool QLibraryPrivate::loadLibrary() desc = new DyldLibDesc; desc->img = img; desc->mod = mod; } pHnd = desc; return pHnd != 0; } bool QLibraryPrivate::freeLibrary() { //qDebug("QLibraryPrivate::freeLibrary\n"); //return FALSE; if ( !pHnd ) return TRUE; DyldLibDesc* desc = (DyldLibDesc*) pHnd; NSModule mod = desc->mod; NSObjectFileImage img = desc->img; DYLD_BOOL success = NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE); if ( success ) { NSDestroyObjectFileImage(img); delete desc; pHnd = 0; } #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) else { qWarning( "Error in NSUnLinkModule()" ); } #endif return pHnd == 0; } void* QLibraryPrivate::resolveSymbol( const char* symbol ) { //qDebug("QLibraryPrivate::resolveSymbol\n"); //return FALSE; if ( !pHnd ) return 0; DyldLibDesc* desc = (DyldLibDesc*) pHnd; NSSymbol sym = NSLookupSymbolInModule(desc->mod, symbol); void* address = 0; if (sym != 0) { address = NSAddressOfSymbol(sym); } #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) if ( address == 0 ) qWarning( "Cannot find symbol: %s", symbol ); #endif return address; } #else // Something else, assuming POSIX #include <dlfcn.h> bool QLibraryPrivate::loadLibrary() { if ( pHnd ) return TRUE; QString filename = library->library(); pHnd = dlopen( filename.latin1() , RTLD_LAZY ); -#if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) +// #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) if ( !pHnd ) qWarning( "%s", dlerror() ); -#endif +// #endif return pHnd != 0; } bool QLibraryPrivate::freeLibrary() { if ( !pHnd ) return TRUE; int ec = dlclose( pHnd ); if ( !ec ) pHnd = 0; #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) else { const char* error = dlerror(); if ( error ) qWarning( "%s", error ); } #endif return pHnd == 0; } void* QLibraryPrivate::resolveSymbol( const char* f ) { if ( !pHnd ) return 0; void* address = dlsym( pHnd, f ); #if defined(QT_DEBUG) || defined(QT_DEBUG_COMPONENT) const char* error = dlerror(); if ( error ) qWarning( "%s", error ); #endif return address; } #endif // POSIX #endif // QT_NO_COMPONENT diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 1d93f5c..66e8f01 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp @@ -1,101 +1,102 @@ /* =. This file is part of the OPIE Project .=l. Copyright (c) 2002 Maximilian Reiss <max.reiss@gmx.de> .>+-= _;:, .> :=|. This library is free software; you can .> <, > . <= redistribute it and/or modify it under :=1 )Y*s>-.-- : the terms of the GNU Library 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 library 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 ..}^=.= = ; Library General Public License for more ++= -. . .: details. : = ...= . :.=- -. .:....=;==+<; You should have received a copy of the GNU -_. . . )=. = Library General Public License along with -- :-= this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bluezapplet.h" #include <qapplication.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/config.h> #include <qpe/resource.h> #include <opie2/odevice.h> +#include <opie2/odebug.h> #include <qpoint.h> #include <qpainter.h> #include <qlayout.h> #include <qframe.h> #include <qpixmap.h> #include <qstring.h> #include <qtimer.h> #include <qpopupmenu.h> #include <device.h> using namespace Opie::Core; namespace OpieTooth { BluezApplet::BluezApplet( QWidget *parent, const char *name ) : QWidget( parent, name ) { setFixedHeight( 18 ); setFixedWidth( 14 ); bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); startTimer(4000); btDevice = 0; bluezactive = false; bluezDiscoveryActive = false; } BluezApplet::~BluezApplet() { if ( btDevice ) { delete btDevice; } } bool BluezApplet::checkBluezStatus() { if (btDevice) { if (btDevice->isLoaded() ) { return true; } else { return false; } } else { return false; } } int BluezApplet::setBluezStatus(int c) { if ( c == 1 ) { switch ( ODevice::inst()->model() ) { case Model_iPAQ_H39xx: btDevice = new Device( "/dev/tts/1", "bcsp", "921600" ); break; case Model_iPAQ_H5xxx: btDevice = new Device( "/dev/tts/1", "any", "921600" ); break; default: btDevice = new Device( "/dev/ttySB0", "bcsp", "230400" ); break; } } else { diff --git a/noncore/net/opietooth/lib/startdunconnection.cpp b/noncore/net/opietooth/lib/startdunconnection.cpp index 37f2ae7..2d23b3a 100644 --- a/noncore/net/opietooth/lib/startdunconnection.cpp +++ b/noncore/net/opietooth/lib/startdunconnection.cpp @@ -1,64 +1,65 @@ +#include <opie2/odebug.h> #include "startdunconnection.h" using namespace OpieTooth; using namespace Opie::Core; StartDunConnection::StartDunConnection() { m_dunConnect = 0l; setConnectionType(); } StartDunConnection::~StartDunConnection() { delete m_dunConnect; } StartDunConnection::StartDunConnection( QString mac ) { m_dunConnect = 0l; m_mac = mac; setConnectionType(); } void StartDunConnection::setName( QString name ) { m_name = name; } QString StartDunConnection::name() { return m_name; } void StartDunConnection::setConnectionType() { m_connectionType = Pan; } StartConnection::ConnectionType StartDunConnection::type() { return m_connectionType; } void StartDunConnection::start() { m_dunConnect = new OProcess(); *m_dunConnect << "dund" << "--listen" << "--connect" << m_mac; connect( m_dunConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(Opie::Core::OProcess*) ) ); connect( m_dunConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if (!m_dunConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { owarn << "could not start" << oendl; delete m_dunConnect; } } void StartDunConnection::slotExited( OProcess* proc ) { delete m_dunConnect; } void StartDunConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartDunConnection::stop() { if ( m_dunConnect ) { delete m_dunConnect; diff --git a/noncore/net/opietooth/lib/startpanconnection.cpp b/noncore/net/opietooth/lib/startpanconnection.cpp index 50afc9f..29b95e9 100644 --- a/noncore/net/opietooth/lib/startpanconnection.cpp +++ b/noncore/net/opietooth/lib/startpanconnection.cpp @@ -1,65 +1,65 @@ - +#include <opie2/odebug.h> #include "startpanconnection.h" using namespace OpieTooth; using namespace Opie::Core; using namespace Opie::Core; StartPanConnection::StartPanConnection() { m_panConnect = 0l; setConnectionType(); } StartPanConnection::~StartPanConnection() { delete m_panConnect; } StartPanConnection::StartPanConnection( QString mac ) { m_panConnect = 0l; m_mac = mac; setConnectionType(); } void StartPanConnection::setName( QString name ) { m_name = name; } QString StartPanConnection::name() { return m_name; } void StartPanConnection::setConnectionType() { m_connectionType = Pan; } StartConnection::ConnectionType StartPanConnection::type() { return m_connectionType; } void StartPanConnection::start() { m_panConnect = new OProcess(); odebug << "IM START " + m_mac << oendl; *m_panConnect << "pand" << "--connect" << m_mac; connect( m_panConnect, SIGNAL( processExited(Opie::Core::OProcess*) ) , this, SLOT( slotExited(Opie::Core::OProcess*) ) ); connect( m_panConnect, SIGNAL( receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT( slotStdOut(Opie::Core::OProcess*,char*,int) ) ); if (!m_panConnect->start( OProcess::NotifyOnExit, OProcess::AllOutput) ) { owarn << "could not start" << oendl; delete m_panConnect; } } void StartPanConnection::slotExited( OProcess* proc ) { delete m_panConnect; m_panConnect = 0l; } void StartPanConnection::slotStdOut(OProcess* proc, char* chars, int len) {} void StartPanConnection::stop() { diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index b1cddd2..ee01b61 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -1,92 +1,94 @@ /* * bluebase.cpp * * --------------------- * * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "bluebase.h" #include "scandialog.h" #include "hciconfwrapper.h" #include "devicehandler.h" #include "btconnectionitem.h" #include "rfcommassigndialogimpl.h" /* OPIE */ #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/config.h> +#include <opie2/odebug.h> +using namespace Opie::Core; /* QT */ #include <qframe.h> #include <qlabel.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qimage.h> #include <qpixmap.h> #include <qtabwidget.h> #include <qscrollview.h> #include <qvbox.h> #include <qmessagebox.h> #include <qcheckbox.h> #include <qlineedit.h> #include <qlistview.h> #include <qdir.h> #include <qpopupmenu.h> #include <qtimer.h> #include <qlist.h> /* STD */ #include <remotedevice.h> #include <services.h> #include <stdlib.h> using namespace OpieTooth; BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl ) : BluetoothBase( parent, name, fl ) { m_localDevice = new Manager( "hci0" ); connect( PushButton2, SIGNAL( clicked() ), this, SLOT(startScan() ) ); connect( configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges() ) ); connect( rfcommBindButton, SIGNAL( clicked() ), this, SLOT( rfcommDialog() ) ); // not good since lib is async // connect( ListView2, SIGNAL( expanded(QListViewItem*) ), // this, SLOT( addServicesToDevice(QListViewItem*) ) ); connect( ListView2, SIGNAL( clicked(QListViewItem*)), this, SLOT( startServiceActionClicked(QListViewItem*) ) ); connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), this, SLOT(startServiceActionHold(QListViewItem*,const QPoint&,int) ) ); connect( m_localDevice , SIGNAL( foundServices(const QString&,Services::ValueList) ), this, SLOT( addServicesToDevice(const QString&,Services::ValueList) ) ); connect( m_localDevice, SIGNAL( available(const QString&,bool) ), this, SLOT( deviceActive(const QString&,bool) ) ); connect( m_localDevice, SIGNAL( connections(ConnectionState::ValueList) ), this, SLOT( addConnectedDevices(ConnectionState::ValueList) ) ); connect( m_localDevice, SIGNAL( signalStrength(const QString&,const QString&) ), this, SLOT( addSignalStrength(const QString&,const QString&) ) ); // let hold be rightButtonClicked() QPEApplication::setStylusOperation( ListView2->viewport(), QPEApplication::RightOnHold); QPEApplication::setStylusOperation( ListView4->viewport(), QPEApplication::RightOnHold); //Load all icons needed m_offPix = Resource::loadPixmap( "opietooth/notconnected" ); m_onPix = Resource::loadPixmap( "opietooth/connected" ); m_findPix = Resource::loadPixmap( "opietooth/find" ); diff --git a/noncore/net/opietooth/manager/config.in b/noncore/net/opietooth/manager/config.in index ecebb9b..56d8b78 100644 --- a/noncore/net/opietooth/manager/config.in +++ b/noncore/net/opietooth/manager/config.in @@ -1,4 +1,4 @@ config OPIETOOTH-MANAGER boolean "opie-bluetoothmanager (Bluetooth manager)" default "y" - depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && OPIETOOTH && LIBOPIETOOTH + depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && OPIETOOTH && LIBOPIETOOTH && LIBOPIE2UI diff --git a/noncore/net/opietooth/manager/devicehandler.cpp b/noncore/net/opietooth/manager/devicehandler.cpp index bd34351..320ad44 100644 --- a/noncore/net/opietooth/manager/devicehandler.cpp +++ b/noncore/net/opietooth/manager/devicehandler.cpp @@ -1,69 +1,71 @@ #include <stdlib.h> #include <qdir.h> #include <qpe/config.h> +#include <opie2/odebug.h> +using namespace Opie::Core; #include "devicehandler.h" using namespace OpieTooth; DeviceHandler::DeviceHandler() { }; DeviceHandler::~DeviceHandler() { } RemoteDevice::ValueList DeviceHandler::load() { RemoteDevice::ValueList list; QString path = QDir::homeDirPath() + "/Settings/bluetooth"; QDir deviceListSave( path); // list of .conf files QStringList devicesFileList = deviceListSave.entryList(); // cut .conf of to get the mac and also read the name entry in it. if (!devicesFileList.isEmpty() ) { QString name; QString mac; QStringList::Iterator it; for (it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { if ( (*it) == "." || (*it) == ".." ) continue; odebug << (*it).latin1() << oendl; Config conf(path + "/"+(*it), Config::File); conf.setGroup("Info"); name = conf.readEntry("name", "Error"); mac = conf.readEntry("mac", QString::null); odebug << "MAC: " + mac << oendl; odebug << "NAME: " + name << oendl; if (mac.isEmpty() ) continue; RemoteDevice currentDevice( mac , name ); list.append( currentDevice ); } } return list; }; /* * This is some how rude but make sure all old devices * are getting deleted */ void DeviceHandler::save( const RemoteDevice::ValueList& list) { QCString rm; rm += "rm -rf "; rm += QDir::homeDirPath() + "/Settings/bluetooth"; system ( rm.data() ); if (list.isEmpty() ) // no need to create the dir return; /** * Create a new dir */ rm = "mkdir "; rm += QDir::homeDirPath() + "/Settings/bluetooth"; owarn << "out " << rm.data() << "" << oendl; diff --git a/noncore/net/opietooth/manager/dunpopup.cpp b/noncore/net/opietooth/manager/dunpopup.cpp index 5b01d2f..10505a9 100644 --- a/noncore/net/opietooth/manager/dunpopup.cpp +++ b/noncore/net/opietooth/manager/dunpopup.cpp @@ -1,63 +1,65 @@ #include <qpe/qcopenvelope_qws.h> #include <qtimer.h> +#include <opie2/odebug.h> +using namespace Opie::Core; #include "dunpopup.h" using namespace OpieTooth; /* * c'tor init the QAction */ DunPopup::DunPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { owarn << "DunPopup c'tor" << oendl; m_item = item; QAction *a, *b, *c; m_dunconnection = 0l; /* connect action */ a = new QAction(); // so it's get deleted a->setText( tr("connect") ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); b = new QAction(); b->setText( tr( "connect+conf" ) ); b->addTo( this ); connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); c = new QAction(); c->setText( tr( "disconnect" ) ); c->addTo( this ); connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); }; DunPopup::~DunPopup() { } void DunPopup::slotConnect() { m_dunconnection = new StartDunConnection( m_item->mac() ); m_dunconnection->start(); } void DunPopup::slotDisconnect() { m_dunconnection->stop(); } void DunPopup::slotConnectAndConfig() { slotConnect(); // more intelligence here later like passing the device ( bnepX ) QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "networksettings" ); } diff --git a/noncore/net/opietooth/manager/hciconfwrapper.cpp b/noncore/net/opietooth/manager/hciconfwrapper.cpp index 71c935c..ca2e7bd 100644 --- a/noncore/net/opietooth/manager/hciconfwrapper.cpp +++ b/noncore/net/opietooth/manager/hciconfwrapper.cpp @@ -1,70 +1,73 @@ #include "hciconfwrapper.h" #include <qfile.h> #include <qtextstream.h> #include <qregexp.h> +#include <opie2/odebug.h> +using namespace Opie::Core; + namespace OpieTooth { HciConfWrapper::HciConfWrapper( const QString &fileName) { m_fileName = fileName; } HciConfWrapper::~HciConfWrapper() { } void HciConfWrapper::setPinHelper( const QString& app ) { setValue( "pin_helper" , app ); } void HciConfWrapper::setName( const QString &name ) { qDebug ("NAME : " + name); setValue( "name" , "\"" + name + "\"" ); } void HciConfWrapper::setIscan( bool enable) { if ( enable ) { setValue( "iscan" , "enable" ); } else { setValue( "iscan" , "disable" ); } } void HciConfWrapper::setPscan( bool enable) { if ( enable ) { setValue( "pscan" , "enable" ); } else { setValue( "pscan" , "disable" ); } } void HciConfWrapper::setAuth( bool enable) { if ( enable ) { setValue( "auth" , "enable" ); } else { setValue( "auth" , "disable" ); } } void HciConfWrapper::setEncrypt( bool enable) { if ( enable ) { setValue( "encrypt" , "enable" ); } else { setValue( "encrypt" , "disable" ); } } void HciConfWrapper::setValue(const QString &key, const QString &value ) { if (m_file.isEmpty() ) // load first return; diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro index 238acb3..5c05b4d 100644 --- a/noncore/net/opietooth/manager/manager.pro +++ b/noncore/net/opietooth/manager/manager.pro @@ -1,30 +1,30 @@ CONFIG = qt warn_on quick-app HEADERS = btconnectionitem.h btdeviceitem.h \ btserviceitem.h stdpopups.h \ popuphelper.h bluebase.h \ scandialog.h btlistitem.h \ hciconfwrapper.h bticonloader.h \ pppdialog.h obexdialog.h \ rfcommassigndialogimpl.h rfcommassigndialogitem.h \ devicehandler.h rfcpopup.h obexpopup.h \ rfcommhelper.h panpopup.h dunpopup.h rfcommconfhandler.h SOURCES = btconnectionitem.cpp btdeviceitem.cpp \ btserviceitem.cpp stdpopups.cpp \ popuphelper.cpp main.cpp \ bluebase.cpp scandialog.cpp \ btlistitem.cpp hciconfwrapper.cpp \ bticonloader.cpp pppdialog.cpp \ rfcommassigndialogimpl.cpp rfcommassigndialogitem.cpp \ obexdialog.cpp devicehandler.cpp \ rfcpopup.cpp obexpopup.cpp \ rfcommhelper.cpp panpopup.cpp dunpopup.cpp rfcommconfhandler.cpp INCLUDEPATH += $(OPIEDIR)/include INCLUDEPATH += $(OPIEDIR)/noncore/net/opietooth/lib DEPENDPATH += $(OPIEDIR)/include -LIBS += -lqpe -lopietooth -lopiecore2 +LIBS += -lqpe -lopietooth -lopiecore2 -lopieui2 INTERFACES = bluetoothbase.ui devicedialog.ui rfcommassigndialogbase.ui rfcommdialogitembase.ui TARGET = bluetooth-manager include ( $(OPIEDIR)/include.pro ) diff --git a/noncore/net/opietooth/manager/obexdialog.cpp b/noncore/net/opietooth/manager/obexdialog.cpp index 3a3dbb0..951d87a 100644 --- a/noncore/net/opietooth/manager/obexdialog.cpp +++ b/noncore/net/opietooth/manager/obexdialog.cpp @@ -1,77 +1,79 @@ #include "obexdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <qfileinfo.h> #include <qpe/resource.h> #include <opie2/oprocess.h> #include <opie2/ofiledialog.h> +#include <opie2/odebug.h> +using namespace Opie::Core; using namespace OpieTooth; using namespace Opie::Core; using namespace Opie::Ui; using namespace Opie::Core; ObexDialog::ObexDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "ObexDialog" ); setCaption( tr( "beam files " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Which file should be beamed?") ); cmdLine = new QLineEdit( this ); QPushButton *browserButton; browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); connect( browserButton, SIGNAL(released() ), this , SLOT(browse() ) ); chNameLine = new QLineEdit( this ); sendButton = new QPushButton( this ); sendButton->setText( tr( "Send" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(browserButton); layout->addWidget(chNameLine); layout->addWidget(sendButton); connect( sendButton, SIGNAL( clicked() ), this, SLOT( sendData() ) ); } ObexDialog::~ObexDialog() { } void ObexDialog::browse() { MimeTypes types; QStringList all; all << "*/*"; types.insert("All Files", all ); QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); cmdLine->setText( str ); } void ObexDialog::sendData() { QString fileURL = cmdLine->text(); QString file = QFileInfo( fileURL ).fileName(); QString modifiedName = chNameLine->text(); // vom popupmenu beziehen OProcess* obexSend = new OProcess(); if ( !modifiedName.isEmpty() ) { diff --git a/noncore/net/opietooth/manager/obexpopup.cpp b/noncore/net/opietooth/manager/obexpopup.cpp index 9a50199..010f7de 100644 --- a/noncore/net/opietooth/manager/obexpopup.cpp +++ b/noncore/net/opietooth/manager/obexpopup.cpp @@ -1,45 +1,47 @@ #include "obexdialog.h" #include "obexpopup.h" /* OPIE */ #include <qpe/qpeapplication.h> +#include <opie2/odebug.h> +using namespace Opie::Core; /* QT */ #include <qtimer.h> using namespace OpieTooth; /* * c'tor init the QAction */ ObexPopup::ObexPopup() : QPopupMenu() { owarn << "RfcCommPopup c'tor" << oendl; QAction* a; /* connect action */ a = new QAction( ); // so it's get deleted a->setText("Push file"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotPush() ) ); }; ObexPopup::~ObexPopup() {} void ObexPopup::slotPush() { owarn << "push something" << oendl; ObexDialog obexDialog; QPEApplication::execDialog( &obexDialog ); } diff --git a/noncore/net/opietooth/manager/panpopup.cpp b/noncore/net/opietooth/manager/panpopup.cpp index 43c2777..f02a58c 100644 --- a/noncore/net/opietooth/manager/panpopup.cpp +++ b/noncore/net/opietooth/manager/panpopup.cpp @@ -1,64 +1,66 @@ #include <qpe/qcopenvelope_qws.h> +#include <opie2/odebug.h> +using namespace Opie::Core; #include <qtimer.h> #include "panpopup.h" using namespace OpieTooth; /* * c'tor init the QAction */ PanPopup::PanPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { owarn << "PanPopup c'tor" << oendl; m_item = item; QAction *a, *b, *c; m_panconnection = 0l; /* connect action */ a = new QAction(); // so it's get deleted a->setText( tr("connect") ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); b = new QAction(); b->setText( tr( "connect+conf" ) ); b->addTo( this ); connect( b, SIGNAL( activated() ), this, SLOT( slotConnectAndConfig() ) ); c = new QAction(); c->setText( tr( "disconnect" ) ); c->addTo( this ); connect( c, SIGNAL( activated() ), this, SLOT( slotDisconnect() ) ); }; PanPopup::~PanPopup() { } void PanPopup::slotConnect() { m_panconnection = new StartPanConnection( m_item->mac() ); m_panconnection->start(); } void PanPopup::slotDisconnect() { if (!m_panconnection) m_panconnection = new StartPanConnection( m_item->mac() ); m_panconnection->stop(); } void PanPopup::slotConnectAndConfig() { slotConnect(); // more intelligence here later like passing the device ( bnepX ) QCopEnvelope e( "QPE/System", "execute(QString)" ); e << QString( "networksettings" ); } diff --git a/noncore/net/opietooth/manager/pppdialog.cpp b/noncore/net/opietooth/manager/pppdialog.cpp index 989bf45..ef007f5 100644 --- a/noncore/net/opietooth/manager/pppdialog.cpp +++ b/noncore/net/opietooth/manager/pppdialog.cpp @@ -1,69 +1,71 @@ #include "pppdialog.h" #include <qpushbutton.h> #include <qmultilineedit.h> #include <qlineedit.h> #include <qlayout.h> #include <qlabel.h> #include <opie2/oprocess.h> +#include <opie2/odebug.h> +using namespace Opie::Core; using namespace OpieTooth; using namespace Opie::Core; PPPDialog::PPPDialog( QWidget* parent, const char* name, bool modal, WFlags fl, const QString& device ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "PPPDialog" ); setCaption( tr( "ppp connection " ) ) ; m_device = device; layout = new QVBoxLayout( this ); QLabel* info = new QLabel( this ); info->setText( tr("Enter an ppp script name:") ); cmdLine = new QLineEdit( this ); outPut = new QMultiLineEdit( this ); QFont outPut_font( outPut->font() ); outPut_font.setPointSize( 8 ); outPut->setFont( outPut_font ); outPut->setWordWrap( QMultiLineEdit::WidgetWidth ); connectButton = new QPushButton( this ); connectButton->setText( tr( "Connect" ) ); layout->addWidget(info); layout->addWidget(cmdLine); layout->addWidget(outPut); layout->addWidget(connectButton); connect( connectButton, SIGNAL( clicked() ), this, SLOT( connectToDevice() ) ); } PPPDialog::~PPPDialog() { } void PPPDialog::connectToDevice() { outPut->clear(); // vom popupmenu beziehen QString connectScript = "/etc/ppp/peers/" + cmdLine->text(); OProcess* pppDial = new OProcess(); *pppDial << "pppd" << m_device << "call" << connectScript; connect( pppDial, SIGNAL(receivedStdout(Opie::Core::OProcess*,char*,int) ), this, SLOT(fillOutPut(Opie::Core::OProcess*,char*,int) ) ); if (!pppDial->start(OProcess::DontCare, OProcess::AllOutput) ) { owarn << "could not start" << oendl; delete pppDial; } } void PPPDialog::fillOutPut( OProcess* pppDial, char* cha, int len ) { QCString str(cha, len ); outPut->insertLine( str ); delete pppDial; } diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp index 4469129..3fe2ea6 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp @@ -1,72 +1,74 @@ #include "rfcommassigndialogimpl.h" #include "rfcommassigndialogitem.h" #include "rfcommconfhandler.h" /* OPIE */ #include <qpe/config.h> #include <qpe/qpeapplication.h> +#include <opie2/odebug.h> +using namespace Opie::Core; /* QT */ #include <qlayout.h> using namespace OpieTooth; // TODO: write only the file in bluebase? // muss rfcommd dann neu gestartet werden // sollte rfcomm bind all nicht eh default config sein ( polled das? - d.h. sobald nen gerät in der nähe ist bindet es? RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : RfcommAssignDialogBase( parent, name, modal, fl ) { m_range = 5; m_scrollView = new QScrollView( this ); m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); m_box = new QVBox( m_scrollView->viewport() ); m_scrollView->addChild( m_box ); confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); loadConfig(); } RfcommAssignDialog::~RfcommAssignDialog() { if ( confHandler ) { delete confHandler; } } void RfcommAssignDialog::newDevice( const QString & mac ) { for ( int i = 0 ; i < m_range; i++ ) { QMap<QString, RfCommConfObject*>::Iterator it; it = confHandler->foundEntries().find( QString("%1").arg( i ) ); // make sure that rfcommX is not assigned yet if ( it == confHandler->foundEntries().end() ) { QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); newDev->setIdent( i ); newDev->setMac( mac ); if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) { RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); m_itemList.insert( i , rfcomm ); rfcomm->setIdent( i ); rfcomm->setMac( mac ); rfcomm->setChannel( newDev->channel() ); diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp index 2ef95ff..1f7ba65 100644 --- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp +++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp @@ -1,66 +1,68 @@ #include <qtextstream.h> +#include <opie2/odebug.h> +using namespace Opie::Core; #include "rfcommconfhandler.h" using namespace OpieTooth; // move to lib RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { m_number = number; m_mac = mac; m_channel = channel; m_comment = comment; // m_foundEntries = 0; } void RfCommConfObject::setNumber( int number ) { m_number = number; } void RfCommConfObject::setMac( QString mac ) { m_mac = mac; } void RfCommConfObject::setChannel( int channel ) { m_channel = channel; } void RfCommConfObject::setComment( QString comment ) { m_comment = comment; } RfCommConfObject::~RfCommConfObject() { } RfCommConfHandler::RfCommConfHandler( const QString & filename ) { m_filename = filename; load(); } RfCommConfHandler::~RfCommConfHandler() { } void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { QFile rfCommConf( "/tmp/test" ); QTextStream outStream( &rfCommConf ); if ( rfCommConf.open( IO_WriteOnly ) ) { QMap<QString, RfCommConfObject*>::Iterator it; for( it = devices.begin(); it != devices.end(); ++it ) { outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; outStream << " device " + it.data()->mac() + ";\n"; outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; outStream << " comment \"" + it.data()->comment() + "\";\n"; outStream << "}\n\n"; } rfCommConf.close(); diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp index 01ad616..54f1eb7 100644 --- a/noncore/net/opietooth/manager/rfcpopup.cpp +++ b/noncore/net/opietooth/manager/rfcpopup.cpp @@ -1,71 +1,73 @@ #include "pppdialog.h" #include "rfcpopup.h" #include "rfcommassigndialogimpl.h" /* OPIE */ #include <qpe/qpeapplication.h> +#include <opie2/odebug.h> +using namespace Opie::Core; /* QT */ #include <qtimer.h> using namespace OpieTooth; /* * c'tor init the QAction */ RfcCommPopup::RfcCommPopup( OpieTooth::BTDeviceItem* item ) : QPopupMenu() { owarn << "RfcCommPopup c'tor" << oendl; QAction* a; m_item = item; /* connect action */ a = new QAction( ); // so it's get deleted a->setText("Connect"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotConnect() ) ); /* disconnect action */ a = new QAction( ); a->setText("Disconnect"); a->addTo( this ); connect( a, SIGNAL( activated() ) , this, SLOT( slotDisconnect() ) ); /* foo action */ a = new QAction( ); a->setText("Bind table"); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotBind() ) ); /* bar action */ a = new QAction( ); a->setText( "Bar" ); a->addTo( this ); connect( a, SIGNAL( activated() ), this, SLOT( slotBar() ) ); }; RfcCommPopup::~RfcCommPopup() { /* delete m_con; delete m_dis; delete m_foo; delete m_bar; */ } void RfcCommPopup::slotConnect() { diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index 3b005c4..bccc6c2 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -1,97 +1,100 @@ /* main.cpp * * --------------------- * * copyright : (c) 2002 by Maximilian Reiß * email : max.reiss@gmx.de * */ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #include "scandialog.h" #include <qheader.h> #include <qlistview.h> #include <qpushbutton.h> #include <qlayout.h> #include <qvariant.h> #include <qtooltip.h> #include <qwhatsthis.h> #include <qprogressbar.h> #include <qlist.h> #include <manager.h> #include <device.h> +#include <opie2/odebug.h> +using namespace Opie::Core; + namespace OpieTooth { #include <remotedevice.h> /** */ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { setCaption( tr( "Scan for devices" ) ); Layout11 = new QVBoxLayout( this ); Layout11->setSpacing( 6 ); Layout11->setMargin( 0 ); progress = new QProgressBar( this, "progbar"); progress->setTotalSteps(20); StartStopButton = new QPushButton( this, "StartButton" ); StartStopButton->setText( tr( "Start scan" ) ); ListView1 = new QListView( this, "ListView1" ); //ListView1->addColumn( tr( "Add" ) ); ListView1->addColumn( tr( "Add Device" ) ); //ListView1->addColumn( tr( "Type" ) ); Layout11->addWidget( ListView1 ); Layout11->addWidget( progress ); Layout11->addWidget( StartStopButton ); localDevice = new Manager( "hci0" ); connect( StartStopButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) ); connect( localDevice, SIGNAL( foundDevices(const QString&,RemoteDevice::ValueList) ), this, SLOT( fillList(const QString&,RemoteDevice::ValueList) ) ) ; progressStat = 0; m_search = false; } // hack, make cleaner later void ScanDialog::progressTimer() { progressStat++; if ( progressStat++ < 20 && m_search ) { QTimer::singleShot( 2000, this, SLOT( progressTimer() ) ); progress->setProgress( progressStat++ ); } } void ScanDialog::accept() { emitToManager(); QDialog::accept(); } void ScanDialog::startSearch() { if ( m_search ) { stopSearch(); return; } m_search = true; |