Added dbus-tqt and dbus-tqt-1 from SVN

v3.5.13-sru
Timothy Pearson 13 years ago
parent 7d523fac5a
commit 10df383d2a

@ -0,0 +1,16 @@
Olivier Andrieu <oliv__a@users.sourceforge.net>
Philip Blundell <pb@nexus.co.uk>
Anders Carlsson <andersca@gnome.org>
Kristian Hogsberg <krh@redhat.com>
Alex Larsson <alexl@redhat.com>
Robert McQueen <robot101@debian.org>
Michael Meeks <michael@ximian.com>
Seth Nickell <seth@gnome.org>
John (J5) Palmieri <johnp@redhat.com>
Havoc Pennington <hp@redhat.com>
Harri Porten <porten@kde.org>
Matthew Rickard <mjricka@epoch.ncsc.mil>
Zack Rusin <zack@kde.org>
Joe Shaw <joe@assbarn.com>
Colin Walters <walters@verbum.org>
David Zeuthen <david@fubar.dk>

@ -0,0 +1,82 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
project( dbus-tqt-1 )
##### cmake setup ###############################
cmake_minimum_required( VERSION 2.8 )
include( FindPkgConfig )
include( CheckCXXSourceCompiles )
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
include( ConfigureChecks.cmake )
##### install paths setup #######################
tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" )
tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )
##### install headers ###########################
install( FILES
dbus-qt.h message.h connection.h server.h
DESTINATION ${INCLUDE_INSTALL_DIR}/dbus-1.0/dbus )
##### write pkgconfig file ######################
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} )
configure_file( dbus-tqt.pc.cmake dbus-tqt.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
##### build setup ###############################
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
add_definitions(
-DQT_THREAD_SUPPORT
${TQT_CFLAGS_OTHER}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TQT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
)
##### dbus-tqt-1 (shared) #########################
tde_add_library( dbus-tqt-1 SHARED AUTOMOC
SOURCES
dbus-qthread.cpp message.cpp connection.cpp
integrator.cpp server.cpp
VERSION 0.0.0
LINK ${TQT_LIBRARIES} ${DBUS_LIBRARIES}
DESTINATION ${LIB_INSTALL_DIR}
)

@ -0,0 +1,551 @@
D-BUS is licensed to you under your choice of the Academic Free
License version 2.1, or the GNU General Public License version 2.
Both licenses are included here. Some of the standalone binaries are
under the GPL only; in particular, but not limited to,
tools/dbus-cleanup-sockets.c and test/decode-gcov.c. Each source code
file is marked with the proper copyright information.
The Academic Free License
v. 2.1
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
Licensed under the Academic Free License version 2.1
1) Grant of Copyright License. Licensor hereby grants You a
world-wide, royalty-free, non-exclusive, perpetual, sublicenseable
license to do the following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original Work;
c) to distribute copies of the Original Work and Derivative Works to the public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide,
royalty-free, non-exclusive, perpetual, sublicenseable license, under
patent claims owned or controlled by the Licensor that are embodied in
the Original Work as furnished by the Licensor, to make, use, sell and
offer for sale the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the
preferred form of the Original Work for making modifications to it and
all available documentation describing how to modify the Original
Work. Licensor hereby agrees to provide a machine-readable copy of the
Source Code of the Original Work along with each copy of the Original
Work that Licensor distributes. Licensor reserves the right to satisfy
this obligation by placing a machine-readable copy of the Source Code
in an information repository reasonably calculated to permit
inexpensive and convenient access by You for as long as Licensor
continues to distribute the Original Work, and by publishing the
address of that information repository in a notice immediately
following the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor
the names of any contributors to the Original Work, nor any of their
trademarks or service marks, may be used to endorse or promote
products derived from this Original Work without express prior written
permission of the Licensor. Nothing in this License shall be deemed to
grant any rights to trademarks, copyrights, patents, trade secrets or
any other intellectual property of Licensor except as expressly stated
herein. No patent license is granted to make, use, sell or offer to
sell embodiments of any patent claims other than the licensed claims
defined in Section 2. No right is granted to the trademarks of
Licensor even if such marks are included in the Original Work. Nothing
in this License shall be interpreted to prohibit Licensor from
licensing under different terms from this License any Original Work
that Licensor otherwise would have a right to license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any
Derivative Works that You create, all copyright, patent or trademark
notices from the Source Code of the Original Work, as well as any
notices of licensing and any descriptive text identified therein as an
"Attribution Notice." You must cause the Source Code for any
Derivative Works that You create to carry a prominent Attribution
Notice reasonably calculated to inform recipients that You have
modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor
warrants that the copyright in and to the Original Work and the patent
rights granted herein by Licensor are owned by the Licensor or are
sublicensed to You under the terms of this License with the permission
of the contributor(s) of those copyrights and patent rights. Except as
expressly stated in the immediately proceeding sentence, the Original
Work is provided under this License on an "AS IS" BASIS and WITHOUT
WARRANTY, either express or implied, including, without limitation,
the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL
WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential
part of this License. No license to Original Work is granted hereunder
except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal
theory, whether in tort (including negligence), contract, or
otherwise, shall the Licensor be liable to any person for any direct,
indirect, special, incidental, or consequential damages of any
character arising as a result of this License or the use of the
Original Work including, without limitation, damages for loss of
goodwill, work stoppage, computer failure or malfunction, or any and
all other commercial damages or losses. This limitation of liability
shall not apply to liability for death or personal injury resulting
from Licensor's negligence to the extent applicable law prohibits such
limitation. Some jurisdictions do not allow the exclusion or
limitation of incidental or consequential damages, so this exclusion
and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the
Original Work or a Derivative Work, You must make a reasonable effort
under the circumstances to obtain the express assent of recipients to
the terms of this License. Nothing else but this License (or another
written agreement between Licensor and You) grants You permission to
create Derivative Works based upon the Original Work or to exercise
any of the rights granted in Section 1 herein, and any attempt to do
so except under the terms of this License (or another written
agreement between Licensor and You) is expressly prohibited by
U.S. copyright law, the equivalent laws of other countries, and by
international treaty. Therefore, by exercising any of the rights
granted to You in Section 1 herein, You indicate Your acceptance of
this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate
automatically and You may no longer exercise any of the rights granted
to You by this License as of the date You commence an action,
including a cross-claim or counterclaim, against Licensor or any
licensee alleging that the Original Work infringes a patent. This
termination provision shall not apply for an action alleging patent
infringement by combinations of the Original Work with other software
or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating
to this License may be brought only in the courts of a jurisdiction
wherein the Licensor resides or in which Licensor conducts its primary
business, and under the laws of that jurisdiction excluding its
conflict-of-law provisions. The application of the United Nations
Convention on Contracts for the International Sale of Goods is
expressly excluded. Any use of the Original Work outside the scope of
this License or after its termination shall be subject to the
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101
et seq., the equivalent laws of other countries, and international
treaty. This section shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License
or seeking damages relating thereto, the prevailing party shall be
entitled to recover its costs and expenses, including, without
limitation, reasonable attorneys' fees and costs incurred in
connection with such action, including any appeal of such action. This
section shall survive the termination of this License.
13) Miscellaneous. This License represents the complete agreement
concerning the subject matter hereof. If any provision of this License
is held to be unenforceable, such provision shall be reformed only to
the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this
License, whether in upper or lower case, means an individual or a
legal entity exercising rights under, and complying with all of the
terms of, this License. For legal entities, "You" includes any entity
that controls, is controlled by, or is under common control with
you. For purposes of this definition, "control" means (i) the power,
direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of fifty
percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not
otherwise restricted or conditioned by this License or by law, and
Licensor promises not to interfere with or be responsible for such
uses by You.
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights
reserved. Permission is hereby granted to copy and distribute this
license without modification. This license may not be modified without
the express written permission of its copyright owner.
--
END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential
differences between the Academic Free License (AFL) version 1.0 and other
open source licenses:
The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache
licenses in many respects but it is intended to solve a few problems with
those licenses.
* The AFL is written so as to make it clear what software is being
licensed (by the inclusion of a statement following the copyright notice
in the software). This way, the license functions better than a template
license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software.
* The AFL tqcontains a complete copyright grant to the software. The BSD
and Apache licenses are vague and incomplete in that respect.
* The AFL tqcontains a complete patent grant to the software. The BSD, MIT,
UoI/NCSA and Apache licenses rely on an implied patent license and contain
no explicit patent grant.
* The AFL makes it clear that no trademark rights are granted to the
licensor's trademarks. The Apache license tqcontains such a provision, but the
BSD, MIT and UoI/NCSA licenses do not.
* The AFL includes the warranty by the licensor that it either owns the
copyright or that it is distributing the software under a license. None of
the other licenses contain that warranty. All other warranties are disclaimed,
as is the case for the other licenses.
* The AFL is itself copyrighted (with the right granted to copy and distribute
without modification). This ensures that the owner of the copyright to the
license will control changes. The Apache license tqcontains a copyright notice,
but the BSD, MIT and UoI/NCSA licenses do not.
--
START OF GNU GENERAL PUBLIC LICENSE
--
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which tqcontains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part tqcontains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it tqcontains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,22 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# dbus-1
pkg_search_module( DBUS dbus-1 )
if( NOT DBUS_FOUND )
tde_message_fatal( "dbus-1 is required, but was not found on your system" )
endif( )
# qt3
find_package( Qt )
# tqt
find_package( TQt )

@ -0,0 +1,200 @@
The guidelines in this file are the ideals; it's better to send a
not-fully-following-guidelines patch than no patch at all, though. We
can always polish it up.
Mailing list
===
The D-BUS mailing list is message-bus-list@freedesktop.org; discussion
of patches, etc. should go there.
Security
===
Most of D-BUS is security sensitive. Guidelines related to that:
- avoid memcpy(), sprintf(), strlen(), snprintf, strlcat(),
strstr(), strtok(), or any of this stuff. Use DBusString.
If DBusString doesn't have the feature you need, add it
to DBusString.
There are some exceptions, for example
if your strings are just used to index a hash table
and you don't do any parsing/modification of them, perhaps
DBusString is wasteful and wouldn't help much. But definitely
if you're doing any parsing, reallocation, etc. use DBusString.
- do not include system headers outside of dbus-memory.c,
dbus-sysdeps.c, and other places where they are already
included. This gives us one place to audit all external
dependencies on features in libc, etc.
- do not use libc features that are "complicated"
and may contain security holes. For example, you probably shouldn't
try to use regcomp() to compile an untrusted regular expression.
Regular expressions are just too complicated, and there are many
different libc's out there.
- we need to design the message bus daemon (and any similar features)
to use limited privileges, run in a chroot jail, and so on.
http://vsftpd.beasts.org/ has other good security suggestions.
Coding Style
===
- The C library uses GNU coding conventions, with GLib-like
extensions (e.g. lining up function arguments). The
Qt wrapper uses KDE coding conventions.
- Write docs for all non-static functions and structs and so on. try
"doxygen Doxyfile" prior to commit and be sure there are no
warnings printed.
- All external interfaces (network protocols, file formats, etc.)
should have documented specifications sufficient to allow an
alternative implementation to be written. Our implementation should
be strict about specification compliance (should not for example
heuristically parse a file and accept not-well-formed
data). Avoiding heuristics is also important for security reasons;
if it looks funny, ignore it (or exit, or disconnect).
Making a release
===
To make a release of D-BUS, do the following:
- check out a fresh copy from CVS
- verify that the libtool versioning/library soname is
changed if it needs to be, or not changed if not
- update the file NEWS based on the ChangeLog
- add a ChangeLog entry containing the version number
you're releasing ("Released 0.3" or something)
so people can see which changes were before and after
a given release.
- "make distcheck" (DO NOT just "make dist" - pass the check!)
- if make distcheck fails, fix it.
- once distcheck succeeds, "cvs commit"
- if someone else made changes and the commit fails,
you have to "cvs up" and run "make distcheck" again
- once the commit succeeds, "cvs tag DBUS_X_Y_Z" where
X_Y_Z map to version X.Y.Z
- bump the version number up in configure.in, and commit
it. Make sure you do this *after* tagging the previous
release!
- scp your tarball to freedesktop.org server and copy it
to /srv/dbus.freedesktop.org/releases. This should
be possible if you're in group "dbus"
- update the wiki page http://www.freedesktop.org/Software/dbus by
adding the new release under the Download heading. Then, cut the
link and changelog for the previous that was there.
- update the wiki page
http://www.freedesktop.org/Software/DbusReleaseArchive pasting the
previous release. Note that bullet points for each of the changelog
items must be indented three more spaces to conform to the
formatting of the other releases there.
- post to dbus@lists.freedesktop.org announcing the release.
Environment variables
===
These are the environment variables that are used by the D-BUS client library
DBUS_VERBOSE=1
Turns on printing verbose messages. This only works if D-BUS has been
compiled with --enable-verbose-mode
DBUS_MALLOC_FAIL_NTH=n
Can be set to a number, causing every nth call to dbus_alloc or
dbus_realloc to fail. This only works if D-BUS has been compiled with
--enable-tests.
DBUS_MALLOC_FAIL_GREATER_THAN=n
Can be set to a number, causing every call to dbus_alloc or
dbus_realloc to fail if the number of bytes to be allocated is greater
than the specified number. This only works if D-BUS has been compiled with
--enable-tests.
DBUS_TEST_MALLOC_FAILURES=n
Many of the D-BUS tests will run over and over, once for each malloc
involved in the test. Each run will fail a different malloc, plus some
number of mallocs following that malloc (because a fair number of bugs
only happen if two or more mallocs fail in a row, e.g. error recovery
that itself involves malloc). This env variable sets the number of
mallocs to fail.
Here's why you care: If set to 0, then the malloc checking is skipped,
which makes the test suite a heck of a lot faster. Just run with this
env variable unset before you commit.
Tests
===
These are the test programs that are built if dbus is compiled using
--enable-tests.
dbus/dbus-test
This is the main unit test program that tests all aspects of the D-BUS
client library.
dbus/bus-test
This it the unit test program for the message bus.
test/break-loader
A test that tries to break the message loader by passing it randomly
created invalid messages.
"make check" runs all the deterministic test programs (i.e. not break-loader).
"make check-coverage" is available if you configure with --enable-gcov and
gives a complete report on test suite coverage. You can also run
"test/decode-gcov foo.c" on any source file to get annotated source,
after running make check with a gcov-enabled tree.
Patches
===
Please file them at http://bugzilla.freedesktop.org under component
dbus, and also post to the mailing list for discussion. The commit
rules are:
- for fixes that don't affect API or protocol, they can be committed
if any one qualified reviewer other than patch author
reviews and approves
- for fixes that do affect API or protocol, two people
in the reviewer group have to review and approve the commit, and
posting to the list is definitely mandatory
- if there's a live unresolved controversy about a change,
don't commit it while the argument is still raging.
- regardless of reviews, to commit a patch:
- make check must pass
- the test suite must be extended to cover the new code
as much as reasonably feasible
- the patch has to follow the portability, security, and
style guidelines
- the patch should as much as reasonable do one thing,
not many unrelated changes
No reviewer should approve a patch without these attributes, and
failure on these points is grounds for reverting the patch.
The reviewer group that can approve patches: Havoc Pennington, Michael
Meeks, Alex Larsson, Zack Rusin, Joe Shaw, Mikael Hallendal, Richard
Hult, Owen Fraser-Green, Olivier Andrieu, Colin Walters.

@ -0,0 +1,294 @@
DBus Installation
=================
Quick start
===========
DBus uses GNU AutoTools for its build system, thus the basic install
procedure can be summarized as:
./configure --prefix=/usr
make
su make install
The configure script will automatically determine whether to try and
build bindings for GLib, Qt, Qt3, Python and Mono based on what tools
are installed on the host system. The default build behaviour can be
overridden using the --enable-XXX/--disable-XXX arguments to configure.
A typical scenario in which it is desirable to override automatic
detection, is during packaging of binary builds, where a predictable
dependancy chain is required. For more details on GNU AutoTools
installation, consult the generic instructions later in this document
External software dependancies
==============================
The only fundamental requirement to build DBus is an XML parser,
however, there are a number of other software packages which (if
present) will enhance functionality.
Core library
------------
Requisite:
- Gettext
- expat or libxml-2
NB, expat is the recommended XML parser because it has more robust
handling of OOM conditions.
Optional:
- libselinux (for SELinux integration)
- dnotify (for automatic service file reload)
- doxygen (for API documentation)
- xmlto (for Spec & other XML documentation)
GLib Bindings
-------------
Requisite:
- GLib >= 2.4
Optional:
- GTK+ >= 2.4 (for dbus-viewer tool)
Qt Bindings
-----------
Requisite:
- QtCore and QtXml >= 4.1.3
Optional:
- QtTest (for Qt Unit tests)
- QtGui >= 4.1.3 (for the chat example program)
Note: Qt 4.1.3 is not available in released form. You need to download
the 4.1.3 snapshots from Trolltech. However, the Qt binding compiles
and works in Qt 4.1.2, but not the dbusidl2cpp tool.
Note that DBus detects QtCore and QtXml during the configure process
using pkg-config. You may need to set the PKG_CONFIG_PATH to include
the Qt4 library directory. If you don't have your Qt4 installed, then
you may also need to use the --with-qt-tqmoc directive to point to the
Qt4 tqmoc executable (e.g. $QTDIR/bin/tqmoc).
Qt 3 Bindings
-------------
Requisite:
- Qt >= 3.1
Mono Bindings
-------------
Requisite:
- Mono >= 0.95
Optional:
- MonoDoc >= 0.16 (for API documentation)
Python Bindings
---------------
Requisite:
- Python >= 2.4
- Pyrex
====================================================================
The rest of this document tqcontains the generic GNU AutoTools install
insructions....
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
tqcontains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory tqlayout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
tqfind the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

@ -0,0 +1,504 @@
D-BUS 0.62 (12 June 2006)
==
- Doc fixes
- Added support for all data-types for the dbus tools
- Fixed eavesdropping on method calls (dbus-monitor)
- Fixed silent dropping of method calls with interface=NULL
- Fixed console ownership problems in Solaris
- Fixed installation of dbus-signature.h and #include it in dbus/dbus.h
- Flush the user database cache on config reload
- GLib bindings:
- Fix memory leaks
- Fix properties in DBusGProxy so that they can be given in any
order
- Added lots of assertions to ensure correct use
- Remove duplicated code
- Fix static string pointer uses in GPtrArray-based collections
- Python bindings:
- Remove reference to sys/cdefs.h
- Qt4 bindings:
- Code reorganized
- Added the dbusidl2cpp, dbuscpp2xml and dbus tools
- Added example programs (ping-pong, complex ping-pong, listnames, chat)
- Updated selftests
- Fixed compilation and .tqmoc- and .ui-file processing and cleaning
- Made central classes derive from QObject
- Enhance error reporting
- Many bugfixes
- Mono bindings:
- Minor bugfixes
D-BUS 0.61 (24 Febuary 2006)
==
- Documentation all around
- dbus-launch now produces correct sh and csh syntax
- Nested arrays now work correctly
- GLib bindings:
- Inheriting from DBusGProxy is now possible
- GPtrArrays can now be marshalled
- org.freedesktop.DBus.GLib.ClientCSymbol annotation added
- Openning connections to arbitrary addresses now supported
- Python bindings:
- sender_keyword and path_keyword keywords added to signal listener API
- Byte types now demarshal to unsigned char
- calling methods now do the correct thing
- Qt bindings:
- both Qt3 and Qt4 bindings can be built at the same time
- Use the standard org.freedesktop.DBus.Method.NoReply annotation
for the "async" calls instead of creating one for us.
- Mono bindings:
- 64bit arch fixes
- Massive bug fixing all around
D-BUS 0.60 (30 November 2005)
==
- major ABI/API changes - sonames changed
- RequestName queuing behavior has changed (refer to dbus-specification)
- DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT has been removed and
DBUS_NAME_FLAG_ALLOW_REPLACEMENT has been added to the flags
- Q_SIGNALS emitted by the bus now show up in the introspect data
- auth EXTERNAL now supported on BSD varients
- ReleaseName method added to the bus to allow a service
to remove itself as owner of a bus name
- dbus_connection_read_write added for getting messages off the bus
in the absence of a mainloop
- Qt4 bindings added and the Qt3 bindings have been depricated
- python bindings:
- marshal using introspect data if available
- better exception handling and propigation
- private connections are now supported
- UTF-8 cleanups
- out_signature added to method decorators for specifying
how the return values should be marshaled
- sender_keyword added to method decorators for specifying
and argument to provide the unique name of the method caller
- async_callbacks added to method decorators
- multiple inheritance of classes now supported
- GLib bindings:
- respect NoReply annotations
- dbus_g_method_return_get_reply and dbus_g_method_return_send_reply
added to the lowlevel code for use when the dbus-glib marshalling
code is not adiquate
- numerous bug fixes all around
D-BUS 0.50 (06 September 2005)
===
This is a minor release from 0.36.2. The series number has changed
not because of any technical reasons but as an indication that we
are moving closer to 1.0. It is hoped that this will be the last
series to see major changes, most of which will be isolated to the
GLib and Python bindings, as we transition to concentrate more on
bug busting and code auditing.
- D-Bus builds on the Cygwin platform
- Makefile cleanups
- Various bug fixes
- Optimization of the dbus object tree
- Memleaks and GIL crasher bugs have been fixed in the Python bindings
D-BUS 0.36.2 (29 August 2005)
===
- Security: Restrict other users from connecting to another users
session bus
D-BUS 0.36.1 (24 August 2005)
===
- Python Bindings:
- fixed to work with hal-tqdevice-manager
- For 64bit builds everything is installed to lib64/python2.4/
since Python can't handle multilib
D-BUS 0.36 (23 August 2005)
===
- Maximum sized of cached messages have been reduced to 10K
- Match rules now allow matching on arguments inside the message
- introspect.xsl XSLT style sheet added for formatting introspection
data into XHTML for analysis
- Python bindings:
- now have working type objects for explicit
typecasting
- Variant type has been added
- Dictionaries, Variants and Arrays can all be passed the signiture or
type(s) of their tqchildren
- the optional timeout= keyword has been added when making method calls
- match on args has been implemented
- a .pth file has been added for dealing with libraries and python files
being in different directories such as in 64bit installs
- various bug fixes
- GLib bindings:
- deeply recursive types now supported
- many symbols are no longer exported as part of the public API
- various memleak and other bug fixes
D-BUS 0.35.2 (17 July 2005)
===
- Rename Unix Security Context to SELinux Security Context in API
- Fixed more dist errors that distcheck didn't pick up on
- Fixed various bugs in the python bindings that prevented them from working
D-BUS 0.35.1 (16 July 2005)
===
- Fixed dist error where python/dbus_bindings.pxd was being shipped
instead of dbus_bindings.pxd.in
- Use this instead of the 0.35 tarball
D-BUS 0.35 (15 July 2005)
===
- --with-dbus-user added to the configure scripts for configuring the
user the system bus runs on
- --with-console-auth-dir added to configure scripts for configuring the
directory to look in for console user locks
- service files for auto-starting D-Bus services now has the ability to pass
in command line arguments to the executable
- Huge auto-start bug squashed which caused some services not to start when
requested in rapid succession
- SE-Linux security contexts can now be appended to messages for inspection
by services that enforce their own security policies
- Colin says the GLib binding are ready for general consumption
- New GLib tutorial
- New GLib example code
- Python bindings are now version (0,42,0)
- Python bindings API has changed on the service side
- dbus.service has been split out as a seperate module
- dbus.service.Service is renamed to dbus.service.BusName
- dbus.service.Object has swapped the bus_name and object_path constructor
parameters to make it easier to do inheritance over the bus
- dbus.glib has been seperated out in order to lessen the dependency on glib
and to allow other mainloops to be integrated with the bindings including
a planned generic mainloop for non-gui apps.
- Python bindings now aquire the GIL when calling back into the python
interpreter. Fixes crashes when using threading and other random segfaults.
- New Python tutorial
- Numerous D-Bus bug fixes all around
D-BUS 0.34 (15 June 2005)
===
- dbus_connection_disconnect is deprecated in favor of dbus_connection_close
- The bus can now use D_NOTIFY (if available) to check when configuration files
have changed and reload them
- New dbus_message_has_path/member/interface API added
- The Ping message from the org.freedesktop.DBus.Peer interface is now handled
- Complete glib bindings overhaul (and are still under construction)
- Tutorial now has an updated GLib section
- GLib bindings can now send/receive hash tables, arrays and other complex types
- Python bindings overhaul (most public facing API's done)
- Python bindings have been split up into separate files
- Python added new type classes for hinting to the marshaler what type
to send over the wire
- Python bindings now have decorators for specifying exported methods and Q_SIGNALS
- Numerous bug fixes
D-BUS 0.33 (25 Apr 2005)
===
- downgrade requirement from GTK+-2.6 to 2.4 for building gtk components
- python binding API's have been overhalled to be more "pythonic" and cleaner
- python bindings now export dbus.version which is set to (0,40,0)
- python bindings now implement the org.freedesktop.DBus.Introspectable interface
- python binding match rules are now more flexable
- make check has been fixed
- many, many major bug fixes
D-BUS 0.32 (29 Mar 2005)
===
- mono bindings now compiles correctly
- mono binding cleanups
- glib bindings generates wrappers for bus methods in dbus-glib-bindings.h
- glib binding cleanus
- users and groups can now be specified by UID and GID in config files
- numerous memory leak fixes
- various other fixes
D-BUS 0.31 (07 Mar 2005)
===
- land the new message args API and recursive type system
- add docs and fixed Doxygen warnings throught source
- split out some functions not needed in libdbus to *-util.c source files
- take out type convienience functions
- libdbus now back below 150K
- booleans are now 32-bit instead of 8-bit
- specification updated
- grand renaming to strip out the use of "service"
just say "name" instead (or "bus name" when ambiguous)
- rename dbus-daemon-1 to dbus-daemon throughout
- rename activation to auto-start
- auto-start on by default now
- note that libdbus is the low-level API
- python bindings updated to the new API
- mono bindings updated to the new API
- add 16 bit types
- dictionaries are now ARRAYS of DICT_ENTRY
- dbus-glib-tool renamed to dbus-binding-tool
- massive rewrite of the glib bindings
- saner names for the dbus interface, object path and service defines
- new functions for handling type signitures
- bump sonames for libdbus and libdbus-glib
- various small fixes
D-BUS 0.23 (11 Jan 2005)
===
- add setgroups() to drop supplementary groups
- updated SELinux support
- add an "at console" security policy
- fix a bug where org.freedesktop.DBus wasn't recognized as an existing
service.
- error out if --enable-mono is explicitly set and mono libs can't be found
- set the max_match_rules_per_connection limit from the config file.
- removed dbus_bug_get_with_g_main since it's been tqreplaced by
dbus_g_bus_get
- fix fd leaks in socket code
- lots and lots of mono binding updates, including fixes to make it
compatible with Mono 1.1.3
- added --nofork option to override config file setting at runtime
- added support for int64 and uint64 to the python bindings
- lots of python binding updates
- config file DTD updates
- use SerivceOwnerChanges signal instead of ServiceCreated and
ServiceDeleted
- fixes to the authentication code
- new init script for Slackware
- print out the pid even when --fork is passed
- increase preallocation sizes in DBusMessage to heavily reduce
reallocs
- lots of performance enhancements
- lots more small bug fixes
D-BUS 0.22
===
- add --reply-timeout to dbus-send
- fix a memleak
- fix Solaris/Forte build
- switch to AFL 2.1 rather than 2.0 to address patent termination clause
concerns
- add SELinux support
- mostly repair libxml backend for config parser, still doesn't
pass out of memory tests
- fix distcheck to include language bindings
- add GetConnectionUnixUser method on bus driver
- also for UnixProcessID
- lots of Python, Mono, other binding fixes
- change GLib bindings to not include dbus/dbus.h (fully encapsulate libdbus)
- pass paths as strings, not arrays of string
- add message signature header field
- cleanups to marshaling code
- clean up authentication code
- reload conf files on SIGHUP
- rename SERVICE/SENDER_SERVICE to DESTINATION/SENDER
- fix circular conf file inclusion
- allow empty arrays
- tons of other small bugfixes
D-BUS 0.21
===
- implement "auto activation" flag on messages, so the destination
service can be launched automatically
- fix a bug in custom type marshaling
- optimize case where multiple apps activate the same service
(avoid "thundering herd")
- add dynamic service file discovery/reloading
- fix a busy loop when blocking for a reply
- fix a 64-bit crash involving varargs
- fix a bus crash when processing an AcquireService
- allow appending TYPE_BYTE via append_args_valist
- fix dicts-inside-dicts
- enhancements to Python and Qt bindings
D-BUS 0.20
===
This release lands some very large API changes and numerous bugfixes.
The list of changes is too large to fully document here; please refer
to the documentation, and message-bus-list archives.
D-BUS 0.13
===
This is probably the last release before landing the large API changes
on the "dbus-object-names" branch.
- fix system bus to always use filesystem socket; anyone
can create any abstract socket, which isn't secure
since if you can crash the system bus you'd be able
to tqreplace it.
- add DTD for configuration file
- improve specification a bit
D-BUS 0.12
===
- fix "service messagebus status" on Red Hat
- fix demarshaling of DBUS_TYPE_NAMED
- fix "eval `dbus-launch --exit-with-session`" to exit properly
- fix build without --prefix
- useless fooling with Mono bindings
- useless fooling with gcj bindings
- fix srcdir != builddir
- fix various compiler warnings and other issues
- add get/set data to DBusMessage
- fix headers for C++
- OS X build fixes
- abstract domain sockets support (Linux only)
- add dbus-cleanup-sockets utility for people
not using linux
- be consistent about defaulting to --session/--system
with command line tools
- merge in policies from included config files
- fix build on non-x86
- docs updates
- lots of other bugfixes
D-BUS 0.11
===
- add --enable-docs to turn off/on the docbook stuff
(doesn't cover doxygen stuff yet)
- make people define DBUS_API_SUBJECT_TO_CHANGE
and read warning in README so they don't
expect the API to be frozen already
- rename .pc files to "dbus-1.pc" instead of
"dbus-1.0.pc" etc. - this will require changing
pkg-config invocations
- some docs cleanups
- add man pages for all executables
- allow send to/from bus driver in the default system.conf
- fix user lookup bug
- implement dbus-launch to launch the session message bus
- fix some thread deadlocks
- some performance profiling/optimization
- add dbus_bus_activate_service() function
- fix some minor bugs here and there
- install Red Hat initscript in the right place
D-BUS 0.10
===
- reversed order of args to dbus_message_new()
- renamed dbus_message_name_is() and some other
functions
- change DBusWatch to have dbus_watch_handle()
similar to dbus_timeout_handle(), drop
connection/server-specific handle routines
- change message serials to be unsigned
- implemented <allow>/<deny>/<limit> features for
config file; system bus now has a deny-all policy
by default.
- system.conf has <includedir>system.d</includedir>
so packages can install additions to the default
policy to <allow> the messages they need. e.g.
CUPS might install a cups.conf - see
test/data/valid-config-files/system.d/test.conf
for an example.
- add timeouts for authentication, activation
- add glib-style "checks" on public API, enable
those by default, disable assertions by default
- add GMainContext argument to GLib setup functions,
can be NULL for default context. Needed for threads.
- add 64-bit integer type
- validate type of standard message header fields
- consider messages in the org.freedesktop.Local
namespace to be invalid (to avoid fake disconnect
messages for example)
- fix assorted memory leaks and other bugs in
the SHA-1 auth mechanism
- cache user database information (groups user is
in, etc.) helps a lot with NIS
- always store uid_t, pid_t, gid_t in "ulong"
rather than "int"
- implement config file settings for which
users can connect
- SHA-1 unit test
- dbus-send, dbus-monitor command line utilities
- fixed lots of misc crashes and other bugs
D-BUS 0.9
===
- implemented a test case for service activation,
and fixed many bugs exposed by that
- implemented recursive argument marshaling/demarshaling
for messages, allowing multidimensional arrays
- fixed up integration of message dispatch with
main loop by adding a callback on change of
dispatch status
- add a pidfile feature to daemon
- some build fixes
- clean up unix domain sockets on exit
- add --print-address and the ability
to create a random server address
in a temporary directory
D-BUS 0.8
===
- fix dumb bug in 0.7
D-BUS 0.7
===
- implement configuration file used to control bus characteristics
- implement daemon mode, changing user ID, and other system
bus features
- add init scripts for systemwide bus
- add "make check-coverage" target to check test coverage
- more test suite additions
- many, many bugfixes
- many API changes/fixes
D-BUS 0.6
===
- Vastly improved bus daemon test suite
- Lots of misc. bugfixes and memory leak fixes
- Support for marshalling key/value data
- Activation improvements.
D-BUS 0.5
===
- Specification updates
- port to OS X and other BSD variants
- port to Solaris
- Partial work on cookie-based authentication
- Thread safety fixes
- Lots of misc. bugfixes
- Support for more array types
- Add data Q_SLOTS to DBusServer
- DBusString security audit fixes
- Fix for systems (or valgrind) with unaligned malloc blocks
D-BUS 0.4
===
- Preliminary activation support.
- Better authentication test suite
- Bus test program
- Specification updates
- Thread safety
- Bug fixes
D-BUS 0.3
===
- Preliminary limitations
- Message sending works
- Bus client
- Array marshalling/demarshalling
- Services
- Better OOM handling in the bus
- In-proc debug transport
- Transport/server address support
D-BUS 0.2
===
- Include test code in the tarball.
D-BUS 0.1
===
- Initial release.

@ -0,0 +1,101 @@
D-BUS is a simple IPC library based on messages.
See also the file HACKING for notes of interest to developers working on D-BUS.
See http://www.freedesktop.org/software/dbus/ for lots of documentation,
mailing lists, etc.
Note
===
A core concept of the D-BUS implementation is that "libdbus" is
intended to be a low-level API, similar to Xlib. Most programmers are
intended to use the bindings to GLib, Qt, Python, Mono, Java, or
whatever. These bindings have varying levels of completeness.
Configuration flags
===
These are the dbus-specific configuration flags that can be given to
the ./configure program.
--enable-qt enable Qt-friendly client library (note: Qt4)
--enable-qt-debug enable Qt-friendly client library, linked to debug
Qt libraries
--enable-qt3 enable Qt3-friendly client library
--enable-glib enable GLib-friendly client library
--enable-gtk enable GTK-requiring executables
--enable-tests enable unit test code
--enable-ansi enable -ansi -pedantic gcc flags
--enable-verbose-mode support verbose debug mode
--enable-asserts include assertion checks
--enable-checks include sanity checks on public API
--enable-xml-docs build XML documentation (requires xmlto)
--enable-doxygen-docs build DOXYGEN documentation (requires Doxygen)
--enable-gcov compile with coverage profiling instrumentation (gcc only)
--enable-abstract-sockets
use abstract socket namespace (linux only)
--enable-gcj build gcj bindings
--enable-mono build mono bindings
--enable-mono-docs build mono docs
--enable-python build python bindings
--enable-selinux build with SELinux support
--enable-dnotify build with dnotify support (linux only)
--with-qt-tqmoc=<path> tqmoc for Qt
--with-qt3-tqmoc=<path> tqmoc for Qt3
--with-xml=libxml/expat XML library to use
--with-init-scripts=redhat Style of init scripts to install
--with-session-socket-dir=dirname Where to put sockets for the per-login-session message bus
--with-test-socket-dir=dirname Where to put sockets for make check
--with-system-pid-file=pidfile PID file for systemwide daemon
--with-system-socket=filename UNIX domain socket for systemwide daemon
--with-console-auth-dir=dirname directory to check for console ownerhip
--with-dbus-user=<user> User for running the DBUS daemon (messagebus)
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
--with-tags[=TAGS] include additional configurations [automatic]
--with-x use the X Window System
API/ABI Policy
===
D-BUS API/ABI and protocol necessarily remain in flux until we are
sure it will meet the various needs it's intended to meet. This means
we need to see some significant sample usage in the contexts of GNOME,
KDE, desktop applications, and systemwide uses such as print queue
monitoring, hotplug events, or whatever. We need the flexibility to
incorporate feedback from this sample usage.
Once we feel confident in the protocol and the API, we will release a
version 1.0. At that point, the intent is:
- The protocol will never be broken again; any message bus should
work with any client forever. However, extensions are possible
where the protocol is extensible.
- If the library API is modified incompatibly, we will rename it
as in http://ometer.com/parallel.html - in other words,
it will always be possible to compile against and use the older
API, and apps will always get the API they expect.
Until 1.0 is released, feedback that requires API changes may be
incorporated into D-BUS. This may break the API, the ABI, the
protocol, or all three.
To avoid a huge soname, the plan is to increment the soname only
between official stable releases, not with every development snapshot.
Versions numbered 0.x are considered development snapshots.
Until 1.0 is released, you have to define -DDBUS_API_SUBJECT_TO_CHANGE
just as a safety check to be sure everyone is aware of this API/ABI
policy and has the right expectations.
We do need people to test the APIs, so please do use the development
snapshots of D-BUS. They are intended to work and we do actively
address bugs.
However, if you're shipping a commercial binary-only application that
needs to keep running on M future versions of N operating systems, you
might want to include your own copy of D-BUS rather than relying on
the installed copy, for example.

@ -0,0 +1,86 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
if( NOT TDE_FOUND )
message( STATUS "checking for 'TDE'")
# if the path is not already defined by user,
# find kde-config executable
if( NOT DEFINED KDECONFIG_EXECUTABLE )
find_program( KDECONFIG_EXECUTABLE
NAMES kde-config
HINTS ${BIN_INSTALL_DIR} )
if( NOT KDECONFIG_EXECUTABLE )
tde_message_fatal( "kde-config are NOT found." )
endif( NOT KDECONFIG_EXECUTABLE )
endif( NOT DEFINED KDECONFIG_EXECUTABLE )
# check for installed trinity version
execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --version
OUTPUT_VARIABLE _version
RESULT_VARIABLE _result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result )
tde_message_fatal( "Unable to run kde-config!\n KDELIBS are correctly installed?\n Path to kde-config are corect?" )
endif( _result )
# parse kde-config output, to extract TDE version
string( REGEX MATCH "KDE: ([0-9\\.]+)" __dummy "${_version}" )
set( TDE_VERSION "${CMAKE_MATCH_1}" )
# ask kde-config for few paths
macro( __internal_get_path __type __var )
execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
OUTPUT_VARIABLE ${__var}
OUTPUT_STRIP_TRAILING_WHITESPACE )
endmacro( __internal_get_path )
__internal_get_path( include TDE_INCLUDE_DIR )
__internal_get_path( lib TDE_LIB_DIR )
__internal_get_path( exe TDE_BIN_DIR )
__internal_get_path( data TDE_DATA_DIR )
__internal_get_path( config TDE_CONFIG_DIR )
__internal_get_path( html TDE_HTML_DIR )
__internal_get_path( cmake TDE_CMAKE_DIR )
__internal_get_path( qtplugins TDE_QTPLUGINS_DIR )
# find kde tools
macro( __internal_find_program __prog __var )
find_program( ${__var}
NAMES ${__prog}
HINTS ${TDE_BIN_INSTALL_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT ${__var} )
tde_message_fatal( "${__prog} are NOT found.\n KDELIBS are correctly installed?" )
endif( NOT ${__var} )
endmacro( __internal_find_program )
__internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE )
__internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE )
__internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE )
__internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE )
__internal_find_program( kconfig_compiler KDE3_KCFGC_EXECUTABLE )
__internal_find_program( makekdewidgets KDE3_MAKEKDEWIDGETS_EXECUTABLE )
# dcopidlng is a bash script which using kde-config;
# if PATH to kde-config is not set, dcopidlng will fail;
# for this reason we set KDECONFIG environment variable before running dcopidlng
set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
CACHE INTERNAL KDE3_DCOPIDLNG_EXECUTABLE FORCE )
message( STATUS " found 'TDE', version ${TDE_VERSION}" )
endif( NOT TDE_FOUND )
include( "${TDE_CMAKE_DIR}/kdelibs.cmake" )

