summaryrefslogtreecommitdiff
path: root/noncore/net/opietooth/applet/bluezapplet.cpp
Unidiff
Diffstat (limited to 'noncore/net/opietooth/applet/bluezapplet.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 8a7f0bc..1d93f5c 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -113,109 +113,109 @@ namespace OpieTooth {
113 int BluezApplet::setBluezDiscoveryStatus(int d) { 113 int BluezApplet::setBluezDiscoveryStatus(int d) {
114 } 114 }
115 115
116 void BluezApplet::mousePressEvent( QMouseEvent *) { 116 void BluezApplet::mousePressEvent( QMouseEvent *) {
117 117
118 QPopupMenu *menu = new QPopupMenu(); 118 QPopupMenu *menu = new QPopupMenu();
119 QPopupMenu *signal = new QPopupMenu(); 119 QPopupMenu *signal = new QPopupMenu();
120 int ret=0; 120 int ret=0;
121 121
122 /* Refresh active state */ 122 /* Refresh active state */
123 timerEvent( 0 ); 123 timerEvent( 0 );
124 124
125 125
126 if (bluezactive) { 126 if (bluezactive) {
127 menu->insertItem( tr("Disable Bluetooth"), 0 ); 127 menu->insertItem( tr("Disable Bluetooth"), 0 );
128 } else { 128 } else {
129 menu->insertItem( tr("Enable Bluetooth"), 1 ); 129 menu->insertItem( tr("Enable Bluetooth"), 1 );
130 } 130 }
131 131
132 menu->insertItem( tr("Launch manager"), 2 ); 132 menu->insertItem( tr("Launch manager"), 2 );
133 133
134 menu->insertSeparator(6); 134 menu->insertSeparator(6);
135 //menu->insertItem( tr("Signal strength"), signal, 5); 135 //menu->insertItem( tr("Signal strength"), signal, 5);
136 //menu->insertSeparator(8); 136 //menu->insertSeparator(8);
137 137
138 if (bluezDiscoveryActive) { 138 if (bluezDiscoveryActive) {
139 menu->insertItem( tr("Disable discovery"), 3 ); 139 menu->insertItem( tr("Disable discovery"), 3 );
140 } else { 140 } else {
141 menu->insertItem( tr("Enable discovery"), 4 ); 141 menu->insertItem( tr("Enable discovery"), 4 );
142 } 142 }
143 143
144 144
145 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); 145 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) );
146 ret = menu->exec(p, 0); 146 ret = menu->exec(p, 0);
147 147
148 switch(ret) { 148 switch(ret) {
149 case 0: 149 case 0:
150 setBluezStatus(0); 150 setBluezStatus(0);
151 timerEvent( 0 ); 151 timerEvent( 0 );
152 break; 152 break;
153 case 1: 153 case 1:
154 setBluezStatus(1); 154 setBluezStatus(1);
155 timerEvent( 0 ); 155 timerEvent( 0 );
156 break; 156 break;
157 case 2: 157 case 2:
158 // start bluetoothmanager 158 // start bluetoothmanager
159 launchManager(); 159 launchManager();
160 timerEvent( 0 ); 160 timerEvent( 0 );
161 break; 161 break;
162 case 3: 162 case 3:
163 setBluezDiscoveryStatus(0); 163 setBluezDiscoveryStatus(0);
164 timerEvent( 0 ); 164 timerEvent( 0 );
165 break; 165 break;
166 case 4: 166 case 4:
167 setBluezDiscoveryStatus(1); 167 setBluezDiscoveryStatus(1);
168 timerEvent(0 ); 168 timerEvent(0 );
169 break; 169 break;
170 //case 7: 170 //case 7:
171 // With table of currently-detected devices. 171 // With table of currently-detected devices.
172 } 172 }
173 173
174 delete signal; 174 delete signal;
175 delete menu; 175 delete menu;
176 } 176 }
177 177
178 178
179/** 179/**
180 * Launches the bluetooth manager 180 * Launches the bluetooth manager
181 */ 181 */
182 void BluezApplet::launchManager() { 182 void BluezApplet::launchManager() {
183 QCopEnvelope e("QPE/System", "execute(QString)"); 183 QCopEnvelope e("QPE/System", "execute(QString)");
184 e << QString("bluetooth-manager"); 184 e << QString("bluetooth-manager");
185 } 185 }
186 186
187/** 187/**
188 * Refresh timer 188 * Refresh timer
189 * @param the timer event 189 * @param the timer event
190 */ 190 */
191 void BluezApplet::timerEvent( QTimerEvent * ) { 191 void BluezApplet::timerEvent( QTimerEvent * ) {
192 bool oldactive = bluezactive; 192 bool oldactive = bluezactive;
193 int olddiscovery = bluezDiscoveryActive; 193 int olddiscovery = bluezDiscoveryActive;
194 194
195 bluezactive = checkBluezStatus(); 195 bluezactive = checkBluezStatus();
196 bluezDiscoveryActive = checkBluezDiscoveryStatus(); 196 bluezDiscoveryActive = checkBluezDiscoveryStatus();
197 197
198 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { 198 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
199 update(); 199 update();
200 } 200 }
201 } 201 }
202 202
203/** 203/**
204 * Implementation of the paint event 204 * Implementation of the paint event
205 * @param the QPaintEvent 205 * @param the QPaintEvent
206 */ 206 */
207 void BluezApplet::paintEvent( QPaintEvent* ) { 207 void BluezApplet::paintEvent( QPaintEvent* ) {
208 QPainter p(this); 208 QPainter p(this);
209 qDebug("paint bluetooth pixmap"); 209 odebug << "paint bluetooth pixmap" << oendl;
210 210
211 if (bluezactive > 0) { 211 if (bluezactive > 0) {
212 p.drawPixmap( 0, 1, bluezOnPixmap ); 212 p.drawPixmap( 0, 1, bluezOnPixmap );
213 } else { 213 } else {
214 p.drawPixmap( 0, 1, bluezOffPixmap ); 214 p.drawPixmap( 0, 1, bluezOffPixmap );
215 } 215 }
216 216
217 if (bluezDiscoveryActive > 0) { 217 if (bluezDiscoveryActive > 0) {
218 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap ); 218 p.drawPixmap( 0, 1, bluezDiscoveryOnPixmap );
219 } 219 }
220 } 220 }
221}; 221};