author | harlekin <harlekin> | 2002-06-13 19:03:25 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-13 19:03:25 (UTC) |
commit | 9939c618389465ef5837bf510186d583891e65e3 (patch) (unidiff) | |
tree | 5857e9fd68618b033414204ebdffd2e8b3ef5961 | |
parent | 9976f7357601e33c4a1984bf79a68ac344fdd188 (diff) | |
download | opie-9939c618389465ef5837bf510186d583891e65e3.zip opie-9939c618389465ef5837bf510186d583891e65e3.tar.gz opie-9939c618389465ef5837bf510186d583891e65e3.tar.bz2 |
fix leak
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 39a9c6e..a380ac7 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -109,95 +109,97 @@ namespace OpieTooth { | |||
109 | menu->insertItem( tr("Disable Bluetooth"), 0 ); | 109 | menu->insertItem( tr("Disable Bluetooth"), 0 ); |
110 | } else { | 110 | } else { |
111 | menu->insertItem( tr("Enable Bluetooth"), 1 ); | 111 | menu->insertItem( tr("Enable Bluetooth"), 1 ); |
112 | } | 112 | } |
113 | 113 | ||
114 | menu->insertItem( tr("Launch manager"), 2 ); | 114 | menu->insertItem( tr("Launch manager"), 2 ); |
115 | 115 | ||
116 | menu->insertSeparator(6); | 116 | menu->insertSeparator(6); |
117 | menu->insertItem( tr("Signal strength"), signal, 5); | 117 | menu->insertItem( tr("Signal strength"), signal, 5); |
118 | menu->insertSeparator(8); | 118 | menu->insertSeparator(8); |
119 | 119 | ||
120 | if (bluezDiscoveryActive) { | 120 | if (bluezDiscoveryActive) { |
121 | menu->insertItem( tr("Disable discovery"), 3 ); | 121 | menu->insertItem( tr("Disable discovery"), 3 ); |
122 | } else { | 122 | } else { |
123 | menu->insertItem( tr("Enable discovery"), 4 ); | 123 | menu->insertItem( tr("Enable discovery"), 4 ); |
124 | } | 124 | } |
125 | //menu->insertItem( tr("More..."), 7 ) | 125 | //menu->insertItem( tr("More..."), 7 ) |
126 | 126 | ||
127 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); | 127 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); |
128 | ret = menu->exec(p, 0); | 128 | ret = menu->exec(p, 0); |
129 | 129 | ||
130 | // qDebug("ret was %d\n", ret); | 130 | // qDebug("ret was %d\n", ret); |
131 | 131 | ||
132 | switch(ret) { | 132 | switch(ret) { |
133 | case 0: | 133 | case 0: |
134 | setBluezStatus(0); | 134 | setBluezStatus(0); |
135 | timerEvent(NULL); | 135 | timerEvent(NULL); |
136 | break; | 136 | break; |
137 | case 1: | 137 | case 1: |
138 | setBluezStatus(1); | 138 | setBluezStatus(1); |
139 | timerEvent(NULL); | 139 | timerEvent(NULL); |
140 | break; | 140 | break; |
141 | case 2: | 141 | case 2: |
142 | // start bluetoothmanager | 142 | // start bluetoothmanager |
143 | launchManager(); | 143 | launchManager(); |
144 | timerEvent(NULL); | 144 | timerEvent(NULL); |
145 | break; | 145 | break; |
146 | case 3: | 146 | case 3: |
147 | setBluezDiscoveryStatus(0); | 147 | setBluezDiscoveryStatus(0); |
148 | timerEvent(NULL); | 148 | timerEvent(NULL); |
149 | break; | 149 | break; |
150 | case 4: | 150 | case 4: |
151 | setBluezDiscoveryStatus(1); | 151 | setBluezDiscoveryStatus(1); |
152 | timerEvent(NULL); | 152 | timerEvent(NULL); |
153 | break; | 153 | break; |
154 | //case 7: | 154 | //case 7: |
155 | // With table of currently-detected devices. | 155 | // With table of currently-detected devices. |
156 | } | 156 | } |
157 | delete menu; | ||
157 | } | 158 | } |
158 | 159 | ||
160 | |||
159 | /** | 161 | /** |
160 | * Launches the bluetooth manager | 162 | * Launches the bluetooth manager |
161 | */ | 163 | */ |
162 | void BluezApplet::launchManager() { | 164 | void BluezApplet::launchManager() { |
163 | QCopEnvelope e("QPE/System", "execute(QString)"); | 165 | QCopEnvelope e("QPE/System", "execute(QString)"); |
164 | e << QString("bluetooth-manager"); | 166 | e << QString("bluetooth-manager"); |
165 | } | 167 | } |
166 | 168 | ||
167 | /** | 169 | /** |
168 | * Refresh timer | 170 | * Refresh timer |
169 | * @param the timer event | 171 | * @param the timer event |
170 | */ | 172 | */ |
171 | void BluezApplet::timerEvent( QTimerEvent * ) { | 173 | void BluezApplet::timerEvent( QTimerEvent * ) { |
172 | int oldactive = bluezactive; | 174 | int oldactive = bluezactive; |
173 | int olddiscovery = bluezDiscoveryActive; | 175 | int olddiscovery = bluezDiscoveryActive; |
174 | 176 | ||
175 | bluezactive = checkBluezStatus(); | 177 | bluezactive = checkBluezStatus(); |
176 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); | 178 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); |
177 | 179 | ||
178 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { | 180 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { |
179 | paintEvent(NULL); | 181 | paintEvent(NULL); |
180 | } | 182 | } |
181 | } | 183 | } |
182 | 184 | ||
183 | /** | 185 | /** |
184 | * Implementation of the paint event | 186 | * Implementation of the paint event |
185 | * @param the QPaintEvent | 187 | * @param the QPaintEvent |
186 | */ | 188 | */ |
187 | void BluezApplet::paintEvent( QPaintEvent* ) { | 189 | void BluezApplet::paintEvent( QPaintEvent* ) { |
188 | QPainter p(this); | 190 | QPainter p(this); |
189 | qDebug("paint bluetooth pixmap"); | 191 | qDebug("paint bluetooth pixmap"); |
190 | 192 | ||
191 | p.eraseRect ( 0, 0, this->width(), this->height() ); | 193 | p.eraseRect ( 0, 0, this->width(), this->height() ); |
192 | 194 | ||
193 | if (bluezactive > 0) { | 195 | if (bluezactive > 0) { |
194 | p.drawPixmap( 0, 1, bluezOnPixmap ); | 196 | p.drawPixmap( 0, 1, bluezOnPixmap ); |
195 | } else { | 197 | } else { |
196 | p.drawPixmap( 0, 1, bluezOffPixmap ); | 198 | p.drawPixmap( 0, 1, bluezOffPixmap ); |
197 | } | 199 | } |
198 | 200 | ||
199 | if (bluezDiscoveryActive > 0) { | 201 | if (bluezDiscoveryActive > 0) { |
200 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); | 202 | p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); |
201 | } | 203 | } |
202 | } | 204 | } |
203 | }; | 205 | }; |