@ -0,0 +1,81 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
macro( tqt_message )
message( STATUS "${ARGN}" )
endmacro( )
pkg_search_module( TQT tqt )
if( NOT TQT_FOUND )
tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
endif( )
# tmoc_executable
execute_process(
COMMAND pkg-config tqt --variable=tmoc_executable
OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( TMOC_EXECUTABLE )
tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to tmoc is not set.\n tqt is correctly installed?" )
endif( )
# moc_executable
execute_process(
COMMAND pkg-config tqt --variable=moc_executable
OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( MOC_EXECUTABLE )
tqt_message( " moc path: ${MOC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
endif( )
# uic_executable
execute_process(
COMMAND pkg-config tqt --variable=uic_executable
OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( UIC_EXECUTABLE )
tqt_message( " uic path: ${UIC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to uic is not set.\n tqt is correctly installed?" )
endif( )
# check if tqt is usable
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
foreach( _dirs ${TQT_LIBRARY_DIRS} )
list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
endforeach()
list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
check_cxx_source_compiles("
#include <tqapplication.h>
int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
HAVE_USABLE_TQT )
if( NOT HAVE_USABLE_TQT )
tde_message_fatal( "Unable to build a simple tqt test." )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
# TQT_CXX_FLAGS
foreach( _flag ${TQT_CFLAGS_OTHER} )
set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
endforeach()

File diff suppressed because it is too large Load Diff

@ -0,0 +1,67 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
#################################################
#####
##### tde_internal_setup_path
macro( _tde_internal_setup_path _path _default _comment )
if( DEFINED ${_path} )
set( ${_path} "${${_path}}" CACHE PATH "${_comment}" )
else( DEFINED ${_path} )
set( ${_path} "${_default}" )
endif( DEFINED ${_path} )
endmacro( _tde_internal_setup_path )
#################################################
#####
##### tde_setup_paths
macro( tde_setup_paths )
# install paths
_tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" )
_tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" )
_tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" )
_tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" )
_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" )
_tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
_tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
_tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" )
_tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" )
_tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" )
_tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/kde/HTML" "The HTML install dir for documentation" )
_tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" )
_tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files" )
_tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" )
_tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" )
_tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" )
_tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" )
_tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" )
_tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" )
_tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" )
_tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" )
_tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir" )
_tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" )
_tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" )
_tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" )
_tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" )
_tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" )
_tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir" )
_tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" )
_tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" )
endmacro( tde_setup_paths )

@ -0,0 +1,45 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
# FIXME this will working only on out-of-source mode
set( local_ui_file ${_ui_basename}.ui )
configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
execute_process( COMMAND tqt-replace ${local_ui_file} )
execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${local_ui_file}
OUTPUT_VARIABLE _ui_h_content )
if( _ui_h_content )
string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
if( TDE_QTPLUGINS_DIR )
set( L -L ${TDE_QTPLUGINS_DIR} )
endif( )
execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
-impl ${_ui_basename}.h
${local_ui_file}
OUTPUT_VARIABLE _ui_cpp_content )
if( _ui_cpp_content )
string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <klocale.h>\n\n${_ui_cpp_content}" )
endif( )

@ -0,0 +1,5 @@
#ifdef _AIX
namespace {
void *not_empty_file;
}
#endif

@ -0,0 +1,7 @@
add_library( @_target@ @_type@ IMPORTED )
set_target_properties( @_target@ PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
IMPORTED_LOCATION "@_location@"
IMPORTED_SONAME "@_soname@" )

@ -0,0 +1,2 @@
extern "C" int kdemain(int argc, char* argv[]);
int main(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,3 @@
#include <kdemacros.h>
extern "C" int kdemain(int argc, char* argv[]);
extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,35 @@
# @_laname@ - a libtool library file
# Generated by CMake - GNU libtool
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='@_library_name_2@'
# Names of this library.
library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=''
# Version information for @_name@.
current=@_version_current@
age=@_version_age@
revision=@_version_revision@
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=@_shouldnotlink@
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='@_libdir@'

@ -0,0 +1,168 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* connection.cpp: TQt wrapper for DBusConnection
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "connection.h"
using namespace DBusQt;
#include "integrator.h"
using Internal::Integrator;
struct Connection::Private
{
Private( Connection *qq );
void setConnection( DBusConnection *c );
DBusConnection *connection;
int connectionSlot;
DBusError error;
Integrator *integrator;
int timeout;
Connection *q;
};
Connection::Private::Private( Connection *qq )
: connection( 0 ), connectionSlot( 0 ), integrator( 0 ),
timeout( -1 ), q( qq )
{
dbus_error_init( &error );
}
void Connection::Private::setConnection( DBusConnection *c )
{
if (!c) {
qDebug( "error: %s, %s", error.name, error.message );
dbus_error_free( &error );
return;
}
connection = c;
integrator = new Integrator( c, q );
connect( integrator, TQT_SIGNAL(readReady()), q, TQT_SLOT(dispatchRead()) );
}
Connection::Connection( TQObject *tqparent )
: TQObject( tqparent )
{
d = new Private( this );
}
Connection::Connection( const TQString& host, TQObject *tqparent )
: TQObject( tqparent )
{
d = new Private( this );
if ( !host.isEmpty() )
init( host );
}
Connection::Connection( DBusBusType type, TQObject* tqparent )
: TQObject( tqparent )
{
d = new Private( this );
d->setConnection( dbus_bus_get(type, &d->error) );
}
void Connection::init( const TQString& host )
{
d->setConnection( dbus_connection_open( host.ascii(), &d->error) );
//dbus_connection_allocate_data_slot( &d->connectionSlot );
//dbus_connection_set_data( d->connection, d->connectionSlot, 0, 0 );
}
bool Connection::isConnected() const
{
return dbus_connection_get_is_connected( d->connection );
}
bool Connection::isAuthenticated() const
{
return dbus_connection_get_is_authenticated( d->connection );
}
void Connection::open( const TQString& host )
{
if ( host.isEmpty() ) return;
init( host );
}
void Connection::close()
{
dbus_connection_close( d->connection );
}
void Connection::flush()
{
dbus_connection_flush( d->connection );
}
void Connection::dispatchRead()
{
while ( dbus_connection_dispatch( d->connection ) == DBUS_DISPATCH_DATA_REMAINS )
;
}
DBusConnection* Connection::connection() const
{
return d->connection;
}
Connection::Connection( DBusConnection *connection, TQObject *tqparent )
: TQObject( tqparent )
{
d = new Private(this);
d->setConnection(connection);
}
void Connection::send( const Message &m )
{
dbus_connection_send(d->connection, m.message(), 0);
}
void Connection::sendWithReply( const Message& )
{
}
Message Connection::sendWithReplyAndBlock( const Message &m )
{
DBusMessage *reply;
reply = dbus_connection_send_with_reply_and_block( d->connection, m.message(), d->timeout, &d->error );
if (dbus_error_is_set(&d->error)) {
qDebug("error: %s, %s", d->error.name, d->error.message);
dbus_error_free(&d->error);
}
return Message( reply );
}
void* Connection::virtual_hook( int, void* )
{
}
void Connection::dbus_connection_setup_with_qt_main (DBusConnection *connection)
{
d->setConnection( connection );
}
/////////////////////////////////////////////////////////
#include "connection.moc"

@ -0,0 +1,84 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* connection.h: TQt wrapper for DBusConnection
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBUS_TQT_CONNECTION_H
#define DBUS_TQT_CONNECTION_H
#include "message.h"
#include <tqobject.h>
#include <tqstring.h>
#include "dbus/dbus.h"
namespace DBusQt {
namespace Internal {
class Integrator;
}
class Connection : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Connection( TQObject *tqparent =0 );
Connection( const TQString& host,
TQObject *tqparent = 0 );
Connection( DBusBusType type, TQObject* tqparent = 0 );
bool isConnected() const;
bool isAuthenticated() const;
Message borrowMessage();
Message popMessage();
void stealBorrowMessage( const Message& );
void dbus_connection_setup_with_qt_main (DBusConnection *connection);
public slots:
void open( const TQString& );
void close();
void flush();
void send( const Message& );
void sendWithReply( const Message& );
Message sendWithReplyAndBlock( const Message& );
protected slots:
void dispatchRead();
protected:
void init( const TQString& host );
virtual void *virtual_hook( int id, void *data );
private:
friend class Internal::Integrator;
DBusConnection *connection() const;
Connection( DBusConnection *connection, TQObject *tqparent );
private:
struct Private;
Private *d;
};
}
#endif

@ -0,0 +1,81 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/*
* dbus-qt.h TQt integration
*
* Copyright (C) 2002 DBus Developers
*
* Licensed under the Academic Free License version 2.1
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*
*/
#ifndef DBUS_TQT_H
#define DBUS_TQT_H
#include <dbus/dbus.h>
/*
* Two approaches - one presented below a DBusQtConnection
* object which is a TQt wrapper around DBusConnection
class DBusQtConnection : public TQObject {
TQ_OBJECT
public:
DBusQtConnection( const char *address=0, TQObject *tqparent=0,
const char *name=0 );
bool open( const char *address );
bool isConnected() const;
int numMessages() const;
public slots:
void disconnect();
void flush();
void sendMessage( DBusMessage *message );
signals:
void message( DBusMessage* message );
void error( const char* error );
private:
DBusConnection *mConnection;
TQSocketNotifier *mReadNotifier;
TQSocketNotifier *mWriteNotifier;
};
*
* Second approach is to have a static TQt dispatcher like:
class DBusQtNotifier : public TQObject {
TQ_OBJECT
public:
static DBusQtNotifier* dbus_qt_notifier();
void addConnection(DBusConnection* connection);
signals:
void message (DBusConnection* connection, DBusMessage* message);
private:
DBusQtNotifier(TQObject *tqparent);
private slots:
void processNotifiers( int socket );
private:
//implemented in terms of TQSocketNotifiers
TQAsciiDict<DBusConnection> mReadNotifiers;
TQAsciiDict<DBusConnection> mWriteNotifiers;
};
*
* First one gives us a full wrapper for DBusConnection (the TQt way),
* the other exposes DBusConnection, so would be easier to maintain
* and keep up while DBus evolves.
*
*/
#endif /* DBUS_TQT_H */

@ -0,0 +1,164 @@
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-qthread.cpp TQt threads integration
*
* Copyright (C) 2002 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <dbus/dbus.h>
#include <tqmutex.h>
//#if defined(TQT_THREAD_SUPPORT)
#if 0
static DBusMutex * dbus_qmutex_new (void);
static void dbus_qmutex_free (DBusMutex *mutex);
static dbus_bool_t dbus_qmutex_lock (DBusMutex *mutex);
static dbus_bool_t dbus_qmutex_unlock (DBusMutex *mutex);
static DBusCondVar*dbus_qcondvar_new (void);
static void dbus_qcondvar_free (DBusCondVar *cond);
static void dbus_qcondvar_wait (DBusCondVar *cond,
DBusMutex *mutex);
static dbus_bool_t dbus_qcondvar_wait_timeout (DBusCondVar *cond,
DBusMutex *mutex,
int timeout_msec);
static void dbus_qcondvar_wake_one (DBusCondVar *cond);
static void dbus_qcondvar_wake_all (DBusCondVar *cond);
static const DBusThreadFunctions functions =
{
DBUS_THREAD_FUNCTIONS_NEW_MASK |
DBUS_THREAD_FUNCTIONS_FREE_MASK |
DBUS_THREAD_FUNCTIONS_LOCK_MASK |
DBUS_THREAD_FUNCTIONS_UNLOCK_MASK |
DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK |
DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK |
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK |
DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK |
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK|
DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK,
dbus_qmutex_new,
dbus_qmutex_free,
dbus_qmutex_lock,
dbus_qmutex_unlock
dbus_qcondvar_new,
dbus_qcondvar_free,
dbus_qcondvar_wait,
dbus_qcondvar_wait_timeout,
dbus_qcondvar_wake_one,
dbus_qcondvar_wake_all
};
static DBusMutex *
dbus_qmutex_new (void)
{
TQMutex *mutex;
mutex = new TQMutex;
return static_cast<DBusMutex*>( mutex );
}
static void
dbus_qmutex_free (DBusMutex *mutex)
{
TQMutex * qmutex = static_cast<TQMutex*>(mutex);
delete mutex;
}
static dbus_bool_t
dbus_qmutex_lock (DBusMutex *mutex)
{
TQMutex *qmutex = static_cast<TQMutex*>(mutex);
qmutex->lock();
return TRUE;
}
static dbus_bool_t
dbus_qmutex_unlock (DBusMutex *mutex)
{
TQMutex *qmutex = static_cast<TQMutex*>(mutex);
qmutex->unlock();
return TRUE;
}
static DBusCondVar*
dbus_qcondvar_new (void)
{
TQWaitCondition *cond;
cond = new TQWaitCondition;
return static_cast<DBusCondVar*>( cond );
}
static void
dbus_qcondvar_free (DBusCondVar *cond)
{
TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond);
delete qcond;
}
static void
dbus_qcondvar_wait (DBusCondVar *cond,
DBusMutex *mutex)
{
TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond);
TQMutex *qmutex = static_cast<TQMutex*>(mutex);
qcond->wait (qmutex);
}
static dbus_bool_t
dbus_gcondvar_wait_timeout (DBusCondVar *cond,
DBusMutex *mutex,
int timeout_msec)
{
TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond);
TQMutex *qmutex = static_cast<TQMutex*>(mutex);
return qcond->wait (qmutex, timout_msec);
}
static void
dbus_qcondvar_wake_one (DBusCondVar *cond)
{
TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond);
qcond->wakeOne (qmutex);
}
static void
dbus_qcondvar_wake_all (DBusCondVar *cond)
{
TQWaitCondition *qcond = static_cast<TQWaitCondition*>(cond);
qcond->wakeAll (qmutex);
}
extern "C" {
void
dbus_qthread_init (void)
{
//Do we want to do anything else here?
dbus_threads_init (&functions);
}
}
#endif // TQT_THREAD_SUPPORT

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@PC_EXEC_PREFIX@
libdir=@PC_LIB_DIR@
includedir=@PC_INCLUDE_DIR@
Name: dbus-tqt
Description: DBUS bindings for the Trinity Qt [TQt] interface
Version: 0.9.0
Libs: -L${libdir} -ldbus-tqt-1 -ldbus-1
Cflags: -I${includedir}

@ -0,0 +1,6 @@
dbus-tqt (0.63.svn.0ubuntu0) maverick; urgency=low
* Migrate to Trinity Qt [TQt] Interface
-- Timothy Pearson <kb9vqf@pearsoncomputing.net> Wed, 23 March 2011 17:11:00 -0600

@ -0,0 +1,39 @@
Source: dbus-tqt
Section: devel
Priority: optional
Maintainer: Utopia Maintenance Team <pkg-utopia-maintainers@lists.alioth.debian.org>
Uploaders: Sjoerd Simons <sjoerd@debian.org>, Sebastian Dröge <slomo@ubuntu.com>
Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.37.2), libtqtinterface-dev, libdbus-1-dev (>= 0.90), cmake
Standards-Version: 3.8.3
Package: libdbus-tqt-1-dev
Section: libdevel
Architecture: any
Depends: libdbus-tqt-1-1c2 (= ${Source-Version}), libdbus-1-dev (>= 0.90), libtqtinterface-dev
Conflicts: dbus-tqt-1-dev
Replaces: dbus-tqt-1-dev
Description: simple interprocess messaging system (TQt interface)
D-BUS is a message bus, used for sending messages between applications.
Conceptually, it fits somewhere in between raw sockets and CORBA in
terms of complexity.
.
This package provides a TQt-style interface to D-BUS.
.
See the dbus description for more information about D-BUS in general.
Package: libdbus-tqt-1-1c2
Section: libs
Architecture: any
Depends: ${shlibs:Depends}
Conflicts: dbus-tqt-1, dbus-tqt-1c2, libdbus-tqt-1-1
Replaces: dbus-tqt-1, dbus-tqt-1c2, libdbus-tqt-1-1
Description: simple interprocess messaging system (TQt-based shared library)
D-BUS is a message bus, used for sending messages between applications.
Conceptually, it fits somewhere in between raw sockets and CORBA in
terms of complexity.
.
This package provides the TQt-based shared library for applications using the
Qt interface to D-BUS.
.
See the dbus description for more information about D-BUS in general.

@ -0,0 +1,214 @@
This package was debianized by Colin Walters <walters@debian.org> on
Thu, 6 Mar 2003 18:01:37 -0500
The source tarball was created by splitting out the qt3 bindings part from the
dbus-qt3 git repository: http://gitweb.freedesktop.org/?p=dbus/dbus-qt3.git
This package is dual-licensed under the Academic Free License, and the
GPL. For a description of the GPL, see /usr/share/common-licenses/GPL
on your Debian system.
Portions of the package are only licensed under the GPL (notably
tools/dbus-cleanup-sockets.c and test/decode-gcov.c ).
The Academic Free License follows:
The Academic Free License
v. 2.0
This Academic Free License (the "License") applies to any original
work of authorship (the "Original Work") whose owner (the "Licensor")
has placed the following notice immediately following the copyright
notice for the Original Work:
Licensed under the Academic Free License version 2.0
1) Grant of Copyright License. Licensor hereby grants You a
world-wide, royalty-free, non-exclusive, perpetual, sublicenseable
license to do the following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original Work;
c) to distribute copies of the Original Work and Derivative Works to the public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide,
royalty-free, non-exclusive, perpetual, sublicenseable license, under
patent claims owned or controlled by the Licensor that are embodied in
the Original Work as furnished by the Licensor, to make, use, sell and
offer for sale the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the
preferred form of the Original Work for making modifications to it and
all available documentation describing how to modify the Original
Work. Licensor hereby agrees to provide a machine-readable copy of
the Source Code of the Original Work along with each copy of the
Original Work that Licensor distributes. Licensor reserves the right
to satisfy this obligation by placing a machine-readable copy of the
Source Code in an information repository reasonably calculated to
permit inexpensive and convenient access by You for as long as
Licensor continues to distribute the Original Work, and by publishing
the address of that information repository in a notice immediately
following the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor
the names of any contributors to the Original Work, nor any of their
trademarks or service marks, may be used to endorse or promote
products derived from this Original Work without express prior written
permission of the Licensor. Nothing in this License shall be deemed
to grant any rights to trademarks, copyrights, patents, trade secrets
or any other intellectual property of Licensor except as expressly
stated herein. No patent license is granted to make, use, sell or
offer to sell embodiments of any patent claims other than the licensed
claims defined in Section 2. No right is granted to the trademarks of
Licensor even if such marks are included in the Original Work.
Nothing in this License shall be interpreted to prohibit Licensor from
licensing under different terms from this License any Original Work
that Licensor otherwise would have a right to license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any
Derivative Works that You create, all copyright, patent or trademark
notices from the Source Code of the Original Work, as well as any
notices of licensing and any descriptive text identified therein as an
"Attribution Notice." You must cause the Source Code for any
Derivative Works that You create to carry a prominent Attribution
Notice reasonably calculated to inform recipients that You have
modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor
warrants that the copyright in and to the Original Work and the patent
rights granted herein by Licensor are owned by the Licensor or are
sublicensed to You under the terms of this License with the permission
of the contributor(s) of those copyrights and patent rights. Except
as expressly stated in the immediately proceeding sentence, the
Original Work is provided under this License on an "AS IS" BASIS and
WITHOUT WARRANTY, either express or implied, including, without
limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY
OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY
constitutes an essential part of this License. No license to Original
Work is granted hereunder except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal
theory, whether in tort (including negligence), contract, or
otherwise, shall the Licensor be liable to any person for any direct,
indirect, special, incidental, or consequential damages of any
character arising as a result of this License or the use of the
Original Work including, without limitation, damages for loss of
goodwill, work stoppage, computer failure or malfunction, or any and
all other commercial damages or losses. This limitation of liability
shall not apply to liability for death or personal injury resulting
from Licensor's negligence to the extent applicable law prohibits such
limitation. Some jurisdictions do not allow the exclusion or
limitation of incidental or consequential damages, so this exclusion
and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the
Original Work or a Derivative Work, You must make a reasonable effort
under the circumstances to obtain the express assent of recipients to
the terms of this License. Nothing else but this License (or another
written agreement between Licensor and You) grants You permission to
create Derivative Works based upon the Original Work or to exercise
any of the rights granted in Section 1 herein, and any attempt to do
so except under the terms of this License (or another written
agreement between Licensor and You) is expressly prohibited by
U.S. copyright law, the equivalent laws of other countries, and by
international treaty. Therefore, by exercising any of the rights
granted to You in Section 1 herein, You indicate Your acceptance of
this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate
automatically and You may no longer exercise any of the rights granted
to You by this License as of the date You commence an action,
including a cross-claim or counterclaim, for patent infringement (i)
against Licensor with respect to a patent applicable to software or
(ii) against any entity with respect to a patent applicable to the
Original Work (but excluding combinations of the Original Work with
other software or hardware).
11) Jurisdiction, Venue and Governing Law. Any action or suit relating
to this License may be brought only in the courts of a jurisdiction
wherein the Licensor resides or in which Licensor conducts its primary
business, and under the laws of that jurisdiction excluding its
conflict-of-law provisions. The application of the United Nations
Convention on Contracts for the International Sale of Goods is
expressly excluded. Any use of the Original Work outside the scope of
this License or after its termination shall be subject to the
requirements and penalties of the U.S. Copyright Act, 17 U.S.C. \u00a4
101 et seq., the equivalent laws of other countries, and international
treaty. This section shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License
or seeking damages relating thereto, the prevailing party shall be
entitled to recover its costs and expenses, including, without
limitation, reasonable attorneys' fees and costs incurred in
connection with such action, including any appeal of such action.
This section shall survive the termination of this License.
13) Miscellaneous. This License represents the complete agreement
concerning the subject matter hereof. If any provision of this
License is held to be unenforceable, such provision shall be reformed
only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this
License, whether in upper or lower case, means an individual or a
legal entity exercising rights under, and complying with all of the
terms of, this License. For legal entities, "You" includes any entity
that controls, is controlled by, or is under common control with you.
For purposes of this definition, "control" means (i) the power, direct
or indirect, to cause the direction or management of such entity,
whether by contract or otherwise, or (ii) ownership of fifty percent
(50%) or more of the outstanding shares, or (iii) beneficial ownership
of such entity.
15) Right to Use. You may use the Original Work in all ways not
otherwise restricted or conditioned by this License or by law, and
Licensor promises not to interfere with or be responsible for such
uses by You.
This license is Copyright (C) 2003 Lawrence E. Rosen. All rights
reserved. Permission is hereby granted to copy and distribute this
license without modification. This license may not be modified
without the express written permission of its copyright owner.
--
END OF ACADEMIC FREE LICENSE. The following is intended to describe the essential
differences between the Academic Free License (AFL) version 1.0 and other
open source licenses:
The Academic Free License is similar to the BSD, MIT, UoI/NCSA and Apache
licenses in many respects but it is intended to solve a few problems with
those licenses.
* The AFL is written so as to make it clear what software is being
licensed (by the inclusion of a statement following the copyright notice
in the software). This way, the license functions better than a template
license. The BSD, MIT and UoI/NCSA licenses apply to unidentified software.
* The AFL tqcontains a complete copyright grant to the software. The BSD
and Apache licenses are vague and incomplete in that respect.
* The AFL tqcontains a complete patent grant to the software. The BSD, MIT,
UoI/NCSA and Apache licenses rely on an implied patent license and contain
no explicit patent grant.
* The AFL makes it clear that no trademark rights are granted to the
licensor's trademarks. The Apache license tqcontains such a provision, but the
BSD, MIT and UoI/NCSA licenses do not.
* The AFL includes the warranty by the licensor that it either owns the
copyright or that it is distributing the software under a license. None of
the other licenses contain that warranty. All other warranties are disclaimed,
as is the case for the other licenses.
* The AFL is itself copyrighted (with the right granted to copy and distribute
without modification). This ensures that the owner of the copyright to the
license will control changes. The Apache license tqcontains a copyright notice,
but the BSD, MIT and UoI/NCSA licenses do not.

@ -0,0 +1 @@
debian/tmp/usr/lib/libdbus-tqt-*.so.*

@ -0,0 +1,6 @@
debian/tmp/usr/include/dbus*/dbus/dbus-qt.h
debian/tmp/usr/include/dbus*/dbus/connection.h
debian/tmp/usr/include/dbus*/dbus/server.h
debian/tmp/usr/include/dbus*/dbus/message.h
debian/tmp/usr/lib/libdbus-tqt-*.so
debian/tmp/usr/lib/pkgconfig/*.pc

@ -0,0 +1,12 @@
#!/usr/bin/make -f
# Copyright © 2002,2003 Colin Walters <walters@verbum.org>
# Copyright © 2003 Daniel Stone <daniels@debian.org>
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk
# Strict library versioning
DEB_DH_MAKESHLIBS_ARGS_ALL := -V

@ -0,0 +1,530 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2005-07-09.11
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that tqcontains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and tqreplace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
tmpdepfile="$stripped.u"
if test "$libtool" = yes; then
"$@" -Wc,-M
else
"$@" -M
fi
stat=$?
if test -f "$tmpdepfile"; then :
else
stripped=`echo "$stripped" | sed 's,^.*/,,'`
tmpdepfile="$stripped.u"
fi
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
if test -f "$tmpdepfile"; then
outname="$stripped.o"
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mecanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

