author | harlekin <harlekin> | 2002-06-01 23:40:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-06-01 23:40:58 (UTC) |
commit | a885fb38c87f97fd44e307397daf39bed3a2b9f1 (patch) (unidiff) | |
tree | 8de4888e3bd81eb95ca869afe23d0e27cea065d4 | |
parent | 7b145de0bf5dfe015e3c53fb4058315857e725a3 (diff) | |
download | opie-a885fb38c87f97fd44e307397daf39bed3a2b9f1.zip opie-a885fb38c87f97fd44e307397daf39bed3a2b9f1.tar.gz opie-a885fb38c87f97fd44e307397daf39bed3a2b9f1.tar.bz2 |
update
-rw-r--r-- | noncore/net/opietooth/applet/bluezapplet.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/opietooth/applet/bluezapplet.cpp b/noncore/net/opietooth/applet/bluezapplet.cpp index 9569b36..b662ff7 100644 --- a/noncore/net/opietooth/applet/bluezapplet.cpp +++ b/noncore/net/opietooth/applet/bluezapplet.cpp | |||
@@ -60,129 +60,129 @@ namespace OpieTooth { | |||
60 | 60 | ||
61 | BluezApplet::~BluezApplet() { | 61 | BluezApplet::~BluezApplet() { |
62 | } | 62 | } |
63 | 63 | ||
64 | int BluezApplet::checkBluezStatus() { | 64 | int BluezApplet::checkBluezStatus() { |
65 | if (btDevice->isLoaded() ) { | 65 | if (btDevice->isLoaded() ) { |
66 | return 1; | 66 | return 1; |
67 | } else { | 67 | } else { |
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | } | 70 | } |
71 | 71 | ||
72 | int BluezApplet::setBluezStatus(int c) { | 72 | int BluezApplet::setBluezStatus(int c) { |
73 | 73 | ||
74 | if (c == 1) { | 74 | if (c == 1) { |
75 | btDevice = new Device("/dev/ttySB0", "scr" ); | 75 | btDevice = new Device("/dev/ttySB0", "scr" ); |
76 | // system("hciattach /dev/ttySB0 csr"); | 76 | // system("hciattach /dev/ttySB0 csr"); |
77 | //system("hcid"); | 77 | //system("hcid"); |
78 | } else { | 78 | } else { |
79 | if (btDevice) { | 79 | if (btDevice) { |
80 | delete btDevice; | 80 | delete btDevice; |
81 | } | 81 | } |
82 | //system("killall hciattach"); | 82 | //system("killall hciattach"); |
83 | //system("killall hcid"); | 83 | //system("killall hcid"); |
84 | } | 84 | } |
85 | return 0; | 85 | return 0; |
86 | } | 86 | } |
87 | 87 | ||
88 | int BluezApplet::checkBluezDiscoveryStatus() { | 88 | int BluezApplet::checkBluezDiscoveryStatus() { |
89 | } | 89 | } |
90 | 90 | ||
91 | int BluezApplet::setBluezDiscoveryStatus(int d) { | 91 | int BluezApplet::setBluezDiscoveryStatus(int d) { |
92 | } | 92 | } |
93 | 93 | ||
94 | void BluezApplet::mousePressEvent( QMouseEvent *) { | 94 | void BluezApplet::mousePressEvent( QMouseEvent *) { |
95 | 95 | ||
96 | QPopupMenu *menu = new QPopupMenu(); | 96 | QPopupMenu *menu = new QPopupMenu(); |
97 | QPopupMenu *signal = new QPopupMenu(); | 97 | QPopupMenu *signal = new QPopupMenu(); |
98 | int ret=0; | 98 | int ret=0; |
99 | 99 | ||
100 | /* Refresh active state */ | 100 | /* Refresh active state */ |
101 | timerEvent(NULL); | 101 | timerEvent(NULL); |
102 | 102 | ||
103 | 103 | ||
104 | if (bluezactive) { | 104 | if (bluezactive) { |
105 | menu->insertItem( tr("Disable Bluetooth"), 0 ); | 105 | menu->insertItem( tr("Disable Bluetooth"), 0 ); |
106 | } else { | 106 | } else { |
107 | menu->insertItem( tr("Enable Bluetooth"), 1 ); | 107 | menu->insertItem( tr("Enable Bluetooth"), 1 ); |
108 | } | 108 | } |
109 | 109 | ||
110 | menu->insertItem( tr("Launch manager"), 2 ); | 110 | menu->insertItem( tr("Launch manager"), 2 ); |
111 | 111 | ||
112 | menu->insertSeparator(6); | 112 | menu->insertSeparator(6); |
113 | menu->insertItem( tr("Signal strength"), signal, 5); | 113 | menu->insertItem( tr("Signal strength"), signal, 5); |
114 | menu->insertSeparator(8); | 114 | menu->insertSeparator(8); |
115 | 115 | ||
116 | if (bluezDiscoveryActive) { | 116 | if (bluezDiscoveryActive) { |
117 | menu->insertItem( tr("Disable discovery"), 3 ); | 117 | menu->insertItem( tr("Disable discovery"), 3 ); |
118 | } else { | 118 | } else { |
119 | menu->insertItem( tr("Enable discovery"), 4 ); | 119 | menu->insertItem( tr("Enable discovery"), 4 ); |
120 | } | 120 | } |
121 | //menu->insertItem( tr("More..."), 7 ) | 121 | //menu->insertItem( tr("More..."), 7 ) |
122 | 122 | ||
123 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); | 123 | QPoint p = mapToGlobal( QPoint(1, -menu->sizeHint().height()-1) ); |
124 | ret = menu->exec(p, 2); | 124 | ret = menu->exec(p, 0); |
125 | 125 | ||
126 | // qDebug("ret was %d\n", ret); | 126 | // qDebug("ret was %d\n", ret); |
127 | 127 | ||
128 | switch(ret) { | 128 | switch(ret) { |
129 | case 0: | 129 | case 0: |
130 | setBluezStatus(0); | 130 | setBluezStatus(0); |
131 | timerEvent(NULL); | 131 | timerEvent(NULL); |
132 | break; | 132 | break; |
133 | case 1: | 133 | case 1: |
134 | setBluezStatus(1); | 134 | setBluezStatus(1); |
135 | timerEvent(NULL); | 135 | timerEvent(NULL); |
136 | break; | 136 | break; |
137 | case 2: | 137 | case 2: |
138 | // start bluetoothmanager | 138 | // start bluetoothmanager |
139 | launchManager(); | 139 | launchManager(); |
140 | timerEvent(NULL); | 140 | timerEvent(NULL); |
141 | break; | 141 | break; |
142 | case 3: | 142 | case 3: |
143 | setBluezDiscoveryStatus(0); | 143 | setBluezDiscoveryStatus(0); |
144 | timerEvent(NULL); | 144 | timerEvent(NULL); |
145 | break; | 145 | break; |
146 | case 4: | 146 | case 4: |
147 | setBluezDiscoveryStatus(1); | 147 | setBluezDiscoveryStatus(1); |
148 | timerEvent(NULL); | 148 | timerEvent(NULL); |
149 | break; | 149 | break; |
150 | //case 7: | 150 | //case 7: |
151 | // With table of currently-detected devices. | 151 | // With table of currently-detected devices. |
152 | } | 152 | } |
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
156 | * Launches the bluetooth manager | 156 | * Launches the bluetooth manager |
157 | */ | 157 | */ |
158 | void BluezApplet::launchManager() { | 158 | void BluezApplet::launchManager() { |
159 | QCopEnvelope e("QPE/System", "execute(QString)"); | 159 | QCopEnvelope e("QPE/System", "execute(QString)"); |
160 | e << QString("bluetooth-manager"); | 160 | e << QString("bluetooth-manager"); |
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Refresh timer | 164 | * Refresh timer |
165 | * @param the timer event | 165 | * @param the timer event |
166 | */ | 166 | */ |
167 | void BluezApplet::timerEvent( QTimerEvent * ) { | 167 | void BluezApplet::timerEvent( QTimerEvent * ) { |
168 | int oldactive = bluezactive; | 168 | int oldactive = bluezactive; |
169 | int olddiscovery = bluezDiscoveryActive; | 169 | int olddiscovery = bluezDiscoveryActive; |
170 | 170 | ||
171 | bluezactive = checkBluezStatus(); | 171 | bluezactive = checkBluezStatus(); |
172 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); | 172 | bluezDiscoveryActive = checkBluezDiscoveryStatus(); |
173 | 173 | ||
174 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { | 174 | if ((bluezactive != oldactive) || (bluezDiscoveryActive != olddiscovery)) { |
175 | paintEvent(NULL); | 175 | paintEvent(NULL); |
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Implementation of the paint event | 180 | * Implementation of the paint event |
181 | * @param the QPaintEvent | 181 | * @param the QPaintEvent |
182 | */ | 182 | */ |
183 | void BluezApplet::paintEvent( QPaintEvent* ) { | 183 | void BluezApplet::paintEvent( QPaintEvent* ) { |
184 | QPainter p(this); | 184 | QPainter p(this); |
185 | qDebug("paint bluetooth pixmap"); | 185 | qDebug("paint bluetooth pixmap"); |
186 | 186 | ||
187 | p.eraseRect ( 0, 0, this->width(), this->height() ); | 187 | p.eraseRect ( 0, 0, this->width(), this->height() ); |
188 | 188 | ||