summaryrefslogtreecommitdiff
authorkorovkin <korovkin>2006-03-25 18:10:13 (UTC)
committer korovkin <korovkin>2006-03-25 18:10:13 (UTC)
commitc4f82599db775f52c7e04cce09c7c45ecc89ccfd (patch) (unidiff)
tree81d48e5363a2135bb6820510ae7f5dee9999e8f2
parentda3c4a6231882bc56266162415a8d1a2a1bf0293 (diff)
downloadopie-c4f82599db775f52c7e04cce09c7c45ecc89ccfd.zip
opie-c4f82599db775f52c7e04cce09c7c45ecc89ccfd.tar.gz
opie-c4f82599db775f52c7e04cce09c7c45ecc89ccfd.tar.bz2
Added RFCOMM binding table functionality.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/manager/TODO.txt5
-rw-r--r--noncore/net/opietooth/manager/btdeviceitem.cpp2
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp115
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogimpl.h40
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogitem.cpp9
-rw-r--r--noncore/net/opietooth/manager/rfcommassigndialogitem.h4
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.cpp98
-rw-r--r--noncore/net/opietooth/manager/rfcommconfhandler.h7
-rw-r--r--noncore/net/opietooth/manager/rfcommdialogitembase.ui298
-rw-r--r--noncore/net/opietooth/manager/rfcpopup.cpp3
10 files changed, 349 insertions, 232 deletions
diff --git a/noncore/net/opietooth/manager/TODO.txt b/noncore/net/opietooth/manager/TODO.txt
index e6bd9b1..76fae68 100644
--- a/noncore/net/opietooth/manager/TODO.txt
+++ b/noncore/net/opietooth/manager/TODO.txt
@@ -1,5 +1,4 @@
11. Make bind table edit /etc/bluetooth/rfcomm.conf file. 11. Add an rfcomm port number to the connection dialog.
22. Add an rfcomm port number to the connection dialog. 22. Collect requirements from others.
33. Collect requirements from others.
4 3
5//eof 4//eof
diff --git a/noncore/net/opietooth/manager/btdeviceitem.cpp b/noncore/net/opietooth/manager/btdeviceitem.cpp
index fb1b1c1..c112463 100644
--- a/noncore/net/opietooth/manager/btdeviceitem.cpp
+++ b/noncore/net/opietooth/manager/btdeviceitem.cpp
@@ -7,7 +7,7 @@ using namespace OpieTooth;
7BTDeviceItem::BTDeviceItem( QListView* parent, const RemoteDevice& dev ) 7BTDeviceItem::BTDeviceItem( QListView* parent, const RemoteDevice& dev )
8 : BTListItem( parent ) { 8 : BTListItem( parent ) {
9 9
10 setText( 0, dev.name() ); 10 setText( 0, dev.name().utf8() );
11 m_device = dev; 11 m_device = dev;
12}; 12};
13BTDeviceItem::~BTDeviceItem() { 13BTDeviceItem::~BTDeviceItem() {
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
index be720b8..7943deb 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp
@@ -1,3 +1,13 @@
1/* $Id$ */
2/* RFCOMM binding table edit dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1 11
2#include "rfcommassigndialogimpl.h" 12#include "rfcommassigndialogimpl.h"
3#include "rfcommassigndialogitem.h" 13#include "rfcommassigndialogitem.h"
@@ -22,17 +32,16 @@ using namespace OpieTooth;
22RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) 32RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl )
23 : RfcommAssignDialogBase( parent, name, modal, fl ) 33 : RfcommAssignDialogBase( parent, name, modal, fl )
24{ 34{
25
26 m_range = 5; 35 m_range = 5;
27 36
28 m_scrollView = new QScrollView( this ); 37 m_scrollView = new QScrollView(this);
29 m_scrollView->setResizePolicy( QScrollView::AutoOneFit ); 38 m_scrollView->setResizePolicy( QScrollView::AutoOneFit );
30 m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff ); 39 m_scrollView->setHScrollBarMode( QScrollView::AlwaysOff );
31 40
32 RfcommAssignDialogBaseLayout->addWidget( m_scrollView ); 41 RfcommAssignDialogBaseLayout->addWidget(m_scrollView);
33 42
34 m_box = new QVBox( m_scrollView->viewport() ); 43 m_box = new QVBox(m_scrollView->viewport());
35 m_scrollView->addChild( m_box ); 44 m_scrollView->addChild(m_box);
36 45
37 confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" ); 46 confHandler = new RfCommConfHandler( "/etc/bluetooth/rfcomm.conf" );
38 47
@@ -48,92 +57,98 @@ RfcommAssignDialog::~RfcommAssignDialog()
48} 57}
49 58
50 59
51void RfcommAssignDialog::newDevice( const QString & mac ) 60void RfcommAssignDialog::newDevice(const QString & mac, int channel)
52{ 61{
53 62
54 for ( int i = 0 ; i < m_range; i++ ) 63 for ( int i = 0 ; i < m_range; i++ )
55 { 64 {
56
57 QMap<QString, RfCommConfObject*>::Iterator it; 65 QMap<QString, RfCommConfObject*>::Iterator it;
58 it = confHandler->foundEntries().find( QString("%1").arg( i ) ); 66 it = confHandler->foundEntries().find(QString::number(i));
59 // make sure that rfcommX is not assigned yet 67 // make sure that rfcommX is not assigned yet
60 if ( it == confHandler->foundEntries().end() ) 68 if ( it == confHandler->foundEntries().end() )
61 { 69 {
62 QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); 70 QDialog dialog( this, "newdevice", true, WStyle_ContextHelp );
63 dialog.setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, 71 dialog.setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7,
64 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth())); 72 (QSizePolicy::SizeType)7, sizePolicy().hasHeightForWidth()));
65 73 QVBoxLayout layout(&dialog);
66 RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); 74 layout.setSpacing( 0 );
67 newDev->setIdent( i ); 75 layout.setMargin( 0 );
68 newDev->setMac( mac ); 76
77 RfcommDialogItem newDev(&dialog);
78 newDev.setIdent( i );
79 newDev.setMac( mac );
80 newDev.setChannel( channel );
81 layout.addWidget(&newDev);
69 82
70 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) 83 if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted )
71 { 84 {
72 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 85 QMap<int, RfcommDialogItem*>::Iterator it;
73 m_itemList.insert( i , rfcomm ); 86 it = m_itemList.find( i );
87 RfcommDialogItem *rfcomm = it.data();
74 rfcomm->setIdent( i ); 88 rfcomm->setIdent( i );
75 rfcomm->setMac( mac ); 89 rfcomm->setMac( mac );
76 rfcomm->setChannel( newDev->channel() ); 90 rfcomm->setChannel( newDev.channel() );
77 rfcomm->setComment( newDev->comment() ); 91 rfcomm->setComment( newDev.comment() );
92 rfcomm->setBind( newDev.isBind() );
78 odebug << "New device set up" << oendl; 93 odebug << "New device set up" << oendl;
79 } 94 }
95 break;
80 } 96 }
81 } 97 }
82} 98}
83 99
100/*
101 * Load rfcomm bind configuration
102 */
84void RfcommAssignDialog::loadConfig() 103void RfcommAssignDialog::loadConfig()
85{ 104{
86
87 //Config cfg( "bluetoothmanager-rfcommbind" );
88
89 for ( int i = 0 ; i < m_range; i++ ) 105 for ( int i = 0 ; i < m_range; i++ )
90 { 106 {
91 // cfg.setGroup( QString("%1").arg( i ) );
92 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); 107 RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box );
93 m_itemList.insert( i , rfcomm ); 108 m_itemList.insert(i, rfcomm);
94 rfcomm->setIdent( i ); 109 rfcomm->setIdent(i);
95 QMap<QString, RfCommConfObject*>::Iterator it; 110 QMap<QString, RfCommConfObject*>::Iterator it;
96 it = confHandler->foundEntries().find( QString("%1").arg( i ) ); 111 it = confHandler->foundEntries().find(QString::number(i));
97 if ( it != confHandler->foundEntries().end() ) 112 if (it != confHandler->foundEntries().end())
98 { 113 {
99 odebug << "Found key in foundEntries() " << oendl; 114 rfcomm->setMac(it.data()->mac());
100 rfcomm->setMac( it.data()->mac() ); 115 rfcomm->setChannel(it.data()->channel());
101 rfcomm->setChannel( it.data()->channel() ); 116 rfcomm->setComment(it.data()->comment());
102 rfcomm->setComment( it.data()->comment() ); 117 rfcomm->setBind(it.data()->isBind());
103 } 118 }
104 /* Use rfcomm.conf directly for now
105 * rfcomm->setMac( cfg.readEntry( "mac", "" ) );
106 * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) );
107 * rfcomm->setComment( cfg.readEntry( "comment", "" ) );
108 */
109 } 119 }
110} 120}
111 121
112 122
123/*
124 * Save rfcomm bind configuration
125 */
113void RfcommAssignDialog::saveConfig() 126void RfcommAssignDialog::saveConfig()
114{ 127{
115
116 //Config cfg( "bluetoothmanager-rfcommbind" );
117
118 QMap< int, RfcommDialogItem*>::Iterator it; 128 QMap< int, RfcommDialogItem*>::Iterator it;
119
120 QMap< QString, RfCommConfObject*> outMap; 129 QMap< QString, RfCommConfObject*> outMap;
121 130
122 for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) 131 for( it = m_itemList.begin(); it != m_itemList.end(); ++it )
123 { 132 {
124
125 //cfg.setGroup( QString("%1").arg( it.key() ) );
126 RfcommDialogItem *rfcomm = it.data(); 133 RfcommDialogItem *rfcomm = it.data();
127 134 if (rfcomm->mac().isEmpty())
128 135 continue;
129 outMap.insert( QString( "%1").arg( it.key() ), new RfCommConfObject( it.key(), rfcomm->mac(), rfcomm->channel(), rfcomm->comment() ) ); 136 outMap.insert(QString::number(it.key()),
130 137 new RfCommConfObject(it.key(),
131 138 rfcomm->mac(), rfcomm->channel(), rfcomm->comment(),
132 //cfg.writeEntry( "mac", rfcomm->mac() ); 139 rfcomm->isBind()));
133 //cfg.writeEntry( "channel", rfcomm->channel() );
134 //cfg.writeEntry( "comment", rfcomm->comment() );
135 } 140 }
141 confHandler->save(outMap);
142}
136 143
137 confHandler->save( outMap ); 144/*
138 145 * Reaction on the OK button
146 */
147void RfcommAssignDialog::accept()
148{
149 odebug << "save configuration" << oendl;
150 saveConfig();
151 RfcommAssignDialogBase::accept();
139} 152}
153
154//eof
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h
index 9983632..12cde0e 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.h
+++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.h
@@ -1,3 +1,13 @@
1/* $Id$ */
2/* RFCOMM binding table edit dialog */
3/***************************************************************************
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 ***************************************************************************/
1#ifndef RFCOMMASSIGN 11#ifndef RFCOMMASSIGN
2#define RFCOMMASSIGN 12#define RFCOMMASSIGN
3 13
@@ -12,26 +22,26 @@
12namespace OpieTooth { 22namespace OpieTooth {
13 23
14 class RfcommAssignDialog: public RfcommAssignDialogBase { 24 class RfcommAssignDialog: public RfcommAssignDialogBase {
15 25 Q_OBJECT
16 Q_OBJECT
17
18 public: 26 public:
27 RfcommAssignDialog(QWidget* parent = 0, const char* name = 0,
28 bool modal = 0, WFlags fl = 0);
29 ~RfcommAssignDialog();
19 30
20 RfcommAssignDialog( QWidget* parent = 0, const char* name = 0,bool modal = 0, WFlags fl = 0 ); 31 void loadConfig();
21 ~RfcommAssignDialog(); 32 void saveConfig();
22
23 void loadConfig();
24 void saveConfig();
25 33
26 void newDevice( const QString & mac ); 34 void newDevice( const QString & mac, int channel );
27 35
28 private: 36 private:
29 QScrollView *m_scrollView; 37 QScrollView *m_scrollView;
30 // how many rfcomm devices are possible 38 // how many rfcomm devices are possible
31 int m_range; 39 int m_range;
32 QMap< int, RfcommDialogItem* > m_itemList; 40 QMap< int, RfcommDialogItem* > m_itemList;
33 QVBox *m_box; 41 QVBox *m_box;
34 RfCommConfHandler *confHandler; 42 RfCommConfHandler *confHandler;
43 protected slots:
44 virtual void accept();
35}; 45};
36 46
37} 47}
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp
index a41f304..472b86c 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp
+++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.cpp
@@ -4,6 +4,7 @@
4#include <qlineedit.h> 4#include <qlineedit.h>
5#include <qcombobox.h> 5#include <qcombobox.h>
6#include <qgroupbox.h> 6#include <qgroupbox.h>
7#include <qcheckbox.h>
7 8
8using namespace OpieTooth; 9using namespace OpieTooth;
9 10
@@ -33,6 +34,10 @@ QString RfcommDialogItem::comment() {
33 return m_commentLine->text(); 34 return m_commentLine->text();
34} 35}
35 36
37bool RfcommDialogItem::isBind() {
38 return m_bind->isChecked();
39}
40
36void RfcommDialogItem::setIdent( int ident ) { 41void RfcommDialogItem::setIdent( int ident ) {
37 m_ident = ident; 42 m_ident = ident;
38 m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) ); 43 m_identLabel->setTitle( QString( "rfcomm%1").arg( ident ) );
@@ -50,4 +55,8 @@ void RfcommDialogItem::setComment( const QString &comment ) {
50 m_commentLine->setText( comment ); 55 m_commentLine->setText( comment );
51} 56}
52 57
58void RfcommDialogItem::setBind( bool dobind ) {
59 m_bind->setChecked( dobind );
60}
53 61
62//eof
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogitem.h b/noncore/net/opietooth/manager/rfcommassigndialogitem.h
index 34a794f..cc9c8db 100644
--- a/noncore/net/opietooth/manager/rfcommassigndialogitem.h
+++ b/noncore/net/opietooth/manager/rfcommassigndialogitem.h
@@ -21,11 +21,13 @@ namespace OpieTooth {
21 QString mac(); 21 QString mac();
22 int channel(); 22 int channel();
23 QString comment(); 23 QString comment();
24 bool isBind();
24 25
25 void setIdent( int ident ); 26 void setIdent( int ident );
26 void setMac( const QString& mac ); 27 void setMac( const QString& mac );
27 void setChannel( int channel ); 28 void setChannel( int channel );
28 void setComment( const QString& comment ); 29 void setComment( const QString& comment );
30 void setBind(bool dobind);
29 31
30 private: 32 private:
31 33
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.cpp b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
index f82d2c8..054b446 100644
--- a/noncore/net/opietooth/manager/rfcommconfhandler.cpp
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.cpp
@@ -11,12 +11,13 @@ using namespace OpieTooth;
11// move to lib 11// move to lib
12 12
13 13
14RfCommConfObject::RfCommConfObject( int number, QString mac, int channel, QString comment ) { 14RfCommConfObject::RfCommConfObject(int number, QString mac, int channel,
15 QString comment, bool bind) {
15 m_number = number; 16 m_number = number;
16 m_mac = mac; 17 m_mac = mac;
17 m_channel = channel; 18 m_channel = channel;
18 m_comment = comment; 19 m_comment = comment;
19 // m_foundEntries = 0; 20 m_doBind = bind;
20} 21}
21 22
22void RfCommConfObject::setNumber( int number ) { 23void RfCommConfObject::setNumber( int number ) {
@@ -41,7 +42,6 @@ RfCommConfObject::~RfCommConfObject() {
41 42
42 43
43RfCommConfHandler::RfCommConfHandler( const QString & filename ) { 44RfCommConfHandler::RfCommConfHandler( const QString & filename ) {
44
45 m_filename = filename; 45 m_filename = filename;
46 load(); 46 load();
47} 47}
@@ -52,19 +52,32 @@ RfCommConfHandler::~RfCommConfHandler() {
52 52
53void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) { 53void RfCommConfHandler::save( QMap<QString, RfCommConfObject*> devices ) {
54 54
55 QFile rfCommConf( "/tmp/test" ); 55//// For debugging purposes
56//// QFile rfCommConf( "/mnt/net/opie/bin/rfcomm.conf" );
57 QFile rfCommConf( m_filename );
56 QTextStream outStream( &rfCommConf ); 58 QTextStream outStream( &rfCommConf );
57 if ( rfCommConf.open( IO_WriteOnly ) ) { 59 if ( rfCommConf.open( IO_WriteOnly ) ) {
58
59 QMap<QString, RfCommConfObject*>::Iterator it; 60 QMap<QString, RfCommConfObject*>::Iterator it;
61 outStream << "#\n";
62 outStream << "# RFCOMM configuration file.\n";
63 outStream << "#\n";
64 outStream << "# $Id$\n";
65 outStream << "#\n\n";
60 for( it = devices.begin(); it != devices.end(); ++it ) { 66 for( it = devices.begin(); it != devices.end(); ++it ) {
61 outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n"; 67 outStream << "rfcomm" + QString("%1").arg( it.data()->number() ) + " {\n";
62 outStream << " device " + it.data()->mac() + ";\n"; 68 outStream << "\t# Automatically bind the device at startup\n";
63 outStream << " channel " + QString( "%1" ).arg( it.data()->channel() ) + ";\n"; 69 outStream << "\tbind " << ((it.data()->isBind())? "yes": "no") << ";\n";
64 outStream << " comment \"" + it.data()->comment() + "\";\n"; 70 outStream << "\n";
71 outStream << "\t# Bluetooth address of the device\n";
72 outStream << "\tdevice " + it.data()->mac() + ";\n";
73 outStream << "\n";
74 outStream << "\t# RFCOMM channel for the connection\n";
75 outStream << "\tchannel\t" + QString( "%1" ).arg( it.data()->channel() ) + ";\n";
76 outStream << "\n";
77 outStream << "\t# Description of the connection\n";
78 outStream << "\tcomment \"" + it.data()->comment() + "\";\n";
65 outStream << "}\n\n"; 79 outStream << "}\n\n";
66 } 80 }
67
68 rfCommConf.close(); 81 rfCommConf.close();
69 } 82 }
70} 83}
@@ -75,42 +88,73 @@ QMap<QString, RfCommConfObject*> RfCommConfHandler::foundEntries() {
75} 88}
76 89
77void RfCommConfHandler::load() { 90void RfCommConfHandler::load() {
91 //Keywords
92 QCString k_rfcomm("rfcomm");
93 QCString k_device("device ");
94 QCString k_channel("channel ");
95 QCString k_comment("comment ");
96 QCString k_bind("bind ");
78 97
79 QFile rfCommConf( m_filename ); 98 m_foundEntries.clear();
80 if ( rfCommConf.open( IO_ReadOnly ) ) { 99 QFile rfCommConf(m_filename); //File we read
100 if (rfCommConf.open(IO_ReadOnly)) {
81 101
82 QStringList list; 102 QStringList list;
83 QTextStream inStream( &rfCommConf ); 103 QTextStream inStream( &rfCommConf );
84 list = QStringList::split( "\n", inStream.read() ); 104 list = QStringList::split( "\n", inStream.read() );
85 105
86 QString number;
87 QString mac; 106 QString mac;
88 QString channel; 107 QString channel;
89 QString comment; 108 QString comment;
109 QString bind;
110 bool bbind;
111 QString number;
90 112
91 for ( QStringList::Iterator line=list.begin(); line != list.end(); line++ ) { 113 for (QStringList::Iterator line = list.begin();
114 line != list.end(); line++) {
92 115
93 QString tmpLine = ( *line ).stripWhiteSpace(); 116 QString tmpLine = (*line).simplifyWhiteSpace();
94 117
95 if ( tmpLine.startsWith("rfcomm") ) { 118 if (tmpLine.startsWith(k_rfcomm)) {
96 QString number = tmpLine.mid( 6,1 ); 119 number = tmpLine.mid( k_rfcomm.length(), 1 );
97 odebug << tmpLine << oendl; 120 odebug << tmpLine << oendl;
98 odebug << "TEST " + number << oendl; 121 odebug << "device " << number << oendl;
99 } else if ( tmpLine.startsWith( "}" ) ) { 122 } else if ( tmpLine.startsWith( "}" ) ) {
100 m_foundEntries.insert( number, new RfCommConfObject( number.toInt(), mac, channel.toInt(), comment ) ); 123 m_foundEntries.insert(number,
101 } else if ( tmpLine.startsWith( "device" ) ) { 124 new RfCommConfObject(number.toInt(), mac, channel.toInt(),
102 mac = tmpLine.mid( 7, 17 ); 125 comment, bbind));
103 odebug << "mac" + mac << oendl; 126 } else if ( tmpLine.startsWith(k_device) ) {
104 } else if ( tmpLine.startsWith( "channel" ) ) { 127 mac = tmpLine.mid(k_device.length(),
105 channel = tmpLine.mid( 8, 1 ); 128 tmpLine.find(';') - k_device.length());
106 odebug << "Channel :" << channel << oendl; 129 odebug << "mac " + mac << oendl;
107 } else if ( tmpLine.startsWith( "comment" ) ) { 130 } else if ( tmpLine.startsWith(k_channel) ) {
108 comment = tmpLine.mid( 9, tmpLine.find( ';' ) - 9 - 1 ); 131 channel = tmpLine.mid(k_channel.length(),
132 tmpLine.find(';') - k_channel.length());
133 odebug << "Channel: " << channel << oendl;
134 } else if ( tmpLine.startsWith(k_comment) ) {
135 comment = tmpLine.mid(k_comment.length(),
136 tmpLine.find(';') - k_comment.length());
137 if (comment.left(1) == "\"")
138 comment.remove(0, 1);
139 if (comment.right(1) == "\"")
140 comment.remove(comment.length() - 1, 1);
109 odebug << "Comment: " + comment << oendl; 141 odebug << "Comment: " + comment << oendl;
142 } else if ( tmpLine.startsWith(k_bind) ) {
143 bind = tmpLine.mid(k_bind.length(),
144 tmpLine.find(';') - k_bind.length());
145 if (bind == "no")
146 bbind = false;
147 else if (bind == "yes")
148 bbind = true;
149 else
150 bbind = true;
151 odebug << "bind: " + bind << oendl;
110 } 152 }
111 } 153 }
112 rfCommConf.close(); 154 rfCommConf.close();
113 } 155 }
114 save( m_foundEntries ); 156 save(m_foundEntries);
115 odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl; 157 odebug << QString( "ENTries: %1").arg( m_foundEntries.count() ) << oendl;
116} 158}
159
160//eof
diff --git a/noncore/net/opietooth/manager/rfcommconfhandler.h b/noncore/net/opietooth/manager/rfcommconfhandler.h
index e13c833..46aaa26 100644
--- a/noncore/net/opietooth/manager/rfcommconfhandler.h
+++ b/noncore/net/opietooth/manager/rfcommconfhandler.h
@@ -11,7 +11,8 @@ namespace OpieTooth {
11 class RfCommConfObject { 11 class RfCommConfObject {
12 12
13 public: 13 public:
14 RfCommConfObject( int number, QString mac, int channel, QString comment ); 14 RfCommConfObject( int number, QString mac, int channel, QString comment,
15 bool bind);
15 ~RfCommConfObject(); 16 ~RfCommConfObject();
16 17
17 void setNumber( int number ); 18 void setNumber( int number );
@@ -22,9 +23,11 @@ namespace OpieTooth {
22 int channel() { return m_channel; }; 23 int channel() { return m_channel; };
23 void setComment( QString comment ); 24 void setComment( QString comment );
24 QString comment() { return m_comment; }; 25 QString comment() { return m_comment; };
25 26 bool isBind() { return m_doBind; }
27 void doBind(bool arg) { m_doBind = arg; }
26 28
27 private: 29 private:
30 bool m_doBind;
28 int m_number; 31 int m_number;
29 QString m_mac; 32 QString m_mac;
30 int m_channel; 33 int m_channel;
diff --git a/noncore/net/opietooth/manager/rfcommdialogitembase.ui b/noncore/net/opietooth/manager/rfcommdialogitembase.ui
index dd8f121..43f3269 100644
--- a/noncore/net/opietooth/manager/rfcommdialogitembase.ui
+++ b/noncore/net/opietooth/manager/rfcommdialogitembase.ui
@@ -11,7 +11,7 @@
11 <rect> 11 <rect>
12 <x>0</x> 12 <x>0</x>
13 <y>0</y> 13 <y>0</y>
14 <width>239</width> 14 <width>235</width>
15 <height>95</height> 15 <height>95</height>
16 </rect> 16 </rect>
17 </property> 17 </property>
@@ -44,177 +44,211 @@
44 <property> 44 <property>
45 <name>layoutSpacing</name> 45 <name>layoutSpacing</name>
46 </property> 46 </property>
47 <grid> 47 <vbox>
48 <property stdset="1"> 48 <property stdset="1">
49 <name>margin</name> 49 <name>margin</name>
50 <number>5</number> 50 <number>0</number>
51 </property> 51 </property>
52 <property stdset="1"> 52 <property stdset="1">
53 <name>spacing</name> 53 <name>spacing</name>
54 <number>5</number> 54 <number>2</number>
55 </property> 55 </property>
56 <widget row="0" column="0" > 56 <widget>
57 <class>QLayoutWidget</class> 57 <class>QLayoutWidget</class>
58 <property stdset="1"> 58 <property stdset="1">
59 <name>name</name> 59 <name>name</name>
60 <cstring>Layout3</cstring> 60 <cstring>Layout3</cstring>
61 </property> 61 </property>
62 <hbox> 62 <property>
63 <name>layoutSpacing</name>
64 </property>
65 <vbox>
63 <property stdset="1"> 66 <property stdset="1">
64 <name>margin</name> 67 <name>margin</name>
65 <number>0</number> 68 <number>0</number>
66 </property> 69 </property>
67 <property stdset="1"> 70 <property stdset="1">
68 <name>spacing</name> 71 <name>spacing</name>
69 <number>6</number> 72 <number>2</number>
70 </property> 73 </property>
71 <widget> 74 <widget>
72 <class>QLabel</class> 75 <class>QCheckBox</class>
73 <property stdset="1"> 76 <property stdset="1">
74 <name>name</name> 77 <name>name</name>
75 <cstring>TextLabel4</cstring> 78 <cstring>m_bind</cstring>
76 </property> 79 </property>
77 <property stdset="1"> 80 <property stdset="1">
78 <name>text</name> 81 <name>text</name>
79 <string>Mac</string> 82 <string>bind automatically</string>
80 </property>
81 </widget>
82 <widget>
83 <class>QLineEdit</class>
84 <property stdset="1">
85 <name>name</name>
86 <cstring>m_macAddress</cstring>
87 </property> 83 </property>
88 </widget> 84 </widget>
89 <widget> 85 <widget>
90 <class>QLabel</class> 86 <class>QLayoutWidget</class>
91 <property stdset="1"> 87 <property stdset="1">
92 <name>name</name> 88 <name>name</name>
93 <cstring>TextLabel5</cstring> 89 <cstring>Layout3</cstring>
94 </property> 90 </property>
95 <property stdset="1"> 91 <property>
96 <name>text</name> 92 <name>layoutSpacing</name>
97 <string>Channel</string>
98 </property> 93 </property>
99 </widget> 94 <hbox>
100 <widget> 95 <property stdset="1">
101 <class>QComboBox</class> 96 <name>margin</name>
102 <item> 97 <number>0</number>
103 <property>
104 <name>text</name>
105 <string>0</string>
106 </property>
107 </item>
108 <item>
109 <property>
110 <name>text</name>
111 <string>1</string>
112 </property>
113 </item>
114 <item>
115 <property>
116 <name>text</name>
117 <string>2</string>
118 </property> 98 </property>
119 </item> 99 <property stdset="1">
120 <item> 100 <name>spacing</name>
121 <property> 101 <number>6</number>
122 <name>text</name>
123 <string>3</string>
124 </property> 102 </property>
125 </item> 103 <widget>
126 <item> 104 <class>QLabel</class>
127 <property> 105 <property stdset="1">
128 <name>text</name> 106 <name>name</name>
129 <string>4</string> 107 <cstring>TextLabel4</cstring>
130 </property> 108 </property>
131 </item> 109 <property stdset="1">
132 <item> 110 <name>text</name>
133 <property> 111 <string>Mac</string>
134 <name>text</name> 112 </property>
135 <string>5</string> 113 </widget>
136 </property> 114 <widget>
137 </item> 115 <class>QLineEdit</class>
138 <item> 116 <property stdset="1">
139 <property> 117 <name>name</name>
140 <name>text</name> 118 <cstring>m_macAddress</cstring>
141 <string>6</string> 119 </property>
142 </property> 120 </widget>
143 </item> 121 <widget>
144 <item> 122 <class>QLabel</class>
145 <property> 123 <property stdset="1">
146 <name>text</name> 124 <name>name</name>
147 <string>7</string> 125 <cstring>TextLabel5</cstring>
148 </property> 126 </property>
149 </item> 127 <property stdset="1">
150 <item> 128 <name>text</name>
151 <property> 129 <string>Channel</string>
152 <name>text</name> 130 </property>
153 <string>8</string> 131 </widget>
154 </property> 132 <widget>
155 </item> 133 <class>QComboBox</class>
156 <item> 134 <item>
157 <property> 135 <property>
158 <name>text</name> 136 <name>text</name>
159 <string>9</string> 137 <string>0</string>
160 </property> 138 </property>
161 </item> 139 </item>
162 <item> 140 <item>
163 <property> 141 <property>
164 <name>text</name> 142 <name>text</name>
165 <string>10</string> 143 <string>1</string>
166 </property> 144 </property>
167 </item> 145 </item>
168 <property stdset="1"> 146 <item>
169 <name>name</name> 147 <property>
170 <cstring>m_channelDropdown</cstring> 148 <name>text</name>
171 </property> 149 <string>2</string>
172 </widget> 150 </property>
173 </hbox> 151 </item>
174 </widget> 152 <item>
175 <widget row="1" column="0" > 153 <property>
176 <class>QLayoutWidget</class> 154 <name>text</name>
177 <property stdset="1"> 155 <string>3</string>
178 <name>name</name> 156 </property>
179 <cstring>Layout4</cstring> 157 </item>
180 </property> 158 <item>
181 <hbox> 159 <property>
182 <property stdset="1"> 160 <name>text</name>
183 <name>margin</name> 161 <string>4</string>
184 <number>0</number> 162 </property>
185 </property> 163 </item>
186 <property stdset="1"> 164 <item>
187 <name>spacing</name> 165 <property>
188 <number>6</number> 166 <name>text</name>
189 </property> 167 <string>5</string>
190 <widget> 168 </property>
191 <class>QLabel</class> 169 </item>
192 <property stdset="1"> 170 <item>
193 <name>name</name> 171 <property>
194 <cstring>TextLabel3</cstring> 172 <name>text</name>
195 </property> 173 <string>6</string>
196 <property stdset="1"> 174 </property>
197 <name>sizePolicy</name> 175 </item>
198 <sizepolicy> 176 <item>
199 <hsizetype>1</hsizetype> 177 <property>
200 <vsizetype>1</vsizetype> 178 <name>text</name>
201 </sizepolicy> 179 <string>7</string>
202 </property> 180 </property>
203 <property stdset="1"> 181 </item>
204 <name>text</name> 182 <item>
205 <string>Comment:</string> 183 <property>
206 </property> 184 <name>text</name>
185 <string>8</string>
186 </property>
187 </item>
188 <item>
189 <property>
190 <name>text</name>
191 <string>9</string>
192 </property>
193 </item>
194 <item>
195 <property>
196 <name>text</name>
197 <string>10</string>
198 </property>
199 </item>
200 <property stdset="1">
201 <name>name</name>
202 <cstring>m_channelDropdown</cstring>
203 </property>
204 </widget>
205 </hbox>
207 </widget> 206 </widget>
208 <widget> 207 <widget>
209 <class>QLineEdit</class> 208 <class>QLayoutWidget</class>
210 <property stdset="1"> 209 <property stdset="1">
211 <name>name</name> 210 <name>name</name>
212 <cstring>m_commentLine</cstring> 211 <cstring>Layout4</cstring>
213 </property> 212 </property>
213 <hbox>
214 <property stdset="1">
215 <name>margin</name>
216 <number>0</number>
217 </property>
218 <property stdset="1">
219 <name>spacing</name>
220 <number>6</number>
221 </property>
222 <widget>
223 <class>QLabel</class>
224 <property stdset="1">
225 <name>name</name>
226 <cstring>TextLabel3</cstring>
227 </property>
228 <property stdset="1">
229 <name>sizePolicy</name>
230 <sizepolicy>
231 <hsizetype>1</hsizetype>
232 <vsizetype>1</vsizetype>
233 </sizepolicy>
234 </property>
235 <property stdset="1">
236 <name>text</name>
237 <string>Comment:</string>
238 </property>
239 </widget>
240 <widget>
241 <class>QLineEdit</class>
242 <property stdset="1">
243 <name>name</name>
244 <cstring>m_commentLine</cstring>
245 </property>
246 </widget>
247 </hbox>
214 </widget> 248 </widget>
215 </hbox> 249 </vbox>
216 </widget> 250 </widget>
217 </grid> 251 </vbox>
218 </widget> 252 </widget>
219 </vbox> 253 </vbox>
220</widget> 254</widget>
diff --git a/noncore/net/opietooth/manager/rfcpopup.cpp b/noncore/net/opietooth/manager/rfcpopup.cpp
index 7711f0a..04da19f 100644
--- a/noncore/net/opietooth/manager/rfcpopup.cpp
+++ b/noncore/net/opietooth/manager/rfcpopup.cpp
@@ -105,7 +105,8 @@ void RfcCommPopup::slotBind()
105{ 105{
106 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp ); 106 RfcommAssignDialog rfcommAssign ( this, "RfcommAssignDialog", true, WStyle_ContextHelp );
107 107
108 rfcommAssign.newDevice( m_item->mac() ); 108 rfcommAssign.newDevice( m_item->mac(),
109 m_service.protocolDescriptorList().last().port());
109 110
110 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted ) 111 if ( QPEApplication::execDialog( &rfcommAssign ) == QDialog::Accepted )
111 { 112 {