author | zecke <zecke> | 2002-06-28 16:30:08 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-06-28 16:30:08 (UTC) |
commit | e72d93a703f4b38109f8f02ec96a759d93b8f91c (patch) (unidiff) | |
tree | 39d6725fa1061965c64c42dabb663a3cfdc1c976 | |
parent | ce221c2cf5b003f1033e6f0b603670ceb0bff7c7 (diff) | |
download | opie-e72d93a703f4b38109f8f02ec96a759d93b8f91c.zip opie-e72d93a703f4b38109f8f02ec96a759d93b8f91c.tar.gz opie-e72d93a703f4b38109f8f02ec96a759d93b8f91c.tar.bz2 |
Don't leak
-rw-r--r-- | noncore/net/opietooth/manager/bluebase.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/net/opietooth/manager/bluebase.cpp b/noncore/net/opietooth/manager/bluebase.cpp index b4b59c3..0385cb1 100644 --- a/noncore/net/opietooth/manager/bluebase.cpp +++ b/noncore/net/opietooth/manager/bluebase.cpp | |||
@@ -105,128 +105,129 @@ namespace OpieTooth { | |||
105 | 105 | ||
106 | 106 | ||
107 | deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with | 107 | deviceName = cfg.readEntry( "name" , "No name" ); // name the device should identify with |
108 | defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak | 108 | defaultPasskey = cfg.readEntryCrypt( "passkey" , "" ); // <- hmm, look up how good the trolls did that, maybe too weak |
109 | useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); | 109 | useEncryption = cfg.readNumEntry( "useEncryption" , 1 ); |
110 | enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); | 110 | enableAuthentification = cfg.readNumEntry( "enableAuthentification" , 1 ); |
111 | enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); | 111 | enablePagescan = cfg.readNumEntry( "enablePagescan" , 1 ); |
112 | enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); | 112 | enableInquiryscan = cfg.readNumEntry( "enableInquiryscan" , 1 ); |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Writes all options to the config file | 117 | * Writes all options to the config file |
118 | */ | 118 | */ |
119 | void BlueBase::writeConfig() { | 119 | void BlueBase::writeConfig() { |
120 | 120 | ||
121 | 121 | ||
122 | Config cfg( "bluetoothmanager" ); | 122 | Config cfg( "bluetoothmanager" ); |
123 | cfg.setGroup( "bluezsettings" ); | 123 | cfg.setGroup( "bluezsettings" ); |
124 | 124 | ||
125 | cfg.writeEntry( "name" , deviceName ); | 125 | cfg.writeEntry( "name" , deviceName ); |
126 | cfg.writeEntryCrypt( "passkey" , defaultPasskey ); | 126 | cfg.writeEntryCrypt( "passkey" , defaultPasskey ); |
127 | cfg.writeEntry( "useEncryption" , useEncryption ); | 127 | cfg.writeEntry( "useEncryption" , useEncryption ); |
128 | cfg.writeEntry( "enableAuthentification" , enableAuthentification ); | 128 | cfg.writeEntry( "enableAuthentification" , enableAuthentification ); |
129 | cfg.writeEntry( "enablePagescan" , enablePagescan ); | 129 | cfg.writeEntry( "enablePagescan" , enablePagescan ); |
130 | cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); | 130 | cfg.writeEntry( "enableInquiryscan" , enableInquiryscan ); |
131 | 131 | ||
132 | writeToHciConfig(); | 132 | writeToHciConfig(); |
133 | } | 133 | } |
134 | 134 | ||
135 | void BlueBase::writeToHciConfig() { | 135 | void BlueBase::writeToHciConfig() { |
136 | 136 | ||
137 | HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" ); | 137 | HciConfWrapper *hciconf = new HciConfWrapper( "/tmp/hcid.conf" ); |
138 | hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 138 | hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); |
139 | 139 | ||
140 | 140 | ||
141 | // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); | 141 | // hciconf->setPinHelper( "/bin/QtPalmtop/bin/blue-pin" ); |
142 | 142 | ||
143 | hciconf->setName( deviceName ); | 143 | hciconf->setName( deviceName ); |
144 | 144 | ||
145 | if ( useEncryption == 1) { | 145 | if ( useEncryption == 1) { |
146 | hciconf->setEncrypt( true ); | 146 | hciconf->setEncrypt( true ); |
147 | } else { | 147 | } else { |
148 | hciconf->setEncrypt( false ); | 148 | hciconf->setEncrypt( false ); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | if ( enableAuthentification == 1) { | 152 | if ( enableAuthentification == 1) { |
153 | hciconf->setAuth( true ); | 153 | hciconf->setAuth( true ); |
154 | } else { | 154 | } else { |
155 | hciconf->setAuth( false ); | 155 | hciconf->setAuth( false ); |
156 | } | 156 | } |
157 | 157 | ||
158 | if ( enablePagescan == 1) { | 158 | if ( enablePagescan == 1) { |
159 | hciconf->setPscan( true ); | 159 | hciconf->setPscan( true ); |
160 | } else { | 160 | } else { |
161 | hciconf->setPscan( false ); | 161 | hciconf->setPscan( false ); |
162 | } | 162 | } |
163 | 163 | ||
164 | if ( enableInquiryscan == 1) { | 164 | if ( enableInquiryscan == 1) { |
165 | hciconf->setIscan( true ); | 165 | hciconf->setIscan( true ); |
166 | } else { | 166 | } else { |
167 | hciconf->setIscan( false ); | 167 | hciconf->setIscan( false ); |
168 | } | 168 | } |
169 | delete hciconf; | ||
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | /** | 173 | /** |
173 | * Read the list of allready known devices | 174 | * Read the list of allready known devices |
174 | * | 175 | * |
175 | */ | 176 | */ |
176 | void BlueBase::readSavedDevices() { | 177 | void BlueBase::readSavedDevices() { |
177 | 178 | ||
178 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; | 179 | QList<RemoteDevice> *loadedDevices = new QList<RemoteDevice>; |
179 | 180 | ||
180 | QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); | 181 | QDir deviceListSave( QDir::homeDirPath() + "/Settings/bluetooth/"); |
181 | // list of .conf files | 182 | // list of .conf files |
182 | QStringList devicesFileList = deviceListSave.entryList(); | 183 | QStringList devicesFileList = deviceListSave.entryList(); |
183 | 184 | ||
184 | // cut .conf of to get the mac and also read the name entry in it. | 185 | // cut .conf of to get the mac and also read the name entry in it. |
185 | 186 | ||
186 | for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { | 187 | for ( QStringList::Iterator it = devicesFileList.begin(); it != devicesFileList.end(); ++it ) { |
187 | 188 | ||
188 | QString name; | 189 | QString name; |
189 | QString mac; | 190 | QString mac; |
190 | qDebug((*it).latin1() ); | 191 | qDebug((*it).latin1() ); |
191 | Config conf((*it)); | 192 | Config conf((*it)); |
192 | conf.setGroup("Info"); | 193 | conf.setGroup("Info"); |
193 | name = conf.readEntry("name", "Error"); | 194 | name = conf.readEntry("name", "Error"); |
194 | qDebug("MAC: " + mac); | 195 | qDebug("MAC: " + mac); |
195 | qDebug("NAME: " + name); | 196 | qDebug("NAME: " + name); |
196 | RemoteDevice currentDevice = RemoteDevice( mac , name ); | 197 | RemoteDevice currentDevice = RemoteDevice( mac , name ); |
197 | loadedDevices->append( ¤tDevice ); | 198 | loadedDevices->append( ¤tDevice ); |
198 | } | 199 | } |
199 | addSearchedDevices( *loadedDevices ); | 200 | addSearchedDevices( *loadedDevices ); |
200 | } | 201 | } |
201 | 202 | ||
202 | /** | 203 | /** |
203 | * Write the list of allready known devices | 204 | * Write the list of allready known devices |
204 | * | 205 | * |
205 | */ | 206 | */ |
206 | void BlueBase::writeSavedDevices() { | 207 | void BlueBase::writeSavedDevices() { |
207 | 208 | ||
208 | QListViewItemIterator it( ListView2 ); | 209 | QListViewItemIterator it( ListView2 ); |
209 | 210 | ||
210 | for ( ; it.current(); ++it ) { | 211 | for ( ; it.current(); ++it ) { |
211 | 212 | ||
212 | // seperate config file for each device, to store more information in future. | 213 | // seperate config file for each device, to store more information in future. |
213 | // TO FIX: BTLISTITEM!!! | 214 | // TO FIX: BTLISTITEM!!! |
214 | 215 | ||
215 | // Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem)it.current())->mac()) + ".conf", Config::File ); | 216 | // Config conf( QDir::homeDirPath() + "/Settings/bluetooth/" + (((BTListItem)it.current())->mac()) + ".conf", Config::File ); |
216 | // conf.setGroup( "Info" ); | 217 | // conf.setGroup( "Info" ); |
217 | // conf.writeEntry( "name", it.current()->name() ); | 218 | // conf.writeEntry( "name", it.current()->name() ); |
218 | } | 219 | } |
219 | } | 220 | } |
220 | 221 | ||
221 | 222 | ||
222 | /** | 223 | /** |
223 | * Set up the gui | 224 | * Set up the gui |
224 | */ | 225 | */ |
225 | void BlueBase::initGui() { | 226 | void BlueBase::initGui() { |
226 | 227 | ||
227 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() | 228 | StatusLabel->setText( getStatus() ); // maybe move it to getStatus() |
228 | 229 | ||
229 | cryptCheckBox->setChecked( useEncryption ); | 230 | cryptCheckBox->setChecked( useEncryption ); |
230 | authCheckBox->setChecked( enableAuthentification ); | 231 | authCheckBox->setChecked( enableAuthentification ); |
231 | pagescanCheckBox->setChecked( enablePagescan ); | 232 | pagescanCheckBox->setChecked( enablePagescan ); |
232 | inquiryscanCheckBox->setChecked( enableInquiryscan ); | 233 | inquiryscanCheckBox->setChecked( enableInquiryscan ); |