@ -0,0 +1,323 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2005-05-14.22
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
chmodcmd="$chmodprog 0755"
chowncmd=
chgrpcmd=
stripcmd=
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=
dst=
dir_arg=
dstarg=
no_target_directory=
usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
-c (ignored)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
--help display this help and exit.
--version display version info and exit.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
while test -n "$1"; do
case $1 in
-c) shift
continue;;
-d) dir_arg=true
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
--help) echo "$usage"; exit $?;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-s) stripcmd=$stripprog
shift
continue;;
-t) dstarg=$2
shift
shift
continue;;
-T) no_target_directory=true
shift
continue;;
--version) echo "$0 $scriptversion"; exit $?;;
*) # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
test -n "$dir_arg$dstarg" && break
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dstarg"; then
# $@ is not empty: it tqcontains at least $arg.
set fnord "$@" "$dstarg"
shift # fnord
fi
shift # arg
dstarg=$arg
done
break;;
esac
done
if test -z "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
src=
if test -d "$dst"; then
mkdircmd=:
chmodcmd=
else
mkdircmd=$mkdirprog
fi
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) tqcontains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dstarg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst ;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dstarg: Is a directory" >&2
exit 1
fi
dst=$dst/`basename "$src"`
fi
fi
# This sed command emulates the dirname command.
dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# Skip lots of stat calls in the usual case.
if test ! -d "$dstdir"; then
defaultIFS='
'
IFS="${IFS-$defaultIFS}"
oIFS=$IFS
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
shift
IFS=$oIFS
pathcomp=
while test $# -ne 0 ; do
pathcomp=$pathcomp$1
shift
if test ! -d "$pathcomp"; then
$mkdirprog "$pathcomp"
# mkdir can fail with a `File exist' error in case several
# install-sh are creating the directory concurrently. This
# is OK.
test -d "$pathcomp" || exit
fi
pathcomp=$pathcomp/
done
fi
if test -n "$dir_arg"; then
$doit $mkdircmd "$dst" \
&& { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
else
dstfile=`basename "$dst"`
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
trap '(exit $?); exit' 1 2 13 15
# Copy the file name to the temp name.
$doit $cpprog "$src" "$dsttmp" &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
&& { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
&& { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
&& { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
# Now rename the file to the real destination.
{ $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
|| {
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
if test -f "$dstdir/$dstfile"; then
$doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
|| $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
|| {
echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
(exit 1); exit 1
}
else
:
fi
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
}
}
fi || { (exit 1); exit 1; }
done
# The final little trick to "correctly" pass the exit status to the exit trap.
{
(exit 0); exit 0
}
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

@ -0,0 +1,244 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* integrator.h: integrates D-BUS into TQt event loop
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "integrator.h"
#include "connection.h"
#include <tqtimer.h>
#include <tqsocketnotifier.h>
#include <tqintdict.h>
#include <tqptrlist.h>
namespace DBusQt
{
namespace Internal {
struct Watch {
Watch(): readSocket( 0 ), writeSocket( 0 ) { }
DBusWatch *watch;
TQSocketNotifier *readSocket;
TQSocketNotifier *writeSocket;
};
//////////////////////////////////////////////////////////////
dbus_bool_t dbusAddWatch( DBusWatch *watch, void *data )
{
Integrator *con = static_cast<Integrator*>( data );
con->addWatch( watch );
return true;
}
void dbusRemoveWatch( DBusWatch *watch, void *data )
{
Integrator *con = static_cast<Integrator*>( data );
con->removeWatch( watch );
}
void dbusToggleWatch( DBusWatch *watch, void *data )
{
Integrator *itg = static_cast<Integrator*>( data );
if ( dbus_watch_get_enabled( watch ) )
itg->addWatch( watch );
else
itg->removeWatch( watch );
}
dbus_bool_t dbusAddTimeout( DBusTimeout *timeout, void *data )
{
if ( !dbus_timeout_get_enabled(timeout) )
return true;
Integrator *itg = static_cast<Integrator*>( data );
itg->addTimeout( timeout );
return true;
}
void dbusRemoveTimeout( DBusTimeout *timeout, void *data )
{
Integrator *itg = static_cast<Integrator*>( data );
itg->removeTimeout( timeout );
}
void dbusToggleTimeout( DBusTimeout *timeout, void *data )
{
Integrator *itg = static_cast<Integrator*>( data );
if ( dbus_timeout_get_enabled( timeout ) )
itg->addTimeout( timeout );
else
itg->removeTimeout( timeout );
}
void dbusWakeupMain( void* )
{
}
void dbusNewConnection( DBusServer *server,
DBusConnection *new_connection,
void *data )
{
Integrator *itg = static_cast<Integrator*>( data );
itg->handleConnection( new_connection );
}
/////////////////////////////////////////////////////////////
Timeout::Timeout( TQObject *tqparent, DBusTimeout *t )
: TQObject( tqparent ), m_timeout( t )
{
m_timer = new TQTimer( this );
connect( m_timer, TQT_SIGNAL(timeout()),
TQT_SLOT(slotTimeout()) );
}
void Timeout::slotTimeout()
{
emit timeout( m_timeout );
}
void Timeout::start()
{
m_timer->start( dbus_timeout_get_interval( m_timeout ) );
}
Integrator::Integrator( DBusConnection *conn, TQObject *tqparent )
: TQObject( tqparent ), m_connection( conn )
{
m_timeouts.setAutoDelete( true );
dbus_connection_set_watch_functions( m_connection,
dbusAddWatch,
dbusRemoveWatch,
dbusToggleWatch,
this, 0 );
dbus_connection_set_timeout_functions( m_connection,
dbusAddTimeout,
dbusRemoveTimeout,
dbusToggleTimeout,
this, 0 );
dbus_connection_set_wakeup_main_function( m_connection,
dbusWakeupMain,
this, 0 );
}
Integrator::Integrator( DBusServer *server, TQObject *tqparent )
: TQObject( tqparent ), m_server( server )
{
m_connection = reinterpret_cast<DBusConnection*>( m_server );
m_timeouts.setAutoDelete( true );
dbus_server_set_watch_functions( m_server,
dbusAddWatch,
dbusRemoveWatch,
dbusToggleWatch,
this, 0 );
dbus_server_set_timeout_functions( m_server,
dbusAddTimeout,
dbusRemoveTimeout,
dbusToggleTimeout,
this, 0 );
dbus_server_set_new_connection_function( m_server,
dbusNewConnection,
this, 0 );
}
void Integrator::slotRead( int fd )
{
TQIntDictIterator<Watch> it( m_watches );
for ( ; it.current(); ++it )
dbus_watch_handle ( it.current()->watch, DBUS_WATCH_READABLE );
emit readReady();
}
void Integrator::slotWrite( int fd )
{
TQIntDictIterator<Watch> it( m_watches );
for ( ; it.current(); ++it )
dbus_watch_handle ( it.current()->watch, DBUS_WATCH_WRITABLE );
}
void Integrator::slotTimeout( DBusTimeout *timeout )
{
dbus_timeout_handle( timeout );
}
void Integrator::addWatch( DBusWatch *watch )
{
if ( !dbus_watch_get_enabled( watch ) )
return;
Watch *qtwatch = new Watch;
qtwatch->watch = watch;
int flags = dbus_watch_get_flags( watch );
int fd = dbus_watch_get_fd( watch );
if ( flags & DBUS_WATCH_READABLE ) {
qtwatch->readSocket = new TQSocketNotifier( fd, TQSocketNotifier::Read, this );
TQObject::connect( qtwatch->readSocket, TQT_SIGNAL(activated(int)), TQT_SLOT(slotRead(int)) );
}
if (flags & DBUS_WATCH_WRITABLE) {
qtwatch->writeSocket = new TQSocketNotifier( fd, TQSocketNotifier::Write, this );
TQObject::connect( qtwatch->writeSocket, TQT_SIGNAL(activated(int)), TQT_SLOT(slotWrite(int)) );
}
m_watches.insert( fd, qtwatch );
}
void Integrator::removeWatch( DBusWatch *watch )
{
int key = dbus_watch_get_fd( watch );
Watch *qtwatch = m_watches.take( key );
if ( qtwatch ) {
delete qtwatch->readSocket; qtwatch->readSocket = 0;
delete qtwatch->writeSocket; qtwatch->writeSocket = 0;
delete qtwatch;
}
}
void Integrator::addTimeout( DBusTimeout *timeout )
{
Timeout *mt = new Timeout( this, timeout );
m_timeouts.insert( timeout, mt );
connect( mt, TQT_SIGNAL(timeout(DBusTimeout*)),
TQT_SLOT(slotTimeout(DBusTimeout*)) );
mt->start();
}
void Integrator::removeTimeout( DBusTimeout *timeout )
{
m_timeouts.remove( timeout );
}
void Integrator::handleConnection( DBusConnection *c )
{
Connection *con = new Connection( c, this );
emit newConnection( con );
}
}//end namespace Internal
}//end namespace DBusQt
#include "integrator.moc"

@ -0,0 +1,94 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* integrator.h: integrates D-BUS into TQt event loop
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBUS_TQT_INTEGRATOR_H
#define DBUS_TQT_INTEGRATOR_H
#include <tqobject.h>
#include <tqintdict.h>
#include <tqptrdict.h>
#include "dbus/dbus.h"
class TQTimer;
namespace DBusQt
{
class Connection;
namespace Internal
{
struct Watch;
class Timeout : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Timeout( TQObject *tqparent, DBusTimeout *t );
public:
void start();
signals:
void timeout( DBusTimeout* );
protected slots:
void slotTimeout();
private:
TQTimer *m_timer;
DBusTimeout *m_timeout;
};
class Integrator : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Integrator( DBusConnection *connection, TQObject *tqparent );
Integrator( DBusServer *server, TQObject *tqparent );
signals:
void readReady();
void newConnection( Connection* );
protected slots:
void slotRead( int );
void slotWrite( int );
void slotTimeout( DBusTimeout *timeout );
public:
void addWatch( DBusWatch* );
void removeWatch( DBusWatch* );
void addTimeout( DBusTimeout* );
void removeTimeout( DBusTimeout* );
void handleConnection( DBusConnection* );
private:
TQIntDict<Watch> m_watches;
TQPtrDict<Timeout> m_timeouts;
DBusConnection *m_connection;
DBusServer *m_server;
};
}
}
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,561 @@
/* -*- mode: C++; c-file-style: "gnu" -*- */
/* message.cpp: TQt wrapper for DBusMessage
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "message.h"
#include <tqmap.h>
#include <cstdlib>
namespace DBusQt {
struct Message::iterator::IteratorData {
DBusMessageIter *iter;
TQVariant var;
bool end;
DBusMessage *mesg;
};
/**
* Iterator.
*/
Message::iterator::iterator()
{
d = new IteratorData;
d->iter = 0; d->end = true;
}
/**
* Constructs iterator for the message.
* @param msg message whose fields we want to iterate
*/
Message::iterator::iterator( DBusMessage* msg )
{
d = new IteratorData;
d->mesg = msg;
d->iter = static_cast<DBusMessageIter *>( malloc( sizeof(DBusMessageIter) ) );
dbus_message_iter_init( d->mesg, d->iter );
if ( !d->iter ) {
qDebug("No iterator??");
}
fillVar();
d->end = false;
}
/**
* Copy constructor for the iterator.
* @param itr iterator
*/
Message::iterator::iterator( const iterator& itr )
{
d = new IteratorData;
d->iter = itr.d->iter;
d->var = itr.d->var;
d->end = itr.d->end;
}
/**
* Destructor.
*/
Message::iterator::~iterator()
{
free( d->iter );
delete d; d=0;
}
/**
* Creates an iterator equal to the @p itr iterator
* @param itr other iterator
* @return
*/
Message::iterator&
Message::iterator::operator=( const iterator& itr )
{
IteratorData *tmp = new IteratorData;
tmp->iter = itr.d->iter;
tmp->var = itr.d->var;
tmp->end = itr.d->end;
delete d; d=tmp;
return *this;
}
/**
* Returns the constant TQVariant held by the iterator.
* @return the constant reference to TQVariant held by this iterator
*/
const TQVariant&
Message::iterator::operator*() const
{
return d->var;
}
/**
* Returns the TQVariant held by the iterator.
* @return reference to TQVariant held by this iterator
*/
TQVariant&
Message::iterator::operator*()
{
return d->var;
}
/**
* Moves to the next field and return a reference to itself after
* incrementing.
* @return reference to self after incrementing
*/
Message::iterator&
Message::iterator::operator++()
{
if ( d->end )
return *this;
if ( dbus_message_iter_next( d->iter ) ) {
fillVar();
} else {
d->end = true;
d->var = TQVariant();
}
return *this;
}
/**
* Moves to the next field and returns self before incrementing.
* @return self before incrementing
*/
Message::iterator
Message::iterator::operator++(int)
{
iterator itr( *this );
operator++();
return itr;
}
/**
* Compares this iterator to @p it iterator.
* @param it the iterator to which we're comparing this one to
* @return true if they're equal, false otherwise
*/
bool
Message::iterator::operator==( const iterator& it )
{
if ( d->end == it.d->end ) {
if ( d->end == true ) {
return true;
} else {
return d->var == it.d->var;
}
} else
return false;
}
/**
* Compares two iterators.
* @param it The other iterator.
* @return true if two iterators are not equal, false
* otherwise
*/
bool
Message::iterator::operator!=( const iterator& it )
{
return !operator==( it );
}
TQVariant Message::iterator::marshallBaseType( DBusMessageIter* i )
{
TQVariant ret;
switch (dbus_message_iter_get_arg_type(i)) {
case DBUS_TYPE_INT32:
{
dbus_int32_t v;
dbus_message_iter_get_basic (i, &v);
ret = TQVariant( v );
}
break;
case DBUS_TYPE_UINT32:
{
dbus_uint32_t v;
dbus_message_iter_get_basic (i, &v);
ret = TQVariant( v );
}
break;
case DBUS_TYPE_DOUBLE:
{
double v;
dbus_message_iter_get_basic (i, &v);
ret = TQVariant( v );
}
break;
case DBUS_TYPE_STRING:
{
const char *v;
dbus_message_iter_get_basic (i, &v);
ret = TQVariant( v );
}
break;
default:
ret = TQVariant();
break;
}
return ret;
}
/**
* Fills TQVariant based on what current DBusMessageIter helds.
*/
void
Message::iterator::fillVar()
{
switch ( dbus_message_iter_get_arg_type( d->iter ) ) {
case DBUS_TYPE_INT32:
case DBUS_TYPE_UINT32:
case DBUS_TYPE_DOUBLE:
case DBUS_TYPE_STRING:
d->var = marshallBaseType( d->iter );
break;
case DBUS_TYPE_ARRAY: {
switch ( dbus_message_iter_get_element_type( d->iter ) ) {
case DBUS_TYPE_STRING: {
TQStringList tempList;
DBusMessageIter sub;
dbus_message_iter_recurse (d->iter, &sub);
while (dbus_message_iter_get_arg_type (&sub) != DBUS_TYPE_INVALID)
{
const char *v;
dbus_message_iter_get_basic (&sub, &v);
tempList.append( TQString( v ) );
dbus_message_iter_next (&sub);
}
d->var = TQVariant( tempList );
break;
}
default:
qDebug( "Array of type not implemented" );
d->var = TQVariant();
break;
}
break;
}
#if 0
/* DICT is gone for now, but expected to be reintroduced, or else
* reintroduced as a flag on the introspection data that can
* apply to array of struct of two fields
*/
case DBUS_TYPE_DICT: {
qDebug( "Got a hash!" );
TQMap<TQString, TQVariant> tempMap;
DBusMessageIter dictIter;
dbus_message_iter_init_dict_iterator( d->iter, &dictIter );
do {
char *key = dbus_message_iter_get_dict_key( &dictIter );
tempMap[key] = marshallBaseType( &dictIter );
dbus_free( key );
dbus_message_iter_next( &dictIter );
} while( dbus_message_iter_has_next( &dictIter ) );
d->var = TQVariant( tempMap );
break;
qDebug( "Hash/Dict type not implemented" );
d->var = TQVariant();
break;
}
#endif
default:
qDebug( "not implemented" );
d->var = TQVariant();
break;
}
}
/**
* Returns a TQVariant help by this iterator.
* @return TQVariant held by this iterator
*/
TQVariant
Message::iterator::var() const
{
return d->var;
}
struct Message::Private {
DBusMessage *msg;
};
Message::Message( DBusMessage *m )
{
d = new Private;
d->msg = m;
}
/**
*
*/
Message::Message( int messageType )
{
d = new Private;
d->msg = dbus_message_new( messageType );
}
/**
* Constructs a new Message with the given service and name.
* @param service service service that the message should be sent to
* @param name name of the message
*/
Message::Message( const TQString& service, const TQString& path,
const TQString& interface, const TQString& method )
{
d = new Private;
d->msg = dbus_message_new_method_call( service.latin1(), path.latin1(),
interface.latin1(), method.latin1() );
}
/**
* Constructs a message that is a reply to some other
* message.
* @param name the name of the message
* @param replayingTo original_message the message which the created
* message is a reply to.
*/
Message::Message( const Message& replayingTo )
{
d = new Private;
d->msg = dbus_message_new_method_return( replayingTo.d->msg );
}
Message:: Message( const TQString& path, const TQString& interface,
const TQString& name )
{
d = new Private;
d->msg = dbus_message_new_signal( path.ascii(), interface.ascii(),
name.ascii() );
}
Message::Message( const Message& replayingTo, const TQString& errorName,
const TQString& errorMessage )
{
d = new Private;
d->msg = dbus_message_new_error( replayingTo.d->msg, errorName.utf8(),
errorMessage.utf8() );
}
Message Message::operator=( const Message& other )
{
//FIXME: ref the other.d->msg instead of copying it?
}
/**
* Destructs message.
*/
Message::~Message()
{
if ( d->msg ) {
dbus_message_unref( d->msg );
}
delete d; d=0;
}
int Message::type() const
{
return dbus_message_get_type( d->msg );
}
void Message::setPath( const TQString& path )
{
dbus_message_set_path( d->msg, path.ascii() );
}
TQString Message::path() const
{
return dbus_message_get_path( d->msg );
}
void Message::setInterface( const TQString& iface )
{
dbus_message_set_interface( d->msg, iface.ascii() );
}
TQString Message::interface() const
{
return dbus_message_get_interface( d->msg );
}
void Message::setMember( const TQString& member )
{
dbus_message_set_member( d->msg, member.ascii() );
}
TQString Message::member() const
{
return dbus_message_get_member( d->msg );
}
void Message::setErrorName( const TQString& err )
{
dbus_message_set_error_name( d->msg, err.ascii() );
}
TQString Message::errorName() const
{
return dbus_message_get_error_name( d->msg );
}
void Message::setDestination( const TQString& dest )
{
dbus_message_set_destination( d->msg, dest.ascii() );
}
TQString Message::destination() const
{
return dbus_message_get_destination( d->msg );
}
/**
* Sets the message sender.
* @param sender the sender
* @return false if unsuccessful
*/
bool
Message::setSender( const TQString& sender )
{
return dbus_message_set_sender( d->msg, sender.latin1() );
}
/**
* Returns sender of this message.
* @return sender
*/
TQString
Message::sender() const
{
return dbus_message_get_sender( d->msg );
}
TQString Message::signature() const
{
return dbus_message_get_signature( d->msg );
}
/**
* Returns the starting iterator for the fields of this
* message.
* @return starting iterator
*/
Message::iterator
Message::begin() const
{
return iterator( d->msg );
}
/**
* Returns the ending iterator for the fields of this
* message.
* @return ending iterator
*/
Message::iterator
Message::end() const
{
return iterator();
}
/**
* Returns the field at position @p i
* @param i position of the wanted field
* @return TQVariant at position @p i or an empty TQVariant
*/
TQVariant
Message::at( int i )
{
iterator itr( d->msg );
while ( i-- ) {
if ( itr == end() )
return TQVariant();//nothing there
++itr;
}
return *itr;
}
/**
* The underlying DBusMessage of this class.
* @return DBusMessage pointer.
*/
DBusMessage*
Message::message() const
{
return d->msg;
}
Message& Message::operator<<( bool b )
{
const dbus_bool_t right_size_bool = b;
dbus_message_append_args( d->msg, DBUS_TYPE_BOOLEAN, &right_size_bool,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( TQ_INT8 byte )
{
dbus_message_append_args( d->msg, DBUS_TYPE_BYTE, &byte,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( TQ_INT32 num )
{
dbus_message_append_args( d->msg, DBUS_TYPE_INT32, &num,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( TQ_UINT32 num )
{
dbus_message_append_args( d->msg, DBUS_TYPE_UINT32, &num,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( TQ_INT64 num )
{
dbus_message_append_args( d->msg, DBUS_TYPE_INT64, &num,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( TQ_UINT64 num )
{
dbus_message_append_args( d->msg, DBUS_TYPE_UINT64, &num,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( double num )
{
dbus_message_append_args( d->msg, DBUS_TYPE_DOUBLE, &num,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( const TQString& str )
{
const char *u = str.utf8();
dbus_message_append_args( d->msg, DBUS_TYPE_STRING, &u,
DBUS_TYPE_INVALID );
}
Message& Message::operator<<( const TQVariant& custom )
{
//FIXME: imeplement
}
}

@ -0,0 +1,131 @@
/* -*- mode: C++; c-file-style: "gnu" -*- */
/* message.h: TQt wrapper for DBusMessage
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBUS_TQT_MESSAGE_H
#define DBUS_TQT_MESSAGE_H
#include <tqvariant.h>
#include <tqstring.h>
#include <tqstringlist.h>
#include "dbus/dbus.h"
namespace DBusQt {
class Message
{
public:
class iterator {
public:
iterator();
iterator( const iterator& );
iterator( DBusMessage* msg );
~iterator();
iterator& operator=( const iterator& );
const TQVariant& operator*() const;
TQVariant& operator*();
iterator& operator++();
iterator operator++(int);
bool operator==( const iterator& it );
bool operator!=( const iterator& it );
TQVariant var() const;
protected:
TQVariant marshallBaseType( DBusMessageIter* i );
void fillVar();
struct IteratorData;
IteratorData *d;
};
Message( int messageType );
Message( DBusMessage * );//hide this one from the public implementation
Message( const TQString& service, const TQString& path,
const TQString& interface, const TQString& method );
Message( const Message& replayingTo );
Message( const TQString& path, const TQString& interface,
const TQString& name );
Message( const Message& replayingTo, const TQString& errorName,
const TQString& errorMessage );
Message operator=( const Message& other );
virtual ~Message();
int type() const;
void setPath( const TQString& );
TQString path() const;
void setInterface( const TQString& );
TQString interface() const;
void setMember( const TQString& );
TQString member() const;
void setErrorName( const TQString& );
TQString errorName() const;
void setDestination( const TQString& );
TQString destination() const;
bool setSender( const TQString& sender );
TQString sender() const;
TQString signature() const;
iterator begin() const;
iterator end() const;
TQVariant at( int i );
public:
Message& operator<<( bool );
Message& operator<<( TQ_INT8 );
Message& operator<<( TQ_INT32 );
Message& operator<<( TQ_UINT32 );
Message& operator<<( TQ_INT64 );
Message& operator<<( TQ_UINT64 );
Message& operator<<( double );
Message& operator<<( const TQString& );
Message& operator<<( const TQVariant& );
//Message& operator<<();
//Message& operator<<();
//Message& operator<<();
//Message& operator<<();
//Message& operator<<();
//Message& operator<<();
//Message& operator<<();
protected:
friend class Connection;
DBusMessage* message() const;
private:
struct Private;
Private *d;
};
}
#endif

@ -0,0 +1,360 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2005-06-08.21
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that tqcontains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case "$1" in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case "$1" in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case "$1" in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
tqfind . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a tqreplacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
fi
if [ -f "$file" ]; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case "$firstarg" in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case "$firstarg" in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

@ -0,0 +1,90 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* server.h: TQt wrapper for DBusServer
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.0
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "server.h"
#include "connection.h"
#include "integrator.h"
using DBusQt::Internal::Integrator;
namespace DBusQt
{
struct Server::Private {
Private() : integrator( 0 ), server( 0 )
{}
Integrator *integrator;
DBusServer *server;
DBusError error;
};
Server::Server( const TQString& addr, TQObject *tqparent )
: TQObject( tqparent )
{
d = new Private;
if ( !addr.isEmpty() ) {
init( addr );
}
}
Server::~Server()
{
delete d;
}
bool Server::isConnected() const
{
return dbus_server_get_is_connected( d->server );
}
void Server::disconnect()
{
dbus_server_disconnect( d->server );
}
TQString Server::address() const
{
//FIXME: leak?
return dbus_server_get_address( d->server );
}
void Server::listen( const TQString& addr )
{
if ( !d->server ) {
init( addr );
}
}
void Server::init( const TQString& addr )
{
d->server = dbus_server_listen( addr.ascii(), &d->error );
d->integrator = new Integrator( d->server, this );
connect( d->integrator, TQT_SIGNAL(newConnection(Connection*)),
TQT_SIGNAL(newConnection(Connection*)) );
}
}
#include "server.moc"

@ -0,0 +1,58 @@
// -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
/* server.h: TQt wrapper for DBusServer
*
* Copyright (C) 2003 Zack Rusin <zack@kde.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef DBUS_TQT_SERVER_H
#define DBUS_TQT_SERVER_H
#include <tqobject.h>
#include "dbus/dbus.h"
namespace DBusQt
{
class Connection;
class Server : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Server( const TQString& addr = TQString(), TQObject *tqparent=0 );
~Server();
bool isConnected() const;
TQString address() const;
public slots:
void listen( const TQString& addr );
void disconnect();
signals:
void newConnection( Connection* );
private:
void init( const TQString& addr );
private:
struct Private;
Private *d;
};
}
#endif

@ -0,0 +1,5 @@
Harald Fernengel <harry@kdevelop.org>
Original developer
Kevin Krammer <kevin.krammer@gmx.at>
Initial port, current maintainer

@ -0,0 +1,103 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
project( dbus-1-tqt )
##### cmake setup ###############################
cmake_minimum_required( VERSION 2.8 )
include( FindPkgConfig )
include( CheckCXXSourceCompiles )
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
include( ConfigureChecks.cmake )
##### install paths setup #######################
tde_setup_install_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" )
tde_setup_install_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" )
tde_setup_install_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" )
tde_setup_install_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include/${CMAKE_PROJECT_NAME}" )
tde_setup_install_path( PKGCONFIG_INSTALL_DIR "${LIB_INSTALL_DIR}/pkgconfig" )
##### install headers ###########################
install( FILES
tqdbuserror.h tqdbusmessage.h tqdbusconnection.h
tqdbusvariant.h tqdbusobject.h tqdbusproxy.h
tqdbusmacros.h tqdbusdata.h tqdbusdatalist.h
tqdbusdatamap.h tqdbusobjectpath.h tqdbusdataconverter.h
DESTINATION ${INCLUDE_INSTALL_DIR} )
##### install other data ########################
##### write pkgconfig file ######################
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_EXEC_PREFIX ${EXEC_INSTALL_PREFIX} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_INCLUDE_DIR ${INCLUDE_INSTALL_DIR} )
string( REGEX REPLACE "^${CMAKE_INSTALL_PREFIX}" "\${prefix}" PC_LIB_DIR ${LIB_INSTALL_DIR} )
configure_file( dbus-1-tqt.pc.cmake dbus-1-tqt.pc @ONLY )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/dbus-1-tqt.pc DESTINATION ${PKGCONFIG_INSTALL_DIR} )
##### build setup ###############################
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include tqt.h" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
add_definitions(
-DDBUS_COMPILATION
-DQT_THREAD_SUPPORT
${TQT_CFLAGS_OTHER}
)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${TQT_INCLUDE_DIRS}
${DBUS_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
)
##### dbus-1-tqt (shared) #########################
tde_add_library( dbus-1-tqt SHARED AUTOMOC
SOURCES ${dbus_tqt_MOCS}
tqdbusconnection.cpp tqdbuserror.cpp tqdbusintegrator.cpp
tqdbusmarshall.cpp tqdbusmessage.cpp tqdbusserver.cpp
tqdbusproxy.cpp tqdbusdata.cpp tqdbusdatalist.cpp
tqdbusobjectpath.cpp tqdbusdataconverter.cpp
VERSION 0.0.0
LINK ${TQT_LIBRARIES} ${DBUS_LIBRARIES}
DESTINATION ${LIB_INSTALL_DIR}
)
##### dbusxml2qt3 (executable) ##################
tde_add_executable( dbusxml2qt3
SOURCES
tools/dbusxml2qt3/classgen.cpp
tools/dbusxml2qt3/main.cpp
tools/dbusxml2qt3/methodgen.cpp
LINK ${TQT_LIBRARIES}
DESTINATION ${BIN_INSTALL_DIR}
)

@ -0,0 +1,10 @@
The software of this project is distributed under the terms of three
licenses.
The Qt3 D-Bus bindings library is distributed under the terms of
the Academic Free License version 2.1 (see COPYING.AFL for details)
as well as the GNU Public License 2.1 (or at your option any later version,
see COPYING.GPL for details)
The binding generator tool dbusxml2q3 is distributed under the terms
of the MIT licence (see tools/dbusxml2qt3/LICENSE for details)

@ -0,0 +1,54 @@
# Larry Rosen has ceased to use or recommend any version
# of the Academic Free License below version 2.1
The Academic Free License
v. 2.1
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
Licensed under the Academic Free License version 2.1
1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original Work;
c) to distribute copies of the Original Work and Derivative Works to the public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner.

@ -0,0 +1,346 @@
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
the instance of code that it refers to (the kde programs) are copyrighted
by the authors who actually wrote it.
---------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which tqcontains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part tqcontains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it tqcontains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

@ -0,0 +1,51 @@
2008-06-05 krake: Updating changelog after forgetting about it for a long
time. Rather incomplete list, listing only major changes.
* Added dbusxml2qt3 code generation tool for creating client and server side
code based on D-Bus XML introspection data
* Added cross-bindings test suite support
* Added QDBusDataConverter template to build helper classes for
transforming native C++ types into QDBusData objects and vice versa
* Added support for nested containers
* Added support for empty containers
* Added support for D-Bus variant
* Handling D-Bus object path different than String
2006-01-28 krake:
* Added a default constructor to QDBusConnection which creates empty/null
connections suitable for variable initialization
* Fixed initialization of the connection member in QDBusProxy
* Use pkg-config to determine linker flags for the D-BUS base library
when building examples
* Added documentation on object registering to the service overview docs
* Added documentation on requesting service names to overview docs
* Added documentation on handling interfaces to service overview docs
* Added table of contents to client and service overview docs
2006-01-25 krake:
* Fixed pkg-config input files and got them installed
* Fixed build files to use new package name dbus-1-qt3 instead of the too
generic qdbus
2006-01-22 krake:
* API docs for QDBusMessage
2006-01-21 krake:
* API docs for QDBusProxy and overview documentation for using the bindings
in a client.
* Adjusted example programs to changed build situation
* Changed example programs to use non-GUI QApplication
* API docs for QDBusError, QDBusObjectBase and overview documentation for
using the bindings to provide services.
* Fixed service example
* API docs for QDBusConnection
2006-01-20 krake:
* Changed build files to be able to build with KDE 3.5 admin/ directory
2006-01-19 krake:
* Changed library name to from dbus-qt3-1 dbus-1-qt3. Seems more logical to
to me having the DBus version number closer to "dbus"
2006-01-17 krake:
* Imported my backport to the SVN directory originally created by Will
* Fixed licences (FSF address, missing licence in examle files)

@ -0,0 +1,19 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# dbus-1
pkg_search_module( DBUS dbus-1 )
if( NOT DBUS_FOUND )
tde_message_fatal( "dbus-1 is required, but was not found on your system" )
endif( )
# tqt
find_package( TQt )

@ -0,0 +1,184 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
tqcontains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `gmake' to compile the package. Or if you're using a Linux
powered machine, or if make is GNU make, type `make'. You can
check with make --version. KDE requires GNU make to build, if
gmake is appropriate, tqreplace any instance below of make with gmake.
It will give output similar to:
#make --version
GNU Make version 3.78.1, by Richard Stallman and Roland McGrath.
Built for i386--freebsd4.0
Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99
...
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/kde/bin', `/usr/local/kde/lib', etc. You can specify an
installation prefix other than `/usr/local/kde' by giving `configure'
the option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
tqfind the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

@ -0,0 +1,20 @@
This is a backport of Harald Fernengel's Qt4 D-Bus bindings.
Some Qt4 based code had no direct equivalent in Qt3. Cases where this
transition to Qt3 might not be fully correct are marked with FIXME-QT4
Depending on the use case it might be necessary to extend QDBusMesssage
to allow marshalling/de-marshalling based on an application provided
helper as the Qt3 QVariant can not handle all cases the Qt4 pendant can
(user defined types, etc)
In order to build you need to copy or symlink the kde-common/admin directory
into this directory and then run
make -f Makefile.cvs
to generate the configure script.

@ -0,0 +1,11 @@
- Have someone with Qt4 experience check the code marked with FIXME-QT4
- Port the Qt4 bindings' unit tests to something available for Qt3
- Add static methods for D-BUS standard errors to QDBusError.
At least for those a service implementation might need more often
- Check possibility of a QObject adapter implementation of QDBusObjectBase,
i.e. a making an QObject's Q_SLOTS callable through D-BUS

@ -0,0 +1,86 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
if( NOT TDE_FOUND )
message( STATUS "checking for 'TDE'")
# if the path is not already defined by user,
# find kde-config executable
if( NOT DEFINED KDECONFIG_EXECUTABLE )
find_program( KDECONFIG_EXECUTABLE
NAMES kde-config
HINTS ${BIN_INSTALL_DIR} )
if( NOT KDECONFIG_EXECUTABLE )
tde_message_fatal( "kde-config are NOT found." )
endif( NOT KDECONFIG_EXECUTABLE )
endif( NOT DEFINED KDECONFIG_EXECUTABLE )
# check for installed trinity version
execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --version
OUTPUT_VARIABLE _version
RESULT_VARIABLE _result
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( _result )
tde_message_fatal( "Unable to run kde-config!\n KDELIBS are correctly installed?\n Path to kde-config are corect?" )
endif( _result )
# parse kde-config output, to extract TDE version
string( REGEX MATCH "KDE: ([0-9\\.]+)" __dummy "${_version}" )
set( TDE_VERSION "${CMAKE_MATCH_1}" )
# ask kde-config for few paths
macro( __internal_get_path __type __var )
execute_process(
COMMAND ${KDECONFIG_EXECUTABLE} --expandvars --install ${__type}
OUTPUT_VARIABLE ${__var}
OUTPUT_STRIP_TRAILING_WHITESPACE )
endmacro( __internal_get_path )
__internal_get_path( include TDE_INCLUDE_DIR )
__internal_get_path( lib TDE_LIB_DIR )
__internal_get_path( exe TDE_BIN_DIR )
__internal_get_path( data TDE_DATA_DIR )
__internal_get_path( config TDE_CONFIG_DIR )
__internal_get_path( html TDE_HTML_DIR )
__internal_get_path( cmake TDE_CMAKE_DIR )
__internal_get_path( qtplugins TDE_QTPLUGINS_DIR )
# find kde tools
macro( __internal_find_program __prog __var )
find_program( ${__var}
NAMES ${__prog}
HINTS ${TDE_BIN_INSTALL_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE )
if( NOT ${__var} )
tde_message_fatal( "${__prog} are NOT found.\n KDELIBS are correctly installed?" )
endif( NOT ${__var} )
endmacro( __internal_find_program )
__internal_find_program( dcopidl KDE3_DCOPIDL_EXECUTABLE )
__internal_find_program( dcopidlng KDE3_DCOPIDLNG_EXECUTABLE )
__internal_find_program( dcopidl2cpp KDE3_DCOPIDL2CPP_EXECUTABLE )
__internal_find_program( meinproc KDE3_MEINPROC_EXECUTABLE )
__internal_find_program( kconfig_compiler KDE3_KCFGC_EXECUTABLE )
__internal_find_program( makekdewidgets KDE3_MAKEKDEWIDGETS_EXECUTABLE )
# dcopidlng is a bash script which using kde-config;
# if PATH to kde-config is not set, dcopidlng will fail;
# for this reason we set KDECONFIG environment variable before running dcopidlng
set( KDE3_DCOPIDLNG_EXECUTABLE env KDECONFIG=${KDECONFIG_EXECUTABLE} ${KDE3_DCOPIDLNG_EXECUTABLE}
CACHE INTERNAL KDE3_DCOPIDLNG_EXECUTABLE FORCE )
message( STATUS " found 'TDE', version ${TDE_VERSION}" )
endif( NOT TDE_FOUND )
include( "${TDE_CMAKE_DIR}/kdelibs.cmake" )

@ -0,0 +1,81 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
macro( tqt_message )
message( STATUS "${ARGN}" )
endmacro( )
pkg_search_module( TQT tqt )
if( NOT TQT_FOUND )
tde_message_fatal( "Unable to find tqt!\n Try adding the directory in which the tqt.pc file is located\nto the PKG_CONFIG_PATH variable." )
endif( )
# tmoc_executable
execute_process(
COMMAND pkg-config tqt --variable=tmoc_executable
OUTPUT_VARIABLE TMOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( TMOC_EXECUTABLE )
tqt_message( " tmoc path: ${TMOC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to tmoc is not set.\n tqt is correctly installed?" )
endif( )
# moc_executable
execute_process(
COMMAND pkg-config tqt --variable=moc_executable
OUTPUT_VARIABLE MOC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( MOC_EXECUTABLE )
tqt_message( " moc path: ${MOC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to moc is not set.\n tqt is correctly installed?" )
endif( )
# uic_executable
execute_process(
COMMAND pkg-config tqt --variable=uic_executable
OUTPUT_VARIABLE UIC_EXECUTABLE OUTPUT_STRIP_TRAILING_WHITESPACE )
if( UIC_EXECUTABLE )
tqt_message( " uic path: ${UIC_EXECUTABLE}" )
else( )
tde_message_fatal( "Path to uic is not set.\n tqt is correctly installed?" )
endif( )
# check if tqt is usable
tde_save( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
set( CMAKE_REQUIRED_INCLUDES ${TQT_INCLUDE_DIRS} )
foreach( _dirs ${TQT_LIBRARY_DIRS} )
list( APPEND CMAKE_REQUIRED_LIBRARIES "-L${_dirs}" )
endforeach()
list( APPEND CMAKE_REQUIRED_LIBRARIES ${TQT_LIBRARIES} )
check_cxx_source_compiles("
#include <tqapplication.h>
int main(int argc, char **argv) { TQApplication app(argc, argv); return 0; } "
HAVE_USABLE_TQT )
if( NOT HAVE_USABLE_TQT )
tde_message_fatal( "Unable to build a simple tqt test." )
endif( )
tde_restore( CMAKE_REQUIRED_INCLUDES CMAKE_REQUIRED_LIBRARIES )
# TQT_CXX_FLAGS
foreach( _flag ${TQT_CFLAGS_OTHER} )
set( TQT_CXX_FLAGS "${TQT_CXX_FLAGS} ${_flag}" )
endforeach()

File diff suppressed because it is too large Load Diff

@ -0,0 +1,67 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
#################################################
#####
##### tde_internal_setup_path
macro( _tde_internal_setup_path _path _default _comment )
if( DEFINED ${_path} )
set( ${_path} "${${_path}}" CACHE PATH "${_comment}" )
else( DEFINED ${_path} )
set( ${_path} "${_default}" )
endif( DEFINED ${_path} )
endmacro( _tde_internal_setup_path )
#################################################
#####
##### tde_setup_paths
macro( tde_setup_paths )
# install paths
_tde_internal_setup_path( EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries" )
_tde_internal_setup_path( SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/" )
_tde_internal_setup_path( BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)" )
_tde_internal_setup_path( SBIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/sbin" "The install dir for system executables (default ${EXEC_INSTALL_PREFIX}/sbin)" )
_tde_internal_setup_path( LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})" )
_tde_internal_setup_path( LIBEXEC_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3/libexec" "The subdirectory relative to the install prefix where libraries will be installed (default is ${LIB_INSTALL_DIR}/kde3/libexec)" )
_tde_internal_setup_path( INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix" )
_tde_internal_setup_path( CMAKE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/cmake" "The install dir for cmake import modules" )
_tde_internal_setup_path( PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde3" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde3)" )
_tde_internal_setup_path( CONFIG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config" "The config file install dir" )
_tde_internal_setup_path( DATA_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/apps" "The parent directory where applications can install their data" )
_tde_internal_setup_path( HTML_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/doc/kde/HTML" "The HTML install dir for documentation" )
_tde_internal_setup_path( ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)" )
_tde_internal_setup_path( KCFG_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/config.kcfg" "The install dir for kconfig files" )
_tde_internal_setup_path( LOCALE_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/locale" "The install dir for translations" )
_tde_internal_setup_path( APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applnk" "The install dir for the application desktop files" )
_tde_internal_setup_path( MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mimelnk" "The install dir for the mimetype desktop files" )
_tde_internal_setup_path( SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/services" "The install dir for service (desktop, protocol, ...) files" )
_tde_internal_setup_path( SERVICETYPES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/servicetypes" "The install dir for servicestypes desktop files" )
_tde_internal_setup_path( SOUND_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/sounds" "The install dir for sound files" )
_tde_internal_setup_path( TEMPLATES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/templates" "The install dir for templates (Create new file...)" )
_tde_internal_setup_path( WALLPAPER_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/wallpapers" "The install dir for wallpapers" )
_tde_internal_setup_path( KCONF_UPDATE_INSTALL_DIR "${DATA_INSTALL_DIR}/kconf_update" "The kconf_update install dir" )
_tde_internal_setup_path( AUTOSTART_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/autostart" "The install dir for autostart files" )
_tde_internal_setup_path( SYSCONF_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/etc" "The sysconfig install dir (default ${CMAKE_INSTALL_PREFIX}/etc)" )
_tde_internal_setup_path( MAN_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/man" "The man install dir (default ${SHARE_INSTALL_PREFIX}/man/)" )
_tde_internal_setup_path( INFO_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/info" "The info install dir (default ${SHARE_INSTALL_PREFIX}/info)" )
_tde_internal_setup_path( XDG_MENU_INSTALL_DIR "${SYSCONF_INSTALL_DIR}/xdg/menus" "The XDG menus dir" )
_tde_internal_setup_path( XDG_APPS_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/applications/kde" "The XDG apps dir" )
_tde_internal_setup_path( XDG_DIRECTORY_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/desktop-directories" "The XDG directory" )
_tde_internal_setup_path( XDG_MIME_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/mime/packages" "The install dir for the xdg mimetypes" )
endmacro( tde_setup_paths )

@ -0,0 +1,45 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
get_filename_component( _ui_basename ${UI_FILE} NAME_WE )
# FIXME this will working only on out-of-source mode
set( local_ui_file ${_ui_basename}.ui )
configure_file( ${UI_FILE} ${local_ui_file} COPYONLY )
execute_process( COMMAND tqt-replace ${local_ui_file} )
execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${local_ui_file}
OUTPUT_VARIABLE _ui_h_content )
if( _ui_h_content )
string( REGEX REPLACE "#ifndef " "#ifndef UI_" _ui_h_content "${_ui_h_content}" )
string( REGEX REPLACE "#define " "#define UI_" _ui_h_content "${_ui_h_content}" )
file( WRITE ${_ui_basename}.h "${_ui_h_content}" )
endif( )
if( TDE_QTPLUGINS_DIR )
set( L -L ${TDE_QTPLUGINS_DIR} )
endif( )
execute_process( COMMAND ${UIC_EXECUTABLE}
-nounload -tr tr2i18n
${L}
-impl ${_ui_basename}.h
${local_ui_file}
OUTPUT_VARIABLE _ui_cpp_content )
if( _ui_cpp_content )
string( REGEX REPLACE "tr2i18n\\(\"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
string( REGEX REPLACE "tr2i18n\\(\"\", \"\"\\)" "QString::null" _ui_cpp_content "${_ui_cpp_content}" )
file( WRITE ${_ui_basename}.cpp "#include <kdialog.h>\n#include <klocale.h>\n\n${_ui_cpp_content}" )
endif( )

@ -0,0 +1,5 @@
#ifdef _AIX
namespace {
void *not_empty_file;
}
#endif

@ -0,0 +1,7 @@
add_library( @_target@ @_type@ IMPORTED )
set_target_properties( @_target@ PROPERTIES
IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
IMPORTED_LOCATION "@_location@"
IMPORTED_SONAME "@_soname@" )

@ -0,0 +1,2 @@
extern "C" int kdemain(int argc, char* argv[]);
int main(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,3 @@
#include <kdemacros.h>
extern "C" int kdemain(int argc, char* argv[]);
extern "C" KDE_EXPORT int kdeinitmain(int argc, char* argv[]) { return kdemain(argc,argv); }

@ -0,0 +1,35 @@
# @_laname@ - a libtool library file
# Generated by CMake - GNU libtool
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# The name that we can dlopen(3).
dlname='@_library_name_2@'
# Names of this library.
library_names='@_library_name_1@ @_library_name_2@ @_library_name_3@'
# The name of the static archive.
old_library=''
# Libraries that this one depends upon.
dependency_libs=''
# Version information for @_name@.
current=@_version_current@
age=@_version_age@
revision=@_version_revision@
# Is this an already installed library?
installed=yes
# Should we warn about portability when linking against -modules?
shouldnotlink=@_shouldnotlink@
# Files to dlopen/dlpreopen
dlopen=''
dlpreopen=''
# Directory that this library needs to be installed in:
libdir='@_libdir@'

@ -0,0 +1,10 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=@PC_EXEC_PREFIX@
libdir=@PC_LIB_DIR@
includedir=@PC_INCLUDE_DIR@
Name: dbus-tqt
Description: DBUS bindings for the Trinity Qt [TQt] interface
Version: 0.9.0
Libs: -L${libdir} -ldbus-1-tqt
Cflags: -I${includedir}

@ -0,0 +1,5 @@
dbus-1-tqt (0.9-0ubuntu1) maverick; urgency=low
* Initial package
-- Timothy Pearson <kb9vqf@pearsoncomputing.net> Tue, 23 Mar 2010 13:23:00 -0600

@ -0,0 +1,32 @@
Source: dbus-1-tqt
Section: devel
Priority: optional
Maintainer: Timothy Pearson <kb9vqf@pearsoncomputing.net>
Build-Depends: cdbs (>= 0.4.43), debhelper (>= 5.0.37.2), libtqtinterface-dev, libdbus-1-dev (>= 0.90), cmake
Standards-Version: 3.8.3
Package: libdbus-1-tqt-dev
Section: libdevel
Architecture: any
Depends: libdbus-1-tqt (= ${binary:Version}), libdbus-1-dev (>= 0.90), libtqtinterface-dev
Description: dbus bindings for the Trinity Qt [TQt] interface
D-BUS is a message bus, used for sending messages between applications.
Conceptually, it fits somewhere in between raw sockets and CORBA in
terms of complexity.
.
This package provides bindings for the Trinity Qt TQt interface.
.
See the dbus description for more information about D-BUS in general.
Package: libdbus-1-tqt
Section: libs
Architecture: any
Depends: ${shlibs:Depends}
Description: dbus bindings for the Trinity Qt [TQt] interface
D-BUS is a message bus, used for sending messages between applications.
Conceptually, it fits somewhere in between raw sockets and CORBA in
terms of complexity.
.
This package provides bindings for the Trinity Qt TQt interface.
.
See the dbus description for more information about D-BUS in general.

@ -0,0 +1,93 @@
This package was debianised by Jonathan Riddell <jriddell@ubuntu.com> on
Thu, 03 Jul 2008 18:21:06 +0100
Copyright (C) 2011 Timothy Pearson <kb9vqf@pearsoncomputing.net>
Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
Copyright (C) 2005,2007 Kevin Krammer <kevin.krammer@gmx.at>
The software of this project is distributed under the terms of three
licenses.
The TQt D-Bus bindings library is distributed under the terms of the
Academic Free License version 2.1 as well as the GNU General Public
License 2 (or at your option any later version)
See /usr/share/common-licenses/GPL-2 or below
The binding generator tool dbusxml2q3 is distributed under the terms
of the MIT licence (see tools/dbusxml2qt3/LICENSE for details)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
The Debian packaging is (C) 2008, Canonical Ltd and
is licensed under the GPL version 2 or later, see `/usr/share/common-licenses/GPL-2'.
The Academic Free License
v. 2.1
This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following notice immediately following the copyright notice for the Original Work:
Licensed under the Academic Free License version 2.1
1) Grant of Copyright License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license to do the following:
a) to reproduce the Original Work in copies;
b) to prepare derivative works ("Derivative Works") based upon the Original Work;
c) to distribute copies of the Original Work and Derivative Works to the public;
d) to perform the Original Work publicly; and
e) to display the Original Work publicly.
2) Grant of Patent License. Licensor hereby grants You a world-wide, royalty-free, non-exclusive, perpetual, sublicenseable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, to make, use, sell and offer for sale the Original Work and Derivative Works.
3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor hereby agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work, and by publishing the address of that information repository in a notice immediately following the copyright notice that applies to the Original Work.
4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior written permission of the Licensor. Nothing in this License shall be deemed to grant any rights to trademarks, copyrights, patents, trade secrets or any other intellectual property of Licensor except as expressly stated herein. No patent license is granted to make, use, sell or offer to sell embodiments of any patent claims other than the licensed claims defined in Section 2. No right is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under different terms from this License any Original Work that Licensor otherwise would have a right to license.
5) This section intentionally omitted.
6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work.
7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately proceeding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of NON-INFRINGEMENT, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to Original Work is granted hereunder except under this disclaimer.
8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to any person for any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to liability for death or personal injury resulting from Licensor's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You.
9) Acceptance and Termination. If You distribute copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. Nothing else but this License (or another written agreement between Licensor and You) grants You permission to create Derivative Works based upon the Original Work or to exercise any of the rights granted in Section 1 herein, and any attempt to do so except under the terms of this License (or another written agreement between Licensor and You) is expressly prohibited by U.S. copyright law, the equivalent laws of other countries, and by international treaty. Therefore, by exercising any of the rights granted to You in Section 1 herein, You indicate Your acceptance of this License and all of its terms and conditions.
10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware.
11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of the U.S. Copyright Act, 17 U.S.C. § 101 et seq., the equivalent laws of other countries, and international treaty. This section shall survive the termination of this License.
12) Attorneys Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License.
13) Miscellaneous. This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.
This license is Copyright (C) 2003-2004 Lawrence E. Rosen. All rights reserved. Permission is hereby granted to copy and distribute this license without modification. This license may not be modified without the express written permission of its copyright owner.

@ -0,0 +1,5 @@
debian/tmp/usr/include/*
debian/tmp/usr/lib/libdbus-1-tqt*.so
debian/tmp/usr/bin/dbusxml2qt3
debian/tmp/usr/lib/pkgconfig/dbus-1-tqt.pc
debian/tmp/usr/lib/libdbus-1-tqt.la

@ -0,0 +1 @@
debian/tmp/usr/lib/libdbus-1-tqt*.so.*

@ -0,0 +1,6 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/simple-patchsys.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/cmake.mk

@ -0,0 +1,4 @@
admin
dbus
debian
tools

@ -0,0 +1,18 @@
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

@ -0,0 +1,54 @@
/*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#if !defined(CLASSGEN_H_INCLUDED)
#define CLASSGEN_H_INCLUDED
// forward declarations
class Class;
class TQDomElement;
class TQTextStream;
template<typename T> class TQValueList;
class ClassGenerator
{
public:
static bool initStreams(const TQString& baseName,
TQTextStream& headerStream, TQTextStream& sourceStream);
static bool finishStreams(const TQString& baseName,
TQTextStream& headerStream, TQTextStream& sourceStream);
static bool extractClass(const TQDomElement& interfaceElement, Class& classData);
static bool generateInterface(const Class& classData,
TQTextStream& headerStream,
TQTextStream& sourceStream);
static bool generateProxy(const Class& classData,
TQTextStream& headerStream, TQTextStream& sourceStream);
static bool generateNode(const Class& classData,
const TQValueList<Class>& interfaces,
TQTextStream& headerStream, TQTextStream& sourceStream);
};
#endif
// End of File

@ -0,0 +1,637 @@
/*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
// standard includes
#include <iostream>
#include <cstdlib>
// TQt includes
#include <tqdom.h>
#include <tqfile.h>
#include <tqmap.h>
#include <tqtextstream.h>
// local includes
#include "classgen.h"
#include "methodgen.h"
typedef TQMap<TQString, TQString> OptionMap;
void usage();
OptionMap parseOptions(int argc, char** argv);
bool checkForOption(const OptionMap& options, const TQString& option)
{
return options.tqfind(option) != options.end();
}
int main(int argc, char** argv)
{
const OptionMap options = parseOptions(argc, argv);
if (!checkForOption(options, "filename"))
{
std::cerr << "dbusxml2qt3: introspection data file missing" << std::endl;
usage();
exit(1);
}
TQString fileName = options["filename"];
TQFile file(fileName);
if (!file.exists())
{
std::cerr << "dbusxml2qt3: introspection data file '"
<< fileName.local8Bit().data()
<< "' does not exist" << std::endl;
exit(2);
}
if (!file.open(IO_ReadOnly))
{
std::cerr << "dbusxml2qt3: introspection data file '"
<< fileName.local8Bit().data()
<< "' cannot be read" << std::endl;
exit(2);
}
TQDomDocument document;
if (!document.setContent(&file))
{
file.close();
std::cerr << "dbusxml2qt3: introspection data file '"
<< fileName.local8Bit().data()
<< "' cannot be parsed" << std::endl;
exit(2);
}
file.close();
TQDomElement rootElement = document.documentElement();
if (rootElement.isNull() || rootElement.tagName() != "node")
{
std::cerr << "dbusxml2qt3: introspection data file '"
<< fileName.local8Bit().data()
<< "' does not have a 'node' element as its root node"
<< std::endl;
exit(2);
}
TQValueList<Class> interfaces;
bool hasIntrospectable = false;
TQDomNode child = rootElement.firstChild();
for (; !child.isNull(); child = child.nextSibling())
{
if (!child.isElement()) continue;
TQDomElement element = child.toElement();
if (element.tagName() == "interface")
{
if (!element.attribute("name").isEmpty())
{
Class classData;
if (ClassGenerator::extractClass(element, classData))
{
if (classData.dbusName == "org.freedesktop.DBus.Introspectable")
hasIntrospectable = true;
else
interfaces << classData;
}
}
}
}
if (interfaces.isEmpty())
{
std::cerr << "dbusxml2qt3: introspection data file '"
<< fileName.local8Bit().data()
<< "' does not contain any valid interface descriptions"
<< std::endl;
exit(3);
}
bool generateProxies = checkForOption(options, "proxy");
bool generateInterfaces = checkForOption(options, "interface");
bool generateNode = checkForOption(options, "node");
// if no specific option is selected, we generate everything
bool generateAll = !(generateProxies || generateInterfaces || generateNode);
if (checkForOption(options, "classname"))
{
// class name only useful for single interfaces or just node
if (interfaces.count() > 1 && (generateAll || generateInterfaces || generateProxies))
{
std::cerr << "dbusxml2qt3: class name option specified but "
<< "introspection data file '"
<< fileName.local8Bit().data()
<< "' contains more than one interface description"
<< std::endl;
exit(3);
}
// class name for node is handled differently later on
if (!generateNode)
{
TQStringList nameParts = TQStringList::split("::", options["classname"]);
interfaces[0].name = nameParts.back();
nameParts.pop_back();
interfaces[0].namespaces = nameParts;
}
}
if (checkForOption(options, "namespace"))
{
TQStringList nameParts = TQStringList::split("::", options["namespace"]);
TQValueList<Class>::iterator it = interfaces.begin();
TQValueList<Class>::iterator endIt = interfaces.end();
for (; it != endIt; ++it)
{
(*it).namespaces = nameParts;
}
}
if (generateInterfaces || generateAll)
{
TQTextStream headerStream;
TQTextStream sourceStream;
TQString baseName = options["interface"];
if (!baseName.isEmpty())
{
if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: proxy files, using base name '"
<< baseName.local8Bit().data()
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
}
TQValueList<Class>::const_iterator it = interfaces.begin();
TQValueList<Class>::const_iterator endIt = interfaces.end();
for (; it != endIt; ++it)
{
if (baseName.isEmpty())
{
if (!ClassGenerator::initStreams((*it).name.lower() + "interface",
headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: interface files, using base name '"
<< baseName.local8Bit().data()
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
}
ClassGenerator::generateInterface(*it, headerStream, sourceStream);
if (baseName.isEmpty())
{
ClassGenerator::finishStreams((*it).name.lower() + "interface",
headerStream, sourceStream);
}
}
if (!baseName.isEmpty())
ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
}
if (generateProxies || generateAll)
{
TQTextStream headerStream;
TQTextStream sourceStream;
TQString baseName = options["proxy"];
if (!baseName.isEmpty())
{
if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: proxy files, using base name '"
<< baseName.local8Bit().data()
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
}
TQValueList<Class>::const_iterator it = interfaces.begin();
TQValueList<Class>::const_iterator endIt = interfaces.end();
for (; it != endIt; ++it)
{
if (baseName.isEmpty())
{
if (!ClassGenerator::initStreams((*it).name.lower() + "proxy",
headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: proxy files, using base name '"
<< baseName.local8Bit().data()
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
}
ClassGenerator::generateProxy(*it, headerStream, sourceStream);
if (baseName.isEmpty())
{
ClassGenerator::finishStreams((*it).name.lower() + "proxy",
headerStream, sourceStream);
}
}
if (!baseName.isEmpty())
ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
}
if (generateNode || generateAll)
{
if (!hasIntrospectable)
{
qDebug("Generating org.freedesktop.DBus.Introspectable on demand");
Class classData;
classData.name = "Introspectable";
classData.dbusName = "org.freedesktop.DBus.Introspectable";
classData.namespaces << "org" << "freedesktop" << "DBus";
Method method;
method.name = "Introspect";
method.noReply = false;
method.async = false;
Argument argument;
argument.name = "data";
argument.direction = Argument::Out;
argument.signature = "TQString";
argument.accessor = "String";
argument.isPrimitive = false;
argument.dbusSignature = "s";
argument.forwardDeclarations << "class TQString";
argument.sourceIncludes["TQt"].append("<tqstring.h>");
method.arguments << argument;
classData.methods << method;
TQTextStream headerStream;
TQTextStream sourceStream;
if (!ClassGenerator::initStreams(classData.name.lower() + "interface",
headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: interface files, using base name '"
<< classData.name.lower().local8Bit().data() << "interface"
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
ClassGenerator::generateInterface(classData,
headerStream, sourceStream);
ClassGenerator::finishStreams(classData.name.lower() + "interface",
headerStream, sourceStream);
}
TQString nodeClassName = options["classname"];
if (nodeClassName.isEmpty())
{
nodeClassName = rootElement.attribute("name");
if (nodeClassName.startsWith("/")) nodeClassName = nodeClassName.mid(1);
if (nodeClassName.isEmpty())
{
std::cerr << "dbusxml2qt3: cannot generate node without class name."
<< std::endl;
exit(3);
}
nodeClassName.tqreplace('/', "_");
}
TQStringList nameParts = TQStringList::split("::", nodeClassName);
Class classData;
classData.name = nameParts.back();
nameParts.pop_back();
classData.namespaces = nameParts;
if (checkForOption(options, "namespace"))
{
nameParts = TQStringList::split("::", options["namespace"]);
classData.namespaces = nameParts;
}
TQTextStream headerStream;
TQTextStream sourceStream;
TQString baseName = options["node"];
if (baseName.isEmpty()) baseName = classData.name.lower() + "node";
if (!ClassGenerator::initStreams(baseName, headerStream, sourceStream))
{
std::cerr << "dbusxml2qt3: interface files, using base name '"
<< baseName.local8Bit().data()
<< "', could not be opened for writing"
<< std::endl;
exit(4);
}
ClassGenerator::generateNode(classData, interfaces,
headerStream, sourceStream);
ClassGenerator::finishStreams(baseName, headerStream, sourceStream);
}
return 0;
}
void usage()
{
std::cout << "usage: dbusxml2qt3 [options] <introspectionfile>" << std::endl;
std::cout << std::endl;
std::cout << "Options:" << std::endl;
std::cout << "-h, --help" << std::endl;
std::cout << "\tDisplay this help" << std::endl;
std::cout << std::endl;
std::cout << "-c <classname>, --class <classname>" << std::endl;
std::cout << "\tUse 'classname' instead of last string in interface name"
<< std::endl;
std::cout << std::endl;
std::cout << "-N [namespace], --namespace [namespace]" << std::endl;
std::cout << "\tOverride namespaces. If provided, use 'namespace' instead, otherwise ignore namespaces"
<< std::endl;
std::cout << std::endl;
std::cout << "-i [basename], --interface [basename]" << std::endl;
std::cout << "\tGenerate interface files. If provided, use 'basename' for filenames"
<< std::endl;
std::cout << std::endl;
std::cout << "-p [basename], --proxy [basename]" << std::endl;
std::cout << "\tGenerate proxy files. If provided, use 'basename' for filenames"
<< std::endl;
std::cout << std::endl;
std::cout << "-n [basename], --node [basename]" << std::endl;
std::cout << "\tGenerate node files. If provided, use 'basename' for filenames"
<< std::endl;
std::cout << std::endl;
std::cout << "Examples:" << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml" << std::endl;
std::cout << "\tGenerates as much as possible, i.e. interfaces, proxies and, "
<< "if a node name is specified in 'myinterface.xml', the node files"
<< std::endl;
std::cout << "\tUses lowercased interface names as plus type specific suffix "
<< "for the file names" << std::endl;
std::cout << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml -N" << std::endl;
std::cout << "\tSame as first example but does not use namespaces"
<< std::endl;
std::cout << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml -N org::myorg" << std::endl;
std::cout << "\tSame as first example but overrides namespaces with 'org::myorg'"
<< std::endl;
std::cout << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml -n mynode -c MyNode" << std::endl;
std::cout << "\tGenerate only node files, use 'mynode' as the file basename "
<< "and classname 'MyClass'"
<< std::endl;
std::cout << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml -p" << std::endl;
std::cout << "\tGenerate only proxy files, use default file basename"
<< std::endl;
std::cout << std::endl;
std::cout << "dbusxml2qt3 myinterface.xml -p myproxy" << std::endl;
std::cout << "\tGenerate only proxy files, use 'myproxy' as the file basename"
<< std::endl;
std::cout << std::endl;
}
bool testAndSetOption(OptionMap& options, const TQString& option, const TQString& value)
{
OptionMap::iterator it = options.tqfind(option);
if (it == options.end())
{
options.insert(option, value);
return true;
}
return false;
}
OptionMap parseOptions(int argc, char** argv)
{
TQStringList args;
for (int i = 1; i < argc; ++i)
{
args << TQString::fromLocal8Bit(argv[i]);
}
OptionMap options;
while (!args.isEmpty())
{
TQString arg = args.front();
args.pop_front();
if (arg.startsWith("-"))
{
if (arg.endsWith("help"))
{
usage();
exit(0);
}
else if (arg == "-p" || arg == "--proxy")
{
// test for optional argument
TQString value;
if (!args.isEmpty() > 0 && !args[0].startsWith("-"))
{
value = args.front();
args.pop_front();
}
if (!testAndSetOption(options, "proxy", value))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data() << "'";
if (!value.isEmpty())
std::cerr << ", value '" << value.local8Bit().data() << "':";
else
std::cerr << ":";
std::cerr << " already set to '"
<< options["proxy"].local8Bit().data() << std::endl;
}
}
else if (arg == "-i" || arg == "--interface")
{
// test for optional argument
TQString value;
if (!args.isEmpty() > 0 && !args[0].startsWith("-"))
{
value = args.front();
args.pop_front();
}
if (!testAndSetOption(options, "interface", value))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data() << "'";
if (!value.isEmpty())
std::cerr << ", value '" << value.local8Bit().data() << "':";
else
std::cerr << ":";
std::cerr << " already set to '"
<< options["interface"].local8Bit().data() << std::endl;
}
}
else if (arg == "-n" || arg == "--node")
{
// test for optional argument
TQString value;
if (!args.isEmpty() > 0 && !args[0].startsWith("-"))
{
value = args.front();
args.pop_front();
}
if (!testAndSetOption(options, "node", value))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data() << "'";
if (!value.isEmpty())
std::cerr << ", value '" << value.local8Bit().data() << "':";
else
std::cerr << ":";
std::cerr << " already set to '"
<< options["node"].local8Bit().data() << std::endl;
}
}
else if (arg == "-N" || arg == "--namespace")
{
// test for optional argument
TQString value;
if (!args.isEmpty() > 0 && !args[0].startsWith("-"))
{
value = args.front();
args.pop_front();
}
if (!testAndSetOption(options, "namespace", value))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data() << "'";
if (!value.isEmpty())
std::cerr << ", value '" << value.local8Bit().data() << "':";
else
std::cerr << ":";
std::cerr << " already set to '"
<< options["namespace"].local8Bit().data() << std::endl;
}
}
else if (arg == "-c" || arg == "--class")
{
// test for mandatory argument
if (args.isEmpty() || args[0].startsWith("-"))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data()
<< "': mandatory parameter missing" << std::endl;
usage();
exit(1);
}
TQString value = args.front();
args.pop_front();
if (!testAndSetOption(options, "classname", value))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data() << "'";
if (!value.isEmpty())
std::cerr << ", value '" << value.local8Bit().data() << "':";
else
std::cerr << ":";
std::cerr << " already set to '"
<< options["classname"].local8Bit().data() << std::endl;
}
}
else
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data()
<< "': unknown option" << std::endl;
usage();
exit(1);
}
}
else
{
if (!testAndSetOption(options, "filename", arg))
{
std::cerr << "Error while parsing command line argument '"
<< arg.local8Bit().data()
<< "': introspection file already given as '"
<< options["filename"].local8Bit().data() << std::endl;
usage();
exit(1);
}
}
}
return options;
}
// End of File

File diff suppressed because it is too large Load Diff

@ -0,0 +1,153 @@
/*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#if !defined(METHODGEN_H_INCLUDED)
#define METHODGEN_H_INCLUDED
// TQt includes
#include <tqmap.h>
#include <tqstringlist.h>
// forward declarations
class TQTextStream;
class Argument
{
public:
enum Direction
{
In,
Out
};
TQString name;
TQString annotatedType;
TQString signature;
TQString accessor;
TQString subAccessor;
TQString containerClass;
Direction direction;
bool isPrimitive;
TQStringList forwardDeclarations;
TQMap<TQString, TQStringList> headerIncludes;
TQMap<TQString, TQStringList> sourceIncludes;
TQString dbusSignature;
};
class Method
{
public:
TQString name;
TQValueList<Argument> arguments;
bool noReply;
bool async;
};
class Property : public Argument
{
public:
bool read;
bool write;
};
class Class
{
public:
enum Role
{
Interface,
Proxy,
Node
};
TQString name;
TQString dbusName;
TQStringList namespaces;
TQValueList<Method> methods;
TQValueList<Method> msignals;
TQValueList<Property> properties;
TQValueList<Method> asyncMethods;
TQValueList<Method> asyncReplySignals;
TQValueList<Method> asyncReplyMethods;
};
class MethodGenerator
{
public:
static bool extractMethods(const TQDomElement& interfaceElement,
Class& classData);
static void writeMethodDeclaration(const Method& method, bool pureVirtual,
bool withError, TQTextStream& stream);
static void writePropertyDeclaration(const Property& property, bool pureVirtual,
TQTextStream& stream);
static void writeMethodCallDeclaration(const Method& method,
TQTextStream& stream);
static void writeMethodCall(const Class& classData, const Method& method,
TQTextStream& stream);
static void writeSignalEmitter(const Class& classData, const Method& method,
TQTextStream& stream);
static void writeInterfaceAsyncReplyHandler(const Class& classData,
const Method& method,
TQTextStream& stream);
static void writeInterfaceMainMethod(const Class& classData,
TQTextStream& stream);
static void writeSignalHandler(const Class& classData, TQTextStream& stream);
static void writeProxyBegin(const Class& classData, TQTextStream& stream);
static void writeProxyMethod(const TQString& className, const Method& method,
TQTextStream& stream);
static void writeProxyGenericProperty(const Class& classData,
TQTextStream& stream);
static void writeProxyProperty(const Class& classData, const Property& property,
TQTextStream& stream);
static void writeProxyAsyncReplyHandler(const Class& classData,
TQTextStream& stream);
static void writeIntrospectionDataMethod(const Class& classData,
TQTextStream& stream);
static void writeNodePrivate(const Class& classData, TQTextStream& stream);
static void writeNodeBegin(const Class& classData, TQTextStream& stream);
static void writeNodeMethods(const Class& classData,
const TQValueList<Class>& interfaces, TQTextStream& stream);
};
#endif
// End of File

@ -0,0 +1,40 @@
/* qdbusatomic.h Dummy reference counter
*
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef ATOMIC_H
#define ATOMIC_H
class Atomic
{
public:
Atomic(int value);
void ref();
bool deref();
private:
int m_value;
};
#endif

@ -0,0 +1,396 @@
/* qdbusconnection.cpp
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include <tqapplication.h>
#include "tqdbusconnection.h"
#include "tqdbuserror.h"
#include "tqdbusmessage.h"
#include "tqdbusconnection_p.h"
QT_STATIC_CONST_IMPL char *TQT_DBusConnection::default_connection_name = "qt_dbus_default_connection";
class TQT_DBusConnectionManager
{
public:
TQT_DBusConnectionManager(): default_connection(0) {}
~TQT_DBusConnectionManager();
void bindToApplication();
TQT_DBusConnectionPrivate *connection(const TQString &name) const;
void removeConnection(const TQString &name);
void setConnection(const TQString &name, TQT_DBusConnectionPrivate *c);
static TQT_DBusConnectionManager* instance() {
if (managerInstance == 0) managerInstance = new TQT_DBusConnectionManager();
return managerInstance;
}
private:
TQT_DBusConnectionPrivate *default_connection;
// FIXME-QT4 TQHash<TQString, TQT_DBusConnectionPrivate *> connectionHash;
typedef TQMap<TQString, TQT_DBusConnectionPrivate*> ConnectionHash;
ConnectionHash connectionHash;
static TQT_DBusConnectionManager* managerInstance;
};
// FIXME-QT4 TQ_GLOBAL_STATIC(TQT_DBusConnectionManager, manager);
TQT_DBusConnectionManager* TQT_DBusConnectionManager::managerInstance = 0;
TQT_DBusConnectionManager* manager() {
return TQT_DBusConnectionManager::instance();
}
TQT_DBusConnectionPrivate *TQT_DBusConnectionManager::connection(const TQString &name) const
{
if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name))
return default_connection;
ConnectionHash::const_iterator it = connectionHash.tqfind(name);
return (it != connectionHash.end() ? it.data() : 0);
}
void TQT_DBusConnectionManager::removeConnection(const TQString &name)
{
TQT_DBusConnectionPrivate *d = 0;
if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name)) {
d = default_connection;
default_connection = 0;
} else {
ConnectionHash::iterator it = connectionHash.tqfind(name);
if (it == connectionHash.end())
return;
d = it.data();
connectionHash.erase(it);
}
if (!d->ref.deref())
delete d;
}
TQT_DBusConnectionManager::~TQT_DBusConnectionManager()
{
if (default_connection) {
delete default_connection;
default_connection = 0;
}
/* FIXME-QT4
for (TQHash<TQString, TQT_DBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it) {
delete it.value();
}*/
for (ConnectionHash::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it)
{
delete it.data();
}
connectionHash.clear();
}
void TQT_DBusConnectionManager::bindToApplication()
{
if (default_connection) {
default_connection->bindToApplication();
}
/* FIXME-QT4
for (TQHash<TQString, TQT_DBusConnectionPrivate *>::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it) {
(*it)->bindToApplication();
}*/
for (ConnectionHash::const_iterator it = connectionHash.constBegin();
it != connectionHash.constEnd(); ++it)
{
it.data()->bindToApplication();
}
}
void qDBusBindToApplication()
{
manager()->bindToApplication();
}
void TQT_DBusConnectionManager::setConnection(const TQString &name, TQT_DBusConnectionPrivate *c)
{
if (name == TQString::tqfromLatin1(TQT_DBusConnection::default_connection_name))
default_connection = c;
else
connectionHash[name] = c;
}
TQT_DBusConnection::TQT_DBusConnection() : d(0)
{
}
TQT_DBusConnection::TQT_DBusConnection(const TQString &name)
{
d = manager()->connection(name);
if (d)
d->ref.ref();
}
TQT_DBusConnection::TQT_DBusConnection(const TQT_DBusConnection &other)
{
d = other.d;
if (d)
d->ref.ref();
}
TQT_DBusConnection::~TQT_DBusConnection()
{
if (d && !d->ref.deref())
delete d;
}
TQT_DBusConnection &TQT_DBusConnection::operator=(const TQT_DBusConnection &other)
{
if (other.d)
other.d->ref.ref();
/* FIXME-QT4
TQT_DBusConnectionPrivate *old = static_cast<TQT_DBusConnectionPrivate *>(
q_atomic_set_ptr(&d, other.d));*/
TQT_DBusConnectionPrivate* old = d;
d = other.d;
if (old && !old->ref.deref())
delete old;
return *this;
}
TQT_DBusConnection TQT_DBusConnection::sessionBus()
{
return addConnection(TQT_DBusConnection::SessionBus);
}
TQT_DBusConnection TQT_DBusConnection::systemBus()
{
return addConnection(TQT_DBusConnection::SystemBus);
}
TQT_DBusConnection TQT_DBusConnection::addConnection(BusType type, const TQString &name)
{
// Q_ASSERT_X(TQCoreApplication::instance(), "TQT_DBusConnection::addConnection",
// "Cannot create connection without a Q[Core]Application instance");
TQT_DBusConnectionPrivate *d = manager()->connection(name);
if (d)
return TQT_DBusConnection(name);
d = new TQT_DBusConnectionPrivate;
DBusConnection *c = 0;
switch (type) {
case SystemBus:
c = dbus_bus_get(DBUS_BUS_SYSTEM, &d->error);
break;
case SessionBus:
c = dbus_bus_get(DBUS_BUS_SESSION, &d->error);
break;
case ActivationBus:
c = dbus_bus_get(DBUS_BUS_STARTER, &d->error);
break;
}
d->setConnection(c); //setConnection does the error handling for us
manager()->setConnection(name, d);
return TQT_DBusConnection(name);
}
TQT_DBusConnection TQT_DBusConnection::addConnection(const TQString &address,
const TQString &name)
{
// Q_ASSERT_X(TQCoreApplication::instance(), "TQT_DBusConnection::addConnection",
// "Cannot create connection without a Q[Core]Application instance");
TQT_DBusConnectionPrivate *d = manager()->connection(name);
if (d)
return TQT_DBusConnection(name);
d = new TQT_DBusConnectionPrivate;
// setConnection does the error handling for us
d->setConnection(dbus_connection_open(address.utf8().data(), &d->error));
manager()->setConnection(name, d);
return TQT_DBusConnection(name);
}
void TQT_DBusConnection::closeConnection(const TQString &name)
{
manager()->removeConnection(name);
}
void TQT_DBusConnectionPrivate::timerEvent(TQTimerEvent *e)
{
DBusTimeout *timeout = timeouts[e->timerId()];
dbus_timeout_handle(timeout);
}
bool TQT_DBusConnection::send(const TQT_DBusMessage &message) const
{
if (!d || !d->connection)
return false;
DBusMessage *msg = message.toDBusMessage();
if (!msg)
return false;
bool isOk = dbus_connection_send(d->connection, msg, 0);
dbus_message_unref(msg);
return isOk;
}
int TQT_DBusConnection::sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver,
const char *method) const
{
if (!d || !d->connection)
return 0;
return d->sendWithReplyAsync(message, receiver, method);
}
TQT_DBusMessage TQT_DBusConnection::sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error) const
{
if (!d || !d->connection)
return TQT_DBusMessage::fromDBusMessage(0);
DBusMessage *msg = message.toDBusMessage();
if (!msg)
return TQT_DBusMessage::fromDBusMessage(0);
DBusMessage *reply = dbus_connection_send_with_reply_and_block(d->connection, msg,
-1, &d->error);
if (d->handleError() && error)
*error = d->lastError;
dbus_message_unref(msg);
return TQT_DBusMessage::fromDBusMessage(reply);
}
void TQT_DBusConnection::flush() const
{
if (!d || !d->connection) return;
d->flush();
}
void TQT_DBusConnection::dispatch() const
{
if (!d || !d->connection) return;
d->dispatch();
}
void TQT_DBusConnection::scheduleDispatch() const
{
if (!d || !d->connection) return;
d->scheduleDispatch();
}
bool TQT_DBusConnection::connect(TQObject* object, const char* slot)
{
if (!d || !d->connection || !object || !slot)
return false;
bool ok = object->connect(d, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)), slot);
return ok;
}
bool TQT_DBusConnection::disconnect(TQObject* object, const char* slot)
{
if (!d || !d->connection || !object || !slot)
return false;
bool ok = d->disconnect(object, slot);
return ok;
}
bool TQT_DBusConnection::registerObject(const TQString& path, TQT_DBusObjectBase* object)
{
if (!d || !d->connection || !object || path.isEmpty())
return false;
TQT_DBusConnectionPrivate::ObjectMap::const_iterator it = d->registeredObjects.tqfind(path);
if (it != d->registeredObjects.end())
return false;
d->registeredObjects.insert(path, object);
return true;
}
void TQT_DBusConnection::unregisterObject(const TQString &path)
{
if (!d || !d->connection || path.isEmpty())
return;
TQT_DBusConnectionPrivate::ObjectMap::iterator it = d->registeredObjects.tqfind(path);
if (it == d->registeredObjects.end())
return ;
d->registeredObjects.erase(it);
}
bool TQT_DBusConnection::isConnected( ) const
{
return d && d->connection && dbus_connection_get_is_connected(d->connection);
}
TQT_DBusError TQT_DBusConnection::lastError() const
{
return d ? d->lastError : TQT_DBusError();
}
TQString TQT_DBusConnection::uniqueName() const
{
return d && d->connection ?
TQString::fromUtf8(dbus_bus_get_unique_name(d->connection))
: TQString();
}
bool TQT_DBusConnection::requestName(const TQString &name, int modeFlags)
{
Q_ASSERT(modeFlags >= 0);
if (!d || !d->connection)
return false;
if (modeFlags < 0)
return false;
int dbusFlags = 0;
if (modeFlags & AllowReplace)
dbusFlags |= DBUS_NAME_FLAG_ALLOW_REPLACEMENT;
if (modeFlags & ReplaceExisting)
dbusFlags |= DBUS_NAME_FLAG_REPLACE_EXISTING;
dbus_bus_request_name(d->connection, name.utf8(), dbusFlags, &d->error);
return !d->handleError();
}
#include "tqdbusconnection.moc"

@ -0,0 +1,662 @@
/* qdbusconnection.h TQT_DBusConnection object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSCONNECTION_H
#define TQDBUSCONNECTION_H
/**
* @mainpage TQt3 Bindings for D-Bus
*
* D-Bus is an IPC (inter process communication) technology designed to allow
* applications to interoperate without requiring tight coupling.
*
* For more information about D-Bus itself see its website:
* http://www.freedesktop.org/wiki/Software_2fdbus
*
* The TQt3 D-Bus bindings described here are a TQt3 style API around the base
* implementation to enable TQt3 developers to use D-Bus in their applications
* without requiring them to know about the details of the C based D-Bus API.
*
* The two main use cases are:
* - using the API to access service implemented in other applications.
* See section @ref dbusclient for an introduction on this
*
* - using the API to provide access to services implemented in your application
* See section @ref dbusservice for an introduction on this
*
* Of course an application can do both at the same time.
*/
/**
* @page dbusconventions Naming and syntax conventions in D-Bus
*
* @section dbusconventions-servicename Service names
*
* The service name is D-Bus application identifier, i.e. either
* the unique name handed out to the peer application by the bus on connect
* (see TQT_DBusConnection::uniqueName()) or, more likely, a well known name the
* peer application has requested, see TQT_DBusConnection::requestName()
*
* Such well known names have the form of word separated by dots, like
* Internet domain names but in reverse order.
*
* For example the name for the bus itself (the D-Bus daemon) would be
* @code
* "org.freedesktop.DBus"
* @endcode
*
* @section dbusconventions-objectpath Object paths
*
* The object path is like an address within the peer host application.
* The path format looks like a Unix file path, i.e. words separated by
* slash @c '/' characters.
*
* For example the path for the bus itself (the D-Bus daemon's main object)
* would be
* @code
* "/org/freedesktop/DBus"
* @endcode
*
* @section dbusconventions-interfacename Interface names
*
* The interface name specifies which group of methods and signals
* implemented by the peer service object is used in proxy operations.
*
* Interface names have the form of word separated by dots, like Internet
* domain names but in reverse order or like a fully qualified Java class name.
*
* For example the interface for the bus itself (the D-Bus daemon's main
* interface) would be
* @code
* "org.freedesktop.DBus"
* @endcode
*
* @section dbusconventions-errorname Error names
*
* A D-Bus error name is a sequence of words separated by dots, similar
* to D-Bus service names or interface names, or like a fully qualified
* Java class name.
*
* For example if a D-Bus service does not handle a method invocation sent
* to it because it doesn't know about the method it will return a D-Bus
* error named
* @code
* "org.freedesktop.DBus.Error.UnknownMethod"
* @endcode
* TQT_DBusError can create some of the more common errors based on a type value
* and decode their names into the type respectively. See TQT_DBusError#ErrorType
*
* @section dbusconventions-membername Method and signal names
*
* There is no mandatory convention for member names, neither for methods nor
* for signals.
*
* However, using the standard interfaces of D-Bus as a hint, it is recommended
* to use "camel case" names starting with an uppercase letter, for example
* @code
* "GetConnectionUnixUser"
* @endcode
*/
#include "tqdbusmacros.h"
#include <tqstring.h>
class TQT_DBusConnectionPrivate;
class TQT_DBusError;
class TQT_DBusMessage;
class TQT_DBusObjectBase;
class TQObject;
/**
* @brief Provides access to a specific D-Bus bus
*
* In order to access a D-Bus message bus an application has to connect to it.
* This is very similar to connecting to an FTP server using TQFtp, where any
* number of commands can be sent in sequence over the same connection.
*
* Additionally to the asynchronous command execution provided by TQFtp a
* TQT_DBusConnection can also execute synchronous (blocking) calls so the
* code around those calls stays closer to in-process method incovations.
*
* However it is recommended to only perform blocking calls on D-Bus service
* methods that are likely to be processed fast.
*
* TQT_DBusConnection implements a shared resource, i.e. if you create a
* connection with a specific name in one part of your code and then
* create one with the same name somewhere else, the second creation will
* actually return the same shared connection object the first caller created.
*
* The application can be connected to more than one message bus simultaniously
* using one or more connections per bus, however the most common case is to
* have one connection per bus.
*
* The two main bus types are:
* - System bus: a bus connecting applications on one system across user
* or session boundaries, for example allowing to communicate
* with system services like printer spoolers, etc
*
* - Session bus: a bus connecting applications within one user session, for
* example started at login or by a session manager. Use cases
* or this kind of bus would be accessing user specific
* resources like addressbooks, retrieving user settings or
* controlling session services (e.g. disabling screensaver
* in a video player application during playback)
*
* While TQT_DBusConnection provides the basic API to access D-Bus services
* it is more convenient to use TQT_DBusProxy on top of the connection.
*
* See sections @ref dbusclient and @ref dbusservice for examples
*/
class TQDBUS_EXPORT TQT_DBusConnection
{
public:
/**
* DBus bus types
*/
enum BusType
{
/**
* The session bus is a user and user session specific message
* channel. It will usually be started by a login script or a
* session manager.
*/
SessionBus,
/**
* The system bus is a message channel bridging user level and
* system level process boundaries, e.g. it can allow a user process
* with normal user access restrictions to perform a limited subset
* of operations on a process running with elevated rights.
*
* @warning if an applications exposed services on the system bus, i.e.
* registers objects using registerObject(), it should be
* carefully examined on potential security issues
*/
SystemBus,
// TODO tqfind out about ActivationBus purpose
ActivationBus
};
/**
* @brief Creates an empty/disconnected connection handle
*
* This is mainly used for initializing variables of this type, i.e. like
* the default TQString constructor.
*
* A variable set to such an empty connection can be assigned a working
* connection at any time.
*/
TQT_DBusConnection();
/**
* @brief Creates a connection handle to a named connection
*
* This will result in an disconnected connection handle if no
* connection with that name has been created by addConnection before.
*
* Therefore it is recommended to use addConnection() instead to get a
* connection handle.
*
* @param name identifier of the shared connection object
*/
TQT_DBusConnection(const TQString &name);
/**
* @brief Creates a shallow copy of the given connection
*
* Allows to pass connection handles around by value, similar to TQString
* thus avoiding problems like dangling pointers in application code
*
* @param other the connection to copy from
*/
TQT_DBusConnection(const TQT_DBusConnection &other);
/**
* @brief Destroys the connection handle
*
* If this handle is the last one referencing the shared connection object
* it will delete it, disconnecting it from any objects it was
* collaborating with
*/
~TQT_DBusConnection();
/**
* @brief Creates a shallow copy of the given connection
*
* Allows to pass connection handles around by value, similar to TQString
* thus avoiding problems like dangling pointers in application code
*
* @param other the connection to copy from
*
* @return a reference to this instance as required by assigment operator
* semantics
*/
TQT_DBusConnection &operator=(const TQT_DBusConnection &other);
/**
* @brief Returns whether the connection is connected to a bus
*
* @return @c true if the connection can be used, @c false if the handle
* does not have access to a shared connection object or if the
* connection to the bus could not be established or broke
*/
bool isConnected() const;
/**
* @brief Returns the last error seen by the connection
*
* This can be a connection error, e.g. attempt to connect failed, or a
* transmission error or an error reported by a method call
*
* @return the last error seen by the connection
*/
TQT_DBusError lastError() const;
/**
* @brief Flags for controlling the behavior name collision handling
*
* @see requestName()
*/
enum NameRequestMode
{
/**
* Do not allow others to take over a name requested by this
* application
*/
NoReplace = 0,
/**
* Allow other applications that request the same name to get it,
* i.e. allow the bus to transfer the name from this application
* to the one requesting it
*/
AllowReplace = 1,
/**
* Try to get the name transferred from the current owner to this
* application. This will only work if the other application as
* requested the name using the AllowReplace flag
*/
ReplaceExisting = 2
};
/**
* @brief Requests to be addressable on the bus by a given name
*
* Each connection to a bus gets a unique name once the connection is
* established. This is similar to getting an IP address when connecting
* to the Internet.
*
* If an application's purpose is to provide services to other applications
* the other applications require to know how to address the service
* provider. Similar to a domain name on the Internet D-Bus allows to
* register names on the bus and be addressed through those names instead
* of the connection identifier.
*
* @note this is not required if the application only needs to acccess
* services or only implements generic service APIs
*
* If more than one application request the same name, D-Bus will try
* to resolve this conflict as good as possible.
* The #NameRequestMode flags allow to control how an application prefers
* to be treated in such a conflict.
*
* @param name the name the connection should be addressable with. See
* section @ref dbusconventions-servicename
* @param modeFlags an OR'ed combination of #NameRequestMode flags
*
* @return @c true if the name request was successfull, @c false if
* the connection is not connected to a bus or the name is already
* taken and cannot be tranferred
*
* @see uniqueName()
*/
bool requestName(const TQString &name, int modeFlags = NoReplace);
/**
* @brief Returns the connection identifier assigned at connect
*
* The unique name is the connection address or identifier the bus assigned
* to this connection when it got established.
*
* @return the connection's unique bus identifier
*
* @see requestName()
*/
TQString uniqueName() const;
/**
* @brief Sends a message over the bus
*
* Sends a message composed through the TQT_DBusMessage API to the bus.
* This is the main method for service objects (see TQT_DBusObjectBase) to
* send replies and errors for method calls they accepted or for sending
* D-Bus signals.
*
* @note for doing method calls it is more convenient to use TQT_DBusProxy,
* see TQT_DBusProxy::send()
*
* @param message the message to send
*
* @return @c true if sending succeeded, @c false if the connection is not
* connected, if the message lacks information about the recepient
* or if sending fails a at a lower level in the communication
* stack
*
* @see lastError()
*/
bool send(const TQT_DBusMessage &message) const;
/**
* @brief Sends a message over the bus and waits for the reply
*
* Sends a message composed through the TQT_DBusMessage API to the bus.
* It then blocks and waits until the associated reply is received.
* Any message received in between is stored and can be processed
* by calling dispatch() or scheduleDispatch()
*
* @note for doing method calls it is more convenient to use TQT_DBusProxy,
* see TQT_DBusProxy::sendWithReply()
*
* @param message the message to send
* @param error an optional parameter to directly get any error that might
* occur during processing of the call
*
* @return a message containing either the call's reply or an invalid
* message in case the call failed
*
* @see lastError()
*/
TQT_DBusMessage sendWithReply(const TQT_DBusMessage &message, TQT_DBusError *error = 0) const;
/**
* @brief Sends a message over the bus, specifying a receiver object for
* replies
*
* Sends a message composed through the TQT_DBusMessage API to the bus and
* returns an identifier number to associate with the reply once it is
* received by the given receiver.
* See TQT_DBusMessage::replySerialNumber()
*
* The required slot signature is
* @code
* void slotname(const TQT_DBusMessage&);
* @endcode
*
* @note for doing method calls it is more convenient to use TQT_DBusProxy,
* see TQT_DBusProxy::sendWithAsyncReply()
*
* @param message the message to send
* @param receiver the TQObject to relay the reply to
* @param slot the slot to invoke for the reply
*
* @return a numeric identifier for association with the reply or @c 0 if
* sending failed
*
* @see lastError()
*/
int sendWithAsyncReply(const TQT_DBusMessage &message, TQObject *receiver,
const char *slot) const;
/**
* @brief Flushes buffered outgoing message
*
* Attempts to send all enqueued outgoing messages before returning.
*/
void flush() const;
/**
* @brief Processes buffered inbound messages
*
* Attempts to process all enqueued inbound messages, e.g. replies to
* method calls or received signals.
*
* @warning dispatching message can result in TQt signals being emitted
* before this method returns. In case you just want to make sure
* no inbound message is forgotten, call scheduleDispatch() which
* will execute the dispatch delayed through the event loop.
*/
void dispatch() const;
/**
* @brief Request a delayed check for inbound buffer processing
*
* Similar to dispatch() but delayed by a single shot timer to ensure
* the method has returned before the processing is started.
*
* If a asynchronous method call is followed by a synchronous call without
* returning to the event loop in between, a call to scheduleDispatch()
* ensures that a pending reply to the asynchronous call is processed
* as soon as possible
*/
void scheduleDispatch() const;
/**
* @brief Connects an object to receive D-Bus signals
*
* This provides a basic access to all D-Bus signals received on this
* connection.
* For every D-Bus signal processed by the connection object a TQt signal
* is emitted and thus delivered to all receiver objects connected
* through this method.
*
* The required slot signature is
* @code
* void slotname(const TQT_DBusMessage&);
* @endcode
*
* so a suitable receiver could look like this
* @code
* class DBusSignalReceiver : public TQObject
* {
* TQ_OBJECT
* public slots:
* void dbusSignal(const TQT_DBusMessage&);
* };
* @endcode
*
* and would be connected like this
* @code
* // assuming the following variables
* TQT_DBusConnection connection;
* DBusSignalReceiver* receiver;
*
* connection.connect(receiver, TQT_SLOT(dbusSignal(const TQT_DBusMessage&)));
* @endcode
*
* See TQT_DBusProxy::dbusSignal() for a more obvious way of connecting slots.
*
* @param object the receiver object
* @param slot the receiver slot (or signal for signal->signal connections)
*
* @return @c true if the connection was successfull, otherwise @c false
*
* @see disconnect()
*/
bool connect(TQObject* object, const char* slot);
/**
* @brief Disconnects a given receiver from the D-Bus signal handling
*
* @param object the receiver object to disconnect from
* @param slot the receiver slot (or signal for signal->signal connections)
*
* @return @c true if the disconnect was successfull, otherwise @c false
*
* @see connect()
*/
bool disconnect(TQObject* object, const char* slot);
/**
* @brief Registers a service object for a given path
*
* In order to receive method calls over the D-Bus connection the service
* objects path within its host application has to be registered with the
* connection. See section @ref dbusconventions-objectpath for details.
*
* Only one objects can be registered for a single object path, i.e.
* the path -> object mapping is unambiguous, similar to mapping of
* filesystem paths to files.
*
* If a service object offers more than one interface it is up to the
* service implementation if all are implemented in the object path to this
* method or if the passed object is just another demultiplexer which
* relays the message to the interface implementor.
*
* @param path the object path to register the object for
* @param object the service implementation object for that path
*
* @return @c true if the given object is now registered for the given path
* or @c false if path is empty, object is null or another object
* is already registered for this path
*
* @see unregisterObject()
*/
bool registerObject(const TQString& path, TQT_DBusObjectBase* object);
/**
* @brief Unregister a service object on a given path
*
* Removes any mapping of object path to service object previously
* registered by registerObject().
* See section @ref dbusconventions-objectpath for details.
*
* @warning always(!) unregister a service object before deleting it
*
* @param path the object path of the object to unregister
*
* @see registerObject()
*/
void unregisterObject(const TQString &path);
/**
* @brief Gets a connection to the session bus
*
* Convenience overload for creating the default shared connection to the
* D-Bus session bus.
*
* Equivalent to calling addConnection(SessionBus);
*
* @return a connection handle. Check isConnected() to tqfind out if the
* connection attempt has been successfull
*
* @see addConnection(BusType,const TQString&);
*/
static TQT_DBusConnection sessionBus();
/**
* @brief Gets a connection to the system bus
*
* Convenience overload for creating the default shared connection to the
* D-Bus system bus.
*
* Equivalent to calling addConnection(SystemBus);
*
* @return a connection handle. Check isConnected() to tqfind out if the
* connection attempt has been successfull
*
* @see addConnection(BusType,const TQString&);
*/
static TQT_DBusConnection systemBus();
/**
* @brief Add a connection to a bus with a specific bus type
*
* This is a factory method as it will create a connection for the given
* name if its not available yet, but return a previously created
* connection for that name if available.
*
* Depending on the #BusType the D-Bus library will connect to the address
* configured for that type, so this is the recommended way to create
* connection to D-Bus.
*
* @code
* // Associate the default connection name with a connection to the user's
* // session bus
* TQT_DBusConnection con = TQT_DBusConnection::addConnection(TQT_DBusConnection::SessionBus);
*
* // check if we are connected and which uniqueName we got
* if (con.isConnected())
* {
* qDebug("Connected to session bus. We got uniqueName %s",
* con.uniqueName().local8Bit().data());
* }
* @endcode
* For the common use cases see also sessionBus() and systemBus()
*
* @param type the #BusType of the bus to connect to
* @param name the name to use for TQT_DBusConnection's connection sharing
*
* @return a connection handle. Check isConnected() to tqfind out if the
* connection attempt has been successfull
*
* @see closeConnection()
*/
static TQT_DBusConnection addConnection(BusType type,
const TQString &name = default_connection_name);
/**
* @brief Add a connection to a bus at a specific address
*
* This is a factory method as it will create a connection for the given
* name if its not available yet, but return a previously created
* connection for that name if available.
*
* @note this requires to know the address of a D-Bus daemon to connect to
*
* @param address the address of the D-Bus daemon. Usually a Unix domain
* socket address
* @param name the name to use for TQT_DBusConnection's connection sharing
*
* @return a connection handle. Check isConnected() to tqfind out if the
* connection attempt has been successfull
*
* @see closeConnection()
*/
static TQT_DBusConnection addConnection(const TQString &address,
const TQString &name = default_connection_name);
// TODO check why this doesn't close the D-Bus connection
/**
* @brief Closes a connection with a given name
*
* Removes the name from the pool of shared connections, i.e. a call to
* addConnection() with the same name afterwards will create a new
* connection.
*
* @param name the connection name as used in addConnection()
*/
static void closeConnection(const TQString &name = default_connection_name);
/**
* String used as the default parameter for connection names
*/
QT_STATIC_CONST char *default_connection_name;
private:
TQT_DBusConnectionPrivate *d;
};
#endif

@ -0,0 +1,149 @@
/* qdbusconnection_p.h TQT_DBusConnection private object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
//
// W A R N I N G
// -------------
//
// This file is not part of the public API. This header file may
// change from version to version without notice, or even be
// removed.
//
// We mean it.
//
//
#ifndef TQDBUSCONNECTION_P_H
#define TQDBUSCONNECTION_P_H
#include <tqguardedptr.h>
#include <tqmap.h>
#include <tqobject.h>
#include <tqvaluelist.h>
#include <dbus/dbus.h>
#include "tqdbusatomic.h"
#include "tqdbuserror.h"
#include "tqdbusobject.h"
class TQT_DBusMessage;
class TQSocketNotifier;
class TQTimer;
class TQTimerEvent;
struct DBusConnection;
struct DBusServer;
class TQT_DBusConnectionPrivate: public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
TQT_DBusConnectionPrivate(TQObject *tqparent = 0);
~TQT_DBusConnectionPrivate();
void bindToApplication();
void setConnection(DBusConnection *connection);
void setServer(DBusServer *server);
void closeConnection();
void timerEvent(TQTimerEvent *e);
bool handleSignal(DBusMessage *msg);
bool handleObjectCall(DBusMessage *message);
bool handleError();
void emitPendingCallReply(const TQT_DBusMessage& message);
signals:
void dbusSignal(const TQT_DBusMessage& message);
void dbusPendingCallReply(const TQT_DBusMessage& message);
public slots:
void socketRead(int);
void socketWrite(int);
void objectDestroyed(TQObject* object);
void purgeRemovedWatches();
void scheduleDispatch();
void dispatch();
public:
DBusError error;
TQT_DBusError lastError;
enum ConnectionMode { InvalidMode, ServerMode, ClientMode };
// FIXME TQAtomic ref;
Atomic ref;
ConnectionMode mode;
DBusConnection *connection;
DBusServer *server;
TQTimer* dispatcher;
static int messageMetaType;
static int registerMessageMetaType();
int sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver,
const char *method);
void flush();
struct Watcher
{
Watcher(): watch(0), read(0), write(0) {}
DBusWatch *watch;
TQSocketNotifier *read;
TQSocketNotifier *write;
};
// FIXME typedef TQMultiHash<int, Watcher> WatcherHash;
typedef TQValueList<Watcher> WatcherList;
WatcherList removedWatches;
typedef TQMap<int, WatcherList> WatcherHash;
WatcherHash watchers;
// FIXME typedef TQHash<int, DBusTimeout *> TimeoutHash;
typedef TQMap<int, DBusTimeout*> TimeoutHash;
TimeoutHash timeouts;
typedef TQMap<TQString, TQT_DBusObjectBase*> ObjectMap;
ObjectMap registeredObjects;
TQValueList<DBusTimeout *> pendingTimeouts;
struct TQT_DBusPendingCall
{
TQGuardedPtr<TQObject> receiver;
TQCString method;
DBusPendingCall *pending;
};
typedef TQMap<DBusPendingCall*, TQT_DBusPendingCall*> PendingCallMap;
PendingCallMap pendingCalls;
};
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,143 @@
/* qdbusdataconverter.cpp TQT_DBusDataConverter template
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbusdataconverter.h"
#include "tqdbusdata.h"
#include <tqpoint.h>
#include <tqrect.h>
#include <tqsize.h>
#include <tqvaluelist.h>
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQRect>(const TQT_DBusData& dbusData, TQRect& typeData)
{
if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature;
TQValueList<TQT_DBusData> members = dbusData.toStruct();
if (members.count() != 4) return InvalidSignature;
TQ_INT32 values[4];
TQValueList<TQT_DBusData>::const_iterator it = members.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = members.end();
for (uint i = 0; it != endIt; ++it, ++i)
{
bool ok = false;
values[i] = (*it).toInt32(&ok);
if (!ok) return InvalidSignature;
}
typeData = TQRect(values[0], values[1], values[2], values[3]);
return Success;
}
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQRect>(const TQRect& typeData, TQT_DBusData& dbusData)
{
TQValueList<TQT_DBusData> members;
members << TQT_DBusData::fromInt32(typeData.x());
members << TQT_DBusData::fromInt32(typeData.y());
members << TQT_DBusData::fromInt32(typeData.width());
members << TQT_DBusData::fromInt32(typeData.height());
dbusData = TQT_DBusData::fromStruct(members);
return Success;
}
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQPoint>(const TQT_DBusData& dbusData, TQPoint& typeData)
{
if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature;
TQValueList<TQT_DBusData> members = dbusData.toStruct();
if (members.count() != 2) return InvalidSignature;
TQ_INT32 values[2];
TQValueList<TQT_DBusData>::const_iterator it = members.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = members.end();
for (uint i = 0; it != endIt; ++it, ++i)
{
bool ok = false;
values[i] = (*it).toInt32(&ok);
if (!ok) return InvalidSignature;
}
typeData = TQPoint(values[0], values[1]);
return Success;
}
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQPoint>(const TQPoint& typeData, TQT_DBusData& dbusData)
{
TQValueList<TQT_DBusData> members;
members << TQT_DBusData::fromInt32(typeData.x());
members << TQT_DBusData::fromInt32(typeData.y());
dbusData = TQT_DBusData::fromStruct(members);
return Success;
}
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertFromTQT_DBusData<TQSize>(const TQT_DBusData& dbusData, TQSize& typeData)
{
if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature;
TQValueList<TQT_DBusData> members = dbusData.toStruct();
if (members.count() != 2) return InvalidSignature;
TQ_INT32 values[2];
TQValueList<TQT_DBusData>::const_iterator it = members.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = members.end();
for (uint i = 0; it != endIt; ++it, ++i)
{
bool ok = false;
values[i] = (*it).toInt32(&ok);
if (!ok) return InvalidSignature;
}
typeData = TQSize(values[0], values[1]);
return Success;
}
template <>
TQT_DBusDataConverter::Result TQT_DBusDataConverter::convertToTQT_DBusData<TQSize>(const TQSize& typeData, TQT_DBusData& dbusData)
{
TQValueList<TQT_DBusData> members;
members << TQT_DBusData::fromInt32(typeData.width());
members << TQT_DBusData::fromInt32(typeData.height());
dbusData = TQT_DBusData::fromStruct(members);
return Success;
}

@ -0,0 +1,207 @@
/* qdbusdataconverter.h TQT_DBusDataConverter template
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSDATACONVERTER_H
#define TQDBUSDATACONVERTER_H
#include "tqdbusmacros.h"
class TQT_DBusData;
/**
* @brief Template based converter for getting complex data into or from TQT_DBusData objects
*
* Any data to transport over D-Bus, i.e. method/signal paramaters or properties, need
* to be converted into a TQT_DBusData instance.
*
* For complex types, e.g. structures or nested containers, this can be quite some code,
* and will likely be needed for more than one call.
* Therefore it is more convenient to implement the conversions once per complex type.
*
* Example: sending and recieving a TQRect over D-Bus.
* In D-Bus terminology a TQRect is a struct of four 32-bit signed integers. The code to do
* this manually looks like this:
* @code
* TQRect rect(0, 0, 100, 100);
*
* TQValueList<TQT_DBusData> structMembers;
* structMembers << TQT_DBusData::fromInt32(rect.x());
* structMembers << TQT_DBusData::fromInt32(rect.y());
* structMembers << TQT_DBusData::fromInt32(rect.wdth());
* structMembers << TQT_DBusData::fromInt32(rect.height());
*
* TQT_DBusData rectStruct = TQT_DBusData::fromStruct(structMembers);
* @endcode
* and reverse (without the error checking)
* @code
* TQT_DBusData dbusData; // assume we got this from a D-Bus call
*
* TQValueList<TQT_DBusData> structMembers = dbudData.toStruct();
*
* int x = structMembers[0].toInt32();
* int y = structMembers[1].toInt32();
* int w = structMembers[2].toInt32();
* int h = structMembers[3].toInt32();
*
* TQRect rect(x, y, w, h);
* @endcode
*
* Rather than implementing it in the method which performs the D-Bus call, basically the same
* code can be used as a spezialisation of the TQT_DBusDataConverter methods and then used like this:
* @code
* TQRect rect(0, 0, 100, 100);
* TQT_DBusData rectStruct;
*
* TQT_DBusDataConverter::convertToTQT_DBusData<TQRect>(rect, rectStruct);
* @endcode
* and
* @code
* TQRect rect;
* TQT_DBusData dbusData; // assume we got this from a D-Bus call
*
* TQT_DBusDataConverter::convertFromTQT_DBusData<TQRect>(dbusData, rect);
* @endcode
*
* @note The bindings library tqcontains the spezialisations for TQRect, TQPoint and TQSize.
*/
class TQDBUS_EXPORT TQT_DBusDataConverter
{
public:
/**
* @brief Conversion result values
*/
enum Result
{
/**
* Conversion successfull
*/
Success,
/**
* Conversion failed because the passed TQT_DBusData instance does not contain data
* of the needed signature, e.g. too few to too many members for a struct or wrong types.
*
* @see TQT_DBusError::stdInvalidSignature()
*/
InvalidSignature,
/**
* Conversion failed because the passed TQT_DBusData contained values which are not allowed,
* e.g. out of range for a numerical type used a an enum or flags.
*
* @see TQT_DBusError::stdInvalidArgs()
*/
InvalidArgument
};
/**
* @brief Conversion from a filled TQT_DBusData instance to a native type
*
* For example the implementation for TQPoint looks like this:
* @code
* template <>
* TQT_DBusDataConverter::Result
* TQT_DBusDataConverter::convertFromTQT_DBusData<TQPoint>(const TQT_DBusData& dbusData, TQPoint& typeData)
* {
* if (dbusData.type() != TQT_DBusData::Struct) return InvalidSignature;
*
* TQValueList<TQT_DBusData> members = dbusData.toStruct();
* if (members.count() != 2) return InvalidSignature;
*
* bool ok = false;
* int x = members[0].toInt32(&ok);
* if (!ok) return InvalidSignature;
*
* int y = members[1].toInt32(&ok);
* if (!ok) return InvalidSignature;
*
* typeData = TQPoint(x, y);
*
* return Success;
* }
* @endcode
*
* And then can be used like this:
* @code
* TQT_DBusMessage reply; // assume we got this as a D-Bus call reply
* TQPoint point;
*
* if (TQT_DBusDataConverter::convertFromTQT_DBusData(reply[0], point) != TQT_DBusDataConverter::Success)
* {
* // error handling
* }
* @endcode
*
* @param dbusData the binding's data instance to get the content from
* @param typeData the native type instance to put the content into
*
* @return the conversion result value
*/
template <class T>
static Result convertFromTQT_DBusData(const TQT_DBusData& dbusData, T& typeData);
/**
* @brief Conversion from a native type to a TQT_DBusData instance
*
* For example the implementation for TQPoint looks like this:
* @code
* template <>
* TQT_DBusDataConversion::Result
* TQT_DBusDataConversion::convertToTQT_DBusData<TQPoint>(const TQPoint& typeData, TQT_DBusData& dbusData)
* {
* TQValueList<TQT_DBusData> members;
* members << TQT_DBusData::fromInt32(typeData.x());
* members << TQT_DBusData::fromInt32(typeData.y());
*
* dbusData = TQT_DBusData::fromStruct(members);
*
* return Success;
* }
* @endcode
*
* And then can be used like this:
* @code
* TQPoint point(-10, 100);
* TQT_DBusMessage methodCall; // assume created by TQBusMessage::methodCall()
*
* TQT_DBusData dbusData;
* if (TQT_DBusDataConverter::convertToTQT_DBusData<TQPoint>(point, dbusData) != TQT_DBusDataConverter::Success)
* {
* // error handling
* }
* else
* {
* methodCall << dbusData;
* }
* @endcode
*
* @param typeData the native type instance to get the content from
* @param dbusData the binding's data instance to put the content into
*
* @return the conversion result value
*/
template <class T>
static Result convertToTQT_DBusData(const T& typeData, TQT_DBusData& dbusData);
};
#endif

@ -0,0 +1,748 @@
/* qdbusdatalist.cpp list of DBUS data transport type
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbusdatalist.h"
#include "tqdbusobjectpath.h"
#include "tqdbusvariant.h"
#include <tqstringlist.h>
class TQT_DBusDataList::Private
{
public:
Private() : type(TQT_DBusData::Invalid) {}
public:
TQT_DBusData::Type type;
TQT_DBusData containerItem;
TQValueList<TQT_DBusData> list;
};
TQT_DBusDataList::TQT_DBusDataList() : d(new Private())
{
}
TQT_DBusDataList::TQT_DBusDataList(TQT_DBusData::Type simpleItemType) : d(new Private())
{
d->type = simpleItemType;
}
TQT_DBusDataList::TQT_DBusDataList(const TQT_DBusData& containerItemType) : d(new Private())
{
d->type = containerItemType.type();
switch(d->type)
{
case TQT_DBusData::List: // fall through
case TQT_DBusData::Struct: // fall through
case TQT_DBusData::Map:
d->containerItem = containerItemType;
break;
default: // not a container
break;
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQT_DBusDataList& other) : d(new Private())
{
d->type = other.d->type;
d->list = other.d->list;
d->containerItem = other.d->containerItem;
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusData>& other) : d(new Private())
{
if (other.isEmpty()) return;
TQValueList<TQT_DBusData>::const_iterator it = other.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = other.end();
d->type = (*it).type();
TQCString elementSignature;
if (hasContainerItemType())
{
d->containerItem = other[0]; // would be nice to get an empty one
elementSignature = d->containerItem.buildDBusSignature();
}
for (++it; it != endIt; ++it)
{
if (d->type != (*it).type())
{
d->type = TQT_DBusData::Invalid;
d->containerItem = TQT_DBusData();
return;
}
else if (hasContainerItemType())
{
if ((*it).buildDBusSignature() != elementSignature)
{
d->type = TQT_DBusData::Invalid;
d->containerItem = TQT_DBusData();
return;
}
}
}
d->list = other;
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<bool>& other) : d(new Private())
{
d->type = TQT_DBusData::Bool;
if (other.isEmpty()) return;
TQValueList<bool>::const_iterator it = other.begin();
TQValueList<bool>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromBool(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT8>& other) : d(new Private())
{
d->type = TQT_DBusData::Byte;
if (other.isEmpty()) return;
TQValueList<TQ_UINT8>::const_iterator it = other.begin();
TQValueList<TQ_UINT8>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromByte(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT16>& other) : d(new Private())
{
d->type = TQT_DBusData::Int16;
if (other.isEmpty()) return;
TQValueList<TQ_INT16>::const_iterator it = other.begin();
TQValueList<TQ_INT16>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromInt16(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT16>& other) : d(new Private())
{
d->type = TQT_DBusData::UInt16;
if (other.isEmpty()) return;
TQValueList<TQ_UINT16>::const_iterator it = other.begin();
TQValueList<TQ_UINT16>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromUInt16(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT32>& other) : d(new Private())
{
d->type = TQT_DBusData::Int32;
if (other.isEmpty()) return;
TQValueList<TQ_INT32>::const_iterator it = other.begin();
TQValueList<TQ_INT32>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromInt32(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT32>& other) : d(new Private())
{
d->type = TQT_DBusData::UInt32;
if (other.isEmpty()) return;
TQValueList<TQ_UINT32>::const_iterator it = other.begin();
TQValueList<TQ_UINT32>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromUInt32(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_INT64>& other) : d(new Private())
{
d->type = TQT_DBusData::Int64;
if (other.isEmpty()) return;
TQValueList<TQ_INT64>::const_iterator it = other.begin();
TQValueList<TQ_INT64>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromInt64(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQ_UINT64>& other) : d(new Private())
{
d->type = TQT_DBusData::UInt64;
if (other.isEmpty()) return;
TQValueList<TQ_UINT64>::const_iterator it = other.begin();
TQValueList<TQ_UINT64>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromUInt64(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<double>& other) : d(new Private())
{
d->type = TQT_DBusData::Double;
if (other.isEmpty()) return;
TQValueList<double>::const_iterator it = other.begin();
TQValueList<double>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromDouble(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusVariant>& other)
: d(new Private())
{
d->type = TQT_DBusData::Variant;
if (other.isEmpty()) return;
TQValueList<TQT_DBusVariant>::const_iterator it = other.begin();
TQValueList<TQT_DBusVariant>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromVariant(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQStringList& other) : d(new Private())
{
d->type = TQT_DBusData::String;
if (other.isEmpty()) return;
TQStringList::const_iterator it = other.begin();
TQStringList::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromString(*it);
}
}
TQT_DBusDataList::TQT_DBusDataList(const TQValueList<TQT_DBusObjectPath>& other)
: d(new Private())
{
d->type = TQT_DBusData::ObjectPath;
if (other.isEmpty()) return;
TQValueList<TQT_DBusObjectPath>::const_iterator it = other.begin();
TQValueList<TQT_DBusObjectPath>::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromObjectPath(*it);
}
}
TQT_DBusDataList::~TQT_DBusDataList()
{
delete d;
}
TQT_DBusDataList& TQT_DBusDataList::operator=(const TQT_DBusDataList& other)
{
if (&other == this) return *this;
d->type = other.d->type;
d->list = other.d->list;
d->containerItem = other.d->containerItem;
return *this;
}
TQT_DBusDataList& TQT_DBusDataList::operator=(const TQValueList<TQT_DBusData>& other)
{
d->list.clear();
d->type = TQT_DBusData::Invalid;
d->containerItem = TQT_DBusData();
if (other.isEmpty()) return *this;
TQValueList<TQT_DBusData>::const_iterator it = other.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = other.end();
d->type = (*it).type();
TQCString elementSignature;
if (hasContainerItemType())
{
d->containerItem = other[0]; // would be nice to get an empty one
elementSignature = d->containerItem.buildDBusSignature();
}
for (++it; it != endIt; ++it)
{
if (d->type != (*it).type())
{
d->type = TQT_DBusData::Invalid;
d->containerItem = TQT_DBusData();
return *this;
}
else if (hasContainerItemType())
{
if ((*it).buildDBusSignature() != elementSignature)
{
d->type = TQT_DBusData::Invalid;
d->containerItem = TQT_DBusData();
return *this;
}
}
}
d->list = other;
return *this;
}
TQT_DBusDataList& TQT_DBusDataList::operator=(const TQStringList& other)
{
d->list.clear();
d->type = TQT_DBusData::String;
d->containerItem = TQT_DBusData();
TQStringList::const_iterator it = other.begin();
TQStringList::const_iterator endIt = other.end();
for (; it != endIt; ++it)
{
d->list << TQT_DBusData::fromString(*it);
}
return *this;
}
TQT_DBusData::Type TQT_DBusDataList::type() const
{
return d->type;
}
bool TQT_DBusDataList::hasContainerItemType() const
{
return d->type == TQT_DBusData::List || d->type == TQT_DBusData::Map
|| d->type == TQT_DBusData::Struct;
}
TQT_DBusData TQT_DBusDataList::containerItemType() const
{
return d->containerItem;
}
bool TQT_DBusDataList::isEmpty() const
{
return d->list.isEmpty();
}
uint TQT_DBusDataList::count() const
{
return d->list.count();
}
bool TQT_DBusDataList::operator==(const TQT_DBusDataList& other) const
{
if (&other == this) return true;
if (d == other.d) return true;
bool containerEqual = true;
if (hasContainerItemType())
{
if (other.hasContainerItemType())
{
containerEqual = d->containerItem.buildDBusSignature() ==
other.d->containerItem.buildDBusSignature();
}
else
containerEqual = false;
}
else if (other.hasContainerItemType())
containerEqual = false;
return d->type == other.d->type && containerEqual && d->list == other.d->list;
}
bool TQT_DBusDataList::operator!=(const TQT_DBusDataList& other) const
{
if (&other == this) return false;
if (d == other.d) return false;
bool containerEqual = true;
if (hasContainerItemType())
{
if (other.hasContainerItemType())
{
containerEqual = d->containerItem.buildDBusSignature() ==
other.d->containerItem.buildDBusSignature();
}
else
containerEqual = false;
}
else if (other.hasContainerItemType())
containerEqual = false;
return d->type != other.d->type || !containerEqual || d->list != other.d->list;
}
void TQT_DBusDataList::clear()
{
d->list.clear();
}
TQT_DBusDataList& TQT_DBusDataList::operator<<(const TQT_DBusData& data)
{
if (data.type() == TQT_DBusData::Invalid) return *this;
if (d->type == TQT_DBusData::Invalid)
{
d->type = data.type();
// check if we are now have container items
if (hasContainerItemType()) d->containerItem = data;
d->list << data;
}
else if (d->type != data.type())
{
qWarning("TQT_DBusDataList: trying to add data of type %s to list of type %s",
data.typeName(), TQT_DBusData::typeName(d->type));
}
else if (hasContainerItemType())
{
TQCString ourSignature = d->containerItem.buildDBusSignature();
TQCString dataSignature = data.buildDBusSignature();
if (ourSignature != dataSignature)
{
qWarning("TQT_DBusDataList: trying to add data with signature %s "
"to list with item signature %s",
dataSignature.data(), ourSignature.data());
}
else
d->list << data;
}
else
d->list << data;
return *this;
}
TQValueList<TQT_DBusData> TQT_DBusDataList::toTQValueList() const
{
return d->list;
}
TQStringList TQT_DBusDataList::toTQStringList(bool* ok) const
{
if (d->type != TQT_DBusData::String)
{
if (ok != 0) *ok = false;
return TQStringList();
}
TQStringList result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toString();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<bool> TQT_DBusDataList::toBoolList(bool* ok) const
{
if (d->type != TQT_DBusData::Bool)
{
if (ok != 0) *ok = false;
return TQValueList<bool>();
}
TQValueList<bool> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toBool();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_UINT8> TQT_DBusDataList::toByteList(bool* ok) const
{
if (d->type != TQT_DBusData::Byte)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_UINT8>();
}
TQValueList<TQ_UINT8> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toByte();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_INT16> TQT_DBusDataList::toInt16List(bool* ok) const
{
if (d->type != TQT_DBusData::Int16)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_INT16>();
}
TQValueList<TQ_INT16> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toInt16();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_UINT16> TQT_DBusDataList::toUInt16List(bool* ok) const
{
if (d->type != TQT_DBusData::UInt16)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_UINT16>();
}
TQValueList<TQ_UINT16> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toUInt16();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_INT32> TQT_DBusDataList::toInt32List(bool* ok) const
{
if (d->type != TQT_DBusData::Int32)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_INT32>();
}
TQValueList<TQ_INT32> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toInt32();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_UINT32> TQT_DBusDataList::toUInt32List(bool* ok) const
{
if (d->type != TQT_DBusData::UInt32)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_UINT32>();
}
TQValueList<TQ_UINT32> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toUInt32();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_INT64> TQT_DBusDataList::toInt64List(bool* ok) const
{
if (d->type != TQT_DBusData::Int64)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_INT64>();
}
TQValueList<TQ_INT64> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toInt64();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQ_UINT64> TQT_DBusDataList::toUInt64List(bool* ok) const
{
if (d->type != TQT_DBusData::UInt64)
{
if (ok != 0) *ok = false;
return TQValueList<TQ_UINT64>();
}
TQValueList<TQ_UINT64> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toUInt64();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<double> TQT_DBusDataList::toDoubleList(bool* ok) const
{
if (d->type != TQT_DBusData::Double)
{
if (ok != 0) *ok = false;
return TQValueList<double>();
}
TQValueList<double> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toDouble();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQString> TQT_DBusDataList::toStringList(bool* ok) const
{
return toTQStringList(ok);
}
TQValueList<TQT_DBusObjectPath> TQT_DBusDataList::toObjectPathList(bool* ok) const
{
if (d->type != TQT_DBusData::ObjectPath)
{
if (ok != 0) *ok = false;
return TQValueList<TQT_DBusObjectPath>();
}
TQValueList<TQT_DBusObjectPath> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toObjectPath();
}
if (ok != 0) *ok = true;
return result;
}
TQValueList<TQT_DBusVariant> TQT_DBusDataList::toVariantList(bool* ok) const
{
if (d->type != TQT_DBusData::Variant)
{
if (ok != 0) *ok = false;
return TQValueList<TQT_DBusVariant>();
}
TQValueList<TQT_DBusVariant> result;
TQValueList<TQT_DBusData>::const_iterator it = d->list.begin();
TQValueList<TQT_DBusData>::const_iterator endIt = d->list.end();
for (; it != endIt; ++it)
{
result << (*it).toVariant();
}
if (ok != 0) *ok = true;
return result;
}

@ -0,0 +1,725 @@
/* qdbusdatalist.h list of DBUS data transport type
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSDATALIST_H
#define TQDBUSDATALIST_H
#include "tqdbusdata.h"
template <typename T> class TQValueList;
class TQT_DBusObjectPath;
class TQT_DBusVariant;
class TQString;
class TQStringList;
/**
* @brief Class to transport lists of D-Bus data types
*
* \note while the D-Bus data type is actually called @c array this bindings
* use the term @c list since the behavior and characteristics of the
* implementation is more list like.
*
* There are basically two ways to create TQT_DBusDataList objects:
* - non-empty from content
* - empty by specifying the desired element type
*
* Example for creating a filled list from content
* @code
* TQValueList<TQ_INT16> intList;
* list << 2 << 3 << 5 << 7;
*
* TQT_DBusDataList dbusList(intList);
* TQT_DBusData data = TQT_DBusData::fromList(dbusList);
*
* // or even shorter, using implicit conversion
* TQT_DBusData other = TQT_DBusData::fromList(intList);
* @endcode
*
* Example for creating an empty list
* @code
* // empty list for a simple type
* TQT_DBusDataList list(TQT_DBusData::Double);
*
* // empty list for a list of string lists
* TQT_DBusData elementType = TQT_DBusData::fromList(TQT_DBusDataList(TQT_DBusData::String));
* TQT_DBusDataList outerList(elementType);
* @endcode
*
* @see TQT_DBusDataMap
*/
class TQDBUS_EXPORT TQT_DBusDataList
{
public:
/**
* @brief Creates an empty and invalid list
*
* @see TQT_DBusData::Invalid
*/
TQT_DBusDataList();
/**
* @brief Creates an empty list with the given simple type for elements
*
* The given type has be one of the non-container types, i.e. any other than
* TQT_DBusData::Map, TQT_DBusData::List or TQT_DBusData::Struct
*
* For creating a list with elements which are containers themselves, use
* TQT_DBusDataList(const TQT_DBusData&);
*
* @param simpleItemType the type of the elements in the new list
*/
explicit TQT_DBusDataList(TQT_DBusData::Type simpleItemType);
/**
* @brief Creates an empty list with the given container type for elements
*
* For creating a list with simple elements you can also use
* TQT_DBusDataList(TQT_DBusData::Type);
*
* @param containerItemType the type of the elements in the new list
*
* @see hasContainerItemType()
*/
explicit TQT_DBusDataList(const TQT_DBusData& containerItemType);
/**
* @brief Creates a list from the given @p other list
*
* This behaves basically like copying a TQValueList through its copy
* constructor, i.e. no value are actually copied at this time.
*
* @param other the other list object to copy from
*/
TQT_DBusDataList(const TQT_DBusDataList& other);
/**
* @brief Creates a list from the given TQValueList of TQT_DBusData objects
*
* If the @p other list is empty, this will behave like TQT_DBusDataList(),
* i.e. create an empty and invalid list object.
*
* Type information for the list object, i.e. element type and, if applicable,
* container item type, will be derived from the @p other list's elements.
*
* \warning if the elements of the @p other list do not all have the same
* type, the list object will also be empty and invalid
*
* @param other the TQValueList of TQT_DBusData objects to copy from
*
* @see toTQValueList()
*/
TQT_DBusDataList(const TQValueList<TQT_DBusData>& other);
/**
* @brief Creates a list from the given TQValueList of boolean values
*
* Type information for the list object will be set to TQT_DBusData::Bool
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Bool
*
* @param other the TQValueList of boolean values to copy from
*
* @see toBoolList()
*/
TQT_DBusDataList(const TQValueList<bool>& other);
/**
* @brief Creates a list from the given TQValueList of byte (unsigned char) values
*
* Type information for the list object will be set to TQT_DBusData::Byte
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Byte
*
* @param other the TQValueList of byte (unsigned char) values to copy from
*
* @see toByteList()
*/
TQT_DBusDataList(const TQValueList<TQ_UINT8>& other);
/**
* @brief Creates a list from the given TQValueList of signed 16-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::Int16
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int16
*
* @param other the TQValueList of signed 16-bit integer values to copy from
*
* @see toInt16List()
*/
TQT_DBusDataList(const TQValueList<TQ_INT16>& other);
/**
* @brief Creates a list from the given TQValueList of unsigned 16-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::UInt16
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt16
*
* @param other the TQValueList of unsigned 16-bit integer values to copy from
*
* @see toUInt16List()
*/
TQT_DBusDataList(const TQValueList<TQ_UINT16>& other);
/**
* @brief Creates a list from the given TQValueList of signed 32-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::Int32
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int32
*
* @param other the TQValueList of signed 32-bit integer values to copy from
*
* @see toInt32List()
*/
TQT_DBusDataList(const TQValueList<TQ_INT32>& other);
/**
* @brief Creates a list from the given TQValueList of unsigned 32-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::UInt16
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt32
*
* @param other the TQValueList of unsigned 32-bit integer values to copy from
*
* @see toUInt32List()
*/
TQT_DBusDataList(const TQValueList<TQ_UINT32>& other);
/**
* @brief Creates a list from the given TQValueList of signed 64-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::Int64
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Int64
*
* @param other the TQValueList of signed 64-bit integer values to copy from
*
* @see toInt64List()
*/
TQT_DBusDataList(const TQValueList<TQ_INT64>& other);
/**
* @brief Creates a list from the given TQValueList of unsigned 64-bit integer values
*
* Type information for the list object will be set to TQT_DBusData::UInt64
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::UInt64
*
* @param other the TQValueList of unsigned 64-bit integer values to copy from
*
* @see toUInt64List()
*/
TQT_DBusDataList(const TQValueList<TQ_UINT64>& other);
/**
* @brief Creates a list from the given TQValueList of double values
*
* Type information for the list object will be set to TQT_DBusData::Double
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Double
*
* @param other the TQValueList of double values to copy from
*
* @see toDoubleList()
*/
TQT_DBusDataList(const TQValueList<double>& other);
/**
* @brief Creates a list from the given TQValueList of TQT_DBusVariant values
*
* Type information for the list object will be set to TQT_DBusData::Variant
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::Variant
*
* @param other the TQValueList of variant values to copy from
*
* @see toVariantList()
*/
TQT_DBusDataList(const TQValueList<TQT_DBusVariant>& other);
/**
* @brief Creates a list from the given TQStringList's values
*
* Type information for the list object will be set to TQT_DBusData::String
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::String
*
* @param other the TQStringList to copy from
*
* @see toTQStringList()
*/
TQT_DBusDataList(const TQStringList& other);
/**
* @brief Creates a list from the given TQValueList of object path values
*
* Type information for the list object will be set to TQT_DBusData::ObjectPath
* also when the @p other list is empty, i.e. this allows to create an
* empty but valid list object, comparable to using
* TQT_DBusDataList(TQT_DBusData::Type) with TQT_DBusData::ObjectPath
*
* @param other the TQValueList of object path values to copy from
*
* @see toObjectPathList()
*/
TQT_DBusDataList(const TQValueList<TQT_DBusObjectPath>& other);
/**
* @brief Destroys the list object
*/
~TQT_DBusDataList();
/**
* @brief Copies from the given @p other list
*
* This behaves basically like copying a TQValueList through its assignment
* operator, i.e. no value are actually copied at this time.
*
* @param other the other list object to copy from
*
* @return a reference to this list object
*/
TQT_DBusDataList& operator=(const TQT_DBusDataList& other);
/**
* @brief Copies from the given @p other list
*
* This behaves basically like copying a TQValueList through its assignment
* operator, i.e. no value are actually copied at this time.
*
* \warning the elements of the given @p other list have to be of the same
* type. If they aren't this list's content will cleared and the
* type will be set to TQT_DBusData::Invalid
*
* @param other the other list object to copy from
*
* @return a reference to this list object
*/
TQT_DBusDataList& operator=(const TQValueList<TQT_DBusData>& other);
/**
* @brief Copies from the given @p other list
*
* Convenience overload as TQStringList is a very common data type in
* TQt and D-Bus methods also use "arrays of strings" quite often.
*
* The list object's type will be set to TQT_DBusData::String. If the object
* previously had a container as its element type, this will be reset, i.e.
* hasContainerItemType() will return @c false
*
* @param other the stringlist to copy from
*
* @return a reference to this list object
*/
TQT_DBusDataList& operator=(const TQStringList& other);
/**
* @brief Returns the element type of the list object
*
* @return one of the values of the TQT_DBusData#Type enum
*
* @see hasContainerItemType()
* @see containerItemType()
*/
TQT_DBusData::Type type() const;
/**
* @brief Checks whether the element type is a data container itself
*
* If the elements of the list are containers as well, this will return
* @c true
* In this case containerItemType() will return a prototype for such a
* container.
*
* @return @c true if the element type is either TQT_DBusData::Map,
* TQT_DBusData::List or TQT_DBusData::Struct, otherwise @c false
*
* @see TQT_DBusDataList(const TQT_DBusData&)
*/
bool hasContainerItemType() const;
/**
* @brief Returns a container prototype for the list's element type
*
* Lists which have containers as their elements, i.e. hasContainerItemType()
* returns @c true this will actually specify the details for the use
* container, i.e. the returned data object can be queried for type and
* possible further subtypes.
*
* @return a data object detailing the element type or an invalid data object
* if the list does not have a container as its element type
*
* @see TQT_DBusDataList(const TQT_DBusData&);
* @see type()
* @see TQT_DBusData::Invalid
*/
TQT_DBusData containerItemType() const;
/**
* @brief Checks whether this list object has a valid element type
*
* This is equal to checking type() for not being TQT_DBusData::Invalid
*
* @return @c true if the list object is valid, otherwise @c false
*/
inline bool isValid() const { return type() != TQT_DBusData::Invalid; }
/**
* @brief Checks whether this list object has any elements
*
* @return @c true if there are no elements in this list, otherwise @c false
*
* @see count()
*/
bool isEmpty() const;
/**
* @brief Returns the number of elements of this list object
*
* @return the number of elements
*
* @see isEmpty()
*/
uint count() const;
/**
* @brief Checks whether the given @p other list is equal to this one
*
* Two lists are considered equal when they have the same type (and same
* container item type if the have one) and the element lists are equal
* as well.
*
* @param other the other list object to compare with
*
* @return @c true if the lists are equal, otherwise @c false
*
* @see TQT_DBusData::operator==()
*/
bool operator==(const TQT_DBusDataList& other) const;
/**
* @brief Checks whether the given @p other list is different from this one
*
* Two lists are considered different when they have the different type (or
* different container item type if the have one) or the element lists are
* equal are different.
*
* @param other the other list object to compare with
*
* @return @c true if the lists are different, otherwise @c false
*
* @see TQT_DBusData::operator!=()
*/
bool operator!=(const TQT_DBusDataList& other) const;
/**
* @brief Clears the list
*
* Type and, if applicable, container element type will stay untouched.
*/
void clear();
/**
* @brief Appends a given value to the list
*
* Basically works like the respective TQValueList operator, but checks if
* type of the new value matches the type of the list.
* Lists that are invalid will accept any new type and will then be
* typed accordingly.
*
* If @p data is invalid itself, it will not be appended at any time.
*
* \note the more common use case is to work with a TQValueList and then
* use the respective constructor to create the TQT_DBusDataList object
*
* @param data the data item to append to the list
*
* @return a reference to this list object
*/
TQT_DBusDataList& operator<<(const TQT_DBusData& data);
/**
* @brief Converts the list object into a TQValueList with TQT_DBusData elements
*
* @return the values of the list object as a TQValueList
*/
TQValueList<TQT_DBusData> toTQValueList() const;
/**
* @brief Tries to get the list object's elements as a TQStringList
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::String.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::String)
*
* @return a TQStringList containing the list object's string elements or
* an empty list when converting fails
*
* @see toStringList()
* @see TQT_DBusData::toString()
*/
TQStringList toTQStringList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of bool
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Bool.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Bool)
*
* @return a TQValueList of bool containing the list object's boolean
* elements or an empty list when converting fails
*
* @see TQT_DBusData::toBool()
*/
TQValueList<bool> toBoolList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_UINT8
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Byte.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Byte)
*
* @return a TQValueList of TQ_UINT8 containing the list object's byte
* elements or an empty list when converting fails
*
* @see TQT_DBusData::toByte()
*/
TQValueList<TQ_UINT8> toByteList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_INT16
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Int16.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Int16)
*
* @return a TQValueList of TQ_INT16 containing the list object's
* signed 16-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toInt16()
*/
TQValueList<TQ_INT16> toInt16List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_UINT16
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::UInt16.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::UInt16)
*
* @return a TQValueList of TQ_UINT16 containing the list object's
* unsigned 16-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toUInt16()
*/
TQValueList<TQ_UINT16> toUInt16List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_INT32
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Int32.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Int32)
*
* @return a TQValueList of TQ_INT32 containing the list object's
* signed 32-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toInt32()
*/
TQValueList<TQ_INT32> toInt32List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_UINT32
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::UInt32.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::UInt32)
*
* @return a TQValueList of TQ_UINT32 containing the list object's
* unsigned 32-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toUInt32()
*/
TQValueList<TQ_UINT32> toUInt32List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_INT64
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Int64.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Int64)
*
* @return a TQValueList of TQ_INT64 containing the list object's
* signed 64-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toInt64()
*/
TQValueList<TQ_INT64> toInt64List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQ_UINT64
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::UInt64.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::UInt64)
*
* @return a TQValueList of TQ_UINT64 containing the list object's
* unsigned 64-bit integer elements or an empty list when converting
* fails
*
* @see TQT_DBusData::toUInt64()
*/
TQValueList<TQ_UINT64> toUInt64List(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of double
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Double.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Double)
*
* @return a TQValueList of double containing the list object's double
* elements or an empty list when converting fails
*
* @see TQT_DBusData::toDouble()
*/
TQValueList<double> toDoubleList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQString
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::String, see also toTQStringList().
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::String)
*
* @return a TQValueList of TQString containing the list object's string
* elements or an empty list when converting fails
*
* @see TQT_DBusData::toString()
*/
TQValueList<TQString> toStringList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of object paths
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::ObjectPath)
*
* @return a TQValueList of object paths containing the list object's object path
* elements or an empty list when converting fails
*
* @see TQT_DBusData::toObjectPath()
*/
TQValueList<TQT_DBusObjectPath> toObjectPathList(bool* ok = 0) const;
/**
* @brief Tries to get the list object's elements as a TQValueList of TQT_DBusVariant
*
* This is a convenience overload for the case when the list is of
* type TQT_DBusData::Variant.
*
* @param ok optional pointer to a bool variable to store the
* success information in, i.e. will be set to @c true on success
* and to @c false if the conversion failed (not of type
* TQT_DBusData::Variant)
*
* @return a TQValueList of TQT_DBusVariant containing the list object's
* TQT_DBusVariant elements or an empty list when converting fails
*
* @see TQT_DBusData::toVariant()
*/
TQValueList<TQT_DBusVariant> toVariantList(bool* ok = 0) const;
private:
class Private;
Private* d;
};
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,216 @@
/* qdbuserror.cpp TQT_DBusError object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbuserror.h"
#include <dbus/dbus.h>
#include <tqmap.h>
typedef TQMap<TQString, TQT_DBusError::ErrorType> ErrorNameMap;
static ErrorNameMap errorTypesByName;
static TQString qDBusErrorNameForType(TQT_DBusError::ErrorType type)
{
switch (type)
{
case TQT_DBusError::InvalidError:
Q_ASSERT(false);
return TQString();
case TQT_DBusError::Failed:
return TQString::fromUtf8(DBUS_ERROR_FAILED);
case TQT_DBusError:: NoMemory:
return TQString::fromUtf8(DBUS_ERROR_NO_MEMORY);
case TQT_DBusError:: ServiceUnknown:
return TQString::fromUtf8(DBUS_ERROR_SERVICE_UNKNOWN);
case TQT_DBusError:: NameHasNoOwner:
return TQString::fromUtf8(DBUS_ERROR_NAME_HAS_NO_OWNER);
case TQT_DBusError:: NoReply:
return TQString::fromUtf8(DBUS_ERROR_NO_REPLY);
case TQT_DBusError:: IOError:
return TQString::fromUtf8(DBUS_ERROR_IO_ERROR);
case TQT_DBusError:: BadAddress:
return TQString::fromUtf8(DBUS_ERROR_BAD_ADDRESS);
case TQT_DBusError:: NotSupported:
return TQString::fromUtf8(DBUS_ERROR_NOT_SUPPORTED);
case TQT_DBusError:: LimitsExceeded:
return TQString::fromUtf8(DBUS_ERROR_LIMITS_EXCEEDED);
case TQT_DBusError:: AccessDenied:
return TQString::fromUtf8(DBUS_ERROR_ACCESS_DENIED);
case TQT_DBusError:: AuthFailed:
return TQString::fromUtf8(DBUS_ERROR_AUTH_FAILED);
case TQT_DBusError:: NoServer:
return TQString::fromUtf8(DBUS_ERROR_NO_SERVER);
case TQT_DBusError:: Timeout:
return TQString::fromUtf8(DBUS_ERROR_TIMEOUT);
case TQT_DBusError:: NoNetwork:
return TQString::fromUtf8(DBUS_ERROR_NO_NETWORK);
case TQT_DBusError:: Disconnected:
return TQString::fromUtf8(DBUS_ERROR_DISCONNECTED);
case TQT_DBusError:: InvalidArgs:
return TQString::fromUtf8(DBUS_ERROR_INVALID_ARGS);
case TQT_DBusError:: FileNotFound:
return TQString::fromUtf8(DBUS_ERROR_FILE_NOT_FOUND);
case TQT_DBusError:: FileExists:
return TQString::fromUtf8(DBUS_ERROR_FILE_EXISTS);
case TQT_DBusError:: UnknownMethod:
return TQString::fromUtf8(DBUS_ERROR_UNKNOWN_METHOD);
case TQT_DBusError:: TimedOut:
return TQString::fromUtf8(DBUS_ERROR_TIMED_OUT);
case TQT_DBusError:: InvalidSignature:
return TQString::fromUtf8(DBUS_ERROR_INVALID_SIGNATURE);
case TQT_DBusError::UserDefined:
Q_ASSERT(false);
return TQString();
}
Q_ASSERT(false);
return TQString();
}
static void qDBusErrorSetupNameMapping()
{
for (int i = TQT_DBusError::InvalidError + 1; i < TQT_DBusError::UserDefined; ++i)
{
TQT_DBusError::ErrorType type = static_cast<TQT_DBusError::ErrorType>(i);
errorTypesByName[qDBusErrorNameForType(type)] = type;
}
}
static TQT_DBusError::ErrorType qDBusErrorTypeForName(const TQString& name)
{
if (name.isEmpty()) return TQT_DBusError::InvalidError;
if (errorTypesByName.isEmpty())
qDBusErrorSetupNameMapping();
ErrorNameMap::const_iterator it = errorTypesByName.tqfind(name);
if (it != errorTypesByName.end()) return it.data();
return TQT_DBusError::UserDefined;
}
TQT_DBusError::TQT_DBusError() : errorType(InvalidError)
{
}
TQT_DBusError::TQT_DBusError(const DBusError *error) : errorType(InvalidError)
{
if (!error || !dbus_error_is_set(error))
return;
nm = TQString::fromUtf8(error->name);
msg = TQString::fromUtf8(error->message);
errorType = qDBusErrorTypeForName(nm);
}
TQT_DBusError::TQT_DBusError(const TQString& error, const TQString& message)
: errorType(UserDefined), nm(error), msg(message)
{
errorType = qDBusErrorTypeForName(nm);
}
bool TQT_DBusError::isValid() const
{
return errorType != InvalidError && !nm.isEmpty() && !msg.isEmpty();
}
TQT_DBusError::TQT_DBusError(ErrorType type, const TQString& message)
: errorType(type), msg(message)
{
nm = qDBusErrorNameForType(type);
}
TQT_DBusError TQT_DBusError::stdFailed(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::Failed, message);
}
TQT_DBusError TQT_DBusError::stdNoMemory(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::NoMemory, message);
}
TQT_DBusError TQT_DBusError::stdNoReply(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::NoReply, message);
}
TQT_DBusError TQT_DBusError::stdIOError(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::IOError, message);
}
TQT_DBusError TQT_DBusError::stdNotSupported(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::NotSupported, message);
}
TQT_DBusError TQT_DBusError::stdLimitsExceeded(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::LimitsExceeded, message);
}
TQT_DBusError TQT_DBusError::stdAccessDenied(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::AccessDenied, message);
}
TQT_DBusError TQT_DBusError::stdAuthFailed(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::AuthFailed, message);
}
TQT_DBusError TQT_DBusError::stdTimeout(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::Timeout, message);
}
TQT_DBusError TQT_DBusError::stdInvalidArgs(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::InvalidArgs, message);
}
TQT_DBusError TQT_DBusError::stdFileNotFound(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::FileNotFound, message);
}
TQT_DBusError TQT_DBusError::stdFileExists(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::FileExists, message);
}
TQT_DBusError TQT_DBusError::stdUnknownMethod(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::UnknownMethod, message);
}
TQT_DBusError TQT_DBusError::stdInvalidSignature(const TQString& message)
{
return TQT_DBusError(TQT_DBusError::InvalidSignature, message);
}

@ -0,0 +1,461 @@
/* qdbuserror.h TQT_DBusError object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSERROR_H
#define TQDBUSERROR_H
#include "tqdbusmacros.h"
#include <tqstring.h>
struct DBusError;
/**
* @brief Class for transporting D-Bus errors
*
* A D-Bus error has two parts: an error name (see section
* @ref dbusconventions-errorname) and a message string detailing the error in
* human presentable form.
*/
class TQDBUS_EXPORT TQT_DBusError
{
public:
/**
* @brief Enum of standard D-Bus error types
*
* D-Bus defines a list of common error types and their names.
* The values of this enum map to those an application is likely to encounter
* and likely to create itself.
*
* Standard errors can either be created by specifying the D-Bus error name
* or, as a convenience, by using factory methods of this class for the
* most common ones.
*
* All D-Bus standard error names are within the @c "org.freedesktop.DBus.Error"
* namespace.
*
* @see name()
*/
enum ErrorType
{
/**
* @brief TQT_DBusError specific value, to represent invalid error objects.
*
* @see isValid()
*/
InvalidError,
/**
* @brief Generic failure cause
*
* Can be used whenever the other predefined errors do no match. Basically
* just meaning "something when wrong, see message() for details"
*
* @see stdFailed()
*/
Failed,
/**
* @brief An operation could not allocate enough memory
*
* @see stdNoMemory()
*/
NoMemory,
/**
* @brief An addressed service is neither connected nor can it be activated
*/
ServiceUnknown,
/**
* @brief A non-unique name used in a message is not known
*
* If a message addresses a D-Bus connection through a non-unique
* (requested) name and the D-Bus does not have a mapping to any of the
* unique names.
*/
NameHasNoOwner,
/**
* @brief An call failed to send a reply but one was expected
*
* @see stdNoReply()
*/
NoReply,
/**
* @brief An IO error occured during an operation
*
* Generic indicator that some kind of IO operation failed, e.g.
* reading from a socket.
*
* @see stdIOError()
*/
IOError,
/**
* @brief Caused by trying to connect to a malformed address
*
* Returned by TQT_DBusConnection's addConnection if the specified address
* isn't a valid D-Bus bus address.
*
* @see TQT_DBusConnection::addConnection(const TQString&,const TQString&);
*/
BadAddress,
/**
* @brief An otherwise valid operation request could not be handled
*
* Primarily useful when a service implements a specific interface but
* does not (yet) handle all possible situations.
*
* @see stdNotSupported()
*/
NotSupported,
/**
* @brief Use of a limited resource reached its limit
*
* @see stdLimitsExceeded()
*/
LimitsExceeded,
/**
* @brief Caused by security restrictions denying an operation
*
* Primarily useful when a client tries to manipulate resources a service
* has associated with a different client and which should not be changable
* by anyone else.
*
* @see stdAccessDenied()
*/
AccessDenied,
/**
* @brief An authentification mechanism failed
*
* @see stdAuthFailed()
*/
AuthFailed,
/**
* @brief Connection to a D-Bus server failed
*/
NoServer,
/**
* @brief An timeout occured during an operation
*
* @warning D-Bus defined to quite similar errors but does not detail
* when either one can occur. See #TimedOut
*
* @see stdTimeout()
*/
Timeout,
/**
* @brief The network intended as a transport channel is not available
*/
NoNetwork,
/**
* @brief Caused by trying to use an unconnected D-Bus connection
*
* @see TQT_DBusConnection::isConnected()
*/
Disconnected,
/**
* @brief Caused by invalid arguments passed to a method call
*
* Primarily usefull for service implementations when the incoming
* call does not transport the expected parameters, e.g. wrong types
* or wrong values.
*
* @see stdInvalidArgs()
*/
InvalidArgs,
/**
* @brief A file necessary for an operation is not avaiable
*
* @see stdFileNotFound()
*/
FileNotFound,
/**
* @brief Target file exists but operation does not allow overwriting
*
* @see stdFileExists()
*/
FileExists,
/**
* @brief A method call addresses and unknown method
*
* @see stdUnknownMethod()
*/
UnknownMethod,
/**
* @brief An operation timed out
*
* @warning D-Bus defined to quite similar errors but does not detail
* when either one can occur. See #Timeout
*/
TimedOut,
/**
* @brief An type signature is not valid
*
* A possible cause is a TQT_DBusVariant with an invalid signature, i.e.
* the transported signature is empty, tqcontains unknown type characters
* or has mismatched container enclosings.
*
* @note in case a service implementation wants to indicate that a method
* call did not transport the correct parameter types, use
* #InvalidArgs instead
*
* @see stdInvalidSignature()
*/
InvalidSignature,
/**
* @brief Generic type for all errors not matching on of the other predefined
*
* @see TQT_DBusError(const TQString&,const TQString&);
*/
UserDefined
};
/**
* @brief Creates an empty and invalid error object
*/
TQT_DBusError();
/**
* @brief Creates an error object from an C API D-Bus error object
*
* @param error a pointer to the C API D-Bus error
*/
TQT_DBusError(const DBusError *error);
/**
* @brief Creates an error object for its two given components
*
* @param error a D-Bus error name
* @param message the potentially i18n'ed error description message
*
* @see name()
*/
TQT_DBusError(const TQString& error, const TQString& message);
/**
* @brief Returns the D-Bus error name
*
* See section @ref dbusconventions-errorname for details.
*
* @return the D-Bus error name
*
* @see message()
*/
inline TQString name() const { return nm; }
/**
* @brief Returns a string describing the error
*
* The message is meant to further detail or describe the error.
* It is usually a translated error message meant for direct
* presentation to the user.
*
* @return the error's message
*
* @see name()
*/
inline TQString message() const { return msg; }
/**
* @brief Returns a type for checking of standard errors
*
* D-Bus specifies a couple of standard error names, which are mapped to
* TQT_DBusError types in order to make creating and checking for them easier.
*
* @return the error's type
*
* @see name()
*/
inline ErrorType type() const { return errorType; }
/**
* @brief Returns whether the error object is valid
*
* A TQT_DBusError is considered valid if both name and message are set.
*
* @return @c true if neither name nor message is @c TQString() and the
* error type is a valid type
*/
bool isValid() const;
/**
* @brief Creates a D-Bus standard error for generic failure
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #Failed with the given @p message
*/
static TQT_DBusError stdFailed(const TQString& message);
/**
* @brief Creates a D-Bus standard error for out of memory situations
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #NoMemory with the given @p message
*/
static TQT_DBusError stdNoMemory(const TQString& message);
/**
* @brief Creates a D-Bus standard error for expected reply missing
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #NoReply with the given @p message
*/
static TQT_DBusError stdNoReply(const TQString& message);
/**
* @brief Creates a D-Bus standard error for generic IO errors
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #IOError with the given @p message
*/
static TQT_DBusError stdIOError(const TQString& message);
/**
* @brief Creates a D-Bus standard error for unsupported operations
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #NotSupported with the given @p message
*/
static TQT_DBusError stdNotSupported(const TQString& message);
/**
* @brief Creates a D-Bus standard error for exceeding a limited resource
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #LimitsExceeded with the given @p message
*/
static TQT_DBusError stdLimitsExceeded(const TQString& message);
/**
* @brief Creates a D-Bus standard error for access to a resource being denied
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #AccessDenied with the given @p message
*/
static TQT_DBusError stdAccessDenied(const TQString& message);
/**
* @brief Creates a D-Bus standard error for failed authentification
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #AuthFailed with the given @p message
*/
static TQT_DBusError stdAuthFailed(const TQString& message);
/**
* @brief Creates a D-Bus standard error for timeouts during operations
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #Timeout with the given @p message
*/
static TQT_DBusError stdTimeout(const TQString& message);
/**
* @brief Creates a D-Bus standard error for call arguments being invalid
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #InvalidArgs with the given @p message
*/
static TQT_DBusError stdInvalidArgs(const TQString& message);
/**
* @brief Creates a D-Bus standard error for a file not being available
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #FileNotFound with the given @p message
*/
static TQT_DBusError stdFileNotFound(const TQString& message);
/**
* @brief Creates a D-Bus standard error for a file being in the way
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #FileExists with the given @p message
*/
static TQT_DBusError stdFileExists(const TQString& message);
/**
* @brief Creates a D-Bus standard error for an unknown methods being called
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #UnknownMethod with the given @p message
*/
static TQT_DBusError stdUnknownMethod(const TQString& message);
/**
* @brief Creates a D-Bus standard error for D-Bus type signature not valid
*
* @param message the message detailing the encountered problem
*
* @return an error object of type #InvalidSignature with the given @p message
*/
static TQT_DBusError stdInvalidSignature(const TQString& message);
private:
ErrorType errorType;
TQString nm, msg;
/**
* @brief Creates an error object for one of the standard D-Bus errors
*
* @param type one of the standard error causes
* @param message the potentially i18n'ed error description message
*
* @see ErrorType
*/
TQT_DBusError(ErrorType type, const TQString& message);
};
#endif

