Contents of /trunk/kdebase/patches/kdebase-3.5.5-dbus090.patch
Parent Directory | Revision Log
Revision 144 -
(show annotations)
(download)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 39199 byte(s)
Tue May 8 20:06:05 2007 UTC (17 years, 4 months ago) by niro
File size: 39199 byte(s)
-import
1 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/connection.cpp kdebase-3.5.1/kioslave/media/mediamanager/connection.cpp |
2 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/connection.cpp 1970-01-01 01:00:00.000000000 +0100 |
3 | +++ kdebase-3.5.1/kioslave/media/mediamanager/connection.cpp 2006-01-26 14:54:40.000000000 +0100 |
4 | @@ -0,0 +1,168 @@ |
5 | +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
6 | +/* connection.cpp: Qt wrapper for DBusConnection |
7 | + * |
8 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
9 | + * |
10 | + * Licensed under the Academic Free License version 2.0 |
11 | + * |
12 | + * This program is free software; you can redistribute it and/or modify |
13 | + * it under the terms of the GNU General Public License as published by |
14 | + * the Free Software Foundation; either version 2 of the License, or |
15 | + * (at your option) any later version. |
16 | + * |
17 | + * This program is distributed in the hope that it will be useful, |
18 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | + * GNU General Public License for more details. |
21 | + * |
22 | + * You should have received a copy of the GNU General Public License |
23 | + * along with this program; if not, write to the Free Software |
24 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
25 | + * |
26 | + */ |
27 | +#include "connection.h" |
28 | + |
29 | +using namespace DBusQt; |
30 | + |
31 | +#include "integrator.h" |
32 | +using Internal::Integrator; |
33 | + |
34 | +struct Connection::Private |
35 | +{ |
36 | + Private( Connection *qq ); |
37 | + void setConnection( DBusConnection *c ); |
38 | + DBusConnection *connection; |
39 | + int connectionSlot; |
40 | + DBusError error; |
41 | + Integrator *integrator; |
42 | + int timeout; |
43 | + Connection *q; |
44 | +}; |
45 | + |
46 | +Connection::Private::Private( Connection *qq ) |
47 | + : connection( 0 ), connectionSlot( 0 ), integrator( 0 ), |
48 | + timeout( -1 ), q( qq ) |
49 | +{ |
50 | + dbus_error_init( &error ); |
51 | +} |
52 | + |
53 | +void Connection::Private::setConnection( DBusConnection *c ) |
54 | +{ |
55 | + if (!c) { |
56 | + qDebug( "error: %s, %s", error.name, error.message ); |
57 | + dbus_error_free( &error ); |
58 | + return; |
59 | + } |
60 | + connection = c; |
61 | + integrator = new Integrator( c, q ); |
62 | + connect( integrator, SIGNAL(readReady()), q, SLOT(dispatchRead()) ); |
63 | +} |
64 | + |
65 | +Connection::Connection( QObject *parent ) |
66 | + : QObject( parent ) |
67 | +{ |
68 | + d = new Private( this ); |
69 | +} |
70 | + |
71 | +Connection::Connection( const QString& host, QObject *parent ) |
72 | + : QObject( parent ) |
73 | +{ |
74 | + d = new Private( this ); |
75 | + |
76 | + if ( !host.isEmpty() ) |
77 | + init( host ); |
78 | +} |
79 | + |
80 | +Connection::Connection( DBusBusType type, QObject* parent ) |
81 | + : QObject( parent ) |
82 | +{ |
83 | + d = new Private( this ); |
84 | + d->setConnection( dbus_bus_get(type, &d->error) ); |
85 | +} |
86 | + |
87 | +void Connection::init( const QString& host ) |
88 | +{ |
89 | + d->setConnection( dbus_connection_open( host.ascii(), &d->error) ); |
90 | + //dbus_connection_allocate_data_slot( &d->connectionSlot ); |
91 | + //dbus_connection_set_data( d->connection, d->connectionSlot, 0, 0 ); |
92 | +} |
93 | + |
94 | +bool Connection::isConnected() const |
95 | +{ |
96 | + return dbus_connection_get_is_connected( d->connection ); |
97 | +} |
98 | + |
99 | +bool Connection::isAuthenticated() const |
100 | +{ |
101 | + return dbus_connection_get_is_authenticated( d->connection ); |
102 | +} |
103 | + |
104 | +void Connection::open( const QString& host ) |
105 | +{ |
106 | + if ( host.isEmpty() ) return; |
107 | + |
108 | + init( host ); |
109 | +} |
110 | + |
111 | +void Connection::close() |
112 | +{ |
113 | + dbus_connection_close( d->connection ); |
114 | +} |
115 | + |
116 | +void Connection::flush() |
117 | +{ |
118 | + dbus_connection_flush( d->connection ); |
119 | +} |
120 | + |
121 | +void Connection::dispatchRead() |
122 | +{ |
123 | + while ( dbus_connection_dispatch( d->connection ) == DBUS_DISPATCH_DATA_REMAINS ) |
124 | + ; |
125 | +} |
126 | + |
127 | +DBusConnection* Connection::connection() const |
128 | +{ |
129 | + return d->connection; |
130 | +} |
131 | + |
132 | +Connection::Connection( DBusConnection *connection, QObject *parent ) |
133 | + : QObject( parent ) |
134 | +{ |
135 | + d = new Private(this); |
136 | + d->setConnection(connection); |
137 | +} |
138 | + |
139 | +void Connection::send( const Message &m ) |
140 | +{ |
141 | + dbus_connection_send(d->connection, m.message(), 0); |
142 | +} |
143 | + |
144 | +void Connection::sendWithReply( const Message& ) |
145 | +{ |
146 | +} |
147 | + |
148 | +Message Connection::sendWithReplyAndBlock( const Message &m ) |
149 | +{ |
150 | + DBusMessage *reply; |
151 | + reply = dbus_connection_send_with_reply_and_block( d->connection, m.message(), d->timeout, &d->error ); |
152 | + if (dbus_error_is_set(&d->error)) { |
153 | + qDebug("error: %s, %s", d->error.name, d->error.message); |
154 | + dbus_error_free(&d->error); |
155 | + } |
156 | + return Message( reply ); |
157 | +} |
158 | + |
159 | +void* Connection::virtual_hook( int, void* ) |
160 | +{ |
161 | +} |
162 | + |
163 | +void Connection::dbus_connection_setup_with_qt_main (DBusConnection *connection) |
164 | +{ |
165 | + d->setConnection( connection ); |
166 | +} |
167 | + |
168 | + |
169 | + |
170 | +///////////////////////////////////////////////////////// |
171 | + |
172 | +#include "connection.moc" |
173 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/connection.h kdebase-3.5.1/kioslave/media/mediamanager/connection.h |
174 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/connection.h 1970-01-01 01:00:00.000000000 +0100 |
175 | +++ kdebase-3.5.1/kioslave/media/mediamanager/connection.h 2006-01-26 14:54:44.000000000 +0100 |
176 | @@ -0,0 +1,86 @@ |
177 | +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
178 | +/* connection.h: Qt wrapper for DBusConnection |
179 | + * |
180 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
181 | + * |
182 | + * Licensed under the Academic Free License version 2.1 |
183 | + * |
184 | + * This program is free software; you can redistribute it and/or modify |
185 | + * it under the terms of the GNU General Public License as published by |
186 | + * the Free Software Foundation; either version 2 of the License, or |
187 | + * (at your option) any later version. |
188 | + * |
189 | + * This program is distributed in the hope that it will be useful, |
190 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
191 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
192 | + * GNU General Public License for more details. |
193 | + * |
194 | + * You should have received a copy of the GNU General Public License |
195 | + * along with this program; if not, write to the Free Software |
196 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
197 | + * |
198 | + */ |
199 | +#ifndef DBUS_QT_CONNECTION_H |
200 | +#define DBUS_QT_CONNECTION_H |
201 | + |
202 | +/* We acknowledge the the dbus API is unstable */ |
203 | +#define DBUS_API_SUBJECT_TO_CHANGE |
204 | + |
205 | +#include "message.h" |
206 | + |
207 | +#include <qobject.h> |
208 | +#include <qstring.h> |
209 | + |
210 | +#include "dbus/dbus.h" |
211 | + |
212 | +namespace DBusQt { |
213 | + namespace Internal { |
214 | + class Integrator; |
215 | + } |
216 | + |
217 | + class Connection : public QObject |
218 | + { |
219 | + Q_OBJECT |
220 | + public: |
221 | + Connection( QObject *parent =0 ); |
222 | + Connection( const QString& host, |
223 | + QObject *parent = 0 ); |
224 | + Connection( DBusBusType type, QObject* parent = 0 ); |
225 | + |
226 | + bool isConnected() const; |
227 | + bool isAuthenticated() const; |
228 | + |
229 | + Message borrowMessage(); |
230 | + Message popMessage(); |
231 | + void stealBorrowMessage( const Message& ); |
232 | + void dbus_connection_setup_with_qt_main (DBusConnection *connection); |
233 | + |
234 | + public slots: |
235 | + void open( const QString& ); |
236 | + void close(); |
237 | + void flush(); |
238 | + void send( const Message& ); |
239 | + void sendWithReply( const Message& ); |
240 | + Message sendWithReplyAndBlock( const Message& ); |
241 | + |
242 | + protected slots: |
243 | + void dispatchRead(); |
244 | + |
245 | + protected: |
246 | + void init( const QString& host ); |
247 | + virtual void *virtual_hook( int id, void *data ); |
248 | + |
249 | + private: |
250 | + friend class Internal::Integrator; |
251 | + DBusConnection *connection() const; |
252 | + Connection( DBusConnection *connection, QObject *parent ); |
253 | + |
254 | + private: |
255 | + struct Private; |
256 | + Private *d; |
257 | + }; |
258 | + |
259 | +} |
260 | + |
261 | + |
262 | +#endif |
263 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/integrator.cpp kdebase-3.5.1/kioslave/media/mediamanager/integrator.cpp |
264 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/integrator.cpp 1970-01-01 01:00:00.000000000 +0100 |
265 | +++ kdebase-3.5.1/kioslave/media/mediamanager/integrator.cpp 2006-01-26 14:54:52.000000000 +0100 |
266 | @@ -0,0 +1,244 @@ |
267 | +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
268 | +/* integrator.h: integrates D-BUS into Qt event loop |
269 | + * |
270 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
271 | + * |
272 | + * Licensed under the Academic Free License version 2.0 |
273 | + * |
274 | + * This program is free software; you can redistribute it and/or modify |
275 | + * it under the terms of the GNU General Public License as published by |
276 | + * the Free Software Foundation; either version 2 of the License, or |
277 | + * (at your option) any later version. |
278 | + * |
279 | + * This program is distributed in the hope that it will be useful, |
280 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
281 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
282 | + * GNU General Public License for more details. |
283 | + * |
284 | + * You should have received a copy of the GNU General Public License |
285 | + * along with this program; if not, write to the Free Software |
286 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
287 | + * |
288 | + */ |
289 | +#include "integrator.h" |
290 | +#include "connection.h" |
291 | + |
292 | +#include <qtimer.h> |
293 | +#include <qsocketnotifier.h> |
294 | +#include <qintdict.h> |
295 | +#include <qptrlist.h> |
296 | + |
297 | +namespace DBusQt |
298 | +{ |
299 | +namespace Internal { |
300 | + |
301 | +struct Watch { |
302 | + Watch(): readSocket( 0 ), writeSocket( 0 ) { } |
303 | + |
304 | + DBusWatch *watch; |
305 | + QSocketNotifier *readSocket; |
306 | + QSocketNotifier *writeSocket; |
307 | +}; |
308 | + |
309 | +////////////////////////////////////////////////////////////// |
310 | +dbus_bool_t dbusAddWatch( DBusWatch *watch, void *data ) |
311 | +{ |
312 | + Integrator *con = static_cast<Integrator*>( data ); |
313 | + con->addWatch( watch ); |
314 | + return true; |
315 | +} |
316 | +void dbusRemoveWatch( DBusWatch *watch, void *data ) |
317 | +{ |
318 | + Integrator *con = static_cast<Integrator*>( data ); |
319 | + con->removeWatch( watch ); |
320 | +} |
321 | + |
322 | +void dbusToggleWatch( DBusWatch *watch, void *data ) |
323 | +{ |
324 | + Integrator *itg = static_cast<Integrator*>( data ); |
325 | + if ( dbus_watch_get_enabled( watch ) ) |
326 | + itg->addWatch( watch ); |
327 | + else |
328 | + itg->removeWatch( watch ); |
329 | +} |
330 | + |
331 | +dbus_bool_t dbusAddTimeout( DBusTimeout *timeout, void *data ) |
332 | +{ |
333 | + if ( !dbus_timeout_get_enabled(timeout) ) |
334 | + return true; |
335 | + |
336 | + Integrator *itg = static_cast<Integrator*>( data ); |
337 | + itg->addTimeout( timeout ); |
338 | + return true; |
339 | +} |
340 | + |
341 | +void dbusRemoveTimeout( DBusTimeout *timeout, void *data ) |
342 | +{ |
343 | + Integrator *itg = static_cast<Integrator*>( data ); |
344 | + itg->removeTimeout( timeout ); |
345 | +} |
346 | + |
347 | +void dbusToggleTimeout( DBusTimeout *timeout, void *data ) |
348 | +{ |
349 | + Integrator *itg = static_cast<Integrator*>( data ); |
350 | + |
351 | + if ( dbus_timeout_get_enabled( timeout ) ) |
352 | + itg->addTimeout( timeout ); |
353 | + else |
354 | + itg->removeTimeout( timeout ); |
355 | +} |
356 | + |
357 | +void dbusWakeupMain( void* ) |
358 | +{ |
359 | +} |
360 | + |
361 | +void dbusNewConnection( DBusServer *server, |
362 | + DBusConnection *new_connection, |
363 | + void *data ) |
364 | +{ |
365 | + Integrator *itg = static_cast<Integrator*>( data ); |
366 | + itg->handleConnection( new_connection ); |
367 | +} |
368 | +///////////////////////////////////////////////////////////// |
369 | + |
370 | +Timeout::Timeout( QObject *parent, DBusTimeout *t ) |
371 | + : QObject( parent ), m_timeout( t ) |
372 | +{ |
373 | + m_timer = new QTimer( this ); |
374 | + connect( m_timer, SIGNAL(timeout()), |
375 | + SLOT(slotTimeout()) ); |
376 | +} |
377 | + |
378 | +void Timeout::slotTimeout() |
379 | +{ |
380 | + emit timeout( m_timeout ); |
381 | +} |
382 | + |
383 | +void Timeout::start() |
384 | +{ |
385 | + m_timer->start( dbus_timeout_get_interval( m_timeout ) ); |
386 | +} |
387 | + |
388 | +Integrator::Integrator( DBusConnection *conn, QObject *parent ) |
389 | + : QObject( parent ), m_connection( conn ) |
390 | +{ |
391 | + m_timeouts.setAutoDelete( true ); |
392 | + |
393 | + dbus_connection_set_watch_functions( m_connection, |
394 | + dbusAddWatch, |
395 | + dbusRemoveWatch, |
396 | + dbusToggleWatch, |
397 | + this, 0 ); |
398 | + dbus_connection_set_timeout_functions( m_connection, |
399 | + dbusAddTimeout, |
400 | + dbusRemoveTimeout, |
401 | + dbusToggleTimeout, |
402 | + this, 0 ); |
403 | + dbus_connection_set_wakeup_main_function( m_connection, |
404 | + dbusWakeupMain, |
405 | + this, 0 ); |
406 | +} |
407 | + |
408 | +Integrator::Integrator( DBusServer *server, QObject *parent ) |
409 | + : QObject( parent ), m_server( server ) |
410 | +{ |
411 | + m_connection = reinterpret_cast<DBusConnection*>( m_server ); |
412 | + m_timeouts.setAutoDelete( true ); |
413 | + |
414 | + dbus_server_set_watch_functions( m_server, |
415 | + dbusAddWatch, |
416 | + dbusRemoveWatch, |
417 | + dbusToggleWatch, |
418 | + this, 0 ); |
419 | + dbus_server_set_timeout_functions( m_server, |
420 | + dbusAddTimeout, |
421 | + dbusRemoveTimeout, |
422 | + dbusToggleTimeout, |
423 | + this, 0 ); |
424 | + dbus_server_set_new_connection_function( m_server, |
425 | + dbusNewConnection, |
426 | + this, 0 ); |
427 | +} |
428 | + |
429 | +void Integrator::slotRead( int fd ) |
430 | +{ |
431 | + QIntDictIterator<Watch> it( m_watches ); |
432 | + for ( ; it.current(); ++it ) |
433 | + dbus_watch_handle ( it.current()->watch, DBUS_WATCH_READABLE ); |
434 | + |
435 | + emit readReady(); |
436 | +} |
437 | + |
438 | +void Integrator::slotWrite( int fd ) |
439 | +{ |
440 | + QIntDictIterator<Watch> it( m_watches ); |
441 | + for ( ; it.current(); ++it ) |
442 | + dbus_watch_handle ( it.current()->watch, DBUS_WATCH_WRITABLE ); |
443 | +} |
444 | + |
445 | +void Integrator::slotTimeout( DBusTimeout *timeout ) |
446 | +{ |
447 | + dbus_timeout_handle( timeout ); |
448 | +} |
449 | + |
450 | +void Integrator::addWatch( DBusWatch *watch ) |
451 | +{ |
452 | + if ( !dbus_watch_get_enabled( watch ) ) |
453 | + return; |
454 | + |
455 | + Watch *qtwatch = new Watch; |
456 | + qtwatch->watch = watch; |
457 | + |
458 | + int flags = dbus_watch_get_flags( watch ); |
459 | + int fd = dbus_watch_get_fd( watch ); |
460 | + |
461 | + if ( flags & DBUS_WATCH_READABLE ) { |
462 | + qtwatch->readSocket = new QSocketNotifier( fd, QSocketNotifier::Read, this ); |
463 | + QObject::connect( qtwatch->readSocket, SIGNAL(activated(int)), SLOT(slotRead(int)) ); |
464 | + } |
465 | + |
466 | + if (flags & DBUS_WATCH_WRITABLE) { |
467 | + qtwatch->writeSocket = new QSocketNotifier( fd, QSocketNotifier::Write, this ); |
468 | + QObject::connect( qtwatch->writeSocket, SIGNAL(activated(int)), SLOT(slotWrite(int)) ); |
469 | + } |
470 | + |
471 | + m_watches.insert( fd, qtwatch ); |
472 | +} |
473 | + |
474 | +void Integrator::removeWatch( DBusWatch *watch ) |
475 | +{ |
476 | + int key = dbus_watch_get_fd( watch ); |
477 | + |
478 | + Watch *qtwatch = m_watches.take( key ); |
479 | + |
480 | + if ( qtwatch ) { |
481 | + delete qtwatch->readSocket; qtwatch->readSocket = 0; |
482 | + delete qtwatch->writeSocket; qtwatch->writeSocket = 0; |
483 | + delete qtwatch; |
484 | + } |
485 | +} |
486 | + |
487 | +void Integrator::addTimeout( DBusTimeout *timeout ) |
488 | +{ |
489 | + Timeout *mt = new Timeout( this, timeout ); |
490 | + m_timeouts.insert( timeout, mt ); |
491 | + connect( mt, SIGNAL(timeout(DBusTimeout*)), |
492 | + SLOT(slotTimeout(DBusTimeout*)) ); |
493 | + mt->start(); |
494 | +} |
495 | + |
496 | +void Integrator::removeTimeout( DBusTimeout *timeout ) |
497 | +{ |
498 | + m_timeouts.remove( timeout ); |
499 | +} |
500 | + |
501 | +void Integrator::handleConnection( DBusConnection *c ) |
502 | +{ |
503 | + Connection *con = new Connection( c, this ); |
504 | + emit newConnection( con ); |
505 | +} |
506 | + |
507 | +}//end namespace Internal |
508 | +}//end namespace DBusQt |
509 | + |
510 | +#include "integrator.moc" |
511 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/integrator.h kdebase-3.5.1/kioslave/media/mediamanager/integrator.h |
512 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/integrator.h 1970-01-01 01:00:00.000000000 +0100 |
513 | +++ kdebase-3.5.1/kioslave/media/mediamanager/integrator.h 2006-01-26 14:54:50.000000000 +0100 |
514 | @@ -0,0 +1,95 @@ |
515 | +// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*- |
516 | +/* integrator.h: integrates D-BUS into Qt event loop |
517 | + * |
518 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
519 | + * |
520 | + * Licensed under the Academic Free License version 2.1 |
521 | + * |
522 | + * This program is free software; you can redistribute it and/or modify |
523 | + * it under the terms of the GNU General Public License as published by |
524 | + * the Free Software Foundation; either version 2 of the License, or |
525 | + * (at your option) any later version. |
526 | + * |
527 | + * This program is distributed in the hope that it will be useful, |
528 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
529 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
530 | + * GNU General Public License for more details. |
531 | + * |
532 | + * You should have received a copy of the GNU General Public License |
533 | + * along with this program; if not, write to the Free Software |
534 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
535 | + * |
536 | + */ |
537 | +#ifndef DBUS_QT_INTEGRATOR_H |
538 | +#define DBUS_QT_INTEGRATOR_H |
539 | + |
540 | +/* We acknowledge the the dbus API is unstable */ |
541 | +#define DBUS_API_SUBJECT_TO_CHANGE |
542 | + |
543 | +#include <qobject.h> |
544 | + |
545 | +#include <qintdict.h> |
546 | +#include <qptrdict.h> |
547 | + |
548 | +#include "dbus/dbus.h" |
549 | + |
550 | +class QTimer; |
551 | + |
552 | +namespace DBusQt |
553 | +{ |
554 | + class Connection; |
555 | + |
556 | + namespace Internal |
557 | + { |
558 | + struct Watch; |
559 | + |
560 | + class Timeout : public QObject |
561 | + { |
562 | + Q_OBJECT |
563 | + public: |
564 | + Timeout( QObject *parent, DBusTimeout *t ); |
565 | + public: |
566 | + void start(); |
567 | + signals: |
568 | + void timeout( DBusTimeout* ); |
569 | + protected slots: |
570 | + void slotTimeout(); |
571 | + private: |
572 | + QTimer *m_timer; |
573 | + DBusTimeout *m_timeout; |
574 | + }; |
575 | + |
576 | + class Integrator : public QObject |
577 | + { |
578 | + Q_OBJECT |
579 | + public: |
580 | + Integrator( DBusConnection *connection, QObject *parent ); |
581 | + Integrator( DBusServer *server, QObject *parent ); |
582 | + |
583 | + signals: |
584 | + void readReady(); |
585 | + void newConnection( Connection* ); |
586 | + |
587 | + protected slots: |
588 | + void slotRead( int ); |
589 | + void slotWrite( int ); |
590 | + void slotTimeout( DBusTimeout *timeout ); |
591 | + |
592 | + public: |
593 | + void addWatch( DBusWatch* ); |
594 | + void removeWatch( DBusWatch* ); |
595 | + |
596 | + void addTimeout( DBusTimeout* ); |
597 | + void removeTimeout( DBusTimeout* ); |
598 | + |
599 | + void handleConnection( DBusConnection* ); |
600 | + private: |
601 | + QIntDict<Watch> m_watches; |
602 | + QPtrDict<Timeout> m_timeouts; |
603 | + DBusConnection *m_connection; |
604 | + DBusServer *m_server; |
605 | + }; |
606 | + } |
607 | +} |
608 | + |
609 | +#endif |
610 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/message.cpp kdebase-3.5.1/kioslave/media/mediamanager/message.cpp |
611 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/message.cpp 1970-01-01 01:00:00.000000000 +0100 |
612 | +++ kdebase-3.5.1/kioslave/media/mediamanager/message.cpp 2006-01-26 14:54:57.000000000 +0100 |
613 | @@ -0,0 +1,551 @@ |
614 | +/* -*- mode: C++; c-file-style: "gnu" -*- */ |
615 | +/* message.cpp: Qt wrapper for DBusMessage |
616 | + * |
617 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
618 | + * |
619 | + * Licensed under the Academic Free License version 2.0 |
620 | + * |
621 | + * This program is free software; you can redistribute it and/or modify |
622 | + * it under the terms of the GNU General Public License as published by |
623 | + * the Free Software Foundation; either version 2 of the License, or |
624 | + * (at your option) any later version. |
625 | + * |
626 | + * This program is distributed in the hope that it will be useful, |
627 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
628 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
629 | + * GNU General Public License for more details. |
630 | + * |
631 | + * You should have received a copy of the GNU General Public License |
632 | + * along with this program; if not, write to the Free Software |
633 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
634 | + * |
635 | + */ |
636 | +#include "message.h" |
637 | + |
638 | +#include <qmap.h> |
639 | + |
640 | +#include <cstdlib> |
641 | + |
642 | +namespace DBusQt { |
643 | + |
644 | +struct Message::iterator::IteratorData { |
645 | + DBusMessageIter *iter; |
646 | + QVariant var; |
647 | + bool end; |
648 | + DBusMessage *mesg; |
649 | +}; |
650 | + |
651 | +/** |
652 | + * Iterator. |
653 | + */ |
654 | +Message::iterator::iterator() |
655 | +{ |
656 | + d = new IteratorData; |
657 | + d->iter = 0; d->end = true; |
658 | +} |
659 | + |
660 | +/** |
661 | + * Constructs iterator for the message. |
662 | + * @param msg message whose fields we want to iterate |
663 | + */ |
664 | +Message::iterator::iterator( DBusMessage* msg ) |
665 | +{ |
666 | + d = new IteratorData; |
667 | + d->mesg = msg; |
668 | + d->iter = static_cast<DBusMessageIter *>( malloc( sizeof(DBusMessageIter) ) ); |
669 | + dbus_message_iter_init( d->mesg, d->iter ); |
670 | + if ( !d->iter ) { |
671 | + qDebug("No iterator??"); |
672 | + } |
673 | + fillVar(); |
674 | + d->end = false; |
675 | +} |
676 | + |
677 | +/** |
678 | + * Copy constructor for the iterator. |
679 | + * @param itr iterator |
680 | + */ |
681 | +Message::iterator::iterator( const iterator& itr ) |
682 | +{ |
683 | + d = new IteratorData; |
684 | + d->iter = itr.d->iter; |
685 | + d->var = itr.d->var; |
686 | + d->end = itr.d->end; |
687 | +} |
688 | + |
689 | +/** |
690 | + * Destructor. |
691 | + */ |
692 | +Message::iterator::~iterator() |
693 | +{ |
694 | + free( d->iter ); |
695 | + delete d; d=0; |
696 | +} |
697 | + |
698 | +/** |
699 | + * Creates an iterator equal to the @p itr iterator |
700 | + * @param itr other iterator |
701 | + * @return |
702 | + */ |
703 | +Message::iterator& |
704 | +Message::iterator::operator=( const iterator& itr ) |
705 | +{ |
706 | + IteratorData *tmp = new IteratorData; |
707 | + tmp->iter = itr.d->iter; |
708 | + tmp->var = itr.d->var; |
709 | + tmp->end = itr.d->end; |
710 | + delete d; d=tmp; |
711 | + return *this; |
712 | +} |
713 | + |
714 | +/** |
715 | + * Returns the constant QVariant held by the iterator. |
716 | + * @return the constant reference to QVariant held by this iterator |
717 | + */ |
718 | +const QVariant& |
719 | +Message::iterator::operator*() const |
720 | +{ |
721 | + return d->var; |
722 | +} |
723 | + |
724 | +/** |
725 | + * Returns the QVariant held by the iterator. |
726 | + * @return reference to QVariant held by this iterator |
727 | + */ |
728 | +QVariant& |
729 | +Message::iterator::operator*() |
730 | +{ |
731 | + return d->var; |
732 | +} |
733 | + |
734 | +/** |
735 | + * Moves to the next field and return a reference to itself after |
736 | + * incrementing. |
737 | + * @return reference to self after incrementing |
738 | + */ |
739 | +Message::iterator& |
740 | +Message::iterator::operator++() |
741 | +{ |
742 | + if ( d->end ) |
743 | + return *this; |
744 | + |
745 | + if ( dbus_message_iter_next( d->iter ) ) { |
746 | + fillVar(); |
747 | + } else { |
748 | + d->end = true; |
749 | + d->var = QVariant(); |
750 | + } |
751 | + return *this; |
752 | +} |
753 | + |
754 | +/** |
755 | + * Moves to the next field and returns self before incrementing. |
756 | + * @return self before incrementing |
757 | + */ |
758 | +Message::iterator |
759 | +Message::iterator::operator++(int) |
760 | +{ |
761 | + iterator itr( *this ); |
762 | + operator++(); |
763 | + return itr; |
764 | +} |
765 | + |
766 | +/** |
767 | + * Compares this iterator to @p it iterator. |
768 | + * @param it the iterator to which we're comparing this one to |
769 | + * @return true if they're equal, false otherwise |
770 | + */ |
771 | +bool |
772 | +Message::iterator::operator==( const iterator& it ) |
773 | +{ |
774 | + if ( d->end == it.d->end ) { |
775 | + if ( d->end == true ) { |
776 | + return true; |
777 | + } else { |
778 | + return d->var == it.d->var; |
779 | + } |
780 | + } else |
781 | + return false; |
782 | +} |
783 | + |
784 | +/** |
785 | + * Compares two iterators. |
786 | + * @param it The other iterator. |
787 | + * @return true if two iterators are not equal, false |
788 | + * otherwise |
789 | + */ |
790 | +bool |
791 | +Message::iterator::operator!=( const iterator& it ) |
792 | +{ |
793 | + return !operator==( it ); |
794 | +} |
795 | + |
796 | +QVariant Message::iterator::marshallBaseType( DBusMessageIter* i ) |
797 | +{ |
798 | + QVariant ret; |
799 | + switch (dbus_message_iter_get_arg_type(i)) { |
800 | + case DBUS_TYPE_INT32: |
801 | + { |
802 | + dbus_int32_t v; |
803 | + dbus_message_iter_get_basic (i, &v); |
804 | + ret = QVariant( v ); |
805 | + } |
806 | + break; |
807 | + case DBUS_TYPE_UINT32: |
808 | + { |
809 | + dbus_uint32_t v; |
810 | + dbus_message_iter_get_basic (i, &v); |
811 | + ret = QVariant( v ); |
812 | + } |
813 | + break; |
814 | + case DBUS_TYPE_DOUBLE: |
815 | + { |
816 | + double v; |
817 | + dbus_message_iter_get_basic (i, &v); |
818 | + ret = QVariant( v ); |
819 | + } |
820 | + break; |
821 | + case DBUS_TYPE_STRING: |
822 | + { |
823 | + const char *v; |
824 | + dbus_message_iter_get_basic (i, &v); |
825 | + ret = QVariant( v ); |
826 | + } |
827 | + break; |
828 | + default: |
829 | + ret = QVariant(); |
830 | + break; |
831 | + } |
832 | + return ret; |
833 | +} |
834 | + |
835 | +/** |
836 | + * Fills QVariant based on what current DBusMessageIter helds. |
837 | + */ |
838 | +void |
839 | +Message::iterator::fillVar() |
840 | +{ |
841 | + switch ( dbus_message_iter_get_arg_type( d->iter ) ) { |
842 | + case DBUS_TYPE_INT32: |
843 | + case DBUS_TYPE_UINT32: |
844 | + case DBUS_TYPE_DOUBLE: |
845 | + case DBUS_TYPE_STRING: |
846 | + d->var = marshallBaseType( d->iter ); |
847 | + break; |
848 | + case DBUS_TYPE_ARRAY: { |
849 | + switch ( dbus_message_iter_get_element_type( d->iter ) ) { |
850 | + case DBUS_TYPE_STRING: { |
851 | + QStringList tempList; |
852 | + DBusMessageIter sub; |
853 | + dbus_message_iter_recurse (d->iter, &sub); |
854 | + while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID) |
855 | + { |
856 | + const char *v; |
857 | + dbus_message_iter_get_basic (&sub, &v); |
858 | + tempList.append( QString( v ) ); |
859 | + dbus_message_iter_next (&sub); |
860 | + } |
861 | + d->var = QVariant( tempList ); |
862 | + break; |
863 | + } |
864 | + default: |
865 | + qDebug( "Array of type not implemented" ); |
866 | + d->var = QVariant(); |
867 | + break; |
868 | + } |
869 | + break; |
870 | + } |
871 | +#if 0 |
872 | + /* DICT is gone for now, but expected to be reintroduced, or else |
873 | + * reintroduced as a flag on the introspection data that can |
874 | + * apply to array of struct of two fields |
875 | + */ |
876 | + case DBUS_TYPE_DICT: { |
877 | + qDebug( "Got a hash!" ); |
878 | + QMap<QString, QVariant> tempMap; |
879 | + DBusMessageIter dictIter; |
880 | + dbus_message_iter_init_dict_iterator( d->iter, &dictIter ); |
881 | + do { |
882 | + char *key = dbus_message_iter_get_dict_key( &dictIter ); |
883 | + tempMap[key] = marshallBaseType( &dictIter ); |
884 | + dbus_free( key ); |
885 | + dbus_message_iter_next( &dictIter ); |
886 | + } while( dbus_message_iter_has_next( &dictIter ) ); |
887 | + d->var = QVariant( tempMap ); |
888 | + break; |
889 | + qDebug( "Hash/Dict type not implemented" ); |
890 | + d->var = QVariant(); |
891 | + break; |
892 | + } |
893 | +#endif |
894 | + default: |
895 | + qDebug( "not implemented" ); |
896 | + d->var = QVariant(); |
897 | + break; |
898 | + } |
899 | +} |
900 | + |
901 | +/** |
902 | + * Returns a QVariant help by this iterator. |
903 | + * @return QVariant held by this iterator |
904 | + */ |
905 | +QVariant |
906 | +Message::iterator::var() const |
907 | +{ |
908 | + return d->var; |
909 | +} |
910 | + |
911 | +struct Message::Private { |
912 | + DBusMessage *msg; |
913 | +}; |
914 | + |
915 | +Message::Message( DBusMessage *m ) |
916 | +{ |
917 | + d = new Private; |
918 | + d->msg = m; |
919 | +} |
920 | + |
921 | +/** |
922 | + * |
923 | + */ |
924 | +Message::Message( int messageType ) |
925 | +{ |
926 | + d = new Private; |
927 | + d->msg = dbus_message_new( messageType ); |
928 | +} |
929 | + |
930 | +/** |
931 | + * Constructs a new Message with the given service and name. |
932 | + * @param service service service that the message should be sent to |
933 | + * @param name name of the message |
934 | + */ |
935 | +Message::Message( const QString& service, const QString& path, |
936 | + const QString& interface, const QString& method ) |
937 | +{ |
938 | + d = new Private; |
939 | + d->msg = dbus_message_new_method_call( service.latin1(), path.latin1(), |
940 | + interface.latin1(), method.latin1() ); |
941 | +} |
942 | + |
943 | +/** |
944 | + * Constructs a message that is a reply to some other |
945 | + * message. |
946 | + * @param name the name of the message |
947 | + * @param replayingTo original_message the message which the created |
948 | + * message is a reply to. |
949 | + */ |
950 | +Message::Message( const Message& replayingTo ) |
951 | +{ |
952 | + d = new Private; |
953 | + d->msg = dbus_message_new_method_return( replayingTo.d->msg ); |
954 | +} |
955 | + |
956 | +Message:: Message( const QString& path, const QString& interface, |
957 | + const QString& name ) |
958 | +{ |
959 | + d = new Private; |
960 | + d->msg = dbus_message_new_signal( path.ascii(), interface.ascii(), |
961 | + name.ascii() ); |
962 | +} |
963 | + |
964 | +Message::Message( const Message& replayingTo, const QString& errorName, |
965 | + const QString& errorMessage ) |
966 | +{ |
967 | + d = new Private; |
968 | + d->msg = dbus_message_new_error( replayingTo.d->msg, errorName.utf8(), |
969 | + errorMessage.utf8() ); |
970 | +} |
971 | + |
972 | +Message Message::operator=( const Message& other ) |
973 | +{ |
974 | + //FIXME: ref the other.d->msg instead of copying it? |
975 | +} |
976 | +/** |
977 | + * Destructs message. |
978 | + */ |
979 | +Message::~Message() |
980 | +{ |
981 | + if ( d->msg ) { |
982 | + dbus_message_unref( d->msg ); |
983 | + } |
984 | + delete d; d=0; |
985 | +} |
986 | + |
987 | +int Message::type() const |
988 | +{ |
989 | + return dbus_message_get_type( d->msg ); |
990 | +} |
991 | + |
992 | +void Message::setPath( const QString& path ) |
993 | +{ |
994 | + dbus_message_set_path( d->msg, path.ascii() ); |
995 | +} |
996 | + |
997 | +QString Message::path() const |
998 | +{ |
999 | + return dbus_message_get_path( d->msg ); |
1000 | +} |
1001 | + |
1002 | +void Message::setInterface( const QString& iface ) |
1003 | +{ |
1004 | + dbus_message_set_interface( d->msg, iface.ascii() ); |
1005 | +} |
1006 | + |
1007 | +QString Message::interface() const |
1008 | +{ |
1009 | + return dbus_message_get_interface( d->msg ); |
1010 | +} |
1011 | + |
1012 | +void Message::setMember( const QString& member ) |
1013 | +{ |
1014 | + dbus_message_set_member( d->msg, member.ascii() ); |
1015 | +} |
1016 | + |
1017 | +QString Message::member() const |
1018 | +{ |
1019 | + return dbus_message_get_member( d->msg ); |
1020 | +} |
1021 | + |
1022 | +QString Message::errorName() const |
1023 | +{ |
1024 | + return dbus_message_get_error_name( d->msg ); |
1025 | +} |
1026 | + |
1027 | +QString Message::destination() const |
1028 | +{ |
1029 | + return dbus_message_get_destination( d->msg ); |
1030 | +} |
1031 | + |
1032 | +/** |
1033 | + * Sets the message sender. |
1034 | + * @param sender the sender |
1035 | + * @return false if unsuccessful |
1036 | + */ |
1037 | +bool |
1038 | +Message::setSender( const QString& sender ) |
1039 | +{ |
1040 | + return dbus_message_set_sender( d->msg, sender.latin1() ); |
1041 | +} |
1042 | + |
1043 | +/** |
1044 | + * Returns sender of this message. |
1045 | + * @return sender |
1046 | + */ |
1047 | +QString |
1048 | +Message::sender() const |
1049 | +{ |
1050 | + return dbus_message_get_sender( d->msg ); |
1051 | +} |
1052 | + |
1053 | +QString Message::signature() const |
1054 | +{ |
1055 | + return dbus_message_get_signature( d->msg ); |
1056 | +} |
1057 | + |
1058 | + |
1059 | +/** |
1060 | + * Returns the starting iterator for the fields of this |
1061 | + * message. |
1062 | + * @return starting iterator |
1063 | + */ |
1064 | +Message::iterator |
1065 | +Message::begin() const |
1066 | +{ |
1067 | + return iterator( d->msg ); |
1068 | +} |
1069 | + |
1070 | +/** |
1071 | + * Returns the ending iterator for the fields of this |
1072 | + * message. |
1073 | + * @return ending iterator |
1074 | + */ |
1075 | +Message::iterator |
1076 | +Message::end() const |
1077 | +{ |
1078 | + return iterator(); |
1079 | +} |
1080 | + |
1081 | +/** |
1082 | + * Returns the field at position @p i |
1083 | + * @param i position of the wanted field |
1084 | + * @return QVariant at position @p i or an empty QVariant |
1085 | + */ |
1086 | +QVariant |
1087 | +Message::at( int i ) |
1088 | +{ |
1089 | + iterator itr( d->msg ); |
1090 | + |
1091 | + while ( i-- ) { |
1092 | + if ( itr == end() ) |
1093 | + return QVariant();//nothing there |
1094 | + ++itr; |
1095 | + } |
1096 | + return *itr; |
1097 | +} |
1098 | + |
1099 | +/** |
1100 | + * The underlying DBusMessage of this class. |
1101 | + * @return DBusMessage pointer. |
1102 | + */ |
1103 | +DBusMessage* |
1104 | +Message::message() const |
1105 | +{ |
1106 | + return d->msg; |
1107 | +} |
1108 | + |
1109 | +Message& Message::operator<<( bool b ) |
1110 | +{ |
1111 | + const dbus_bool_t right_size_bool = b; |
1112 | + dbus_message_append_args( d->msg, DBUS_TYPE_BOOLEAN, &right_size_bool, |
1113 | + DBUS_TYPE_INVALID ); |
1114 | +} |
1115 | + |
1116 | +Message& Message::operator<<( Q_INT8 byte ) |
1117 | +{ |
1118 | + dbus_message_append_args( d->msg, DBUS_TYPE_BYTE, &byte, |
1119 | + DBUS_TYPE_INVALID ); |
1120 | +} |
1121 | + |
1122 | +Message& Message::operator<<( Q_INT32 num ) |
1123 | +{ |
1124 | + dbus_message_append_args( d->msg, DBUS_TYPE_INT32, &num, |
1125 | + DBUS_TYPE_INVALID ); |
1126 | +} |
1127 | + |
1128 | +Message& Message::operator<<( Q_UINT32 num ) |
1129 | +{ |
1130 | + dbus_message_append_args( d->msg, DBUS_TYPE_UINT32, &num, |
1131 | + DBUS_TYPE_INVALID ); |
1132 | +} |
1133 | + |
1134 | +Message& Message::operator<<( Q_INT64 num ) |
1135 | +{ |
1136 | + dbus_message_append_args( d->msg, DBUS_TYPE_INT64, &num, |
1137 | + DBUS_TYPE_INVALID ); |
1138 | +} |
1139 | + |
1140 | +Message& Message::operator<<( Q_UINT64 num ) |
1141 | +{ |
1142 | + dbus_message_append_args( d->msg, DBUS_TYPE_UINT64, &num, |
1143 | + DBUS_TYPE_INVALID ); |
1144 | +} |
1145 | + |
1146 | +Message& Message::operator<<( double num ) |
1147 | +{ |
1148 | + dbus_message_append_args( d->msg, DBUS_TYPE_DOUBLE, &num, |
1149 | + DBUS_TYPE_INVALID ); |
1150 | +} |
1151 | + |
1152 | +Message& Message::operator<<( const QString& str ) |
1153 | +{ |
1154 | + const char *u = str.utf8(); |
1155 | + dbus_message_append_args( d->msg, DBUS_TYPE_STRING, &u, |
1156 | + DBUS_TYPE_INVALID ); |
1157 | +} |
1158 | + |
1159 | +Message& Message::operator<<( const QVariant& custom ) |
1160 | +{ |
1161 | + //FIXME: imeplement |
1162 | +} |
1163 | + |
1164 | +} |
1165 | diff -Nur kdebase-3.5.1/kioslave/media.orig/mediamanager/message.h kdebase-3.5.1/kioslave/media/mediamanager/message.h |
1166 | --- kdebase-3.5.1/kioslave/media.orig/mediamanager/message.h 1970-01-01 01:00:00.000000000 +0100 |
1167 | +++ kdebase-3.5.1/kioslave/media/mediamanager/message.h 2006-01-26 14:55:00.000000000 +0100 |
1168 | @@ -0,0 +1,132 @@ |
1169 | +/* -*- mode: C++; c-file-style: "gnu" -*- */ |
1170 | +/* message.h: Qt wrapper for DBusMessage |
1171 | + * |
1172 | + * Copyright (C) 2003 Zack Rusin <zack@kde.org> |
1173 | + * |
1174 | + * Licensed under the Academic Free License version 2.1 |
1175 | + * |
1176 | + * This program is free software; you can redistribute it and/or modify |
1177 | + * it under the terms of the GNU General Public License as published by |
1178 | + * the Free Software Foundation; either version 2 of the License, or |
1179 | + * (at your option) any later version. |
1180 | + * |
1181 | + * This program is distributed in the hope that it will be useful, |
1182 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1183 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1184 | + * GNU General Public License for more details. |
1185 | + * |
1186 | + * You should have received a copy of the GNU General Public License |
1187 | + * along with this program; if not, write to the Free Software |
1188 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
1189 | + * |
1190 | + */ |
1191 | +#ifndef DBUS_QT_MESSAGE_H |
1192 | +#define DBUS_QT_MESSAGE_H |
1193 | + |
1194 | +/* We acknowledge the the dbus API is unstable */ |
1195 | +#define DBUS_API_SUBJECT_TO_CHANGE |
1196 | + |
1197 | +#include <qvariant.h> |
1198 | +#include <qstring.h> |
1199 | +#include <qstringlist.h> |
1200 | + |
1201 | +#include "dbus/dbus.h" |
1202 | + |
1203 | +namespace DBusQt { |
1204 | + |
1205 | + class Message |
1206 | + { |
1207 | + public: |
1208 | + class iterator { |
1209 | + public: |
1210 | + iterator(); |
1211 | + iterator( const iterator& ); |
1212 | + iterator( DBusMessage* msg ); |
1213 | + ~iterator(); |
1214 | + |
1215 | + iterator& operator=( const iterator& ); |
1216 | + const QVariant& operator*() const; |
1217 | + QVariant& operator*(); |
1218 | + iterator& operator++(); |
1219 | + iterator operator++(int); |
1220 | + bool operator==( const iterator& it ); |
1221 | + bool operator!=( const iterator& it ); |
1222 | + |
1223 | + QVariant var() const; |
1224 | + protected: |
1225 | + QVariant marshallBaseType( DBusMessageIter* i ); |
1226 | + void fillVar(); |
1227 | + struct IteratorData; |
1228 | + IteratorData *d; |
1229 | + }; |
1230 | + |
1231 | + Message( int messageType ); |
1232 | + Message( DBusMessage * );//hide this one from the public implementation |
1233 | + Message( const QString& service, const QString& path, |
1234 | + const QString& interface, const QString& method ); |
1235 | + Message( const Message& replayingTo ); |
1236 | + Message( const QString& path, const QString& interface, |
1237 | + const QString& name ); |
1238 | + Message( const Message& replayingTo, const QString& errorName, |
1239 | + const QString& errorMessage ); |
1240 | + |
1241 | + Message operator=( const Message& other ); |
1242 | + |
1243 | + virtual ~Message(); |
1244 | + |
1245 | + int type() const; |
1246 | + |
1247 | + void setPath( const QString& ); |
1248 | + QString path() const; |
1249 | + |
1250 | + void setInterface( const QString& ); |
1251 | + QString interface() const; |
1252 | + |
1253 | + void setMember( const QString& ); |
1254 | + QString member() const; |
1255 | + |
1256 | + QString errorName() const; |
1257 | + |
1258 | + QString destination() const; |
1259 | + |
1260 | + bool setSender( const QString& sender ); |
1261 | + QString sender() const; |
1262 | + |
1263 | + QString signature() const; |
1264 | + |
1265 | + iterator begin() const; |
1266 | + iterator end() const; |
1267 | + |
1268 | + QVariant at( int i ); |
1269 | + |
1270 | + |
1271 | + public: |
1272 | + Message& operator<<( bool ); |
1273 | + Message& operator<<( Q_INT8 ); |
1274 | + Message& operator<<( Q_INT32 ); |
1275 | + Message& operator<<( Q_UINT32 ); |
1276 | + Message& operator<<( Q_INT64 ); |
1277 | + Message& operator<<( Q_UINT64 ); |
1278 | + Message& operator<<( double ); |
1279 | + Message& operator<<( const QString& ); |
1280 | + Message& operator<<( const QVariant& ); |
1281 | + //Message& operator<<(); |
1282 | + //Message& operator<<(); |
1283 | + //Message& operator<<(); |
1284 | + //Message& operator<<(); |
1285 | + //Message& operator<<(); |
1286 | + //Message& operator<<(); |
1287 | + //Message& operator<<(); |
1288 | + |
1289 | + protected: |
1290 | + friend class Connection; |
1291 | + DBusMessage* message() const; |
1292 | + |
1293 | + private: |
1294 | + struct Private; |
1295 | + Private *d; |
1296 | + }; |
1297 | + |
1298 | +} |
1299 | + |
1300 | +#endif |
1301 | --- kdebase-3.5.5/kioslave/media/configure.in.in.orig 2006-10-01 19:31:54.000000000 +0200 |
1302 | +++ kdebase-3.5.5/kioslave/media/configure.in.in 2006-12-01 19:15:45.000000000 +0100 |
1303 | @@ -97,70 +97,6 @@ |
1304 | |
1305 | AC_SUBST(DBUS_INCS) |
1306 | AC_SUBST(DBUS_LIBS) |
1307 | - |
1308 | -########### Check for DBus-Qt3 bindings |
1309 | - |
1310 | - AC_MSG_CHECKING(for DBus-Qt3 bindings) |
1311 | - |
1312 | - dbusqt_inc=NOTFOUND |
1313 | - dbusqt_lib=NOTFOUND |
1314 | - dbusqt=NOTFOUND |
1315 | - |
1316 | - search_incs="$kde_includes $kde_extra_includes /usr/include /usr/include/dbus-1.0 /usr/local/include /usr/local/include/dbus-1.0" |
1317 | - AC_FIND_FILE(dbus/connection.h, $search_incs, dbusqt_incdir) |
1318 | - |
1319 | - if test -r $dbusqt_incdir/dbus/connection.h ; then |
1320 | - have_qt_patch=0 |
1321 | - grep dbus_connection_setup_with_qt_main $dbusqt_incdir/dbus/connection.h \ |
1322 | - > /dev/null 2>&1 && have_qt_patch=1 |
1323 | - if test $have_qt_patch = 1 ; then |
1324 | - DBUSQT_INCS="-I$dbusqt_incdir" |
1325 | - dbusqt_inc=FOUND |
1326 | - fi |
1327 | - fi |
1328 | - |
1329 | - search_libs="$kde_libraries $kde_extra_libs /usr/lib$kdelibsuff /usr/local/lib$kdelibsuff" |
1330 | - AC_FIND_FILE(libdbus-qt-1.so, $search_libs, dbusqt_libdir) |
1331 | - |
1332 | - if test -r $dbusqt_libdir/libdbus-qt-1.so ; then |
1333 | - DBUSQT_LIBS="-L$dbusqt_libdir -ldbus-qt-1" |
1334 | - dbusqt_lib=FOUND |
1335 | - fi |
1336 | - |
1337 | - if test $dbusqt_inc != FOUND || test $dbusqt_lib != FOUND ; then |
1338 | - |
1339 | - search_incs="`pkg-config --cflags dbus-1 |sed 's/-I//g'`" |
1340 | - AC_FIND_FILE(dbus/connection.h, $search_incs, dbusqt_incdir) |
1341 | - if test -r $dbusqt_incdir/dbus/connection.h ; then |
1342 | - have_qt_patch=0 |
1343 | - grep dbus_connection_setup_with_qt_main $dbusqt_incdir/dbus/connection.h \ |
1344 | - > /dev/null 2>&1 && have_qt_patch=1 |
1345 | - if test $have_qt_patch = 1 ; then |
1346 | - DBUSQT_INCS="-I$dbusqt_incdir" |
1347 | - dbusqt_inc=FOUND |
1348 | - fi |
1349 | - fi |
1350 | - |
1351 | - search_libs="`pkg-config --libs dbus-1 --libs-only-L | sed 's/-L//g'`" |
1352 | - AC_FIND_FILE(libdbus-qt-1.so, $search_libs, dbusqt_libdir) |
1353 | - |
1354 | - if test -r $dbusqt_libdir/libdbus-qt-1.so ; then |
1355 | - DBUSQT_LIBS="-L$dbusqt_libdir -ldbus-qt-1" |
1356 | - dbusqt_lib=FOUND |
1357 | - fi |
1358 | - |
1359 | - fi |
1360 | - |
1361 | - |
1362 | - if test $dbusqt_inc = FOUND && test $dbusqt_lib = FOUND ; then |
1363 | - AC_MSG_RESULT(headers $dbusqt_incdir libraries $dbusqt_libdir) |
1364 | - dbusqt=FOUND |
1365 | - else |
1366 | - AC_MSG_RESULT(searched but not found) |
1367 | - fi |
1368 | - |
1369 | - AC_SUBST(DBUSQT_INCS) |
1370 | - AC_SUBST(DBUSQT_LIBS) |
1371 | fi |
1372 | |
1373 | ########### Check if media HAL backend sould be compiled |
1374 | @@ -168,7 +104,7 @@ |
1375 | AC_MSG_CHECKING(if the HAL backend for media:/ should be compiled) |
1376 | |
1377 | HALBACKEND=no |
1378 | -if test "x$hal" = "xFOUND" && test "x$dbus" = "xFOUND" && test "x$dbusqt" = "xFOUND" ; then |
1379 | +if test "x$hal" = "xFOUND" && test "x$dbus" = "xFOUND" ; then |
1380 | AC_DEFINE_UNQUOTED([COMPILE_HALBACKEND],1, [media HAL backend compilation]) |
1381 | HALBACKEND=yes |
1382 | AC_SUBST(HALBACKEND) |
1383 | --- kdebase-3.5.2/kioslave/media/mediamanager/Makefile.am.tn 2006-04-03 23:29:27.000000000 +0200 |
1384 | +++ kdebase-3.5.2/kioslave/media/mediamanager/Makefile.am 2006-04-03 23:29:31.000000000 +0200 |
1385 | @@ -1,17 +1,22 @@ |
1386 | kde_module_LTLIBRARIES = kded_mediamanager.la |
1387 | |
1388 | if include_media_halbackend |
1389 | -HALBACKEND_INCS = $(HAL_INCS) $(DBUS_INCS) $(DBUSQT_INCS) |
1390 | +HALBACKEND_INCS = $(HAL_INCS) $(DBUS_INCS) |
1391 | endif |
1392 | |
1393 | METASOURCES = AUTO |
1394 | INCLUDES = -I$(srcdir)/../libmediacommon -I../libmediacommon $(HALBACKEND_INCS) $(all_includes) |
1395 | |
1396 | +DBUSQT3BINDING_LIB = libdbusqt3.la |
1397 | +libdbusqt3_la_SOURCES = connection.cpp integrator.cpp message.cpp |
1398 | +libdbusqt3_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined |
1399 | +libdbusqt3_la_LIBADD = $(HAL_LIBS) $(DBUS_LIBS) |
1400 | + |
1401 | if include_media_halbackend |
1402 | HALBACKEND_LIB = libhalbackend.la |
1403 | libhalbackend_la_SOURCES = halbackend.cpp |
1404 | libhalbackend_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined |
1405 | -libhalbackend_la_LIBADD = $(HAL_LIBS) $(DBUS_LIBS) $(DBUSQT_LIBS) |
1406 | +libhalbackend_la_LIBADD = $(HAL_LIBS) $(DBUS_LIBS) $(DBUSQT3BINDING_LIB) |
1407 | endif |
1408 | |
1409 | if include_media_linuxcdpolling |
1410 | @@ -20,7 +25,7 @@ |
1411 | liblinuxcdpolling_la_LDFLAGS = -avoid-version $(all_libraries) -no-undefined |
1412 | endif |
1413 | |
1414 | -noinst_LTLIBRARIES = $(LINUXCDPOLLING_LIB) $(HALBACKEND_LIB) |
1415 | +noinst_LTLIBRARIES = $(LINUXCDPOLLING_LIB) $(HALBACKEND_LIB) $(DBUSQT3BINDING_LIB) |
1416 | |
1417 | kded_mediamanager_la_SOURCES = mediamanager.cpp mediamanager.skel medialist.cpp backendbase.cpp fstabbackend.cpp removablebackend.cpp mediadirnotify.cpp mediadirnotify.skel |
1418 | kded_mediamanager_la_LDFLAGS = $(all_libraries) -module -avoid-version |
1419 | --- kdebase-3.5.3/kioslave/media/mediamanager/halbackend.h.tn 2006-06-01 17:40:51.000000000 +0200 |
1420 | +++ kdebase-3.5.3/kioslave/media/mediamanager/halbackend.h 2006-06-01 17:36:23.000000000 +0200 |
1421 | @@ -40,7 +40,7 @@ |
1422 | /* We acknowledge the the dbus API is unstable */ |
1423 | #define DBUS_API_SUBJECT_TO_CHANGE |
1424 | /* DBus-Qt bindings */ |
1425 | -#include <dbus/connection.h> |
1426 | +#include <connection.h> |
1427 | /* HAL libraries */ |
1428 | #include <libhal.h> |
1429 | #include <libhal-storage.h> |