summaryrefslogtreecommitdiff
authorharlekin <harlekin>2003-03-26 18:23:22 (UTC)
committer harlekin <harlekin>2003-03-26 18:23:22 (UTC)
commit88a93db37e001dc02f9edddf81919266fde0173c (patch) (unidiff)
tree337a5b57f3aeb600258f992b261e24bae145519b
parent86f5b1b916949da47d23549ffcff68e039d38ebb (diff)
downloadopie-88a93db37e001dc02f9edddf81919266fde0173c.zip
opie-88a93db37e001dc02f9edddf81919266fde0173c.tar.gz
opie-88a93db37e001dc02f9edddf81919266fde0173c.tar.bz2
nicer icon for search
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/obex/obexsend.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/obex/obexsend.cpp b/core/obex/obexsend.cpp
index 1b19c6b..2931cf7 100644
--- a/core/obex/obexsend.cpp
+++ b/core/obex/obexsend.cpp
@@ -88,208 +88,208 @@ void SendWidget::send( const QString& file, const QString& desc ) {
88 88
89 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) { 89 if ( !QCopChannel::isRegistered("QPE/IrDaApplet") ) {
90 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error ); 90 m_irDeSearch = m_devBox->addDevice( tr("IrDa is not enabled!"), DeviceBox::Error );
91 m_start++; 91 m_start++;
92 }else 92 }else
93 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search ); 93 m_irDeSearch = m_devBox->addDevice( tr("Searching for IrDa Devices."), DeviceBox::Search );
94 94
95 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) { 95 if ( !QCopChannel::isRegistered("QPE/Bluetooth") ) {
96 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error ); 96 m_btDeSearch = m_devBox->addDevice( tr("Bluetooth is not available"), DeviceBox::Error );
97 m_start++; 97 m_start++;
98 }else 98 }else
99 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search ); 99 m_btDeSearch = m_devBox->addDevice( tr("Searching for bluetooth Devices."), DeviceBox::Search );
100 100
101 if (m_start != 2 ) { 101 if (m_start != 2 ) {
102 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()"); 102 QCopEnvelope e0("QPE/IrDaApplet", "enableIrda()");
103 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()"); 103 QCopEnvelope e1("QPE/Bluetooth", "enableBluetooth()");
104 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 104 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
105 QCopEnvelope e3("QPE/Bluetooth", "listDevices()"); 105 QCopEnvelope e3("QPE/Bluetooth", "listDevices()");
106 } 106 }
107} 107}
108void SendWidget::slotIrDaDevices( const QStringList& list) { 108void SendWidget::slotIrDaDevices( const QStringList& list) {
109 qWarning("slot it irda devices "); 109 qWarning("slot it irda devices ");
110 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) { 110 for (QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) {
111 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") ); 111 int id = m_devBox->addDevice( (*it), DeviceBox::IrDa, tr("Scheduling for beam.") );
112 m_irDa.insert( id, (*it) ); 112 m_irDa.insert( id, (*it) );
113 } 113 }
114 m_devBox->removeDevice( m_irDeSearch ); 114 m_devBox->removeDevice( m_irDeSearch );
115 m_irDaIt = m_irDa.begin(); 115 m_irDaIt = m_irDa.begin();
116 116
117 slotStartIrda(); 117 slotStartIrda();
118} 118}
119 119
120void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) { 120void SendWidget::slotBTDevices( const QMap<QString, QString>& str ) {
121 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) { 121 for(QMap<QString, QString>::ConstIterator it = str.begin(); it != str.end(); ++it ) {
122 int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") ); 122 int id = m_devBox->addDevice( it.key(), DeviceBox::BT, tr("Click to beam") );
123 m_bt.insert( id, Pair( it.key(), it.data() ) ); 123 m_bt.insert( id, Pair( it.key(), it.data() ) );
124 } 124 }
125 m_devBox->removeDevice( m_btDeSearch ); 125 m_devBox->removeDevice( m_btDeSearch );
126} 126}
127void SendWidget::slotSelectedDevice( int name, int dev ) { 127void SendWidget::slotSelectedDevice( int name, int dev ) {
128 qWarning("Start beam? %d %d", name, dev ); 128 qWarning("Start beam? %d %d", name, dev );
129 if ( name == m_irDeSearch ) { 129 if ( name == m_irDeSearch ) {
130 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it ) 130 for (QMap<int, QString>::Iterator it= m_irDa.begin(); it != m_irDa.end(); ++it )
131 m_devBox->removeDevice( it.key() ); 131 m_devBox->removeDevice( it.key() );
132 132
133 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()"); 133 QCopEnvelope e2("QPE/IrDaApplet", "listDevices()");
134 } 134 }
135} 135}
136void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) { 136void SendWidget::dispatchIrda( const QCString& str, const QByteArray& ar ) {
137 qWarning("dispatch irda %s", str.data() ); 137 qWarning("dispatch irda %s", str.data() );
138 if ( str == "devices(QStringList)" ) { 138 if ( str == "devices(QStringList)" ) {
139 QDataStream stream( ar, IO_ReadOnly ); 139 QDataStream stream( ar, IO_ReadOnly );
140 QStringList list; 140 QStringList list;
141 stream >> list; 141 stream >> list;
142 slotIrDaDevices( list ); 142 slotIrDaDevices( list );
143 } 143 }
144} 144}
145void SendWidget::dispatchBt( const QCString&, const QByteArray& ) { 145void SendWidget::dispatchBt( const QCString&, const QByteArray& ) {
146 146
147} 147}
148void SendWidget::slotIrError( int ) { 148void SendWidget::slotIrError( int ) {
149 149
150} 150}
151void SendWidget::slotIrSent( bool b) { 151void SendWidget::slotIrSent( bool b) {
152 qWarning("irda sent!!"); 152 qWarning("irda sent!!");
153 QString text = b ? tr("Sent") : tr("Failure"); 153 QString text = b ? tr("Sent") : tr("Failure");
154 m_devBox->setStatus( m_irDaIt.key(), text ); 154 m_devBox->setStatus( m_irDaIt.key(), text );
155 ++m_irDaIt; 155 ++m_irDaIt;
156 slotStartIrda(); 156 slotStartIrda();
157} 157}
158void SendWidget::slotIrTry(unsigned int trI) { 158void SendWidget::slotIrTry(unsigned int trI) {
159 m_devBox->setStatus( m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ) ); 159 m_devBox->setStatus( m_irDaIt.key(), tr("Try %1").arg( QString::number( trI ) ) );
160} 160}
161void SendWidget::slotStartIrda() { 161void SendWidget::slotStartIrda() {
162 if (m_irDaIt == m_irDa.end() ) { 162 if (m_irDaIt == m_irDa.end() ) {
163 m_irDeSearch = m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search ); 163 m_irDeSearch = m_devBox->addDevice(tr("Search again for IrDa."), DeviceBox::Search );
164 return; 164 return;
165 } 165 }
166 m_devBox->setStatus( m_irDaIt.key(), tr("Start sending") ); 166 m_devBox->setStatus( m_irDaIt.key(), tr("Start sending") );
167 m_obex->send( m_file ); 167 m_obex->send( m_file );
168} 168}
169void SendWidget::closeEvent( QCloseEvent* e) { 169void SendWidget::closeEvent( QCloseEvent* e) {
170 e->accept(); // make sure 170 e->accept(); // make sure
171 QTimer::singleShot(0, this, SLOT(slotDone() ) ); 171 QTimer::singleShot(0, this, SLOT(slotDone() ) );
172} 172}
173void SendWidget::slotDone() { 173void SendWidget::slotDone() {
174 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()"); 174 QCopEnvelope e0("QPE/IrDaApplet", "disableIrda()");
175 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()"); 175 QCopEnvelope e1("QPE/Bluetooth", "disableBluetooth()");
176 emit done(); 176 emit done();
177} 177}
178QString SendWidget::file()const { 178QString SendWidget::file()const {
179 return m_file; 179 return m_file;
180} 180}
181DeviceBox::DeviceBox( QWidget* parent ) 181DeviceBox::DeviceBox( QWidget* parent )
182 : QTextBrowser( parent ) { 182 : QTextBrowser( parent ) {
183 183
184} 184}
185DeviceBox::~DeviceBox() { 185DeviceBox::~DeviceBox() {
186 186
187} 187}
188int DeviceBox::addDevice( const QString& name, int dev, const QString& status ) { 188int DeviceBox::addDevice( const QString& name, int dev, const QString& status ) {
189 /* return a id for a range of devices */ 189 /* return a id for a range of devices */
190 int id = idFor ( dev ); 190 int id = idFor ( dev );
191 DeviceItem item( name, status, dev,id ); 191 DeviceItem item( name, status, dev,id );
192 m_dev.insert( id, item ); 192 m_dev.insert( id, item );
193 setText( allText() ); 193 setText( allText() );
194 194
195 return id; 195 return id;
196} 196}
197void DeviceBox::removeDevice( int id ) { 197void DeviceBox::removeDevice( int id ) {
198 if (!m_dev.contains(id) ) return; 198 if (!m_dev.contains(id) ) return;
199 199
200 m_dev.remove( id ); 200 m_dev.remove( id );
201 setText( allText() ); 201 setText( allText() );
202} 202}
203void DeviceBox::setStatus( int id, const QString& status ) { 203void DeviceBox::setStatus( int id, const QString& status ) {
204 if ( !m_dev.contains(id) ) return; 204 if ( !m_dev.contains(id) ) return;
205 m_dev[id].setStatus(status ); 205 m_dev[id].setStatus(status );
206 setText( allText() ); 206 setText( allText() );
207} 207}
208void DeviceBox::setSource( const QString& str ) { 208void DeviceBox::setSource( const QString& str ) {
209 qWarning("SetSource:%d", str.toInt() ); 209 qWarning("SetSource:%d", str.toInt() );
210 int id = str.toInt(); 210 int id = str.toInt();
211 emit selectedDevice( id, m_dev[id].device() ); 211 emit selectedDevice( id, m_dev[id].device() );
212} 212}
213int DeviceBox::idFor ( int id ) { 213int DeviceBox::idFor ( int id ) {
214 static int irId = 1501; 214 static int irId = 1501;
215 static int irBT = 1001; 215 static int irBT = 1001;
216 static int irSr = 501; 216 static int irSr = 501;
217 static int irEr = 0; 217 static int irEr = 0;
218 218
219 int ret = -1; 219 int ret = -1;
220 switch(id ) { 220 switch(id ) {
221 case IrDa: 221 case IrDa:
222 ret = irId; 222 ret = irId;
223 irId++; 223 irId++;
224 break; 224 break;
225 case BT: 225 case BT:
226 ret = irBT; 226 ret = irBT;
227 irBT++; 227 irBT++;
228 break; 228 break;
229 case Search: 229 case Search:
230 ret = irSr; 230 ret = irSr;
231 irSr++; 231 irSr++;
232 break; 232 break;
233 case Error: 233 case Error:
234 ret = irEr; 234 ret = irEr;
235 irEr++; 235 irEr++;
236 break; 236 break;
237 } 237 }
238 return ret; 238 return ret;
239} 239}
240QString DeviceBox::allText() { 240QString DeviceBox::allText() {
241 QString str; 241 QString str;
242 typedef QMap<int, DeviceItem> DeviceMap; 242 typedef QMap<int, DeviceItem> DeviceMap;
243 243
244 for (QMap<int, DeviceItem>::Iterator it = m_dev.begin(); it != m_dev.end(); ++it ) { 244 for (QMap<int, DeviceItem>::Iterator it = m_dev.begin(); it != m_dev.end(); ++it ) {
245 str += it.data().toString() + "<br>"; 245 str += it.data().toString() + "<br>";
246 } 246 }
247 return str; 247 return str;
248} 248}
249 249
250DeviceItem::DeviceItem( const QString& name, 250DeviceItem::DeviceItem( const QString& name,
251 const QString& status, int dev, int id) 251 const QString& status, int dev, int id)
252{ 252{
253 m_name = name; 253 m_name = name;
254 m_status = status; 254 m_status = status;
255 m_dev = dev; 255 m_dev = dev;
256 m_id = id; 256 m_id = id;
257} 257}
258int DeviceItem::id()const { 258int DeviceItem::id()const {
259 return m_id; 259 return m_id;
260} 260}
261QString DeviceItem::name()const { 261QString DeviceItem::name()const {
262 return m_name; 262 return m_name;
263} 263}
264QString DeviceItem::status()const { 264QString DeviceItem::status()const {
265 return m_status; 265 return m_status;
266} 266}
267int DeviceItem::device()const { 267int DeviceItem::device()const {
268 return m_dev; 268 return m_dev;
269} 269}
270QString DeviceItem::pixmap()const{ 270QString DeviceItem::pixmap()const{
271 QString str; 271 QString str;
272 switch(m_dev) { 272 switch(m_dev) {
273 case DeviceBox::IrDa: 273 case DeviceBox::IrDa:
274 str ="obex/irda"; 274 str ="obex/irda";
275 break; 275 break;
276 case DeviceBox::BT: 276 case DeviceBox::BT:
277 str ="obex/bt"; 277 str ="obex/bt";
278 break; 278 break;
279 case DeviceBox::Search: 279 case DeviceBox::Search:
280 str = "obex/search"; 280 str = "mag";
281 break; 281 break;
282 case DeviceBox::Error: 282 case DeviceBox::Error:
283 str = "editdelete"; 283 str = "editdelete";
284 break; 284 break;
285 }; 285 };
286 return str; 286 return str;
287} 287}
288DeviceItem::~DeviceItem() { 288DeviceItem::~DeviceItem() {
289} 289}
290void DeviceItem::setStatus(const QString& status ) { 290void DeviceItem::setStatus(const QString& status ) {
291 m_status = status; 291 m_status = status;
292} 292}
293QString DeviceItem::toString()const { 293QString DeviceItem::toString()const {
294 return "<p><a href=\""+QString::number(m_id) +"\" ><img src=\""+pixmap()+"\" >"+m_name+" "+m_status+" </a></p>" ; 294 return "<p><a href=\""+QString::number(m_id) +"\" ><img src=\""+pixmap()+"\" >"+m_name+" "+m_status+" </a></p>" ;
295} 295}