summaryrefslogtreecommitdiff
path: root/noncore
authorharlekin <harlekin>2002-06-15 19:30:18 (UTC)
committer harlekin <harlekin>2002-06-15 19:30:18 (UTC)
commitef75752efaef84e4b7350f9768f3cb3c4fd744af (patch) (side-by-side diff)
tree214003e2d50a1f9c982b4f3fbcc3f4fd3f0e1ba1 /noncore
parenta041cfe9806d7089d469e14da125adab4a93a5ab (diff)
downloadopie-ef75752efaef84e4b7350f9768f3cb3c4fd744af.zip
opie-ef75752efaef84e4b7350f9768f3cb3c4fd744af.tar.gz
opie-ef75752efaef84e4b7350f9768f3cb3c4fd744af.tar.bz2
wip
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/bluebase.cpp138
-rw-r--r--noncore/net/opietooth/manager/bluebase.h32
-rw-r--r--noncore/net/opietooth/manager/main.cpp6
-rw-r--r--noncore/net/opietooth/manager/manager.pro6
-rw-r--r--noncore/net/opietooth/manager/scandialog.cpp113
-rw-r--r--noncore/net/opietooth/manager/scandialog.h71
-rw-r--r--noncore/net/opietooth/manager/scandialog.ui155
7 files changed, 277 insertions, 244 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp
index 3d446f0..c905ea3 100644
--- a/noncore/net/opietooth/manager/bluebase.cpp
+++ b/noncore/net/opietooth/manager/bluebase.cpp
@@ -37,129 +37,129 @@
#include <qpe/resource.h>
#include <qpe/config.h>
-BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
- : BluetoothBase( parent, name, fl ) {
+namespace OpieTooth {
- QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan()));
- QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges()));
- 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);
+ BlueBase::BlueBase( QWidget* parent, const char* name, WFlags fl )
+ : BluetoothBase( parent, name, fl ) {
- readConfig();
- initGui();
-}
-/**
+ QObject::connect( (QObject*) PushButton2, SIGNAL( clicked() ), this, SLOT(startScan()));
+ QObject::connect((QObject*)configApplyButton, SIGNAL(clicked() ), this, SLOT(applyConfigChanges()));
+
+ 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);
+
+ readConfig();
+ initGui();
+ }
+
+/**
* Reads all options from the config file
*/
-void BlueBase::readConfig() {
+ void BlueBase::readConfig() {
- Config cfg("bluetoothmanager");
- cfg.setGroup("bluezsettings");
-
+ Config cfg("bluetoothmanager");
+ cfg.setGroup("bluezsettings");
- deviceName = cfg.readEntry("name", "No name"); // name the device should identify with
- defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak
- useEncryption = cfg.readNumEntry("useEncryption", 1);
- enableAuthentification = cfg.readNumEntry("enableAuthentification", 1);
- enablePagescan = cfg.readNumEntry("enablePagescan",1);
- enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1);
-}
+ deviceName = cfg.readEntry("name", "No name"); // name the device should identify with
+ defaultPasskey = cfg.readEntryCrypt("passkey", ""); // <- hmm, look up how good the trolls did that, maybe too weak
+ useEncryption = cfg.readNumEntry("useEncryption", 1);
+ enableAuthentification = cfg.readNumEntry("enableAuthentification", 1);
+ enablePagescan = cfg.readNumEntry("enablePagescan",1);
+ enableInquiryscan = cfg.readNumEntry("enableInquiryscan", 1);
+
+ }
/**
* Writes all options to the config file
*/
-void BlueBase::writeConfig() {
-
+ void BlueBase::writeConfig() {
- Config cfg("bluetoothmanager");
- cfg.setGroup("bluezsettings");
-
- cfg.writeEntry("name", deviceName);
- cfg.writeEntryCrypt("passkey", defaultPasskey);
- cfg.writeEntry("useEncryption", useEncryption);
- cfg.writeEntry("enableAuthentification", enableAuthentification);
- cfg.writeEntry("enablePagescan",enablePagescan);
- cfg.writeEntry("enableInquiryscan", enableInquiryscan);
+ Config cfg("bluetoothmanager");
+ cfg.setGroup("bluezsettings");
+ cfg.writeEntry("name", deviceName);
+ cfg.writeEntryCrypt("passkey", defaultPasskey);
+ cfg.writeEntry("useEncryption", useEncryption);
+ cfg.writeEntry("enableAuthentification", enableAuthentification);
+ cfg.writeEntry("enablePagescan",enablePagescan);
+ cfg.writeEntry("enableInquiryscan", enableInquiryscan);
}
/**
- * Set up the gui
+ * Set up the gui
*/
-void BlueBase::initGui() {
+ void BlueBase::initGui() {
- StatusLabel->setText(getStatus()); // maybe move it to getStatus()
-
- cryptCheckBox->setChecked(useEncryption);
- authCheckBox->setChecked(enableAuthentification);
- pagescanCheckBox->setChecked(enablePagescan);
- inquiryscanCheckBox->setChecked(enableInquiryscan);
- deviceNameLine->setText(deviceName);
- passkeyLine->setText(defaultPasskey);
+ StatusLabel->setText(getStatus()); // maybe move it to getStatus()
+ cryptCheckBox->setChecked(useEncryption);
+ authCheckBox->setChecked(enableAuthentification);
+ pagescanCheckBox->setChecked(enablePagescan);
+ inquiryscanCheckBox->setChecked(enableInquiryscan);
+ deviceNameLine->setText(deviceName);
+ passkeyLine->setText(defaultPasskey);
}
/**
* Get the status informations and returns it
* @return QString the status informations gathered
*/
-QString BlueBase::getStatus(){
+ QString BlueBase::getStatus(){
- return ("manger.h need also a status method");
+ return ("manger.h need also a status method");
-}
+ }
/**
* Read the current values from the gui and invoke writeConfig()
*/
-void BlueBase::applyConfigChanges() {
+ void BlueBase::applyConfigChanges() {
- deviceName = deviceNameLine->text();
- defaultPasskey = passkeyLine->text();
- useEncryption = cryptCheckBox->isChecked();
- enableAuthentification = authCheckBox->isChecked();
- enablePagescan = pagescanCheckBox->isChecked();
- enableInquiryscan = inquiryscanCheckBox->isChecked();
+ deviceName = deviceNameLine->text();
+ defaultPasskey = passkeyLine->text();
+ useEncryption = cryptCheckBox->isChecked();
+ enableAuthentification = authCheckBox->isChecked();
+ enablePagescan = pagescanCheckBox->isChecked();
+ enableInquiryscan = inquiryscanCheckBox->isChecked();
- writeConfig();
+ writeConfig();
- QMessageBox* box = new QMessageBox(this, "Test");
- box->setText(tr("Changes applied"));
- box->show();
+ QMessageBox* box = new QMessageBox(this, "Test");
+ box->setText(tr("Changes applied"));
+ box->show();
// falls nötig hcid killhupen - die funktionalität adden
-
-
}
/**
* Open the "scan for devices" dialog
*/
-void BlueBase::startScan() {
- ScanDialog *scan = new ScanDialog( this, "", true);
- scan->exec();
-}
+ void BlueBase::startScan() {
+ ScanDialog *scan = new ScanDialog( this, "", true);
+ scan->exec();
+ }
/**
* Decontructor
*/
-BlueBase::~BlueBase(){
-}
+ BlueBase::~BlueBase(){
+ }
+}
diff --git a/noncore/net/opietooth/manager/bluebase.h b/noncore/net/opietooth/manager/bluebase.h
index fb1844c..023af7a 100644
--- a/noncore/net/opietooth/manager/bluebase.h
+++ b/noncore/net/opietooth/manager/bluebase.h
@@ -17,40 +17,42 @@ class QLabel;
class QPushButton;
class QTabWidget;
class QCheckBox;
-class BlueBase : public BluetoothBase {
- Q_OBJECT
+namespace OpieTooth {
-public:
- BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
- ~BlueBase();
+ class BlueBase : public BluetoothBase {
+ Q_OBJECT
-protected:
+ public:
+ BlueBase( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ ~BlueBase();
+ protected:
- private slots:
- void startScan();
- private:
+ private slots:
+ void startScan();
+
+ private:
void readConfig();
void writeConfig();
QString getStatus();
void initGui();
-
+
QString deviceName;
QString defaultPasskey;
int useEncryption;
int enableAuthentification;
int enablePagescan;
- int enableInquiryscan;
-
+ int enableInquiryscan;
+
private slots:
-
- void applyConfigChanges();
-};
+ void applyConfigChanges();
+ };
+}
#endif
diff --git a/noncore/net/opietooth/manager/main.cpp b/noncore/net/opietooth/manager/main.cpp
index d566419..a86e36d 100644
--- a/noncore/net/opietooth/manager/main.cpp
+++ b/noncore/net/opietooth/manager/main.cpp
@@ -19,18 +19,20 @@
#include "bluebase.h"
#include <qpe/qpeapplication.h>
+
QPEApplication *BluetoothApp;
int main( int argc, char ** argv ) {
QPEApplication a(argc, argv);
BluetoothApp=&a;
- BlueBase t;
+ OpieTooth::BlueBase t;
- t.setCaption( BlueBase::tr("Bluetooth Manager") );
+ // t.setCaption( OpieTooth::BlueBase::tr("Bluetooth Manager") );
a.showMainWidget(&t);
return a.exec();
}
+
diff --git a/noncore/net/opietooth/manager/manager.pro b/noncore/net/opietooth/manager/manager.pro
index c369eba..5f0a62c 100644
--- a/noncore/net/opietooth/manager/manager.pro
+++ b/noncore/net/opietooth/manager/manager.pro
@@ -1,12 +1,12 @@
TEMPLATE = app
#CONFIG = qt warn_on debug
CONFIG = qt warn_on release
-HEADERS = bluebase.h
-SOURCES = main.cpp bluebase.cpp
+HEADERS = bluebase.h scandialog.h
+SOURCES = main.cpp bluebase.cpp scandialog.cpp
INCLUDEPATH += $(OPIEDIR)/include
INCLUDEPATH += $(OPIEDIR)/noncore/opietooth/lib
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopietooth
-INTERFACES = bluetoothbase.ui devicedialog.ui scandialog.ui
+INTERFACES = bluetoothbase.ui devicedialog.ui
TARGET = $(OPIEDIR)/bin/bluetooth-manager
diff --git a/noncore/net/opietooth/manager/scandialog.cpp b/noncore/net/opietooth/manager/scandialog.cpp
new file mode 100644
index 0000000..3ddba3e
--- a/dev/null
+++ b/noncore/net/opietooth/manager/scandialog.cpp
@@ -0,0 +1,113 @@
+/* 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 <qframe.h>
+#include <qheader.h>
+#include <qlabel.h>
+#include <qlistview.h>
+#include <qpushbutton.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+
+#include <manager.h>
+#include <device.h>
+#include <remotedevice.h>
+
+
+namespace OpieTooth {
+
+/*
+
+ */
+ ScanDialog::ScanDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
+ : QDialog( parent, name, modal, fl ) {
+
+ if ( !name )
+ setName( "ScanDialog" );
+ resize( 360, 392 );
+ setCaption( tr( "Scan for devices" ) );
+
+ Frame7 = new QFrame( this, "Frame7" );
+ Frame7->setGeometry( QRect( 0, 0, 240, 331 ) );
+ Frame7->setFrameShape( QFrame::StyledPanel );
+ Frame7->setFrameShadow( QFrame::Raised );
+
+ QWidget* privateLayoutWidget = new QWidget( Frame7, "Layout11" );
+ privateLayoutWidget->setGeometry( QRect( 10, 9, 221, 310 ) );
+ Layout11 = new QGridLayout( privateLayoutWidget );
+ Layout11->setSpacing( 6 );
+ Layout11->setMargin( 0 );
+
+
+ TextLabel10 = new QLabel( privateLayoutWidget, "TextLabel10" );
+ TextLabel10->setText( tr( "ersetzen durch qprogressbar" ) );
+
+ Layout11->addMultiCellWidget( TextLabel10, 1, 1, 0, 1 );
+
+ StartButton = new QPushButton( privateLayoutWidget, "PushButton13" );
+ StartButton->setText( tr( "Start" ) );
+
+ Layout11->addWidget( StartButton, 2, 0 );
+
+ PushButton6 = new QPushButton( privateLayoutWidget, "PushButton6" );
+ PushButton6->setText( tr( "Stop" ) );
+
+ Layout11->addWidget( PushButton6, 2, 1 );
+
+ ListView1 = new QListView( privateLayoutWidget, "ListView1" );
+
+ // ListView1->addColumn( tr( "In List" ) );
+ ListView1->addColumn( tr( "Device Name" ) );
+ //ListView1->addColumn( tr( "Type" ) );
+
+ Layout11->addMultiCellWidget( ListView1, 0, 0, 0, 1 );
+
+ connect( (QObject*)StartButton, SIGNAL( clicked() ), this, SLOT( startSearch() ) );
+ connect( (QObject*)localDevice, SIGNAL( foundDevices( const QString& , RemoteDevices::ValueList ) ),
+ this, SLOT(fillList(const QString& , RemoteDevices::ValueList ) ) ) ;
+ }
+
+ void ScanDialog::startSearch() {
+ // read it from config later
+ localDevice = new Manager( "hci0" );
+ localDevice->searchDevices();
+ }
+
+
+ void ScanDialog::fillList(const QString& device, RemoteDevices::ValueList deviceList) {
+
+
+ RemoteDevices::ValueList::Iterator it;
+ for( it = deviceList.begin(); it != deviceList.end(); ++it ) {
+
+
+ }
+ }
+
+/*
+ * Cleanup
+ */
+ ScanDialog::~ScanDialog() {
+ delete localDevice;
+ }
+
+}
diff --git a/noncore/net/opietooth/manager/scandialog.h b/noncore/net/opietooth/manager/scandialog.h
new file mode 100644
index 0000000..5cebb11
--- a/dev/null
+++ b/noncore/net/opietooth/manager/scandialog.h
@@ -0,0 +1,71 @@
+/* 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. *
+ * *
+ ***************************************************************************/
+
+
+#ifndef SCANDIALOG_H
+#define SCANDIALOG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+
+
+#include <remotedevice.h>
+
+class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
+class QFrame;
+class QLabel;
+class QListView;
+class QListViewItem;
+class QPushButton;
+
+class Manager;
+class Device;
+
+
+namespace OpieTooth {
+
+
+
+ class ScanDialog : public QDialog {
+ Q_OBJECT
+
+ public:
+ ScanDialog( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~ScanDialog();
+
+ QFrame* Frame7;
+ QLabel* TextLabel10;
+ QPushButton* StartButton;
+ QPushButton* PushButton6;
+ QListView* ListView1;
+
+
+ protected:
+ QGridLayout* Layout11;
+
+ private slots:
+ void startSearch();
+ void fillList(const QString& device, RemoteDevices::ValueList list);
+
+ private:
+
+ Manager *localDevice;
+ };
+
+}
+
+#endif // SCANDIALOG_H
diff --git a/noncore/net/opietooth/manager/scandialog.ui b/noncore/net/opietooth/manager/scandialog.ui
deleted file mode 100644
index 37847ba..0000000
--- a/noncore/net/opietooth/manager/scandialog.ui
+++ b/dev/null
@@ -1,155 +0,0 @@
-<!DOCTYPE UI><UI>
-<class>ScanDialog</class>
-<widget>
- <class>QDialog</class>
- <property stdset="1">
- <name>name</name>
- <cstring>ScanDialog</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>360</width>
- <height>392</height>
- </rect>
- </property>
- <property stdset="1">
- <name>caption</name>
- <string>Form3</string>
- </property>
- <widget>
- <class>QFrame</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Frame7</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>0</x>
- <y>0</y>
- <width>240</width>
- <height>331</height>
- </rect>
- </property>
- <property stdset="1">
- <name>frameShape</name>
- <enum>StyledPanel</enum>
- </property>
- <property stdset="1">
- <name>frameShadow</name>
- <enum>Raised</enum>
- </property>
- <widget>
- <class>QLayoutWidget</class>
- <property stdset="1">
- <name>name</name>
- <cstring>Layout11</cstring>
- </property>
- <property stdset="1">
- <name>geometry</name>
- <rect>
- <x>10</x>
- <y>9</y>
- <width>221</width>
- <height>310</height>
- </rect>
- </property>
- <grid>
- <property stdset="1">
- <name>margin</name>
- <number>0</number>
- </property>
- <property stdset="1">
- <name>spacing</name>
- <number>6</number>
- </property>
- <widget row="1" column="0" rowspan="1" colspan="2" >
- <class>QLabel</class>
- <property stdset="1">
- <name>name</name>
- <cstring>TextLabel10</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>ersetzen durch qprogressbar</string>
- </property>
- </widget>
- <widget row="2" column="0" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>PushButton13</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Start</string>
- </property>
- </widget>
- <widget row="2" column="1" >
- <class>QPushButton</class>
- <property stdset="1">
- <name>name</name>
- <cstring>PushButton6</cstring>
- </property>
- <property stdset="1">
- <name>text</name>
- <string>Stop</string>
- </property>
- </widget>
- <widget row="0" column="0" rowspan="1" colspan="2" >
- <class>QListView</class>
- <column>
- <property>
- <name>text</name>
- <string>In List</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>Device Name</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>Type</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>
- </property>
- </widget>
- </grid>
- </widget>
- </widget>
-</widget>
-</UI>