@ -0,0 +1,626 @@
/* qdbusintegrator.cpp TQT_DBusConnection private implementation
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include <tqapplication.h>
#include <tqevent.h>
#include <tqmetaobject.h>
#include <tqsocketnotifier.h>
#include <tqtimer.h>
#include "tqdbusconnection_p.h"
#include "tqdbusmessage.h"
Atomic::Atomic(int value) : m_value(value)
{
}
void Atomic::ref()
{
m_value++;
}
bool Atomic::deref()
{
m_value--;
return m_value > 0;
}
int TQT_DBusConnectionPrivate::messageMetaType = 0;
static dbus_bool_t qDBusAddTimeout(DBusTimeout *timeout, void *data)
{
Q_ASSERT(timeout);
Q_ASSERT(data);
// qDebug("addTimeout %d", dbus_timeout_get_interval(timeout));
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
if (!dbus_timeout_get_enabled(timeout))
return true;
if (!tqApp) {
d->pendingTimeouts.append(timeout);
return true;
}
int timerId = d->startTimer(dbus_timeout_get_interval(timeout));
if (!timerId)
return false;
d->timeouts[timerId] = timeout;
return true;
}
static void qDBusRemoveTimeout(DBusTimeout *timeout, void *data)
{
Q_ASSERT(timeout);
Q_ASSERT(data);
// qDebug("removeTimeout");
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
for (TQValueList<DBusTimeout*>::iterator it = d->pendingTimeouts.begin();
it != d->pendingTimeouts.end();) {
if ((*it) == timeout) {
it = d->pendingTimeouts.erase(it);
}
else
++it;
}
TQT_DBusConnectionPrivate::TimeoutHash::iterator it = d->timeouts.begin();
while (it != d->timeouts.end()) {
if (it.data() == timeout) {
d->killTimer(it.key());
TQT_DBusConnectionPrivate::TimeoutHash::iterator copyIt = it;
++it;
d->timeouts.erase(copyIt);
} else {
++it;
}
}
}
static void qDBusToggleTimeout(DBusTimeout *timeout, void *data)
{
Q_ASSERT(timeout);
Q_ASSERT(data);
//qDebug("ToggleTimeout");
qDBusRemoveTimeout(timeout, data);
qDBusAddTimeout(timeout, data);
}
static dbus_bool_t qDBusAddWatch(DBusWatch *watch, void *data)
{
Q_ASSERT(watch);
Q_ASSERT(data);
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
int flags = dbus_watch_get_flags(watch);
int fd = dbus_watch_get_unix_fd(watch);
TQT_DBusConnectionPrivate::Watcher watcher;
if (flags & DBUS_WATCH_READABLE) {
bool enabled = dbus_watch_get_enabled(watch);
//qDebug("addReadWatch %d %s", fd, (enabled ? "enabled" : "disabled"));
watcher.watch = watch;
if (tqApp) {
watcher.read = new TQSocketNotifier(fd, TQSocketNotifier::Read, d);
if (!enabled) watcher.read->setEnabled(false);
d->connect(watcher.read, TQT_SIGNAL(activated(int)), TQT_SLOT(socketRead(int)));
}
}
if (flags & DBUS_WATCH_WRITABLE) {
bool enabled = dbus_watch_get_enabled(watch);
//qDebug("addWriteWatch %d %s", fd, (enabled ? "enabled" : "disabled"));
watcher.watch = watch;
if (tqApp) {
watcher.write = new TQSocketNotifier(fd, TQSocketNotifier::Write, d);
if (!enabled) watcher.write->setEnabled(false);
d->connect(watcher.write, TQT_SIGNAL(activated(int)), TQT_SLOT(socketWrite(int)));
}
}
// FIXME-QT4 d->watchers.insertMulti(fd, watcher);
TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd);
if (it == d->watchers.end())
{
it = d->watchers.insert(fd, TQT_DBusConnectionPrivate::WatcherList());
}
it.data().append(watcher);
return true;
}
static void qDBusRemoveWatch(DBusWatch *watch, void *data)
{
Q_ASSERT(watch);
Q_ASSERT(data);
//qDebug("remove watch");
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
int fd = dbus_watch_get_unix_fd(watch);
TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd);
if (it != d->watchers.end())
{
TQT_DBusConnectionPrivate::WatcherList& list = *it;
for (TQT_DBusConnectionPrivate::WatcherList::iterator wit = list.begin();
wit != list.end(); ++wit)
{
if ((*wit).watch == watch)
{
// migth be called from a function triggered by a socket listener
// so just disconnect them and schedule their delayed deletion.
d->removedWatches.append(*wit);
if ((*wit).read)
{
(*wit).read->disconnect(d);
(*wit).read = 0;
}
if ((*wit).write)
{
(*wit).write->disconnect(d);
(*wit).write = 0;
}
(*wit).watch = 0;
}
}
}
if (d->removedWatches.count() > 0)
TQTimer::singleShot(0, d, TQT_SLOT(purgeRemovedWatches()));
}
static void qDBusToggleWatch(DBusWatch *watch, void *data)
{
Q_ASSERT(watch);
Q_ASSERT(data);
//qDebug("toggle watch");
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
int fd = dbus_watch_get_unix_fd(watch);
TQT_DBusConnectionPrivate::WatcherHash::iterator it = d->watchers.tqfind(fd);
if (it != d->watchers.end()) {
TQT_DBusConnectionPrivate::WatcherList& list = *it;
for (TQT_DBusConnectionPrivate::WatcherList::iterator wit = list.begin(); wit != list.end();
++wit)
{
if ((*wit).watch == watch) {
bool enabled = dbus_watch_get_enabled(watch);
int flags = dbus_watch_get_flags(watch);
// qDebug("toggle watch %d to %d (write: %d, read: %d)",
// dbus_watch_get_unix_fd(watch), enabled,
// flags & DBUS_WATCH_WRITABLE, flags & DBUS_WATCH_READABLE);
if (flags & DBUS_WATCH_READABLE && (*wit).read)
(*wit).read->setEnabled(enabled);
if (flags & DBUS_WATCH_WRITABLE && (*wit).write)
(*wit).write->setEnabled(enabled);
return;
}
}
}
}
static void qDBusNewConnection(DBusServer *server, DBusConnection *c, void *data)
{
Q_ASSERT(data); Q_ASSERT(server); Q_ASSERT(c);
qDebug("SERVER: GOT A NEW CONNECTION"); // TODO
}
static DBusHandlerResult qDBusSignalFilter(DBusConnection *connection,
DBusMessage *message, void *data)
{
Q_ASSERT(data);
Q_UNUSED(connection);
TQT_DBusConnectionPrivate *d = static_cast<TQT_DBusConnectionPrivate *>(data);
if (d->mode == TQT_DBusConnectionPrivate::InvalidMode)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
int msgType = dbus_message_get_type(message);
bool handled = false;
//TQT_DBusMessage amsg = TQT_DBusMessage::fromDBusMessage(message);
//qDebug() << "got message: " << dbus_message_get_type(message) << amsg;
if (msgType == DBUS_MESSAGE_TYPE_SIGNAL) {
handled = d->handleSignal(message);
} else if (msgType == DBUS_MESSAGE_TYPE_METHOD_CALL) {
handled = d->handleObjectCall(message);
}
return handled ? DBUS_HANDLER_RESULT_HANDLED :
DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
int TQT_DBusConnectionPrivate::registerMessageMetaType()
{
// FIXME-QT4 int tp = messageMetaType = qRegisterMetaType<TQT_DBusMessage>("TQT_DBusMessage");
int tp = 0;
return tp;
}
TQT_DBusConnectionPrivate::TQT_DBusConnectionPrivate(TQObject *tqparent)
: TQObject(tqparent), ref(1), mode(InvalidMode), connection(0), server(0),
dispatcher(0)
{
static const int msgType = registerMessageMetaType();
Q_UNUSED(msgType);
dbus_error_init(&error);
dispatcher = new TQTimer(this);
TQObject::connect(dispatcher, TQT_SIGNAL(timeout()), this, TQT_SLOT(dispatch()));
}
TQT_DBusConnectionPrivate::~TQT_DBusConnectionPrivate()
{
if (dbus_error_is_set(&error))
dbus_error_free(&error);
closeConnection();
}
void TQT_DBusConnectionPrivate::closeConnection()
{
ConnectionMode oldMode = mode;
mode = InvalidMode; // prevent reentrancy
if (oldMode == ServerMode) {
if (server) {
dbus_server_disconnect(server);
dbus_server_unref(server);
server = 0;
}
} else if (oldMode == ClientMode) {
if (connection) {
// closing shared connections is forbidden
#if 0
dbus_connection_close(connection);
// send the "close" message
while (dbus_connection_dispatch(connection) == DBUS_DISPATCH_DATA_REMAINS);
#endif
dbus_connection_unref(connection);
connection = 0;
}
}
}
bool TQT_DBusConnectionPrivate::handleError()
{
lastError = TQT_DBusError(&error);
if (dbus_error_is_set(&error))
dbus_error_free(&error);
return lastError.isValid();
}
void TQT_DBusConnectionPrivate::emitPendingCallReply(const TQT_DBusMessage& message)
{
emit dbusPendingCallReply(message);
}
void TQT_DBusConnectionPrivate::bindToApplication()
{
// Yay, now that we have an application we are in business
// Re-add all watchers
WatcherHash oldWatchers = watchers;
watchers.clear();
// FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(oldWatchers);
for (WatcherHash::const_iterator it = oldWatchers.begin(); it != oldWatchers.end(); ++it)
{
const WatcherList& list = *it;
for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit)
{
if (!(*wit).read && !(*wit).write) {
qDBusAddWatch((*wit).watch, this);
}
}
}
// Re-add all timeouts
while (!pendingTimeouts.isEmpty()) {
qDBusAddTimeout(pendingTimeouts.first(), this);
pendingTimeouts.pop_front();
}
}
void TQT_DBusConnectionPrivate::socketRead(int fd)
{
// FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(watchers);
WatcherHash::const_iterator it = watchers.tqfind(fd);
if (it != watchers.end()) {
const WatcherList& list = *it;
for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit) {
if ((*wit).read && (*wit).read->isEnabled()) {
if (!dbus_watch_handle((*wit).watch, DBUS_WATCH_READABLE))
qDebug("OUT OF MEM");
}
}
}
if (mode == ClientMode)
scheduleDispatch();
}
void TQT_DBusConnectionPrivate::socketWrite(int fd)
{
// FIXME-QT4 TQHashIterator<int, TQT_DBusConnectionPrivate::Watcher> it(watchers);
WatcherHash::const_iterator it = watchers.tqfind(fd);
if (it != watchers.end()) {
const WatcherList& list = *it;
for (WatcherList::const_iterator wit = list.begin(); wit != list.end(); ++wit) {
if ((*wit).write && (*wit).write->isEnabled()) {
if (!dbus_watch_handle((*wit).watch, DBUS_WATCH_WRITABLE))
qDebug("OUT OF MEM");
}
}
}
}
void TQT_DBusConnectionPrivate::objectDestroyed(TQObject* object)
{
//qDebug("Object destroyed");
for (PendingCallMap::iterator it = pendingCalls.begin(); it != pendingCalls.end();)
{
TQObject* receiver = (TQObject*) it.data()->receiver;
if (receiver == object || receiver == 0)
{
PendingCallMap::iterator copyIt = it;
++it;
dbus_pending_call_cancel(copyIt.key());
dbus_pending_call_unref(copyIt.key());
delete copyIt.data();
pendingCalls.erase(copyIt);
}
else
++it;
}
}
void TQT_DBusConnectionPrivate::purgeRemovedWatches()
{
if (removedWatches.isEmpty()) return;
WatcherList::iterator listIt = removedWatches.begin();
for (; listIt != removedWatches.end(); ++listIt)
{
delete (*listIt).read;
delete (*listIt).write;
}
removedWatches.clear();
uint count = 0;
WatcherHash::iterator it = watchers.begin();
while (it != watchers.end())
{
WatcherList& list = *it;
listIt = list.begin();
while (listIt != list.end())
{
if (!((*listIt).read) && !((*listIt).write))
{
listIt = list.erase(listIt);
++count;
}
}
if (list.isEmpty())
{
WatcherHash::iterator copyIt = it;
++it;
watchers.erase(copyIt);
}
else
++it;
}
}
void TQT_DBusConnectionPrivate::scheduleDispatch()
{
dispatcher->start(0);
}
void TQT_DBusConnectionPrivate::dispatch()
{
if (mode == ClientMode)
{
if (dbus_connection_dispatch(connection) != DBUS_DISPATCH_DATA_REMAINS)
{
// stop dispatch timer
dispatcher->stop();
}
}
}
bool TQT_DBusConnectionPrivate::handleObjectCall(DBusMessage *message)
{
TQT_DBusMessage msg = TQT_DBusMessage::fromDBusMessage(message);
ObjectMap::iterator it = registeredObjects.tqfind(msg.path());
if (it == registeredObjects.end())
return false;
return it.data()->handleMethodCall(msg);
}
bool TQT_DBusConnectionPrivate::handleSignal(DBusMessage *message)
{
TQT_DBusMessage msg = TQT_DBusMessage::fromDBusMessage(message);
// yes, it is a single "|" below...
// FIXME-QT4
//return handleSignal(TQString(), msg) | handleSignal(msg.path(), msg);
dbusSignal(msg);
return true;
}
static dbus_int32_t server_slot = -1;
void TQT_DBusConnectionPrivate::setServer(DBusServer *s)
{
if (!server) {
handleError();
return;
}
server = s;
mode = ServerMode;
dbus_server_allocate_data_slot(&server_slot);
if (server_slot < 0)
return;
dbus_server_set_watch_functions(server, qDBusAddWatch, qDBusRemoveWatch,
qDBusToggleWatch, this, 0); // ### check return type?
dbus_server_set_timeout_functions(server, qDBusAddTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, this, 0);
dbus_server_set_new_connection_function(server, qDBusNewConnection, this, 0);
dbus_server_set_data(server, server_slot, this, 0);
}
void TQT_DBusConnectionPrivate::setConnection(DBusConnection *dbc)
{
if (!dbc) {
handleError();
return;
}
connection = dbc;
mode = ClientMode;
dbus_connection_set_exit_on_disconnect(connection, false);
dbus_connection_set_watch_functions(connection, qDBusAddWatch, qDBusRemoveWatch,
qDBusToggleWatch, this, 0);
dbus_connection_set_timeout_functions(connection, qDBusAddTimeout, qDBusRemoveTimeout,
qDBusToggleTimeout, this, 0);
// dbus_bus_add_match(connection, "type='signal',interface='com.trolltech.dbus.Signal'", &error);
// dbus_bus_add_match(connection, "type='signal'", &error);
dbus_bus_add_match(connection, "type='signal'", &error);
if (handleError()) {
closeConnection();
return;
}
const char *service = dbus_bus_get_unique_name(connection);
if (service) {
TQCString filter;
filter += "destination='";
filter += service;
filter += "\'";
dbus_bus_add_match(connection, filter.data(), &error);
if (handleError()) {
closeConnection();
return;
}
} else {
qWarning("TQT_DBusConnectionPrivate::SetConnection: Unable to get unique name");
}
dbus_connection_add_filter(connection, qDBusSignalFilter, this, 0);
//qDebug("unique name: %s", service);
}
static void qDBusResultReceived(DBusPendingCall *pending, void *user_data)
{
//qDebug("Pending Call Result received");
TQT_DBusConnectionPrivate* d = reinterpret_cast<TQT_DBusConnectionPrivate*>(user_data);
TQT_DBusConnectionPrivate::PendingCallMap::iterator it = d->pendingCalls.tqfind(pending);
DBusMessage *dbusReply = dbus_pending_call_steal_reply(pending);
dbus_set_error_from_message(&d->error, dbusReply);
d->handleError();
if (it != d->pendingCalls.end())
{
TQT_DBusMessage reply = TQT_DBusMessage::fromDBusMessage(dbusReply);
TQObject::connect(d, TQT_SIGNAL(dbusPendingCallReply(const TQT_DBusMessage&)),
it.data()->receiver, it.data()->method.data());
d->emitPendingCallReply(reply);
TQObject::disconnect(d, TQT_SIGNAL(dbusPendingCallReply(const TQT_DBusMessage&)),
it.data()->receiver, it.data()->method.data());
}
dbus_message_unref(dbusReply);
dbus_pending_call_unref(pending);
delete it.data();
d->pendingCalls.erase(it);
}
int TQT_DBusConnectionPrivate::sendWithReplyAsync(const TQT_DBusMessage &message, TQObject *receiver,
const char *method)
{
if (!receiver || !method)
return 0;
if (!TQObject::connect(receiver, TQT_SIGNAL(destroyed(TQObject*)),
this, TQT_SLOT(objectDestroyed(TQObject*))))
return false;
DBusMessage *msg = message.toDBusMessage();
if (!msg)
return 0;
DBusPendingCall *pending = 0;
if (dbus_connection_send_with_reply(connection, msg, &pending, message.timeout())) {
TQT_DBusPendingCall *pcall = new TQT_DBusPendingCall;
pcall->receiver = receiver;
pcall->method = method;
pcall->pending = dbus_pending_call_ref(pending);
pendingCalls.insert(pcall->pending, pcall);
dbus_pending_call_set_notify(pending, qDBusResultReceived, this, 0);
return dbus_message_get_serial(msg);
}
return 0;
}
void TQT_DBusConnectionPrivate::flush()
{
if (!connection) return;
dbus_connection_flush(connection);
}
#include "tqdbusconnection_p.moc"

@ -0,0 +1,31 @@
/* qdbusmacros TQDBUS macro definitions
*
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSMACROS_H
#define TQDBUSMACROS_H
#include <tqglobal.h>
#define TQDBUS_EXPORT TQ_EXPORT
#endif

File diff suppressed because it is too large Load Diff

@ -0,0 +1,40 @@
/* qdbusmarshall.h TQT_DBusMarshall object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSMARSHALL_H
#define TQDBUSMARSHALL_H
struct DBusMessage;
class TQT_DBusData;
template <typename T> class TQValueList;
class TQT_DBusMarshall
{
public:
static void listToMessage(const TQValueList<TQT_DBusData> &list, DBusMessage* message);
static void messageToList(TQValueList<TQT_DBusData>& list, DBusMessage* message);
};
#endif

@ -0,0 +1,263 @@
/* qdbusmessage.cpp
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbusmessage.h"
#include <tqstringlist.h>
#include <dbus/dbus.h>
#include "tqdbusmarshall.h"
#include "tqdbusmessage_p.h"
TQT_DBusMessagePrivate::TQT_DBusMessagePrivate(TQT_DBusMessage *qq)
: msg(0), reply(0), q(qq), type(DBUS_MESSAGE_TYPE_INVALID), timeout(-1), ref(1)
{
}
TQT_DBusMessagePrivate::~TQT_DBusMessagePrivate()
{
if (msg)
dbus_message_unref(msg);
if (reply)
dbus_message_unref(reply);
}
///////////////
TQT_DBusMessage TQT_DBusMessage::signal(const TQString &path, const TQString &interface,
const TQString &member)
{
TQT_DBusMessage message;
message.d->type = DBUS_MESSAGE_TYPE_SIGNAL;
message.d->path = path;
message.d->interface = interface;
message.d->member = member;
return message;
}
TQT_DBusMessage TQT_DBusMessage::methodCall(const TQString &service, const TQString &path,
const TQString &interface, const TQString &method)
{
TQT_DBusMessage message;
message.d->type = DBUS_MESSAGE_TYPE_METHOD_CALL;
message.d->service = service;
message.d->path = path;
message.d->interface = interface;
message.d->member = method;
return message;
}
TQT_DBusMessage TQT_DBusMessage::methodReply(const TQT_DBusMessage &other)
{
Q_ASSERT(other.d->msg);
TQT_DBusMessage message;
message.d->type = DBUS_MESSAGE_TYPE_METHOD_RETURN;
message.d->reply = dbus_message_ref(other.d->msg);
return message;
}
TQT_DBusMessage TQT_DBusMessage::methodError(const TQT_DBusMessage &other, const TQT_DBusError& error)
{
Q_ASSERT(other.d->msg);
TQT_DBusMessage message;
if (!error.isValid())
{
qWarning("TQT_DBusMessage: error passed to methodError() is not valid!");
return message;
}
message.d->type = DBUS_MESSAGE_TYPE_ERROR;
message.d->reply = dbus_message_ref(other.d->msg);
message.d->error = error;
return message;
}
TQT_DBusMessage::TQT_DBusMessage()
{
d = new TQT_DBusMessagePrivate(this);
}
TQT_DBusMessage::TQT_DBusMessage(const TQT_DBusMessage &other)
: TQValueList<TQT_DBusData>(other)
{
d = other.d;
d->ref.ref();
}
TQT_DBusMessage::~TQT_DBusMessage()
{
if (!d->ref.deref())
delete d;
}
TQT_DBusMessage &TQT_DBusMessage::operator=(const TQT_DBusMessage &other)
{
TQValueList<TQT_DBusData>::operator=(other);
// FIXME-QT4 qAtomicAssign(d, other.d);
if (other.d) other.d->ref.ref();
TQT_DBusMessagePrivate* old = d;
d = other.d;
if (old && !old->ref.deref())
delete old;
return *this;
}
DBusMessage *TQT_DBusMessage::toDBusMessage() const
{
DBusMessage *msg = 0;
switch (d->type) {
case DBUS_MESSAGE_TYPE_METHOD_CALL:
msg = dbus_message_new_method_call(d->service.utf8().data(),
d->path.utf8().data(), d->interface.utf8().data(),
d->member.utf8().data());
break;
case DBUS_MESSAGE_TYPE_SIGNAL:
msg = dbus_message_new_signal(d->path.utf8().data(),
d->interface.utf8().data(), d->member.utf8().data());
break;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
msg = dbus_message_new_method_return(d->reply);
break;
case DBUS_MESSAGE_TYPE_ERROR:
msg = dbus_message_new_error(d->reply, d->error.name().utf8().data(),
d->error.message().utf8().data());
break;
}
if (!msg)
return 0;
TQT_DBusMarshall::listToMessage(*this, msg);
return msg;
}
TQT_DBusMessage TQT_DBusMessage::fromDBusMessage(DBusMessage *dmsg)
{
TQT_DBusMessage message;
if (!dmsg)
return message;
message.d->type = dbus_message_get_type(dmsg);
message.d->path = TQString::fromUtf8(dbus_message_get_path(dmsg));
message.d->interface = TQString::fromUtf8(dbus_message_get_interface(dmsg));
message.d->member = TQString::fromUtf8(dbus_message_get_member(dmsg));
message.d->sender = TQString::fromUtf8(dbus_message_get_sender(dmsg));
message.d->msg = dbus_message_ref(dmsg);
DBusError dbusError;
dbus_error_init(&dbusError);
if (dbus_set_error_from_message(&dbusError, dmsg))
{
message.d->error = TQT_DBusError(&dbusError);
}
TQT_DBusMarshall::messageToList(message, dmsg);
return message;
}
TQString TQT_DBusMessage::path() const
{
return d->path;
}
TQString TQT_DBusMessage::interface() const
{
return d->interface;
}
TQString TQT_DBusMessage::member() const
{
return d->member;
}
TQString TQT_DBusMessage::sender() const
{
return d->sender;
}
TQT_DBusError TQT_DBusMessage::error() const
{
return d->error;
}
int TQT_DBusMessage::timeout() const
{
return d->timeout;
}
void TQT_DBusMessage::setTimeout(int ms)
{
d->timeout = ms;
}
/*!
Returns the unique serial number assigned to this message
or 0 if the message was not sent yet.
*/
int TQT_DBusMessage::serialNumber() const
{
if (!d->msg)
return 0;
return dbus_message_get_serial(d->msg);
}
/*!
Returns the unique serial number assigned to the message
that triggered this reply message.
If this message is not a reply to another message, 0
is returned.
*/
int TQT_DBusMessage::replySerialNumber() const
{
if (!d->msg)
return 0;
return dbus_message_get_reply_serial(d->msg);
}
TQT_DBusMessage::MessageType TQT_DBusMessage::type() const
{
switch (d->type) {
case DBUS_MESSAGE_TYPE_METHOD_CALL:
return MethodCallMessage;
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
return ReplyMessage;
case DBUS_MESSAGE_TYPE_ERROR:
return ErrorMessage;
case DBUS_MESSAGE_TYPE_SIGNAL:
return SignalMessage;
default:
return InvalidMessage;
}
}

