-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 32 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/bluetoothbase.ui | 6 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/devicedialog.ui | 12 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.cpp | 18 | ||||
-rw-r--r-- | noncore/net/opietooth/manager/scandialog.h | 2 |
5 files changed, 35 insertions, 35 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index 90e44cb..7954cc3 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp @@ -46,87 +46,87 @@ using namespace Opie::Core; #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*) ), + // connect( devicesView, SIGNAL( expanded(QListViewItem*) ), // this, SLOT( addServicesToDevice(QListViewItem*) ) ); - connect( ListView2, SIGNAL( clicked(QListViewItem*)), + connect( devicesView, SIGNAL( clicked(QListViewItem*)), this, SLOT( startServiceActionClicked(QListViewItem*) ) ); - connect( ListView2, SIGNAL( rightButtonClicked(QListViewItem*,const QPoint&,int) ), + connect( devicesView, 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); + QPEApplication::setStylusOperation( devicesView->viewport(), QPEApplication::RightOnHold); + QPEApplication::setStylusOperation( connectionsView->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" ); QPalette pal = this->palette(); QColor col = pal.color( QPalette::Active, QColorGroup::Background ); pal.setColor( QPalette::Active, QColorGroup::Button, col ); pal.setColor( QPalette::Inactive, QColorGroup::Button, col ); pal.setColor( QPalette::Normal, QColorGroup::Button, col ); pal.setColor( QPalette::Disabled, QColorGroup::Button, col ); this->setPalette( pal ); setCaption( tr( "Bluetooth Manager" ) ); readConfig(); initGui(); - ListView2->setRootIsDecorated(true); + devicesView->setRootIsDecorated(true); writeToHciConfig(); // search conncetions addConnectedDevices(); addSignalStrength(); m_iconLoader = new BTIconLoader(); readSavedDevices(); } /** * Reads all options from the config file */ void BlueBase::readConfig() { Config cfg( "bluetoothmanager" ); cfg.setGroup( "bluezsettings" ); m_deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with m_defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak m_useEncryption = cfg.readBoolEntry( "useEncryption" , TRUE ); m_enableAuthentification = cfg.readBoolEntry( "enableAuthentification" , TRUE ); m_enablePagescan = cfg.readBoolEntry( "enablePagescan" , TRUE ); @@ -168,49 +168,49 @@ void BlueBase::writeToHciConfig() hciconf.setIscan( m_enableInquiryscan ); hciconf.save(); } /** * Read the list of allready known devices */ void BlueBase::readSavedDevices() { QValueList<RemoteDevice> loadedDevices; DeviceHandler handler; loadedDevices = handler.load(); addSearchedDevices( loadedDevices ); } /** * Write the list of allready known devices */ void BlueBase::writeSavedDevices() { - QListViewItemIterator it( ListView2 ); + QListViewItemIterator it( devicesView ); BTListItem* item; BTDeviceItem* device; RemoteDevice::ValueList list; for ( ; it.current(); ++it ) { item = (BTListItem*)it.current(); if(item->typeId() != BTListItem::Device ) continue; device = (BTDeviceItem*)item; list.append( device->remoteDevice() ); } /* * if not empty save the List through DeviceHandler */ if ( list.isEmpty() ) return; DeviceHandler handler; handler.save( list ); } /** * Set up the gui @@ -268,49 +268,49 @@ void BlueBase::rfcommDialog() { RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) { rfcommAssign.saveConfig(); } } /** * Add fresh found devices from scan dialog to the listing * */ void BlueBase::addSearchedDevices( const QValueList<RemoteDevice> &newDevices ) { BTDeviceItem * deviceItem; QValueList<RemoteDevice>::ConstIterator it; for( it = newDevices.begin(); it != newDevices.end() ; ++it ) { if (find( (*it) )) // is already inserted continue; - deviceItem = new BTDeviceItem( ListView2 , (*it) ); + deviceItem = new BTDeviceItem( devicesView , (*it) ); deviceItem->setPixmap( 1, m_findPix ); deviceItem->setExpandable ( true ); // look if device is avail. atm, async deviceActive( (*it) ); // ggf auch hier? addServicesToDevice( deviceItem ); } } /** * Action that is toggled on entrys on click */ void BlueBase::startServiceActionClicked( QListViewItem */*item*/ ) {} /** * Action that are toggled on hold (mostly QPopups i guess) */ void BlueBase::startServiceActionHold( QListViewItem * item, const QPoint & point, int /*column*/ ) { @@ -466,144 +466,144 @@ void BlueBase::addServicesToDevice( const QString& device, Services::ValueList s { classId = classIt.key(); } serviceItem->setPixmap( 0, m_iconLoader->serviceIcon( classId ) ); } } else { Services s1; s1.setServiceName( tr("no services found") ); serviceItem = new BTServiceItem( deviceItem, s1 ); } // now remove them from the list m_deviceList.remove( it ); } void BlueBase::addSignalStrength() { - QListViewItemIterator it( ListView4 ); + QListViewItemIterator it( connectionsView ); for ( ; it.current(); ++it ) { m_localDevice->signalStrength( ((BTConnectionItem*)it.current() )->connection().mac() ); } QTimer::singleShot( 5000, this, SLOT( addSignalStrength() ) ); } void BlueBase::addSignalStrength( const QString& mac, const QString& strength ) { - QListViewItemIterator it( ListView4 ); + QListViewItemIterator it( connectionsView ); for ( ; it.current(); ++it ) { if( ((BTConnectionItem*)it.current())->connection().mac() == mac ) { ((BTConnectionItem*)it.current() )->setSignalStrength( strength ); } } } /** * Add the existing connections (pairs) to the connections tab. * This one triggers the search */ void BlueBase::addConnectedDevices() { m_localDevice->searchConnections(); } /** * This adds the found connections to the connection tab. * @param connectionList the ValueList with all current connections */ void BlueBase::addConnectedDevices( ConnectionState::ValueList connectionList ) { QValueList<OpieTooth::ConnectionState>::Iterator it; BTConnectionItem * connectionItem; if ( !connectionList.isEmpty() ) { for (it = connectionList.begin(); it != connectionList.end(); ++it) { - QListViewItemIterator it2( ListView4 ); + QListViewItemIterator it2( connectionsView ); bool found = false; for ( ; it2.current(); ++it2 ) { if( ( (BTConnectionItem*)it2.current())->connection().mac() == (*it).mac() ) { found = true; } } if ( found == false ) { - connectionItem = new BTConnectionItem( ListView4, (*it) ); + connectionItem = new BTConnectionItem( connectionsView, (*it) ); if( m_deviceList.find((*it).mac()).data() ) { connectionItem->setName( m_deviceList.find( (*it).mac()).data()->name() ); } } } - QListViewItemIterator it2( ListView4 ); + QListViewItemIterator it2( connectionsView ); for ( ; it2.current(); ++it2 ) { bool found = false; for (it = connectionList.begin(); it != connectionList.end(); ++it) { if( ( ((BTConnectionItem*)it2.current())->connection().mac() ) == (*it).mac() ) { found = true; } } if ( !found ) { delete it2.current(); } } } else { - ListView4->clear(); + connectionsView->clear(); ConnectionState con; con.setMac( tr("No connections found") ); - connectionItem = new BTConnectionItem( ListView4 , con ); + connectionItem = new BTConnectionItem( connectionsView , con ); } // recall connection search after some time QTimer::singleShot( 15000, this, SLOT( addConnectedDevices() ) ); } /** * Find out if a device can currently be reached * @param device */ void BlueBase::deviceActive( const RemoteDevice &device ) { // search by mac, async, gets a signal back // We should have a BTDeviceItem there or where does it get added to the map -zecke m_localDevice->isAvailable( device.mac() ); } /** * The signal catcher. Set the avail. status on device. * @param device - the mac address * @param connected - if it is avail. or not */ @@ -652,39 +652,39 @@ void BlueBase::startScan() void BlueBase::setInfo() { StatusLabel->setText( status() ); } /** * Decontructor */ BlueBase::~BlueBase() { writeSavedDevices(); delete m_iconLoader; } /** * find searches the ListView for a BTDeviceItem containig * the same Device if found return true else false * @param dev RemoteDevice to find * @return returns true if found */ bool BlueBase::find( const RemoteDevice& rem ) { - QListViewItemIterator it( ListView2 ); + QListViewItemIterator it( devicesView ); BTListItem* item; BTDeviceItem* device; for (; it.current(); ++it ) { item = (BTListItem*) it.current(); if ( item->typeId() != BTListItem::Device ) continue; device = (BTDeviceItem*)item; if ( rem.equals( device->remoteDevice() ) ) return true; } return false; // not found } diff --git a/noncore/net/opietooth/manager/bluetoothbase.ui b/noncore/net/opietooth/manager/bluetoothbase.ui index 2d14b8f..cbde3c6 100644 --- a/noncore/net/opietooth/manager/bluetoothbase.ui +++ b/noncore/net/opietooth/manager/bluetoothbase.ui @@ -1,38 +1,38 @@ <!DOCTYPE UI><UI> <class>BluetoothBase</class> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>BluetoothBase</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>297</width> + <width>293</width> <height>382</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form1</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <widget row="0" column="0" > <class>QTabWidget</class> @@ -76,49 +76,49 @@ <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>Online</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <property stdset="1"> <name>name</name> - <cstring>ListView2</cstring> + <cstring>devicesView</cstring> </property> </widget> <widget> <class>QPushButton</class> <property stdset="1"> <name>name</name> <cstring>PushButton2</cstring> </property> <property stdset="1"> <name>sizePolicy</name> <sizepolicy> <hsizetype>0</hsizetype> <vsizetype>0</vsizetype> </sizepolicy> </property> <property stdset="1"> <name>text</name> <string>&Rescan Devices</string> </property> </widget> </vbox> </widget> <widget> <class>QWidget</class> @@ -164,49 +164,49 @@ <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>Signal</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <property stdset="1"> <name>name</name> - <cstring>ListView4</cstring> + <cstring>connectionsView</cstring> </property> </widget> </vbox> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Config</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <widget row="1" column="0" > diff --git a/noncore/net/opietooth/manager/devicedialog.ui b/noncore/net/opietooth/manager/devicedialog.ui index 2ecfd4c..f5cd9ab 100644 --- a/noncore/net/opietooth/manager/devicedialog.ui +++ b/noncore/net/opietooth/manager/devicedialog.ui @@ -1,38 +1,38 @@ <!DOCTYPE UI><UI> <class>DeviceDialog</class> <widget> <class>QDialog</class> <property stdset="1"> <name>name</name> <cstring>DeviceDialog</cstring> </property> <property stdset="1"> <name>geometry</name> <rect> <x>0</x> <y>0</y> - <width>275</width> + <width>267</width> <height>323</height> </rect> </property> <property stdset="1"> <name>caption</name> <string>Form2</string> </property> <property> <name>layoutMargin</name> </property> <property> <name>layoutSpacing</name> </property> <grid> <property stdset="1"> <name>margin</name> <number>6</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="0" column="0" > <class>QTabWidget</class> @@ -48,134 +48,134 @@ </property> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Services</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="1" column="0" > <class>QPushButton</class> <property stdset="1"> <name>name</name> - <cstring>PushButton5</cstring> + <cstring>applyChanges</cstring> </property> <property stdset="1"> <name>text</name> <string>&Apply Changes</string> </property> </widget> <widget row="0" column="0" > <class>QListView</class> <column> <property> <name>text</name> <string>active</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <column> <property> <name>text</name> <string>service name</string> </property> <property> <name>clickable</name> <bool>true</bool> </property> <property> <name>resizeable</name> <bool>true</bool> </property> </column> <property stdset="1"> <name>name</name> - <cstring>ListView1</cstring> + <cstring>serviceView</cstring> </property> </widget> </grid> </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Settings</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>3</number> </property> <widget row="1" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel8</cstring> </property> <property stdset="1"> <name>text</name> <string>Default PIN Code</string> </property> </widget> <widget row="1" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>LineEdit6</cstring> + <cstring>defaultPinCode</cstring> </property> </widget> <widget row="0" column="1" > <class>QLineEdit</class> <property stdset="1"> <name>name</name> - <cstring>LineEdit1</cstring> + <cstring>deviceName</cstring> </property> </widget> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> <cstring>TextLabel5</cstring> </property> <property stdset="1"> <name>text</name> <string>Change device name</string> </property> </widget> <spacer row="2" column="0" > <property> <name>name</name> <cstring>Spacer1</cstring> </property> <property stdset="1"> <name>orientation</name> <enum>Vertical</enum> </property> <property stdset="1"> <name>sizeType</name> @@ -193,37 +193,37 @@ </widget> <widget> <class>QWidget</class> <property stdset="1"> <name>name</name> <cstring>tab</cstring> </property> <attribute> <name>title</name> <string>Information</string> </attribute> <grid> <property stdset="1"> <name>margin</name> <number>4</number> </property> <property stdset="1"> <name>spacing</name> <number>2</number> </property> <widget row="0" column="0" > <class>QLabel</class> <property stdset="1"> <name>name</name> - <cstring>DeviceInfoLabel</cstring> + <cstring>deviceInfoLabel</cstring> </property> <property stdset="1"> <name>text</name> <string>TextLabel9</string> </property> </widget> </grid> </widget> </widget> </grid> </widget> </UI> diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp index bccc6c2..160e8dd 100644 --- a/noncore/net/opietooth/manager/scandialog.cpp +++ b/noncore/net/opietooth/manager/scandialog.cpp @@ -35,130 +35,130 @@ 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" ); + serviceView = new QListView( this, "serviceView" ); - //ListView1->addColumn( tr( "Add" ) ); - ListView1->addColumn( tr( "Add Device" ) ); - //ListView1->addColumn( tr( "Type" ) ); + //serviceView->addColumn( tr( "Add" ) ); + serviceView->addColumn( tr( "Add Device" ) ); + //serviceView->addColumn( tr( "Type" ) ); - Layout11->addWidget( ListView1 ); + Layout11->addWidget( serviceView ); 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; progress->setProgress(0); progressStat = 0; // empty list before a new scan - ListView1->clear(); + serviceView->clear(); progressTimer(); // when finished, it emmite foundDevices() // checken ob initialisiert , qcop ans applet. StartStopButton->setText( tr( "Stop scan" ) ); localDevice->searchDevices(); } void ScanDialog::stopSearch() { m_search = true; } void ScanDialog::fillList(const QString&, RemoteDevice::ValueList deviceList) { progress->setProgress(0); progressStat = 0; QCheckListItem * deviceItem; RemoteDevice::ValueList::Iterator it; for( it = deviceList.begin(); it != deviceList.end(); ++it ) { - deviceItem = new QCheckListItem( ListView1, (*it).name(), QCheckListItem::CheckBox ); + deviceItem = new QCheckListItem( serviceView, (*it).name(), QCheckListItem::CheckBox ); deviceItem->setText( 1, (*it).mac() ); } m_search = false; StartStopButton->setText( tr( "Start scan" ) ); } /** * Iterates trough the items, and collects the checked items. * Then it emits it, so the manager can connect to the signal to fill the listing. */ void ScanDialog::emitToManager() { - if (!ListView1) { + if (!serviceView) { return; } QValueList<RemoteDevice> deviceList; - QListViewItemIterator it( ListView1 ); + QListViewItemIterator it( serviceView ); for ( ; it.current(); ++it ) { if ( ( (QCheckListItem*)it.current() )->isOn() ) { RemoteDevice device( it.current()->text(1), it.current()->text(0) ); deviceList.append( device ); } } emit selectedDevices( deviceList ); } /** * Cleanup */ ScanDialog::~ScanDialog() { owarn << "delete scan dialog" << oendl; delete localDevice; } } diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h index a644e96..2b04964 100644 --- a/noncore/net/opietooth/manager/scandialog.h +++ b/noncore/net/opietooth/manager/scandialog.h @@ -25,49 +25,49 @@ class QVBoxLayout; class QGridLayout; class QLabel; class QListView; class QListViewItem; class QPushButton; class QProgressBar; namespace OpieTooth { class Manager; class Device; class ScanDialog : public QDialog { Q_OBJECT public: ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); ~ScanDialog(); private: QProgressBar* progress; QPushButton* StartStopButton; - QListView* ListView1; + QListView* serviceView; public slots: void accept(); protected: QVBoxLayout* Layout11; private slots: void stopSearch(); void startSearch(); void progressTimer(); void fillList( const QString& device, RemoteDevice::ValueList list ); private: bool m_search:1; void emitToManager(); Manager *localDevice; int progressStat; signals: void selectedDevices( const QValueList<RemoteDevice>& ); }; |