Diffstat (limited to 'noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp | 51 |
1 files changed, 33 insertions, 18 deletions
diff --git a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp index b5cc074..fc76301 100644 --- a/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp +++ b/noncore/net/opietooth/manager/rfcommassigndialogimpl.cpp | |||
@@ -3,8 +3,11 @@ | |||
3 | #include "rfcommassigndialogitem.h" | 3 | #include "rfcommassigndialogitem.h" |
4 | #include "rfcommconfhandler.h" | 4 | #include "rfcommconfhandler.h" |
5 | 5 | ||
6 | /* OPIE */ | ||
6 | #include <qpe/config.h> | 7 | #include <qpe/config.h> |
8 | #include <qpe/qpeapplication.h> | ||
7 | 9 | ||
10 | /* QT */ | ||
8 | #include <qlayout.h> | 11 | #include <qlayout.h> |
9 | 12 | ||
10 | using namespace OpieTooth; | 13 | using namespace OpieTooth; |
@@ -15,7 +18,8 @@ using namespace OpieTooth; | |||
15 | 18 | ||
16 | 19 | ||
17 | RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 20 | RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
18 | : RfcommAssignDialogBase( parent, name, modal, fl ) { | 21 | : RfcommAssignDialogBase( parent, name, modal, fl ) |
22 | { | ||
19 | 23 | ||
20 | m_range = 5; | 24 | m_range = 5; |
21 | 25 | ||
@@ -33,28 +37,34 @@ RfcommAssignDialog::RfcommAssignDialog( QWidget* parent, const char* name, bool | |||
33 | loadConfig(); | 37 | loadConfig(); |
34 | } | 38 | } |
35 | 39 | ||
36 | RfcommAssignDialog::~RfcommAssignDialog() { | 40 | RfcommAssignDialog::~RfcommAssignDialog() |
37 | if ( confHandler ) { | 41 | { |
42 | if ( confHandler ) | ||
43 | { | ||
38 | delete confHandler; | 44 | delete confHandler; |
39 | } | 45 | } |
40 | } | 46 | } |
41 | 47 | ||
42 | 48 | ||
43 | void RfcommAssignDialog::newDevice( const QString & mac ) { | 49 | void RfcommAssignDialog::newDevice( const QString & mac ) |
50 | { | ||
44 | 51 | ||
45 | for ( int i = 0 ; i < m_range; i++ ) { | 52 | for ( int i = 0 ; i < m_range; i++ ) |
53 | { | ||
46 | 54 | ||
47 | QMap<QString, RfCommConfObject*>::Iterator it; | 55 | QMap<QString, RfCommConfObject*>::Iterator it; |
48 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | 56 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); |
49 | // make sure that rfcommX is not assigned yet | 57 | // make sure that rfcommX is not assigned yet |
50 | if ( it == confHandler->foundEntries().end() ) { | 58 | if ( it == confHandler->foundEntries().end() ) |
59 | { | ||
51 | QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); | 60 | QDialog dialog( this, "newdevice", true, WStyle_ContextHelp ); |
52 | dialog.showMaximized(); | 61 | |
53 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); | 62 | RfcommDialogItem *newDev = new RfcommDialogItem( &dialog ); |
54 | newDev->setIdent( i ); | 63 | newDev->setIdent( i ); |
55 | newDev->setMac( mac ); | 64 | newDev->setMac( mac ); |
56 | 65 | ||
57 | if ( dialog.exec() == QDialog::Accepted ) { | 66 | if ( QPEApplication::execDialog( &dialog ) == QDialog::Accepted ) |
67 | { | ||
58 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 68 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
59 | m_itemList.insert( i , rfcomm ); | 69 | m_itemList.insert( i , rfcomm ); |
60 | rfcomm->setIdent( i ); | 70 | rfcomm->setIdent( i ); |
@@ -67,33 +77,37 @@ void RfcommAssignDialog::newDevice( const QString & mac ) { | |||
67 | } | 77 | } |
68 | } | 78 | } |
69 | 79 | ||
70 | void RfcommAssignDialog::loadConfig() { | 80 | void RfcommAssignDialog::loadConfig() |
81 | { | ||
71 | 82 | ||
72 | //Config cfg( "bluetoothmanager-rfcommbind" ); | 83 | //Config cfg( "bluetoothmanager-rfcommbind" ); |
73 | 84 | ||
74 | for ( int i = 0 ; i < m_range; i++ ) { | 85 | for ( int i = 0 ; i < m_range; i++ ) |
86 | { | ||
75 | // cfg.setGroup( QString("%1").arg( i ) ); | 87 | // cfg.setGroup( QString("%1").arg( i ) ); |
76 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); | 88 | RfcommDialogItem *rfcomm = new RfcommDialogItem( m_box ); |
77 | m_itemList.insert( i , rfcomm ); | 89 | m_itemList.insert( i , rfcomm ); |
78 | rfcomm->setIdent( i ); | 90 | rfcomm->setIdent( i ); |
79 | QMap<QString, RfCommConfObject*>::Iterator it; | 91 | QMap<QString, RfCommConfObject*>::Iterator it; |
80 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); | 92 | it = confHandler->foundEntries().find( QString("%1").arg( i ) ); |
81 | if ( it != confHandler->foundEntries().end() ) { | 93 | if ( it != confHandler->foundEntries().end() ) |
94 | { | ||
82 | qDebug( "Found key in foundEntries() " ); | 95 | qDebug( "Found key in foundEntries() " ); |
83 | rfcomm->setMac( it.data()->mac() ); | 96 | rfcomm->setMac( it.data()->mac() ); |
84 | rfcomm->setChannel( it.data()->channel() ); | 97 | rfcomm->setChannel( it.data()->channel() ); |
85 | rfcomm->setComment( it.data()->comment() ); | 98 | rfcomm->setComment( it.data()->comment() ); |
86 | } | 99 | } |
87 | /* Use rfcomm.conf directly for now | 100 | /* Use rfcomm.conf directly for now |
88 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); | 101 | * rfcomm->setMac( cfg.readEntry( "mac", "" ) ); |
89 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); | 102 | * rfcomm->setChannel( cfg.readNumEntry( "channel", 1 ) ); |
90 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); | 103 | * rfcomm->setComment( cfg.readEntry( "comment", "" ) ); |
91 | */ | 104 | */ |
92 | } | 105 | } |
93 | } | 106 | } |
94 | 107 | ||
95 | 108 | ||
96 | void RfcommAssignDialog::saveConfig() { | 109 | void RfcommAssignDialog::saveConfig() |
110 | { | ||
97 | 111 | ||
98 | //Config cfg( "bluetoothmanager-rfcommbind" ); | 112 | //Config cfg( "bluetoothmanager-rfcommbind" ); |
99 | 113 | ||
@@ -101,7 +115,8 @@ void RfcommAssignDialog::saveConfig() { | |||
101 | 115 | ||
102 | QMap< QString, RfCommConfObject*> outMap; | 116 | QMap< QString, RfCommConfObject*> outMap; |
103 | 117 | ||
104 | for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) { | 118 | for( it = m_itemList.begin(); it != m_itemList.end(); ++it ) |
119 | { | ||
105 | 120 | ||
106 | //cfg.setGroup( QString("%1").arg( it.key() ) ); | 121 | //cfg.setGroup( QString("%1").arg( it.key() ) ); |
107 | RfcommDialogItem *rfcomm = it.data(); | 122 | RfcommDialogItem *rfcomm = it.data(); |