@ -0,0 +1,514 @@
/* qdbusmessage.h TQT_DBusMessage object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSMESSAGE_H
#define TQDBUSMESSAGE_H
#include "tqdbusmacros.h"
#include "tqdbusdata.h"
#include <tqvaluelist.h>
#include <limits.h>
class TQT_DBusError;
class TQT_DBusMessagePrivate;
struct DBusMessage;
/**
* @brief A message converts and transports data over D-Bus
*
* A TQT_DBusMessage is implicitly shared, similar to a TQString, i.e. copying
* a message creates just a shallow copy.
*
* The TQT_DBusMessage is the TQt3 bindings means of encapsulating data for a
* method call, a method reply or an error.
*
* Data specifying the sender and receipient is directly accessible through
* getter methods, while data, e.g. method parameters or return values, are
* managed as a list of TQT_DBusData.
*
* To create a message suitable for sending use one of the static factory
* methods:
* - signal() for creating a D-Bus signal message
*
* - methodCall() for creating a D-Bus method calls to a service object
*
* - methodReply() for creating a method reply on success
*
* - methodError() for creating a method reply on error
*
* @note for applications that just want to perform method calls and/or receive
* signals, it is usually more convenient to use TQT_DBusProxy instead.
*
* Message sending is achieved through TQT_DBusConnection
*
* Example:
* @code
* TQT_DBusConnection con = TQT_DBusConnection::sessionBus();
*
* // receipient service is the bus' main interface
*
* TQString service = "org.freedesktop.DBus";
* TQString path = "/org/freedesktop/DBus";
* TQString interface = "org.freedesktop.DBus";
*
* TQT_DBusMessage msg = TQBusMessage::methodCall(service, path, interface, "ListNames");
*
* TQT_DBusMessage reply = con.sendWithReply(msg);
*
* // awaiting for a message list
*
* if (reply.type() != TQT_DBusMessage::ReplyMessage || reply.count() != 2 ||
* reply[0].type() != TQT_DBusData::List)
* {
* // error handling here
* }
* else
* {
* TQStringList list = reply[0].toTQStringList();
*
* // reply handling here
* }
* @endcode
*
* A service returning such a reply would do something like this
* @code
* bool Service::handleMethodCall(const TQT_DBusMessage& call)
* {
* // checks for correctness, i.e. correct interface, member,
* // would usually haven been placed here
*
* TQStringList result;
* result << "Foo" << "Bar";
*
* TQT_DBusMessage reply = TQT_DBusMessage::methodReply(call);
* reply << TQT_DBusData::fromList(result);
*
* connection.send(reply);
*
* return true;
* }
* @endcode
*/
class TQDBUS_EXPORT TQT_DBusMessage: public TQValueList<TQT_DBusData>
{
friend class TQT_DBusConnection;
public:
/**
* @brief Anonymous enum for timeout constants
*
* @see timeout()
* @see setTimeout()
*/
enum
{
/**
* Use whatever D-Bus has as default timeout
*/
DefaultTimeout = -1,
/**
* Use no timeout at all, i.e. wait as long as necessary
*/
NoTimeout = INT_MAX
};
/**
* @brief D-Bus message types
*
* A message of a specific type can be created using the respective factory
* method. A message created by the default constructor becomes an
* InvalidMessage
*
* @see type()
* @see signal()
* @see methodCall()
* @see methodReply()
* @see methodError()
*/
enum MessageType
{
/**
* An invalid message cannot be sent over D-Bus. This type serves for
* initializing message variables without requiring a "real" message
*/
InvalidMessage,
/**
* A message for doing method calls on remote service objects
*
* @see methodCall()
*/
MethodCallMessage,
/**
* A message for replying to a method call in case of success
*
* @see methodReply()
*/
ReplyMessage,
/**
* A message for replying to a method call in case of failure
*
* @see methodError()
*/
ErrorMessage,
/**
* A message for emitting D-Bus signals
*
* @see signal()
*/
SignalMessage
};
/**
* @brief Creates an empty and invalid message
*
* To create a message suitable for sending through D-Bus see the factory
* methods signal(), methodCall(), methodReply() and methodError()
*
* @see #InvalidMessage
*/
TQT_DBusMessage();
/**
* @brief Creates a shallow copy of the given message
*
* This instance will become a handle to the same message data the other
* message is using, including #MessageType
*
* @param other the message to copy
*/
TQT_DBusMessage(const TQT_DBusMessage &other);
/**
* @brief Destroys a message
*
* If this message handle is the last one using this respective message
* content, the message content will be deleted as well
*/
~TQT_DBusMessage();
/**
* @brief Creates a shallow copy of the given message
*
* This instance will become a handle to the same message data the other
* message is usingm including #MessageType
*
* Any content used in this instance will be deleted if this instance was
* the last handle using that content
*
* @param other the message to copy
*
* @return a reference to this instance as required by assignment operator
* semantics
*/
TQT_DBusMessage &operator=(const TQT_DBusMessage &other);
/**
* @brief Creates a message for sending a D-Bus signal
*
* Sending/emitting a signal over D-Bus requires a message of type
* #SignalMessage as well as the information where it is coming from, i.e.
* which interface of which object is sending it.
* See @ref dbusconventions for recommendations on those parameters.
*
* @param path the object path of the service object
* @param interface the object's interface to which the signal belongs
* @param member the signal's name
*
* @return a message suitable for appending arguments and for sending
*
* @see TQT_DBusConnection::send()
*/
static TQT_DBusMessage signal(const TQString &path, const TQString &interface,
const TQString &member);
/**
* @brief Creates a message for sending a D-Bus method call
*
* Invoking a method over D-Bus requires a message of type
* #MethodCallMessage as well as the information where it should be sent
* to, e.g which interface of which object in which service.
* See @ref dbusconventions for recommendations on those parameters.
*
* @param service the D-Bus name of the application hosting the service
* object
* @param path the object path of the service object
* @param interface the object's interface to which the method belongs
* @param method the method's name
*
* @return a message suitable for appending arguments and for sending
*
* @see methodReply()
* @see methodError()
* @see TQT_DBusConnection::send()
*/
static TQT_DBusMessage methodCall(const TQString &service, const TQString &path,
const TQString &interface, const TQString &method);
/**
* @brief Creates a message for replying to a D-Bus method call
*
* Replying to a D-Bus method call in the case of success requires a message
* of type #ReplyMessage as well as the information to which method call it
* is replying to.
*
* @param other the method call message it is replying to
*
* @return a message suitable for appending arguments and for sending
*
* @see methodCall()
* @see methodError()
* @see TQT_DBusConnection::send()
*/
static TQT_DBusMessage methodReply(const TQT_DBusMessage &other);
/**
* @brief Creates a message for replying to a D-Bus method call
*
* Replying to a D-Bus method call in the case of failure requires a message
* of type #ErrorMessage as well as the information to which method call it
* is replying to and which error occured.
*
* @param other the method call message it is replying to
* @param error the error which occured during during the method call
*
* @return a message suitable for appending arguments and for sending
*
* @see methodCall()
* @see methodReply()
* @see TQT_DBusConnection::send()
*/
static TQT_DBusMessage methodError(const TQT_DBusMessage &other, const TQT_DBusError& error);
/**
* @brief Returns the message's object path
*
* See section @ref dbusconventions-objectpath for details.
*
* The context of the object path depends on the message type:
* - #SignalMessage: the path of the service object which emits the signal
* - #MethodCallMessage: the path of the service object the call is sent to
* - #ReplyMessage: the path of the object which is replying
* - #ErrorMessage: the path of the object which is replying
*
* @return a non-empty object path or @c TQString()
*
* @see interface()
* @see member()
* @see sender()
*/
TQString path() const;
/**
* @brief Returns the message's interface name
*
* See section @ref dbusconventions-interfacename for details.
*
* The context of the interface name depends on the message type:
* - #SignalMessage: the name of the interface which emits the signal
* - #MethodCallMessage: the name of the interface the call is sent to
* - #ReplyMessage: the name of the interface to which the method belonged
* - #ErrorMessage: the name of the interface to which the method belonged
*
* @return a non-empty interface name or @c TQString()
*
* @see path()
* @see member()
* @see sender()
*/
TQString interface() const;
/**
* @brief Returns the message's member name
*
* See section @ref dbusconventions-membername for details.
*
* The context of the member name depends on the message type:
* - #SignalMessage: the name of the emitted signal
* - #MethodCallMessage: the name of the method to call
* - #ReplyMessage: the name of the method which replies
* - #ErrorMessage: the name of the method which replies
*
* @return a non-empty member name or @c TQString()
*
* @see path()
* @see interface()
* @see sender()
*/
TQString member() const;
/**
* @brief Returns the name of the message sender
*
* The message sender name or address used on the D-Bus message bus
* to refer to the application which sent this message.
*
* See section @ref dbusconventions-servicename for details.
*
* This can either be a unique name as handed out by the bus, see
* TQT_DBusConnection::uniqueName() or a name registered with
* TQT_DBusConnection::requestName()
*
* @return a non-empty D-Bus sender name or @c TQString()
*
* @see path()
* @see interface()
* @see member()
*/
TQString sender() const;
/**
* @brief Returns the error of an error message
*
* If this message is of type #ErrorMessage, this method can be used
* to retrieve the respective error object
*
* @return the transported error object. Will be empty if this is not an
* error message
*
* @see type()
*/
TQT_DBusError error() const;
/**
* @brief Returns which kind of message this is
*
* @return the message's type
*/
MessageType type() const;
/**
* @brief Returns the message's timeout
*
* @return the asynchronous wait timeout in milliseconds
*
* @see setTimeout()
*/
int timeout() const;
/**
* @brief Sets the message's timeout
*
* The timeout is the number of milliseconds the D-Bus connection will
* wait for the reply of an asynchronous call.
*
* If no reply is received in time, an error message will be delivered to
* the asynchronous reply receiver.
*
* If no timeout is set explicitly, #DefaultTimeout is assumed, which is
* usually the best option
*
* @return the asynchronous wait timeout in milliseconds
*
* @param ms timeout in milliseconds
*
* @see timeout()
* @see #DefaultTimeout
* @see #NoTimeout
*/
void setTimeout(int ms);
/**
* @brief Returns the message's serial number
*
* The serial number is some kind of short term identifier for messages
* travelling the same connection.
*
* It can be used to associate a reply or error message with a method
* call message.
*
* @return the message's serial number or @c 0 if the message hasn't been
* send yets
*
* @see replySerialNumber()
*/
int serialNumber() const;
/**
* @brief Returns the message's reply serial number
*
* The reply serial number is the serial number of the method call message
* this message is a reply to.
*
* If this is neither a message of type #ReplyMessage or #ErrorMessage, the
* returned value will be @c 0
*
* It can be used to associate a reply or error message with a method
* call message.
*
* @return the serial number of the associated method call message or @c 0
* if this message is not a reply message
*
* @see serialNumber()
* @see methodReply()
* @see methodError()
* @see TQT_DBusConnection::sendWithAsyncReply()
* @see TQT_DBusProxy::sendWithAsyncReply()
*/
int replySerialNumber() const;
//protected:
/**
* @brief Creates a raw D-Bus message from this TQt3-bindings message
*
* Marshalls data contained in the message's value list into D-Bus data
* format and creates a low level API D-Bus message for it.
*
* @note ownership of the returned message is transferred to the caller,
* i.e. it has to be deleted using dbus_message_unref()
*
* @return a C API D-Bus message or @c 0 if this is an #InvalidMessage
* or marshalling failed
*/
DBusMessage *toDBusMessage() const;
/**
* @brief Creates a TQt3-bindings message from the given raw D-Bus message
*
* De-marshalls data contained in the message to a list of TQT_DBusData.
*
* @note ownership of the given message is shared between the caller and
* the returned message, i.e. the message as increased the reference
* counter and will still have access to the raw message even if the
* caller "deleted" it using dbus_message_unref()
*
* @param dmsg a C API D-Bus message
*
* @return a TQt3 bindings message. Can be an #InvalidMessage if the given
* message was @c 0 or if de-marshalling failed
*/
static TQT_DBusMessage fromDBusMessage(DBusMessage *dmsg);
private:
TQT_DBusMessagePrivate *d;
};
#endif

