summaryrefslogtreecommitdiff
path: root/noncore
authorharlekin <harlekin>2002-06-27 13:04:38 (UTC)
committer harlekin <harlekin>2002-06-27 13:04:38 (UTC)
commit540fd6a4a7cc86070c94f41833c4b9b9fa0e9824 (patch) (unidiff)
tree821cc0443c0a24fd19329791121cef625910cb72 /noncore
parent56d22ac17fdc194a20fd0deba673943f85e940ea (diff)
downloadopie-540fd6a4a7cc86070c94f41833c4b9b9fa0e9824.zip
opie-540fd6a4a7cc86070c94f41833c4b9b9fa0e9824.tar.gz
opie-540fd6a4a7cc86070c94f41833c4b9b9fa0e9824.tar.bz2
cleanups
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.cpp19
-rw-r--r--noncore/net/opietooth/applet/bluezapplet.h3
2 files changed, 10 insertions, 12 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp
index 8bb7a93..c0ad246 100644
--- a/noncore/net/opietooth/applet/bluezapplet.cpp
+++ b/noncore/net/opietooth/applet/bluezapplet.cpp
@@ -53,12 +53,14 @@ namespace OpieTooth {
53 setFixedWidth( 14 ); 53 setFixedWidth( 14 );
54 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" ); 54 bluezOnPixmap = Resource::loadPixmap( "bluetoothapplet/bluezon" );
55 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" ); 55 bluezOffPixmap = Resource::loadPixmap( "bluetoothapplet/bluezoff" );
56 // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" ); 56 // bluezDiscoveryOnPixmap = Resource::loadPixmap( "bluetoothapplet/magglass" );
57 startTimer(5000); 57 startTimer(5000);
58 btDevice = 0; 58 btDevice = 0;
59 bluezactive = false;
60 bluezDiscoveryActive = false;
59 61
60 } 62 }
61 63
62 BluezApplet::~BluezApplet() { 64 BluezApplet::~BluezApplet() {
63 } 65 }
64 66
@@ -97,13 +99,13 @@ namespace OpieTooth {
97 99
98 QPopupMenu *menu = new QPopupMenu(); 100 QPopupMenu *menu = new QPopupMenu();
99 QPopupMenu *signal = new QPopupMenu(); 101 QPopupMenu *signal = new QPopupMenu();
100 int ret=0; 102 int ret=0;
101 103
102 /* Refresh active state */ 104 /* Refresh active state */
103 timerEvent(NULL); 105 timerEvent( 0 );
104 106
105 107
106 if (bluezactive) { 108 if (bluezactive) {
107 menu->insertItem( tr("Disable Bluetooth"), 0 ); 109 menu->insertItem( tr("Disable Bluetooth"), 0 );
108 } else { 110 } else {
109 menu->insertItem( tr("Enable Bluetooth"), 1 ); 111 menu->insertItem( tr("Enable Bluetooth"), 1 );
@@ -125,36 +127,35 @@ namespace OpieTooth {
125 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); 127 QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) );
126 ret = menu->exec(p, 0); 128 ret = menu->exec(p, 0);
127 129
128 switch(ret) { 130 switch(ret) {
129 case 0: 131 case 0:
130 setBluezStatus(0); 132 setBluezStatus(0);
131 timerEvent(NULL); 133 timerEvent( 0 );
132 break; 134 break;
133 case 1: 135 case 1:
134 setBluezStatus(1); 136 setBluezStatus(1);
135 timerEvent(NULL); 137 timerEvent( 0 );
136 break; 138 break;
137 case 2: 139 case 2:
138 // start bluetoothmanager 140 // start bluetoothmanager
139 launchManager(); 141 launchManager();
140 timerEvent(NULL); 142 timerEvent( 0 );
141 break; 143 break;
142 case 3: 144 case 3:
143 setBluezDiscoveryStatus(0); 145 setBluezDiscoveryStatus(0);
144 timerEvent(NULL); 146 timerEvent( 0 );
145 break; 147 break;
146 case 4: 148 case 4:
147 setBluezDiscoveryStatus(1); 149 setBluezDiscoveryStatus(1);
148 timerEvent(NULL); 150 timerEvent(0 );
149 break; 151 break;
150 //case 7: 152 //case 7:
151 // With table of currently-detected devices. 153 // With table of currently-detected devices.
152 } 154 }
153 155
154 timerEvent(NULL);
155 delete signal; 156 delete signal;
156 delete menu; 157 delete menu;
157 } 158 }
158 159
159 160
160/** 161/**
@@ -174,26 +175,24 @@ namespace OpieTooth {
174 int olddiscovery = bluezDiscoveryActive; 175 int olddiscovery = bluezDiscoveryActive;
175 176
176 bluezactive = checkBluezStatus(); 177 bluezactive = checkBluezStatus();
177 bluezDiscoveryActive = checkBluezDiscoveryStatus(); 178 bluezDiscoveryActive = checkBluezDiscoveryStatus();
178 179
179 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { 180 if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) {
180 paintEvent(NULL); 181 update();
181 } 182 }
182 } 183 }
183 184
184/** 185/**
185 * Implementation of the paint event 186 * Implementation of the paint event
186 * @param the QPaintEvent 187 * @param the QPaintEvent
187 */ 188 */
188 void BluezApplet::paintEvent( QPaintEvent* ) { 189 void BluezApplet::paintEvent( QPaintEvent* ) {
189 QPainter p(this); 190 QPainter p(this);
190 qDebug("paint bluetooth pixmap"); 191 qDebug("paint bluetooth pixmap");
191 192
192 p.eraseRect ( 0, 0, this->width(), this->height() );
193
194 if (bluezactive > 0) { 193 if (bluezactive > 0) {
195 p.drawPixmap( 0, 1, bluezOnPixmap ); 194 p.drawPixmap( 0, 1, bluezOnPixmap );
196 } else { 195 } else {
197 p.drawPixmap( 0, 1, bluezOffPixmap ); 196 p.drawPixmap( 0, 1, bluezOffPixmap );
198 } 197 }
199 198
diff --git a/noncore/net/opietooth/applet/bluezapplet.h b/noncore/net/opietooth/applet/bluezapplet.h
index 6a8a00e..a8d91a5 100644
--- a/noncore/net/opietooth/applet/bluezapplet.h
+++ b/noncore/net/opietooth/applet/bluezapplet.h
@@ -51,21 +51,20 @@ public slots:
51 void paintEvent( QPaintEvent* ); 51 void paintEvent( QPaintEvent* );
52 void launchManager(); 52 void launchManager();
53 bool checkBluezStatus(); 53 bool checkBluezStatus();
54 int setBluezStatus(int); 54 int setBluezStatus(int);
55 int checkBluezDiscoveryStatus(); 55 int checkBluezDiscoveryStatus();
56 int setBluezDiscoveryStatus(int); 56 int setBluezDiscoveryStatus(int);
57 int sockfd;
58 57
59 private: 58 private:
60 Device* btDevice; 59 Device* btDevice;
61 QPixmap bluezOnPixmap; 60 QPixmap bluezOnPixmap;
62 QPixmap bluezOffPixmap; 61 QPixmap bluezOffPixmap;
63 QPixmap bluezDiscoveryOnPixmap; 62 QPixmap bluezDiscoveryOnPixmap;
64 bool bluezactive; 63 bool bluezactive;
65 int bluezDiscoveryActive; 64 bool bluezDiscoveryActive;
66 65
67private slots: 66private slots:
68 67
69 68
70 }; 69 };
71}; 70};