@ -0,0 +1,52 @@
/* qdbusmessage.h TQT_DBusMessage private object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSMESSAGE_P_H
#define TQDBUSMESSAGE_P_H
#include <tqstring.h>
#include "tqdbusatomic.h"
#include "tqdbuserror.h"
struct DBusMessage;
class TQT_DBusMessagePrivate
{
public:
TQT_DBusMessagePrivate(TQT_DBusMessage *qq);
~TQT_DBusMessagePrivate();
TQString path, interface, member, service, sender;
TQT_DBusError error;
DBusMessage *msg;
DBusMessage *reply;
TQT_DBusMessage *q;
int type;
int timeout;
// FIXME-QT4 TQAtomic ref;
Atomic ref;
};
#endif

@ -0,0 +1,372 @@
/* qdbusobject.h DBUS service object interface
*
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSOBJECT_H
#define TQDBUSOBJECT_H
/**
* @page dbusservice Providing services over D-Bus
*
* Contents:
* - @ref dbusservice-introduction
* - @ref dbusservice-example
* - @ref dbusservice-requestname
* - @ref dbusservice-registerobjects
* - @ref dbusservice-interfaces
*
* @section dbusservice-introduction Introduction
*
* The TQt3 bindings do not support autogeneration of service objects yet. In
* order to provide interfaces over D-Bus, an application has to implement the
* TQT_DBusObjectBase interface and register an instance of the resulting class
* with the TQT_DBusConnection.
*
* @section dbusservice-example A simple D-Bus client example
*
* @code
* #include <dbus/tqdbusconnection.h>;
* #include <dbus/tqdbusobject.h>;
*
* class TQStringList;
*
* class TestService : public TQT_DBusObjectBase
* {
* public:
* TestService(const TQT_DBusConnection& connection);
* virtual ~TestService();
*
* protected:
* virtual bool handleMethodCall(const TQT_DBusMessage& message);
*
* private:
* TQT_DBusConnection m_connection;
*
* private:
* TQStringList sortStrings(const TQStringList& list);
* };
* @endcode
* @code
*
* #include <tqstringlist.h>;
*
* #include <dbus/tqdbuserror.h>;
* #include <dbus/tqdbusmessage.h>;
*
* TestService::TestService(const TQT_DBusConnection& connection) : m_connection(connection)
* {
* m_connection.registerObject("/ListSorter", this);
* }
*
* TestService::~TestService()
* {
* m_connection.unregisterObject("/ListSorter");
* }
*
* // return false to let D-Bus send a standard error message that the method is unknown
*
* bool TestService::handleMethod(const TQT_DBusMessage& message)
* {
* if (message.interface() != "org.example.Sort") return false;
*
* if (message.member() == "Strings")
* {
* // check parameters
*
* if (message.count() != 1 || message[0].type() != TQT_DBusData::List)
* {
* // method signature not what we expected
*
* TQT_DBusError error = TQT_DBusError::stdInvalidArgs(
* "Expected one argument of type array of string");
*
* TQT_DBusMessage reply = TQT_DBusMessage::methodError(message, error);
*
* // send error
*
* m_connection.send(reply);
*
* // tell D-Bus we did handle the call
*
* return true;
* }
*
* // call implementation
*
* TQStringList result = sortStrings(message[0].toTQStringList());
*
* // prepare reply
*
* TQT_DBusMessage reply = TQT_DBusMessage::methodReply(message);
*
* reply << TQT_DBusData::fromList(result);
*
* // send reply
*
* m_connection.send(reply);
*
* // tell D-Bus we did handle the call
*
* return true;
* }
*
* return false;
* }
*
* TQStringList TestService::sortStrings(const TQStringList& list)
* {
* TQStringList result = list;
*
* result.sort();
*
* return result;
* }
* @endcode
* @code
* int main(int argc, char** argv)
* {
* TQApplication app(argc, argv, false);
*
* TQT_DBusConnection connection = TQT_DBusConnection::sessionBus();
* if (!connection.isConnected())
* qFatal("Cannot connect to session bus");
*
* // try to get a specific service name
* if (!connection.requestName("org.example.SortService"))
* {
* qWarning("Requesting name 'org.example.SortService' failed. "
* "Will only be addressable through unique name '%s'",
* connection.uniqueName().local8Bit().data());
* }
* else
* {
* qDebug("Requesting name 'org.example.SortService' successfull");
* }
*
* TestService service(connection);
*
* return app.exec();
* }
* @endcode
*
* @section dbusservice-requestname Requesting service name
*
* When an application connects to D-Bus it gets a unique name generated by
* the bus daemon.
*
* However, an application providing service will often want to be reachable
* under a fixed name, like a webserver being reachable through a domain name
* independent from its actual IP address.
* See section @ref dbusconventions-servicename for details on service names.
*
* In order to get such a specific name an application has to request it
* using TQT_DBusConnection::requestName()
*
* The example above request @c "org.example.SortService" but continues with
* the default unique name in the case some other application is currently
* owning that name.
*
* @section dbusservice-registerobjects Registering objects
*
* To make service objects available to other applications on the same
* bus the application has to register the objects instances with the
* connection to the bus using TQT_DBusConnection::registerObject()
*
* Registering means to specify an object path where the object will be
* located, i.e. how it can be unambiguously be addressed in method calls.
* See section @ref dbusconventions-objectpath for details on object paths.
*
* If the applications has introspectable objects it is recommended to
* register an introspectable root object, i.e. using @c "/" as the path, so
* other applications have a common place to start asking for introspection
* data.
*
* In the example above a service object providing sorting services on lists is
* registered on the path @c "/ListSorter"
*
* @section dbusservice-interfaces Service interfaces
*
* D-Bus methods and signals of a service object a grouped into interfaces.
*
* See section @ref dbusconventions-interfacename for details on interface
* naming.
*
* An object can implement any number of interfaces, for example the interface
* for the functionality it wants to provide and a D-Bus standard interface like
* @c "org.freedesktop.DBus.Introspectable" for providing an XML description of
* all its interfaces.
*
*
* The service object of the example above implements just one interface
* @c "org.example.Sort" and its handleMethodCall() explicitly checks all
* received messages and rejects any messsage not sent to this particular
* interface by returning @c false and thus telling the D-Bus layer to
* generate a standard error response.
*
* Multiple interfaces can of course be directly implemented in one C++ class,
* however it might sometimes be wise to delegate calls for different
* interfaces to different implementations:
* @code
* class Interface1 : public TQT_DBusObjectBase
* {
* public:
* Interface1(const TQT_DBusConnection&);
*
* protected:
* virtual bool handleMethodCall(const TQT_DBusMessage&);
* };
*
* class Interface2 : public TQT_DBusObjectBase
* {
* public:
* Interface2(const TQT_DBusConnection&);
*
* protected:
* virtual bool handleMethodCall(const TQT_DBusMessage&);
* };
*
* class MultiInterfaceService : public TQT_DBusObjectBase
* {
* public:
* MultiInterfaceService(const TQT_DBusConnection&);
*
* protected:
* virtual bool handleMethodCall(const TQT_DBusMessage&);
*
* private:
* TQMap<TQString, TQT_DBusObjectBase*> m_interfaces;
* };
*
* MultiInterfaceService::MultiInterfaceService(const TQT_DBusConnection& connection)
* {
* m_interfaces.insert("org.example.Interface1", new Interface1(connection));
* m_interfaces.insert("org.example.Interface2", new Interface2(connection));
* }
*
* bool MultiInterfaceService::handleMethodCall(const TQT_DBusMessage& message)
* {
* // delegate call to its interface handler
* TQT_DBusObjectBase* handler = m_interfaces[message.interface()];
* if (handler != 0)
* return delegateMethodCall->(message, handler);
* else
* return false; // no such interface
* }
* @endcode
*/
/**
* @include example-service.h
* @example example-service.cpp
*/
#include "tqdbusmacros.h"
class TQT_DBusMessage;
/**
* @brief Base interface for D-Bus service objects
*
* In order to register a service object with the TQT_DBusConnection it needs to
* implement the interface specified by this class.
*
* The connection will forward all method calls that have a path equivalent
* to the path the service object was registered with to the object's
* handleMethodCall() method. See TQT_DBusConnection::registerObject()
*
* If for some reason, e.g. the call is not meant for this interface, or the
* method is unknown, the implementation can just return @c false and the
* connection will handle the rest.
*
* See section @ref dbusservice for documentation on how to use TQT_DBusObjectBase
*/
class TQDBUS_EXPORT TQT_DBusObjectBase
{
friend class TQT_DBusConnectionPrivate;
public:
/**
* @brief Destroys the object
*/
virtual ~TQT_DBusObjectBase() {}
protected:
/**
* @brief Method call entry point
*
* This method has to be implemented to handle method calls sent to the
* service object.
* An object implementation can handle all its interfaces in one class or
* again forward the method call to interface implementators.
*
* If for some reason, e.g. the call is not meant for this interface, or
* the method is unknown, the implementation can just return @c false and
* the connection will handle the rest.
*
* If an error occurs during the method call, e.g. the number of parameters
* or their types are not what would be expected, the service object
* should reply with a TQT_DBusMessage of type TQT_DBusMessage::ErrorMessage
* which in turn should include the D-Bus error describing the problem.
* See TQT_DBusConnection::send() for sending reply messages.
*
* See TQT_DBusMessage::methodError() and TQT_DBusMessage::methodReply() on
* how to create suitable reply messages for the given method call.
*
* @param message the method call to handle
*
* @return @c true if the message can be handled independent if handling
* resulted in an error. In this case implementations should an
* error reply. Returns @c false only if interface or method are
* unknown
*/
virtual bool handleMethodCall(const TQT_DBusMessage& message) = 0;
/**
* @brief Delegate a method call to another object
*
* When a service object is built as a collection of separated interface
* class instances, i.e. each interface of the object is implemented in
* its own TQT_DBusObjectBase subclass and the main object just wanst to pass
* on the method calls to the respective interface implementations, it
* can do so by calling this base class method.
*
* Since it is a method of the base class, it can call the otherwise
* protected handleMethodCall() of the interface implementor.
*
* See @ref dbusservice-interfaces for an example.
*
* @param message the method call to delegate
* @param delegate the object which should handle the call instead
*
* @return @c true if the message can be handled independent if handling
* resulted in an error. In this case implementations should an
* error reply. Returns @c false only if interface or method are
* unknown
*
*/
bool delegateMethodCall(const TQT_DBusMessage& message, TQT_DBusObjectBase* delegate)
{
return delegate->handleMethodCall(message);
}
};
#endif

@ -0,0 +1,79 @@
/* qdbusobjectpath.cpp DBUS object path data type
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbusobjectpath.h"
TQT_DBusObjectPath::TQT_DBusObjectPath() : TQCString()
{
}
TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& other) : TQCString(static_cast<const TQCString&>(other))
{
}
TQT_DBusObjectPath::TQT_DBusObjectPath(const TQCString& other) : TQCString(static_cast<const TQCString&>(other))
{
}
TQT_DBusObjectPath::TQT_DBusObjectPath(const TQT_DBusObjectPath& tqparentNode,
const TQCString& nodeName)
: TQCString(static_cast<const TQCString&>(tqparentNode))
{
if (tqparentNode.length() != 1) append("/");
append(nodeName);
}
bool TQT_DBusObjectPath::isValid() const
{
return (validate(*this) == -1);
}
TQT_DBusObjectPath TQT_DBusObjectPath::tqparentNode() const
{
if (length() == 1) return TQT_DBusObjectPath();
int index = tqfindRev('/');
if (index == -1) return TQT_DBusObjectPath();
if (index == 0) return left(1);
return left(index);
}
int TQT_DBusObjectPath::validate(const TQCString& path)
{
if (path.isEmpty()) return 0;
if (path[0] != '/') return 0;
// TODO add additional checks
uint len = path.length();
// only root node allowed to end in slash
if (path[len - 1] == '/' && len > 1) return (len - 1);
return -1;
}

@ -0,0 +1,118 @@
/* qdbusobjectpath.h DBUS object path data type
*
* Copyright (C) 2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSOBJECTPATH_H
#define TQDBUSOBJECTPATH_H
#include <tqcstring.h>
/**
* @brief Class for representing D-Bus object paths
*
* This data type is necessary to correctly represent object paths in the
* context of D-Bus messages, since normal strings have a different D-Bus
* signature than object paths.
*
* @see @ref dbusconventions-objectpath
*/
class TQT_DBusObjectPath : public TQCString
{
public:
/**
* @brief Creates an empty and invalid object path
*/
TQT_DBusObjectPath();
/**
* @brief Creates copy of the given @p other object path
*
* @param other the object path to copy
*/
TQT_DBusObjectPath(const TQT_DBusObjectPath& other);
/**
* @brief Creates copy of the given @p other object path
*
* @param other the object path to copy
*/
TQT_DBusObjectPath(const TQCString& other);
/**
* @brief Creates an object path for an object as a child of the tqparent node
*
* This is basically like specifying a directory and a file name to create
* the file's full path.
*
* Example:
* @code
* TQT_DBusObjectPath rootNode("/"); // => "/"
*
* TQT_DBusObjectPath childNod(rootNode, "child"); // => "/child"
*
* TQT_DBusObjectPath grandChildNode(childNode, "grandchild"); // => "/child/grandchild"
* @endcode
*
* @param tqparentNode the object path to create the child on
* @param nodeName the name of the child node
*/
TQT_DBusObjectPath(const TQT_DBusObjectPath& tqparentNode, const TQCString& nodeName);
/**
* @brief Returns whether the current content is considered a valid object path
*
* @note Calls validate() to perform a check on the current content
*
* @return \c true if the object's content describe a valid object path,
* otherwise @c false
*
* @see @ref dbusconventions-objectpath
*/
bool isValid() const;
/**
* @brief Returns the object path of this path's tqparent node
*
* This is basically like getting the directory of an file path
*
* @return the tqparent node's object path or an empty and invalid object
* if this is already the root node
*/
TQT_DBusObjectPath tqparentNode() const;
/**
* @brief Checks the given string for validity as a D-Bus object path
*
* See section @ref dbusconventions-objectpath for information on object
* path formatting.
*
* @param path the string to check
*
* @return @c -1 if the object path is valid, otherwise the index of the
* first violating character
*
* @see isValid()
*/
static int validate(const TQCString& path);
};
#endif

@ -0,0 +1,209 @@
/* qdbusproxy.cpp DBUS Object proxy
*
* Copyright (C) 2005 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbuserror.h"
#include "tqdbusconnection.h"
#include "tqdbusmessage.h"
#include "tqdbusproxy.h"
class TQT_DBusProxy::Private
{
public:
Private() : canSend(false) {}
~Private() {}
void checkCanSend()
{
canSend = !path.isEmpty() && !service.isEmpty() && !interface.isEmpty();
}
public:
TQT_DBusConnection connection;
TQString service;
TQString path;
TQString interface;
bool canSend;
TQT_DBusError error;
};
TQT_DBusProxy::TQT_DBusProxy(TQObject* tqparent, const char* name)
: TQObject(tqparent, (name ? name : "TQT_DBusProxy")),
d(new Private())
{
}
TQT_DBusProxy::TQT_DBusProxy(const TQT_DBusConnection& connection,
TQObject* tqparent, const char* name)
: TQObject(tqparent, (name ? name : "TQT_DBusProxy")),
d(new Private())
{
setConnection(connection);
}
TQT_DBusProxy::TQT_DBusProxy(const TQString& service, const TQString& path,
const TQString& interface, const TQT_DBusConnection& connection,
TQObject* tqparent, const char* name)
: TQObject(tqparent, (name ? name : "TQT_DBusProxy")),
d(new Private())
{
setConnection(connection);
d->service = service;
d->path = path;
d->interface = interface;
d->checkCanSend();
}
TQT_DBusProxy::~TQT_DBusProxy()
{
delete d;
}
bool TQT_DBusProxy::setConnection(const TQT_DBusConnection& connection)
{
d->connection.disconnect(this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
d->connection = connection;
return d->connection.connect(this, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
}
const TQT_DBusConnection& TQT_DBusProxy::connection() const
{
return d->connection;
}
void TQT_DBusProxy::setService(const TQString& service)
{
d->service = service;
d->checkCanSend();
}
TQString TQT_DBusProxy::service() const
{
return d->service;
}
void TQT_DBusProxy::setPath(const TQString& path)
{
d->path = path;
d->checkCanSend();
}
TQString TQT_DBusProxy::path() const
{
return d->path;
}
void TQT_DBusProxy::setInterface(const TQString& interface)
{
d->interface = interface;
d->checkCanSend();
}
TQString TQT_DBusProxy::interface() const
{
return d->interface;
}
bool TQT_DBusProxy::canSend() const
{
return d->canSend && d->connection.isConnected();
}
bool TQT_DBusProxy::send(const TQString& method, const TQValueList<TQT_DBusData>& params) const
{
if (!d->canSend || method.isEmpty() || !d->connection.isConnected())
return false;
TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path,
d->interface, method);
message += params;
return d->connection.send(message);
}
TQT_DBusMessage TQT_DBusProxy::sendWithReply(const TQString& method,
const TQValueList<TQT_DBusData>& params,
TQT_DBusError* error) const
{
if (!d->canSend || method.isEmpty() || !d->connection.isConnected())
return TQT_DBusMessage();
TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path,
d->interface, method);
message += params;
TQT_DBusMessage reply = d->connection.sendWithReply(message, &d->error);
if (error)
*error = d->error;
return reply;
}
int TQT_DBusProxy::sendWithAsyncReply(const TQString& method, const TQValueList<TQT_DBusData>& params)
{
if (!d->canSend || method.isEmpty() || !d->connection.isConnected())
return 0;
TQT_DBusMessage message = TQT_DBusMessage::methodCall(d->service, d->path,
d->interface, method);
message += params;
return d->connection.sendWithAsyncReply(message, this,
TQT_SLOT(handleAsyncReply(const TQT_DBusMessage&)));
}
TQT_DBusError TQT_DBusProxy::lastError() const
{
return d->error;
}
void TQT_DBusProxy::handleDBusSignal(const TQT_DBusMessage& message)
{
if (!d->path.isEmpty() && d->path != message.path())
return;
// only filter by service name if the name is a unique name
// because signals are always coming from a connection's unique name
// and filtering by a generic name would reject all signals
if (d->service.startsWith(":") && d->service != message.sender())
return;
if (!d->interface.isEmpty() && d->interface != message.interface())
return;
emit dbusSignal(message);
}
void TQT_DBusProxy::handleAsyncReply(const TQT_DBusMessage& message)
{
d->error = message.error();
emit asyncReply(message.replySerialNumber(), message);
}
#include "tqdbusproxy.moc"

@ -0,0 +1,584 @@
/* qdbusproxy.h DBUS Object proxy
*
* Copyright (C) 2005-2007 Kevin Krammer <kevin.krammer@gmx.at>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSPROXY_H
#define TQDBUSPROXY_H
/**
* @page dbusclient Using D-Bus as a client
*
* Contents:
* - @ref dbusclient-introduction
*
* - @ref dbusclient-example
*
* - @ref dbusclient-initialization
*
* - @ref dbusclient-methodcall
* - @ref dbusclient-synccall
* - @ref dbusclient-asynccall
*
* - @ref dbusclient-signals
* - @ref dbusclient-signals-example
*
* @section dbusclient-introduction Introduction
*
* While it is of course possible to just exchange D-Bus messages with a
* D-Bus service, it is a lot more comfortable to use TQT_DBusProxy.
*
* With TQT_DBusProxy you only need to specify the service object once, i.e.
* its D-Bus name, path and interface, and just provide the method and its
* parameters when initiating an invokation.
*
* Additionally the proxy transforms D-Bus signals from the proxy's peer
* (the D-Bus service object's interface it is associated with) to TQObject
* signal carrying the original signal's content.
*
* @section dbusclient-example A simple D-Bus client example
*
* @code
* #include <dbus/tqdbusconnection.h>
* #include <dbus/tqdbusmessage.h>
* #include <dbus/tqdbusproxy.h>
*
* int main()
* {
* // establish a connection to the session bus
*
* TQT_DBusConnection connection = TQT_DBusConnection::sessionBus();
* if (!connection.isConnected())
* qFatal("Failed to connect to session bus");
*
* // create a proxy object for method calls
*
* TQT_DBusProxy proxy(connection);
* proxy.setService("org.freedesktop.DBus"); // who we work with
* proxy.setPath("/org/freedesktop/DBus"); // which object inside the peer work with
* proxy.setInterface("org.freedesktop.DBus"); // which of its interfaces we will use
*
* // call the "ListNames" method. It returns an array of string, in TQt3 terms
* // a TQStringList, it expects no parameters
*
* TQValueList<TQT_DBusData> params;
* TQT_DBusMessage reply = proxy.sendWithReply("ListNames", params);
*
* if (reply.type() != TQT_DBusMessage::ReplyMessage)
* qFatal("Call failed");
*
* if (reply.count() != 1 || reply[0].type() != TQT_DBusData::List)
* qFatal("Unexpected reply");
*
* bool ok = false;
* TQStringList names = reply[0].toTQStringList(&ok);
*
* if (!ok) qFatal("Unexpected reply");
*
* for (TQStringList::iterator it = names.begin(); it != names.end(); ++it)
* {
* qDebug("%s", (*it).local8Bit().data());
* }
*
* return 0;
* }
* @endcode
*
* @section dbusclient-initialization Program initialization
*
* A connection to the bus is acquired using TQT_DBusConnection::sessionBus()
*
* Next, a proxy is created for the object @c "/org/freedesktop/DBus" with
* interface @c "org.freedesktop.DBus" on the service @c "org.freedesktop.DBus"
*
* This is a proxy for the message bus itself.
*
* @section dbusclient-methodcall Method invocation
*
* There are two choices for method invocation:
* - sychronous (blocking) calls
* - asynchronous (non-blocking) calls
*
* @subsection dbusclient-synccall Synchronous method calls
*
* As seen in the example code above, a synchronous method call can be achieved
* by TQT_DBusProxy::sendWithReply(). It sends a method call to the remote object,
* and blocks until reply is received. The outgoing arguments are specified as
* a list of TQT_DBusData.
*
* @subsection dbusclient-asynccall Asynchronous method calls
*
* To invoke a method asynchronously, connect the proxy's signal
* TQT_DBusProxy::asyncReply(int, const TQT_DBusMessage&) to a suitable slot like
* with any other TQt Signal-Slot connection.
*
* Then call TQT_DBusProxy::sendWithAsyncReply()
* It returns a numerical identifier of the call, so it can be related in the
* slot once the result is available.
*
* The slot's first argument is the reveived reply's call identifier as
* returned by the method call. The second parameter is the reply message
* similar to the one in the synchronous call.
*
* @note For asynchronous calls you'll need a running event loop, i.e. a
* TQApplication object and its exec() having been invoked.
*
* @section dbusclient-signals Connecting to D-Bus signals
*
* To receive D-BUS signals just connect to the TQT_DBusProxy's signal
* TQT_DBusProxy::dbusSignal(const TQT_DBusMessage&)
*
* It will be emitted whenever a D-Bus signal message is received from the peer
* object.
* Filtering of signals is based on the value set for @c service, @c path and
* @c interface
*
* @note Filtering for @c service will only happen if @c service is a unique
* D-Bus name, i.e. if it starts with a colon @c ":" since D-Bus signals
* carry the sender's unique name and filtering by a requested name
* would reject all signals
*
* Usually a proxy will be also be used to send to the peer object, thus having
* them all set. However if a proxy is only needed for signals, any of the
* three properties can be omitted (e.g. set to @c TQString() ), in which
* case only the available properties will be checked against the respective
* message field when deciding about dropping or emitting the message.
* See TQT_DBusProxy::handleDBusSignal()
*
* If you want all signal travelling on the bus, or apply filtering for
* different criteria, e.g. get all signals coming from interfaces starting
* with @c "org.", use @c TQT_DBusConnection::connect() instead.
* The signature of the slot stays the same.
*
* @subsection dbusclient-signals-example Signal example
*
* First declare a receiver class:
* @code
* class MyReceiver : public TQObject
* {
* TQ_OBJECT
* public slots:
* void handleDBusSignal(const TQT_DBusMessage&);
* };
* @endcode
* Then somewhere else in a source file:
* @code
* TQT_DBusConnection connection = TQT_DBusConnection::sessionBus();
*
* MyReceiver* receiver1 = new MyReceiver();
*
* connection.connect(receiver1, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
* @endcode
* @c receiver1 will get all signals on this connection
*
* @code
* TQT_DBusProxy* proxy = new TQT_DBusProxy(connection);
* proxy->setService("org.freedesktop.DBus"); // who we work with
* proxy->setPath("/org/freedesktop/DBus"); // which object inside the peer work with
* proxy->setInterface("org.freedesktop.DBus"); // which of its interfaces we will use
*
* MyReceiver* receiver2 = new MyReceiver();
*
* TQObject::connect(proxy, TQT_SIGNAL(dbusSignal(const TQT_DBusMessage&)),
* receiver2, TQT_SLOT(handleDBusSignal(const TQT_DBusMessage&)));
* @endcode
* @c receiver2 will only get signals coming from the proxy's peer interface
*/
/**
* @include example-client.h
* @example example-client.cpp
*/
#include <tqobject.h>
#include "tqdbusmacros.h"
class TQT_DBusConnection;
class TQT_DBusData;
class TQT_DBusError;
class TQT_DBusMessage;
template <class T> class TQValueList;
/**
* @brief Client interface to a remote service object
*
* TQT_DBusProxy provides a convenience interface for working with D-Bus services,
* or more precisely, interfaces of D-Bus service objects.
*
* A D-Bus service object is identified through the name of its host application
* on the bus and its path (logical location) within the host application.
* Such a service object can implement any number of interfaces, i.e. groups
* methods and signals, and can create a TQT_DBusProxy instance for every one
* your application needs to work with.
*
* See section @ref dbusclient for documentation on how to use TQT_DBusProxy
*/
class TQDBUS_EXPORT TQT_DBusProxy : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
/**
* @brief Creates a proxy without binding it to a service or connection
*
* This basic constructor allows to create a proxy and specify the peer
* object and interface later on.
*
* @param tqparent TQObject tqparent
* @param name TQObject name
*/
TQT_DBusProxy(TQObject* tqparent = 0, const char* name = 0);
/**
* @brief Creates a proxy on a given connection without binding it to a
* service
*
* Similar to the above constructor, it does not yet specify and details
* about the proxy's peer, but already specifies which connection to work
* on.
*
* This can be useful to monitor all signal on a connection without
* filtering for a specific peer.
*
* @param connection the D-Bus connection to work on
* @param tqparent TQObject tqparent
* @param name TQObject name
*/
TQT_DBusProxy(const TQT_DBusConnection& connection, TQObject* tqparent = 0,
const char* name = 0);
/**
* @brief Creates a proxy for a given peer on a given connection
*
* This creates a proxy for a specific peer object-interface combination
* It is equvalent to creating an "empty" proxy and calling setConnection(),
* setService(), setPath() and setInterface() manually.
*
* @param service the name the peer's host application uses on the bus
* @param path the peer object's path within its host application
* @param interface the interface to work with
* @param connection the D-Bus connection to work on
* @param tqparent TQObject tqparent
* @param name TQObject name
*/
TQT_DBusProxy(const TQString& service, const TQString& path,
const TQString& interface, const TQT_DBusConnection& connection,
TQObject* tqparent = 0, const char* name = 0);
/**
* @brief Destroys the proxy instance
*/
virtual ~TQT_DBusProxy();
/**
* @brief Sets the D-Bus connection to work on
*
* Disconnects from any previously used connection and connects
* to the new connection's signal distribution.
* If no peer information has been provided at creation time or through
* the other set methods, the instance's signal dbusSignal() will emit
* all signals received on the given connection.
*
* @param connection the D-Bus connection to work on
*
* @return @c true if connecting to the new connection's signal succeeded,
* @c false if it failed, e.g. if the connection is a "null"
* connection
*
* @see connection()
* @see setService()
* @see setPath()
* @see setInterface()
*/
bool setConnection(const TQT_DBusConnection& connection);
/**
* @brief Returns the currently used D-Bus connection
*
* @see setConnection()
*/
const TQT_DBusConnection& connection() const;
/**
* @brief Sets the peer's service name
*
* A non-empty service name is required if the proxy is to be used for
* method calls. See section @ref dbusconventions-servicename for details.
*
* If a string other than @c TQString() is set, it will be used to
* filter signals, i.e. a signal received by the proxy will only be emitted
* if the service name matches.
*
* @param service the peer's name on the bus
*
* @see service()
* @see setPath()
* @see setInterface()
*/
void setService(const TQString& service);
/**
* @brief Returns the peer's service name
*
* @return the peer object's service name
*
* @see setService()
*/
TQString service() const;
/**
* @brief Sets the peer's object path
*
* A non-empty object path is required if the proxy is to be used for
* method calls. See section @ref dbusconventions-objectpath for details.
*
* If a string other than @c TQString() is set, it will be used to
* filter signals, i.e. a signal received by the proxy will only be emitted
* if the object path matches.
*
* @param path the peer's object path inside its host application
* (logical address)
*
* @see path()
* @see setService()
* @see setInterface()
*/
void setPath(const TQString& path);
/**
* @brief Returns the peer's object path
*
* @return the peer object's path
*
* @see setPath()
*/
TQString path() const;
/**
* @brief Sets the name of the peer interface
*
* A non-empty interface name is required if the proxy is to be used for
* method calls. See section @ref dbusconventions-interfacename for
* details.
*
* If a string other than @c TQString() is set, it will be used to
* filter signals, i.e. a signal received by the proxy will only be emitted
* if the interface name matches.
*
* @param interface the peer's interface to work with
*
* @see interface()
* @see setService()
* @see setPath()
*/
void setInterface(const TQString& interface);
/**
* @brief Returns the name of the peer interface
*
* @return the peer object's interface
*
* @see setInterface()
*/
TQString interface() const;
/**
* @brief Returns whether the proxy can be used to send method calls
*
* The capabilitly to send method calls depends on having all necessary
* base information:
* - Service name, see setService()
* - Object path, see setPath()
* - Interface, see setInterface()
*
* and a working connection, see setConnection()
*
* @return @c true if method calls can be sent, @c false if any of the three
* base information is missing or if the connection is not connected
*
* @see send()
* @see sendWithReply()
* @see sendWithAsyncReply()
*/
bool canSend() const;
/**
* @brief Sends a method call to the peer object
*
* This is roughly equivalent to calling a C++ method with no return value
* or like ignoring the it.
*
* @param method the name of the method to invoke
* @param params the method parameters. Use an empty list if the method
* does not require parameters
*
* @return @c true if sending succeeded, @c false if sending failed,
* the method name was empty or any of the conditions for
* successfull sending as described for canSend() are not met
*
* @see lastError()
* @see sendWithReply()
* @see sendWithAsyncReply()
* @see @ref dbusconventions-membername
*/
bool send(const TQString& method, const TQValueList<TQT_DBusData>& params) const;
/**
* @brief Sends a method call to the peer object and waits for the reply
*
* This is roughly equivalent to calling a C++ method on a local object.
*
* @param method the name of the method to invoke
* @param params the method parameters. Use an empty list if the method
* does not require parameters
* @param error optional parameter to get any error directly
*
* @return a TQT_DBusMessage containing any return values of the invoked method.
* Will be an invalid message if an error occurs. The error can be
* accessed through the optional paramater @p error or through
* lastError()
*
* @see canSend()
* @see send()
* @see sendWithAsyncReply()
* @see @ref dbusconventions-membername
*/
TQT_DBusMessage sendWithReply(const TQString& method,
const TQValueList<TQT_DBusData>& params, TQT_DBusError* error = 0) const;
/**
* @brief Sends a method call to the peer object but does not wait for an
* answer
*
* This is roughly equivalent to calling a C++ method on a local TQt
* event loop driven object, where the result of the method call is
* delivered later through a signal.
*
* @note as with TQt's asychronous classes this needs a running event loop
*
* @param method the name of the method to invoke
* @param params the method parameters. Use an empty list if the method
* does not require parameters
*
* @return a serial number to easily identify the reply once it is received
* or 0 if the call is not possible, i.e. the method name is empty
* or any of the conditions for canSend() are not met
*
* @warning if a asynchronous call is followed by a synchronous call, e.g.
* using sendWithReply(), without returning to the event loop,
* is recommended to call TQT_DBusConnection::scheduleDispatch()
* after the synchronous call to make sure any reply received
* during the blocking call is delivered
*
* @see asyncReply()
* @see send()
* @see sendWithReply()
* @see @ref dbusconventions-membername
*/
int sendWithAsyncReply(const TQString& method, const TQValueList<TQT_DBusData>& params);
/**
* @brief Returns the last error seen by the proxy
*
* The last error can a connection error, e.g. sending a message failed due
* connection being lost, or the error of the last call to sendWithReply or
* the error of the last received asyncReply()
*
* @return the last dbus error seen by this proxy
*/
TQT_DBusError lastError() const;
signals:
/**
* @brief Signal emitted for D-Bus signals from the peer
*
* Signals received on the proxy's connection are filtered by
* handleDBusSignal() for all proxy properties that are not empty.
*
* @param message the signal's content
*
* @see TQT_DBusMessage::SignalMessage
*/
void dbusSignal(const TQT_DBusMessage& message);
/**
* @brief Signal emitted for received replies to asynchronous method calls
*
* If a method invoked by using sendWithAsyncReply() send a response, e.g.
* method return value or errors, this signal is emitted to notify the
* proxy's user.
*
* @param callID the method call's serial number as returned by
* sendWithAsyncReply()
* @param message the reply's content
*
* @see handleAsyncReply()
* @see TQT_DBusMessage::replySerialNumber()
*/
void asyncReply(int callID, const TQT_DBusMessage& message);
protected slots:
/**
* @brief Handles D-Bus signals received on the proxy's connection
*
* The base implementation checks each non-empty property, i.e. service
* name, object path and interface, with the respective field of the
* signal's D-Bus message.
*
* If all available matches succeed, the message is emitted by
* dbusSignal(), otherwise it is discarded.
*
* @note Filtering for @c service will only happen if @c service is a
* unique D-Bus name, i.e. if it starts with a colon @c ":" since
* D-Bus signals carry the sender's unique name and filtering by a
* requested name would reject all signals.
*
* @param message the D-Bus signal message as received
*
* @see TQT_DBusMessage::SignalMessage
*/
virtual void handleDBusSignal(const TQT_DBusMessage& message);
/**
* @brief Handles replies to asynchronous method calls
*
* The base implementation simply extracts the reply's error and makes
* it available for lastError(). It then emits asyncReply()
*
* @param message the D-Bus reply message as received
*
* @see TQT_DBusMessage::replySerialNumber()
*/
virtual void handleAsyncReply(const TQT_DBusMessage& message);
private:
class Private;
Private* d;
private:
TQT_DBusProxy(const TQT_DBusProxy&);
TQT_DBusProxy& operator=(const TQT_DBusProxy&);
};
#endif

@ -0,0 +1,60 @@
/* qdbusserver.cpp
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#include "tqdbusserver.h"
#include "tqdbusconnection_p.h"
TQT_DBusServer::TQT_DBusServer(const TQString &addr, TQObject *tqparent)
: TQObject(tqparent)
{
d = new TQT_DBusConnectionPrivate(this);
if (addr.isEmpty())
return;
d->setServer(dbus_server_listen(addr.utf8().data(), &d->error));
}
bool TQT_DBusServer::isConnected() const
{
return d->server && dbus_server_get_is_connected(d->server);
}
TQT_DBusError TQT_DBusServer::lastError() const
{
return d->lastError;
}
TQString TQT_DBusServer::address() const
{
TQString addr;
if (d->server) {
char *c = dbus_server_get_address(d->server);
addr = TQString::fromUtf8(c);
dbus_free(c);
}
return addr;
}
#include "tqdbusserver.moc"

@ -0,0 +1,53 @@
/* qdbusserver.h TQT_DBusServer object
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSSERVER_H
#define TQDBUSSERVER_H
#include "tqdbusmacros.h"
#include <tqobject.h>
class TQString;
class TQT_DBusConnectionPrivate;
class TQT_DBusError;
class TQDBUS_EXPORT TQT_DBusServer: public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
TQT_DBusServer(const TQString &address, TQObject *tqparent = 0);
bool isConnected() const;
TQT_DBusError lastError() const;
TQString address() const;
private:
TQT_DBusServer(const TQT_DBusServer&);
TQT_DBusServer& operator=(const TQT_DBusServer&);
TQT_DBusConnectionPrivate *d;
};
#endif

@ -0,0 +1,120 @@
/* qdbusvariant.h DBUS variant struct
*
* Copyright (C) 2005 Harald Fernengel <harry@kdevelop.org>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*/
#ifndef TQDBUSVARIANT_H
#define TQDBUSVARIANT_H
#include "tqdbusmacros.h"
#include "tqdbusdata.h"
#include <tqstring.h>
/**
* @brief Data type for representing a D-Bus variant
*
* When D-Bus methods or signal require that a paramater can have any of the
* D-Bus data types, a D-Bus variant can be used.
*
* Basically a D-Bus variant includes the actual data and a D-Bus data signature
* to allow a receiver to determine the contents.
*
* Since the TQT_DBusVariant's #value member will already be fully de-marshalled,
* a receiver using this bindings can savely ignore the signature if it doesn't
* need it for a different purpose (e.g. logging).
*
* However, when creating a TQT_DBusVariant object for sending, make sure the
* #signature member is correctly setup, for example by using the #value
* member's buildDBusSignature() method.
*
* @code
* TQT_DBusVariant variant;
*
* variant.value = TQT_DBusData::fromInt32(131719);
* variant.signature = variant.value.buildDBusSignature();
* @endcode
*/
class TQDBUS_EXPORT TQT_DBusVariant
{
public:
/**
* @brief Creates an empty variant object
*/
TQT_DBusVariant() {}
/**
* @brief Copies the given @p other variant object
*
* @param other the variant object to copy from
*/
TQT_DBusVariant(const TQT_DBusVariant& other)
{
signature = other.signature;
value = other.value;
}
/**
* @brief Checks if the given @p other variant is equal to this one
*
* @param other the variant object to compare with
*
* @return @c true if both #signature and #value are equal, otherwise
* @c false
*/
inline bool operator==(const TQT_DBusVariant& other) const
{
if (&other == this) return true;
return signature == other.signature && value == other.value;
}
/**
* @brief Checks if the given @p other variant is not equal to this one
*
* @param other the variant object to compare with
*
* @return @c true if either #signature or #value is different, otherwise
* @c false
*/
inline bool operator!=(const TQT_DBusVariant& other) const
{
if (&other == this) return false;
return signature != other.signature || value != other.value;
}
public:
/**
* @brief The D-Bus data signature of the data contained in #value
*
* @see TQT_DBusData::buildDBusSignature()
*/
TQString signature;
/**
* @brief The D-Bus data type to transport as a variant
*/
TQT_DBusData value;
};
#endif
Loading…
Cancel
Save