diff options
Diffstat (limited to 'kdelirc')
92 files changed, 9340 insertions, 0 deletions
diff --git a/kdelirc/AUTHORS b/kdelirc/AUTHORS new file mode 100644 index 0000000..c6474a8 --- /dev/null +++ b/kdelirc/AUTHORS @@ -0,0 +1,3 @@ +Code mostly by Gav Wood <gav@kde.org> +LIRC interface code adapted from Noatun/Infrared by Malte Starostik. + diff --git a/kdelirc/COPYING b/kdelirc/COPYING new file mode 100644 index 0000000..c13faf0 --- /dev/null +++ b/kdelirc/COPYING @@ -0,0 +1,340 @@ + 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 contains +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 contains 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 contains, 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., 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) 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. diff --git a/kdelirc/ChangeLog b/kdelirc/ChangeLog new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/kdelirc/ChangeLog diff --git a/kdelirc/Makefile.am b/kdelirc/Makefile.am new file mode 100644 index 0000000..bb18f1c --- /dev/null +++ b/kdelirc/Makefile.am @@ -0,0 +1,3 @@ + +SUBDIRS = icons kdelirc irkick kcmlirc profiles remotes + diff --git a/kdelirc/README b/kdelirc/README new file mode 100644 index 0000000..31af5d0 --- /dev/null +++ b/kdelirc/README @@ -0,0 +1,55 @@ +kdelirc +------- + +KDELIRC is a KDE frontend for the Linux Infrared Remote Control system. It has +two aims: + +1. Provide a control center module for configuration of: + a) Application bindings to remote control buttons. + b) Actual remote controls installed (i.e. lirc configuration). + +2. Provide a system-tray applet to act as a proxy between the LIRC system and + KDE (applications), in order to launch DCOP requests (and potentially + other IPC signals) to applications (and potentially collect/display + results). + +INSTALLATION + +Nothing but the normal ./configure && make && su -c "make install". + +SETUP + +For the KDELirc system to work properly, you *must* have lircd configured and +running. If you have already had a Lirc program running, then you most likely +have Lirc set up properly. If not, be sure that you have a correct kernel module +loaded for your IR receiver (1) and that the lircd program is running (2). + +You must also have some remote controls configured in "/etc/lircd.conf". Go to +the lircd website (www.lirc.org) for more information on this. + +(1) /sbin/lsmod | grep lirc +If you see some output, you have a lirc kernel module loaded (that's not to say +it's the right module for your hardware). + +(2) ps aux | grep -v grep | grep lircd +If you see some output, you have the lircd program running. This is good. + +DESIGN + +The design of the system is really quite simple---a control center module +modifies a centralised configuration file to determine what action(s) should +be taken on a remote control's button press. + +The same(?) module also provides a front-end for the input of /etc/lircd.conf, +necessary to specify remote controls to the LIRC system. An extra (standard +format XML-based) may be provided with the remote control description to give +less sucky (lower case, no spaces/symbols) names. + +The /etc/lircd.conf frontend has not yet been implemented, though all other +features are. + +The system tray applet interfaces with LIRC in order to catch key presses on +remote controls. It is then able to communicate with and potentially start +applications through DCOP. + +Gav Wood, 2003 (gav at kde dot org). diff --git a/kdelirc/README.profile-creation b/kdelirc/README.profile-creation new file mode 100644 index 0000000..95d9e78 --- /dev/null +++ b/kdelirc/README.profile-creation @@ -0,0 +1,145 @@ +How to give your KDE application IR support under KDE. +====================================================== + +by Gav Wood, 2003. + +Introduction +------------ + +All DCOP-using applications under KDE have basic lirc support, since KDELirc has +the ability to interface any button to any DCOP call. However, to give your +application the real professional touch when using it with KDELirc, I recommend +you create a profile for it. + +A profile tells KDELirc (and the user!) what the various DCOP calls do. +Essentially this is a kind of documentation for the DCOP calls. You don't have +to include all DCOP calls - just the ones that you feel would benefit end-users +the most (usually "interface adjusting" calls rather the "information gathering" +calls). + + +Method +------ + +1. DCOP + +The first thing to do is to give your application DCOP functionality. This is +*very* easy and essentially amounts to adding a declaration to each object you +want to give DCOP accessibility and adding an entry to your Makefile. I wont go +into it here as the KDE documentation already provides a suitable resource for +such information. + +Ensure you provide a full accessibility to your application's interface by DCOP, +and especially in the case of IR-interfacing, try not to have functions with too +many parameters, or with exotic types (stick to ints and QStrings where +necessary). + +2. Create a profile + +Having coded the necessary DCOP functionality into your application, the only +other thing to do is describe how it works to the user. This is done by means of +a .profile.xml document, examples of which may be found in the kdelirc/profiles +directory. A quick guide is given here: + +a) First create top level "profile" tags with the DCOP application id and KDE +service name (found in the .desktop file) as attributes of them: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + </profile> + +b) Inside populate with name and author information. If your application is not a +KUniqueApplication, you **must** declare this with an "instances" tag, giving the +attribute "unique" a value of "0" (it defaults to "1", a KUniqueApplication). You +may optionally describe the default behavior KDELirc should take should there be +more than one instance of the application, with the attribute "ifmulti" which may +take one of "dontsend" (do nothing if >1 instance), "sendtoone" (send call to one +arbitrarily chosen instance) and "sendtoall" (send to all instances). The default +is "dontsend", however, "sendtoone" may be the most useful in many circumstances. + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + </profile> + +c) Populate the profile with action tags, for each DCOP action you want to be +available to the user. Each action tag should have DCOP object name and function +prototype. + Several optional attrubutes to specify are the key-class (an identifier to +act as an abstract binding between remote controls and applications). There are +several defined; see the DTD files for a current list. The other options, repeat +and autostart are boolean specificers to tell whether the action should repeat +or automatically start the program by default. + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showint(short int)" + class="number" repeat="0" autostart="0"> + </action> + </profile> + +d) Give the action a name and comment: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showints(short int)" + class="number" repeat="0" autostart="0"> + <name>Show Integers</name> + <comment>Shows a configurable integer</comment> + </action> + </profile> + +e) Describe each argument with a comment and type attribute. Valid types are +found in the profile.dtd file. If you cant find the exact type, just use one +that is silently castable. You should declare a default value between the +default tags: + + <?xml version="1.0" ?> + <!DOCTYPE profile SYSTEM "profile.dtd"> + <profile id="myapp" servicename="My Application"> + <name>My Application</name> + <author>Me</author> + <instances unique="0" ifmulti="sendtoone"/> + <action objid="MyApp" prototype="void showints(short int)" + class="number" repeat="0" autostart="0"> + <name>Show Integers</name> + <comment>Shows a configurable integer</comment> + <argument type="int"> + <default>5</default> + <comment>The integer to be shown</comment> + </argument> + </action> + </profile> + +When you have created your profile.xml file, put in your project's main source +tree. + +3. Profile installation + +There is a data directory in KDE reserved for profiles such as these; it's path +is "$(kde_datadir)/profiles". These extra lines must therefore be added to your +Makefile.am in the directory of your profile.xml: + + profiledata_DATA = [YOURAPPHERE].profile.xml + profiledatadir = $(kde_datadir)/profiles + EXTRA_DIST = $(profiledata_DATA) + +(replace [YOURAPPHERE] with your application name---the prefix to your +profile.xml file.) + + +4. Finished + +That's it you're done! Your KDE application is now fully IR enabled. diff --git a/kdelirc/README.remote-creation b/kdelirc/README.remote-creation new file mode 100644 index 0000000..3582351 --- /dev/null +++ b/kdelirc/README.remote-creation @@ -0,0 +1,129 @@ +How to give your LIRC remote control KDELIRC functionality +========================================================== + +by Gav Wood, 2003. + +Introduction +------------ + +All LIRC-understandable remote controls automatically function in KDELirc. +However, to get the advanced (really cool) KDELirc stuff you'll need to create a +remote.xml file for your remote control. The files are simple and easy to create +so don't be put off. + +The function of the remote.xml file is to describe what the remote controls' +buttons do in a general manner and to provide free-form text names for them, +since LIRC only allows non-spaces, non-symbolic charecters in the remote control +definition files. + +When you're finished your remote.xml, you might want to send it to me +(gav at kde dot org) for inclusion in the distribution of KDELirc. It may soon +be possible to distribute the remote.xml files along with the lircd.conf files. + +Method +------ + +a) Start with the basic template and define the LIRC ID of the remote control. +The LIRC ID is most important, and must be the identifier (look for the line +"name <...>" after the "begin remote" line). put the text after "name" into "id" +attribute of the "remote" tag in the "lircd.conf" file ("/etc/lircd.conf"). + In addition to this, fill in the author and name tags with your name and the +"nice" name of the remote control. Any extra information you may wish to give it +(such as alternate names, multimedia bundles/system is comes with etc) may be +enclosed between optional information tags: + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <information>As bundled with ACME LinTV</information> + </remote> + +This would compliment a "lircd.conf" file: + + begin remote + name myremote + ... + end remote + +b) With the hard work out of the way, just start going though each button on the +remote control. For each button, make sure the "id" attribute is the same as in +the lircd.conf file. + For each (common) button, you might also want to specify the class, which will +help KDELirc match it to any application's action. For a list of all button +classes, look in the remote.dtd file which comes with KDELirc. If the class type +is one which encompasses many buttons, for example "number", then you should also +specify which number it is in the parameter attribute. Currently, this only +actually applies to "number" - all other classes are simple and do not require a +parameter attribute. + Note: If no "class" is given, it will default to the "id". In the unlikely +case that this is not what you want, simply define it to be null (class=""). + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <button id="num0" class="number" parameter="0"> + </button> + <button id="rec" class="record"> + </button> + </remote> + +This would compliment a "lircd.conf" file: + + begin remote + name myremote + ... + begin raw_codes + name num0 + ... + name rec + ... + end raw_codes + end remote + +c) The last thing to define in each of your buttons is the "nice" name. This may +be descriptive and use spaces, symbols and mixed case text, in a similar fashion +to the remote control's name. There is no need to copy the remote control's label +verbatim. If necessary expand the description to provide a readable, aethetically +pleasing label e.g. you should name the "CC" button "Closed Captions" or the "Rec" +button "Record". + + <?xml version="1.0" ?> + <!DOCTYPE remote SYSTEM "remote.dtd"> + + <remote id="myremote"> + <name>My Remote Control</name> + <author>Me</author> + <button id="num0" class="number" parameter="0"> + <name>0</name> + </button> + <button id="rec" class="record"> + <name>Record</name> + </button> + </remote> + + Note: The name of a button will automatically default to its "id", so you can +save yourself some time and effort with buttons which share the same name and id +by changing + + <button id="num0" class="number" parameter="0"> + <name>0</name> + </button> + +to the far less cluttered and simpler: + + <button id="num0" class="number" parameter="0"/> + +That's it - just save it as <id>.remote.xml, where <id> is the ID of the remote +control (*not* its name but the LIRC id!) and copy it to your KDE remotes data +directory (~/.kde/share/apps/remotes). + + You'll probably need to restart control center before the remote definition +is recognised. + +Gav Wood <gav at kde dot org>
\ No newline at end of file diff --git a/kdelirc/TODO b/kdelirc/TODO new file mode 100644 index 0000000..a7e1044 --- /dev/null +++ b/kdelirc/TODO @@ -0,0 +1,6 @@ +general: +* Take out kdedmodule_stub.h, install by default (KDE4) + +kcmlirc: + +irkick: diff --git a/kdelirc/icons/Makefile.am b/kdelirc/icons/Makefile.am new file mode 100644 index 0000000..8b53beb --- /dev/null +++ b/kdelirc/icons/Makefile.am @@ -0,0 +1,3 @@ +kdelirciconsdir = $(kde_datadir)/irkick/icons +kdelircicons_ICON = AUTO + diff --git a/kdelirc/icons/hi16-action-ledblue.png b/kdelirc/icons/hi16-action-ledblue.png Binary files differnew file mode 100644 index 0000000..f8c8df7 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledblue.png diff --git a/kdelirc/icons/hi16-action-ledgreen.png b/kdelirc/icons/hi16-action-ledgreen.png Binary files differnew file mode 100644 index 0000000..698c8d9 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledgreen.png diff --git a/kdelirc/icons/hi16-action-ledlightblue.png b/kdelirc/icons/hi16-action-ledlightblue.png Binary files differnew file mode 100644 index 0000000..e17bcef --- /dev/null +++ b/kdelirc/icons/hi16-action-ledlightblue.png diff --git a/kdelirc/icons/hi16-action-ledlightgreen.png b/kdelirc/icons/hi16-action-ledlightgreen.png Binary files differnew file mode 100644 index 0000000..a351f18 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledlightgreen.png diff --git a/kdelirc/icons/hi16-action-ledorange.png b/kdelirc/icons/hi16-action-ledorange.png Binary files differnew file mode 100644 index 0000000..f142bb6 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledorange.png diff --git a/kdelirc/icons/hi16-action-ledpurple.png b/kdelirc/icons/hi16-action-ledpurple.png Binary files differnew file mode 100644 index 0000000..7b76e5a --- /dev/null +++ b/kdelirc/icons/hi16-action-ledpurple.png diff --git a/kdelirc/icons/hi16-action-ledred.png b/kdelirc/icons/hi16-action-ledred.png Binary files differnew file mode 100644 index 0000000..c19d706 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledred.png diff --git a/kdelirc/icons/hi16-action-ledyellow.png b/kdelirc/icons/hi16-action-ledyellow.png Binary files differnew file mode 100644 index 0000000..6a33ed1 --- /dev/null +++ b/kdelirc/icons/hi16-action-ledyellow.png diff --git a/kdelirc/icons/hi32-action-ledblue.png b/kdelirc/icons/hi32-action-ledblue.png Binary files differnew file mode 100644 index 0000000..26189a2 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledblue.png diff --git a/kdelirc/icons/hi32-action-ledgreen.png b/kdelirc/icons/hi32-action-ledgreen.png Binary files differnew file mode 100644 index 0000000..4d1e191 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledgreen.png diff --git a/kdelirc/icons/hi32-action-ledlightblue.png b/kdelirc/icons/hi32-action-ledlightblue.png Binary files differnew file mode 100644 index 0000000..59dd0fb --- /dev/null +++ b/kdelirc/icons/hi32-action-ledlightblue.png diff --git a/kdelirc/icons/hi32-action-ledlightgreen.png b/kdelirc/icons/hi32-action-ledlightgreen.png Binary files differnew file mode 100644 index 0000000..656bae0 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledlightgreen.png diff --git a/kdelirc/icons/hi32-action-ledorange.png b/kdelirc/icons/hi32-action-ledorange.png Binary files differnew file mode 100644 index 0000000..a8f8608 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledorange.png diff --git a/kdelirc/icons/hi32-action-ledpurple.png b/kdelirc/icons/hi32-action-ledpurple.png Binary files differnew file mode 100644 index 0000000..c599800 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledpurple.png diff --git a/kdelirc/icons/hi32-action-ledred.png b/kdelirc/icons/hi32-action-ledred.png Binary files differnew file mode 100644 index 0000000..a135040 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledred.png diff --git a/kdelirc/icons/hi32-action-ledyellow.png b/kdelirc/icons/hi32-action-ledyellow.png Binary files differnew file mode 100644 index 0000000..36d8fc2 --- /dev/null +++ b/kdelirc/icons/hi32-action-ledyellow.png diff --git a/kdelirc/irkick/Makefile.am b/kdelirc/irkick/Makefile.am new file mode 100644 index 0000000..5479ac1 --- /dev/null +++ b/kdelirc/irkick/Makefile.am @@ -0,0 +1,42 @@ +SUBDIRS = icons + +bin_PROGRAMS = +lib_LTLIBRARIES = +noinst_LTLIBRARIES = libirkick_common.la +kdeinit_LTLIBRARIES = irkick.la + +CLEANFILES = dummy.cpp + +libirkick_common_la_LIBADD = $(LIB_KDECORE) $(LIB_KDEUI) $(LIB_KSYCOCA) ../kdelirc/libkdelirc.la +libirkick_common_la_SOURCES = main.cpp irkick.cpp irkick.skel irkick.stub klircclient.cpp + +libirkick_common_la_LDFLAGS = $(all_libraries) + +irkick_la_LIBADD = libirkick_common.la +irkick_la_SOURCES = dummy.cpp +irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version + +xdg_apps_DATA = irkick.desktop + +autostartdir = $(datadir)/autostart +autostart_DATA = irkick.desktop + +messages: + $(XGETTEXT) *.cpp -o $(podir)/irkick.pot + +dummy.cpp: + echo > dummy.cpp + +#kdedservicesdir = $(kde_servicesdir)/kded +#kdedservices_DATA = irkick.desktop +#lib_LTLIBRARIES = libkded_irkick.la +#libkded_irkick_la_SOURCES = irkick.cpp irkick.skel irkick.stub klircclient.cpp +#libkded_irkick_la_LDFLAGS = $(all_libraries) -module -avoid-version +#libkded_irkick_la_LIBADD = $(LIB_KDECORE) ../kdelirc/libkdelirc.la + +noinst_HEADERS = irkick.h klircclient.h irkick_stub.h + +INCLUDES = -I$(srcdir)/../kdelirc $(all_includes) + +KDE_ICON = AUTO +METASOURCES = AUTO diff --git a/kdelirc/irkick/hi16-app-irkick.png b/kdelirc/irkick/hi16-app-irkick.png Binary files differnew file mode 100644 index 0000000..65d7504 --- /dev/null +++ b/kdelirc/irkick/hi16-app-irkick.png diff --git a/kdelirc/irkick/hi22-app-irkick.png b/kdelirc/irkick/hi22-app-irkick.png Binary files differnew file mode 100644 index 0000000..fd09e86 --- /dev/null +++ b/kdelirc/irkick/hi22-app-irkick.png diff --git a/kdelirc/irkick/hi32-app-irkick.png b/kdelirc/irkick/hi32-app-irkick.png Binary files differnew file mode 100644 index 0000000..f283148 --- /dev/null +++ b/kdelirc/irkick/hi32-app-irkick.png diff --git a/kdelirc/irkick/icons/Makefile.am b/kdelirc/irkick/icons/Makefile.am new file mode 100644 index 0000000..307658e --- /dev/null +++ b/kdelirc/irkick/icons/Makefile.am @@ -0,0 +1,3 @@ +irkickiconsdir = $(kde_datadir)/irkick/icons +irkickicons_ICON = AUTO + diff --git a/kdelirc/irkick/icons/hi16-action-irkick.png b/kdelirc/irkick/icons/hi16-action-irkick.png Binary files differnew file mode 100644 index 0000000..65d7504 --- /dev/null +++ b/kdelirc/irkick/icons/hi16-action-irkick.png diff --git a/kdelirc/irkick/icons/hi16-action-irkickflash.png b/kdelirc/irkick/icons/hi16-action-irkickflash.png Binary files differnew file mode 100644 index 0000000..8c4e5d3 --- /dev/null +++ b/kdelirc/irkick/icons/hi16-action-irkickflash.png diff --git a/kdelirc/irkick/icons/hi16-action-irkickoff.png b/kdelirc/irkick/icons/hi16-action-irkickoff.png Binary files differnew file mode 100644 index 0000000..5498652 --- /dev/null +++ b/kdelirc/irkick/icons/hi16-action-irkickoff.png diff --git a/kdelirc/irkick/irkick.cpp b/kdelirc/irkick/irkick.cpp new file mode 100644 index 0000000..31ec93c --- /dev/null +++ b/kdelirc/irkick/irkick.cpp @@ -0,0 +1,336 @@ +/*************************************************************************** + irkick.cpp - Implementation of the main window + ------------------- + copyright : (C) 2002 by Gav Wood + email : gav@kde.org +***************************************************************************/ + +// This program is free software. + +#include <qwidget.h> +#include <qdialog.h> +#include <qtooltip.h> +#include <qregexp.h> +#include <qtimer.h> +#include <qevent.h> + +#include <kdeversion.h> +#include <kapplication.h> +#include <kaction.h> +#if !(KDE_VERSION_MINOR<=1 && KDE_VERSION_RELEASE<=5) +#include <kactioncollection.h> +#endif +#include <ksimpleconfig.h> +#include <ksystemtray.h> +#include <kiconloader.h> +#include <kpassivepopup.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <kdebug.h> +#include <klocale.h> +#include <kaboutdialog.h> +#include <kaboutkde.h> +#include <kwinmodule.h> +#include <kwin.h> +#include <khelpmenu.h> +#include <kglobal.h> +#include <kstdguiitem.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include "profileserver.h" +#include "irkick.h" + +void IRKTrayIcon::mousePressEvent(QMouseEvent *e) +{ + KSystemTray::mousePressEvent(new QMouseEvent(QEvent::MouseButtonPress, e->pos(), e->globalPos(), e->button() == LeftButton ? RightButton : e->button(), e->state())); +} + +IRKick::IRKick(const QCString &obj) : QObject(), DCOPObject(obj), npApp(QString::null) +{ + kapp->dcopClient()->setDefaultObject(obj); + theClient = new KLircClient(); + + theTrayIcon = new IRKTrayIcon(); + if(theClient->isConnected()) + { theTrayIcon->setPixmap(SmallIcon("irkick")); + QToolTip::add(theTrayIcon, i18n("KDE Lirc Server: Ready.")); + } + else + { theTrayIcon->setPixmap(SmallIcon("irkickoff")); + QToolTip::add(theTrayIcon, i18n("KDE Lirc Server: No infra-red remote controls found.")); + QTimer::singleShot(10000, this, SLOT(checkLirc())); + } + theFlashOff = new QTimer(theTrayIcon); + connect(theFlashOff, SIGNAL(timeout()), SLOT(flashOff())); + + theResetCount = 0; + slotReloadConfiguration(); + connect(theClient, SIGNAL(connectionClosed()), this, SLOT(slotClosed())); + connect(theClient, SIGNAL(remotesRead()), this, SLOT(resetModes())); + connect(theClient, SIGNAL(commandReceived(const QString &, const QString &, int)), this, SLOT(gotMessage(const QString &, const QString &, int))); + + theTrayIcon->contextMenu()->changeTitle(0, "IRKick"); + theTrayIcon->contextMenu()->insertItem(SmallIcon( "configure" ), i18n("&Configure..."), this, SLOT(slotConfigure())); + theTrayIcon->contextMenu()->insertSeparator(); + theTrayIcon->contextMenu()->insertItem(SmallIcon( "help" ), KStdGuiItem::help().text(), (new KHelpMenu(theTrayIcon, KGlobal::instance()->aboutData()))->menu()); + theTrayIcon->actionCollection()->action("file_quit")->disconnect(SIGNAL(activated())); + connect(theTrayIcon->actionCollection()->action("file_quit"), SIGNAL(activated()), SLOT(doQuit())); + + theTrayIcon->show(); +} + +IRKick::~IRKick() +{ + delete theTrayIcon; + for(QMap<QString,IRKTrayIcon *>::iterator i = currentModeIcons.begin(); i != currentModeIcons.end(); ++i) + if(*i) delete *i; +} + +void IRKick::slotClosed() +{ + theTrayIcon->setPixmap(SmallIcon("irkickoff")); + KPassivePopup::message("IRKick", i18n("The infrared system has severed its connection. Remote controls are no longer available."), SmallIcon("irkick"), theTrayIcon); + QTimer::singleShot(1000, this, SLOT(checkLirc())); +} + +void IRKick::checkLirc() +{ + if(!theClient->isConnected()) + if(theClient->connectToLirc()) + { KPassivePopup::message("IRKick", i18n("A connection to the infrared system has been made. Remote controls may now be available."), SmallIcon("irkick"), theTrayIcon); + theTrayIcon->setPixmap(SmallIcon("irkick")); + } + else + QTimer::singleShot(10000, this, SLOT(checkLirc())); +} + +void IRKick::flashOff() +{ + theTrayIcon->setPixmap(SmallIcon("irkick")); +} + +void IRKick::doQuit() +{ + KSimpleConfig theConfig("irkickrc"); + theConfig.setGroup("General"); + switch(KMessageBox::questionYesNoCancel(0, i18n("Should the Infrared Remote Control server start automatically when you begin KDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start"))) + { case KMessageBox::No: theConfig.writeEntry("AutoStart", false); break; + case KMessageBox::Yes: theConfig.writeEntry("AutoStart", true); break; + case KMessageBox::Cancel: return; + } + KApplication::kApplication()->quit(); +} + +void IRKick::resetModes() +{ + if(theResetCount > 1) + KPassivePopup::message("IRKick", i18n("Resetting all modes."), SmallIcon("irkick"), theTrayIcon); + if(!theResetCount) + allModes.generateNulls(theClient->remotes()); + + QStringList remotes = theClient->remotes(); + for(QStringList::iterator i = remotes.begin(); i != remotes.end(); ++i) + { currentModes[*i] = allModes.getDefault(*i).name(); + if(theResetCount && currentModeIcons[*i]) delete currentModeIcons[*i]; + currentModeIcons[*i] = 0; + } + updateModeIcons(); + theResetCount++; +} + +void IRKick::slotReloadConfiguration() +{ + // load configuration from config file + KSimpleConfig theConfig("irkickrc"); + allActions.loadFromConfig(theConfig); + allModes.loadFromConfig(theConfig); + if(currentModes.count() && theResetCount) + resetModes(); +} + +void IRKick::slotConfigure() +{ + KApplication::startServiceByDesktopName("kcmlirc"); +} + +void IRKick::updateModeIcons() +{ + for(QMap<QString,QString>::iterator i = currentModes.begin(); i != currentModes.end(); ++i) + { Mode mode = allModes.getMode(i.key(), i.data()); + if(mode.iconFile().isNull() || mode.iconFile().isEmpty()) + { if(currentModeIcons[i.key()]) + { delete currentModeIcons[i.key()]; + currentModeIcons[i.key()] = 0; + } + } + else + { if(!currentModeIcons[i.key()]) + { currentModeIcons[i.key()] = new IRKTrayIcon(); + currentModeIcons[i.key()]->show(); + currentModeIcons[i.key()]->contextMenu()->changeTitle(0, mode.remoteName()); + currentModeIcons[i.key()]->actionCollection()->action("file_quit")->setEnabled(false); + } + currentModeIcons[i.key()]->setPixmap(KIconLoader().loadIcon(mode.iconFile(), KIcon::Panel)); + QToolTip::add(currentModeIcons[i.key()], mode.remoteName() + ": <b>" + mode.name() + "</b>"); + } + } +} + +bool IRKick::getPrograms(const IRAction &action, QStringList &programs) +{ + DCOPClient *theDC = KApplication::dcopClient(); + programs.clear(); + + if(action.unique()) + { if(theDC->isApplicationRegistered(action.program().utf8())) + programs += action.program(); + } + else + { + QRegExp r = QRegExp("^" + action.program() + "-(\\d+)$"); + // find all instances... + QCStringList buf = theDC->registeredApplications(); + for(QCStringList::iterator i = buf.begin(); i != buf.end(); ++i) + { + QString program = QString::fromUtf8(*i); + if(program.contains(r)) + programs += program; + } + if(programs.size() > 1 && action.ifMulti() == IM_DONTSEND) + return false; + else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOTOP) + { QValueList<WId> s = KWinModule().stackingOrder(); + // go through all the (ordered) window pids + for(QValueList<WId>::iterator i = s.fromLast(); i != s.end(); i--) + { int p = KWin::info(*i).pid; + QString id = action.program() + "-" + QString().setNum(p); + if(programs.contains(id)) + { programs.clear(); + programs += id; + break; + } + } + while(programs.size() > 1) programs.remove(programs.begin()); + } + else if(programs.size() > 1 && action.ifMulti() == IM_SENDTOBOTTOM) + { QValueList<WId> s = KWinModule().stackingOrder(); + // go through all the (ordered) window pids + for(QValueList<WId>::iterator i = s.begin(); i != s.end(); ++i) + { int p = KWin::info(*i).pid; + QString id = action.program() + "-" + QString().setNum(p); + if(programs.contains(id)) + { programs.clear(); + programs += id; + break; + } + } + while(programs.size() > 1) programs.remove(programs.begin()); + } + } + return true; +} + +void IRKick::executeAction(const IRAction &action) +{ + DCOPClient *theDC = KApplication::dcopClient(); + QStringList programs; + + if(!getPrograms(action, programs)) return; + + // if programs.size()==0 here, then the app is definately not running. + if(action.autoStart() && !programs.size()) + { QString sname = ProfileServer::profileServer()->getServiceName(action.program()); + if(!sname.isNull()) + { + KPassivePopup::message("IRKick", i18n("Starting <b>%1</b>...").arg(action.application()), SmallIcon("irkick"), theTrayIcon); + KApplication::startServiceByDesktopName(sname); + } + } + if(action.isJustStart()) return; + + if(!getPrograms(action, programs)) return; + + for(QStringList::iterator i = programs.begin(); i != programs.end(); ++i) + { const QString &program = *i; + if(theDC->isApplicationRegistered(program.utf8())) + { QByteArray data; QDataStream arg(data, IO_WriteOnly); + kdDebug() << "Sending data (" << program << ", " << action.object() << ", " << action.method().prototypeNR() << endl; + for(Arguments::const_iterator j = action.arguments().begin(); j != action.arguments().end(); ++j) + { kdDebug() << "Got argument..." << endl; + switch((*j).type()) + { case QVariant::Int: arg << (*j).toInt(); break; + case QVariant::CString: arg << (*j).toCString(); break; + case QVariant::StringList: arg << (*j).toStringList(); break; + case QVariant::UInt: arg << (*j).toUInt(); break; + case QVariant::Bool: arg << (*j).toBool(); break; + case QVariant::Double: arg << (*j).toDouble(); break; + default: arg << (*j).toString(); break; + } + } + theDC->send(program.utf8(), action.object().utf8(), action.method().prototypeNR().utf8(), data); + } + } +} + +void IRKick::gotMessage(const QString &theRemote, const QString &theButton, int theRepeatCounter) +{ + kdDebug() << "Got message: " << theRemote << ": " << theButton << " (" << theRepeatCounter << ")" << endl; + theTrayIcon->setPixmap(SmallIcon("irkickflash")); + theFlashOff->start(200, true); + if(!npApp.isNull()) + { + QString theApp = npApp; + npApp = QString::null; + // send notifier by DCOP to npApp/npModule/npMethod(theRemote, theButton); + QByteArray data; QDataStream arg(data, IO_WriteOnly); + arg << theRemote << theButton; + KApplication::dcopClient()->send(theApp.utf8(), npModule.utf8(), npMethod.utf8(), data); + } + else + { + if(currentModes[theRemote].isNull()) currentModes[theRemote] = ""; + IRAItList l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton); + if(!currentModes[theRemote].isEmpty()) + l += allActions.findByModeButton(Mode(theRemote, ""), theButton); + bool doBefore = true, doAfter = false; + for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i) + if((**i).isModeChange() && !theRepeatCounter) + { // mode switch + currentModes[theRemote] = (**i).modeChange(); + Mode mode = allModes.getMode(theRemote, (**i).modeChange()); + updateModeIcons(); + doBefore = (**i).doBefore(); + doAfter = (**i).doAfter(); + break; + } + + for(int after = 0; after < 2; after++) + { if(doBefore && !after || doAfter && after) + for(IRAItList::const_iterator i = l.begin(); i != l.end(); ++i) + if(!(**i).isModeChange() && ((**i).repeat() || !theRepeatCounter)) + { executeAction(**i); + } + if(!after && doAfter) + { l = allActions.findByModeButton(Mode(theRemote, currentModes[theRemote]), theButton); + if(!currentModes[theRemote].isEmpty()) + l += allActions.findByModeButton(Mode(theRemote, ""), theButton); + } + } + } +} + +void IRKick::stealNextPress(QString app, QString module, QString method) +{ + npApp = app; + npModule = module; + npMethod = method; +} + +void IRKick::dontStealNextPress() +{ + npApp = QString::null; +} + +#include "irkick.moc" diff --git a/kdelirc/irkick/irkick.desktop b/kdelirc/irkick/irkick.desktop new file mode 100644 index 0000000..406c214 --- /dev/null +++ b/kdelirc/irkick/irkick.desktop @@ -0,0 +1,116 @@ +[Desktop Entry] +Type=Service +Name=IRKick +Name[sv]=IRkick +GenericName=KDE LIRC Server +GenericName[ar]=خادم LIRC لكدى +GenericName[bg]=Сървър LIRC +GenericName[br]=Servijer LIRC KDE +GenericName[bs]=KDE LIRC server +GenericName[ca]=Servidor LIRC de KDE +GenericName[cs]=LIRC server pro KDE +GenericName[cy]=Gweinydd LIRC KDE +GenericName[da]=KDE LIRC-server +GenericName[de]=KDE LIRC-Server +GenericName[el]=ΕξυπηÏετητής LIRC του KDE +GenericName[eo]=KDE LIRC-servilo +GenericName[es]=Servidor LIRC de KDE +GenericName[et]=KDE LIRC server +GenericName[eu]=KDE LIRC Zerbitzaria +GenericName[fa]=KDE LIRC کارساز +GenericName[fi]=KDE:n LIRC-palvelin +GenericName[fr]=Serveur KDE LIRC +GenericName[ga]=Freastalaà LIRC KDE +GenericName[he]=שרת ×”-LIRC של KDE +GenericName[hu]=KDE LIRC szolgáltatás +GenericName[is]=KDE LIRC þjónn +GenericName[it]=Server LIRC di KDE +GenericName[ja]=KDE LIRC サーム+GenericName[ka]=KDE LIRC სერვერი +GenericName[kk]=KDE LIRC Ñервері +GenericName[km]=ម៉ាស៊ីន​បម្រើ KDE LIRC +GenericName[lt]=KDE LIRC serveris +GenericName[nb]=KDE LIRC-tjener +GenericName[nds]=KDE LIRC-Server +GenericName[ne]=KDE LIRC सरà¥à¤à¤° +GenericName[nl]=KDE LIRC-server +GenericName[nn]=KDE LIRC-tenar +GenericName[pa]=KDE LIRC ਸਰਵਰ +GenericName[pl]=Serwer LIRC dla KDE +GenericName[pt]=Servidor de LIRC do KDE +GenericName[pt_BR]=Servidor LIRC do KDE +GenericName[ru]=Сервер LIRC Ð´Ð»Ñ KDE +GenericName[sk]=KDE LIRC server +GenericName[sl]=Strežnik KDE LIRC +GenericName[sr]=KDE-ов LIRC Ñервер +GenericName[sr@Latn]=KDE-ov LIRC server +GenericName[sv]=KDE:s LIRC-server +GenericName[ta]=KDE LIRC சேவகன௠+GenericName[tr]=KDE LIRC Sunucusu +GenericName[uk]=Сервер LIRC Ð´Ð»Ñ KDE +GenericName[uz]=KDE LIRC serveri +GenericName[uz@cyrillic]=KDE LIRC Ñервери +GenericName[zh_CN]=KDE LIRC æœåŠ¡å™¨ +GenericName[zh_TW]=KDE LIRC 伺æœå™¨ + +X-KDE-Library=irkick +X-KDE-autostart-after=panel +X-KDE-StartupNotify=false +X-DCOP-ServiceType=Unique +X-KDE-autostart-condition=irkickrc:General:AutoStart:false +Categories=Qt;KDE;Utility;X-KDE-Utilities-Peripherals; + +Exec=irkick +Icon=irkick +DocPath=irkick/index.html +Comment=KDE Linux infrared remote control server. +Comment[ar]=خادم كدى للتØكّم عن بعد بالأشعة تØت الØمراء ÙÙŠ لينكس. +Comment[bg]=Сървър за управление на диÑтанционно уÑтройÑтво Ñ Ð¸Ð½Ñ„Ñ€Ð°Ñ‡ÐµÑ€Ð²ÐµÐ½Ð¸ лъчи +Comment[bs]=KDEov server za Linux infracrveno daljinsko upravljanje (Linux Infrared Remote Control). +Comment[ca]=Servidor de control remot per infrarojos de Linux KDE. +Comment[cs]=Server dálkového ovládánà pro KDE. +Comment[cy]=Gweinydd rheolydd pell isgoch Linux KDE +Comment[da]=KDE Linux infrarød fjernbetjeningsserver. +Comment[de]=KDE Linux Infrarot Fernsteuerungsserver. +Comment[el]=ΕξυπηÏετητής τηλεχειÏιστηÏίου υπεÏÏθÏων του Linux για το KDE. +Comment[es]=Servidor de control remoto por infrarrojos de KDE +Comment[et]=KDE Linuxi infrapuna kaugjuhtimise server. +Comment[eu]=KDE Linux infrasare urruneko aginte zerbitzaria. +Comment[fa]=KDE Linuxکارساز کنترل از راه دور مادون قرمز +Comment[fi]=KDE:n Linux infrapunalla toimivien kauko-ohjainten ohjauspalvelin. +Comment[fr]=Serveur de contrôle distant infrarouge sous Linux pour KDE. +Comment[ga]=Freastalaà KDE cianrialaithe infridhearg Linux +Comment[he]=שרת לשלט רחוק עבור KDE. +Comment[hi]=केडीई लिनकà¥à¤¸ इनà¥à¤«à¥à¤°à¤¾à¤°à¥‡à¤¡ रिमोट नियंतà¥à¤°à¤£ सरà¥à¤µà¤°. +Comment[hu]=KDE Linux szolgáltatás infravörös távirányÃtók kezeléséhez +Comment[is]=KDE Linux innrauða fjarstýringarstjórnborðið +Comment[it]=Server KDE per i telecomandi ad infrarossi +Comment[ja]=KDE Linux 赤外線リモートコントãƒãƒ¼ãƒ«ã‚µãƒ¼ãƒ +Comment[ka]= KDE ლინუქსის ინფრáƒáƒ¬áƒ˜áƒ—ელი დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვის სერვერი +Comment[kk]=KDE Linux инфрақызыл порт арқылы баÑқару Ñервері. +Comment[km]=ម៉ាស៊ីន​បម្រើ​បញ្ជា KDE Linux infrared ពី​ចម្ងាយ ។ +Comment[lt]=KDE Linux infraraudonųjų spindulių sÄ…sajos nuotolinio valdymo serveris +Comment[nb]=KDE Linux-tjener for infrarød fjernkontroll +Comment[nds]=KDE-Linux Infraroot-Feernbedeenkuntrullserver +Comment[ne]=KDE लिनकà¥à¤¸ अवरकà¥à¤¤ टाढाको नियनà¥à¤¤à¥à¤°à¤£ सरà¥à¤à¤° । +Comment[nl]=KDE-server voor infrarood-afstandsbediening. +Comment[nn]=KDE-tenar for infraraud fjernkontroll. +Comment[pa]=KDE ਲੀਨਕਸ ਇੰਫਰਾਰੈੱਡ ਰਿਮੋਟ ਕੰਟਰੋਲ ਸਰਵਰ ਹੈ। +Comment[pl]=Serwer obsÅ‚ugi pilotów dla KDE. +Comment[pt]=Servidor de comandos à distância por infravermelhos do KDE. +Comment[pt_BR]=servidor de controle infra-vermelho do Linux no KDE +Comment[ro]=Server de control al telecomenziilor în infraroÅŸu +Comment[ru]=Сервер ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ KDE через инфракраÑный порт. +Comment[sk]=KDE server pre infraÄervené vzdialené ovládanie pre Linux. +Comment[sl]=Strežnik KDE Linux za infrardeÄi daljninski upravljalnik +Comment[sr]=KDE-ов Ñервер за контролу инфрацрвених даљинÑких управљача у Linux-у. +Comment[sr@Latn]=KDE-ov server za kontrolu infracrvenih daljinskih upravljaÄa u Linux-u. +Comment[sv]=Infraröd fjärrkontrollserver +Comment[ta]=கேடிஇ லினகà¯à®¸à¯ அகசà¯à®šà®¿à®µà®ªà¯à®ªà¯ கதிர௠தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®Ÿà¯ சேவகன௠+Comment[tg]=ХидматраÑони идоракунии дурдаÑти инфраÑурхи KDE Linux. +Comment[tr]=KDE Linux kızılötesi uzaktan kontrol sunucusu. +Comment[uk]=Сервер диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ñ–Ð½Ñ„Ñ€Ð°Ñ‡ÐµÑ€Ð²Ð¾Ð½Ð¸Ð¼Ð¸ приÑтроÑми Ð´Ð»Ñ Linux та KDE. +Comment[uz]=Infraqizil nur bilan masofadan boshqarish serveri +Comment[uz@cyrillic]=Инфрақизил нур билан маÑофадан бошқариш Ñервери +Comment[zh_CN]=KDE Linux 红外远程控制æœåŠ¡å™¨ã€‚ +Comment[zh_TW]=KDE Linux 紅外線é™æŽ§ä¼ºæœå™¨ã€‚ diff --git a/kdelirc/irkick/irkick.h b/kdelirc/irkick/irkick.h new file mode 100644 index 0000000..875d039 --- /dev/null +++ b/kdelirc/irkick/irkick.h @@ -0,0 +1,132 @@ +/*************************************************************************** + irkick.h - Interface of the main window + copyright : (C) 2002 by Gav Wood + email : gav@kde.org + +***************************************************************************/ + +// This program is free software. + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#ifndef __IRKICK_H +#define __IRKICK_H + +#include <qstring.h> + +#include <ksystemtray.h> +#include <kdedmodule.h> +#include <kaboutdata.h> + +#include <dcopobject.h> + +#include "modes.h" +#include "iractions.h" +#include "klircclient.h" + +class QMouseEvent; + +class IRKTrayIcon: public KSystemTray +{ + void mousePressEvent(QMouseEvent *e); + +public: + KPopupMenu* contextMenu() const { return KSystemTray::contextMenu(); } + KActionCollection* actionCollection() { return KSystemTray::actionCollection(); } + + IRKTrayIcon(QWidget *parent = 0, const char *name = 0): KSystemTray(parent, name) {} +}; + +class IRKick: public QObject, public DCOPObject +{ + Q_OBJECT + K_DCOP + + QString npApp, npModule, npMethod; + QMap<QString, QString> currentModes; + QMap<QString, IRKTrayIcon *> currentModeIcons; + IRActions allActions; + int theResetCount; + Modes allModes; + + IRKTrayIcon *theTrayIcon; + KAboutData *aboutData; + QTimer *theFlashOff; + + void updateModeIcons(); + +protected: + KLircClient *theClient; + +k_dcop: + /** + * Query status of connection. + * + * @returns true if connected to lircd. + */ + virtual bool isConnected() { return theClient->isConnected(); } + + /** + * Query status of remote list. + * + * Make sure this is true before calling remotes()/buttons(...). + * + * @returns true if up to date. + */ + virtual bool haveFullList() { return theClient->haveFullList(); } + + /** + * Retrieve list of remote controls. + * + * @returns said list. + */ + virtual const QStringList remotes() { return theClient->remotes(); } + + /** + * Retrieve list of buttons of a praticular remote control. + * + * @returns said list. + */ + virtual const QStringList buttons(QString theRemote) { return theClient->buttons(theRemote); } + + /** + * Sends next keypress to given application by DCOP. + * + * @param The receiving application. + * @param The receiving application module. + * @param The method name. Must have two QString parameters. + */ + virtual void stealNextPress(QString app, QString module, QString method); + + /** + * Cancels the proceedings of the previous stealNextPress call, if any. + */ + virtual void dontStealNextPress(); + + /** + * Reloads configuration from file(s) + */ + virtual void reloadConfiguration() { slotReloadConfiguration(); } + +private slots: + void gotMessage(const QString &theRemote, const QString &theButton, int theRepeatCounter); + void resetModes(); + void doQuit(); + void flashOff(); + void checkLirc(); + + void slotConfigure(); + void slotReloadConfiguration(); + void slotClosed(); +private: + void executeAction(const IRAction &action); + bool getPrograms(const IRAction &action, QStringList &populous); + +public: + IRKick(const QCString &obj); + virtual ~IRKick(); +}; + +#endif diff --git a/kdelirc/irkick/irkick.project b/kdelirc/irkick/irkick.project new file mode 100644 index 0000000..b486441 --- /dev/null +++ b/kdelirc/irkick/irkick.project @@ -0,0 +1,12 @@ +# KDE Config File +[Desktop Entry] +Encoding=UTF-8 +Type=Application +Exec=irkick -caption "%c" %i %m +Icon=irkick.png +DocPath=irkick/index.html +Comment= +Comment[de]= +Terminal=0 +Name=IRKick +Name[de]=IRKick diff --git a/kdelirc/irkick/kdedmodule_stub.h b/kdelirc/irkick/kdedmodule_stub.h new file mode 100644 index 0000000..5f248f8 --- /dev/null +++ b/kdelirc/irkick/kdedmodule_stub.h @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** DCOP Stub Definition created by dcopidl2cpp from kdedmodule.kidl +** +** WARNING! All changes made in this file will be lost! +** +*****************************************************************************/ + +/* This is a machine-generated file, and may be distributed under the GPL + licence, as described in kdelibs/COPYING. +*/ + +#ifndef __KDEDMODULE_STUB__ +#define __KDEDMODULE_STUB__ + +#include <dcopstub.h> +#include <qobject.h> +#include <dcopobject.h> +#include <dcopref.h> +#include <ksharedptr.h> + + +class KDEDModule_stub : virtual public DCOPStub +{ +public: + KDEDModule_stub( const QCString& app, const QCString& id ); + KDEDModule_stub( DCOPClient* client, const QCString& app, const QCString& id ); + explicit KDEDModule_stub( const DCOPRef& ref ); +protected: + KDEDModule_stub() : DCOPStub( never_use ) {}; +}; + + +#endif diff --git a/kdelirc/irkick/klircclient.cpp b/kdelirc/irkick/klircclient.cpp new file mode 100644 index 0000000..2876079 --- /dev/null +++ b/kdelirc/irkick/klircclient.cpp @@ -0,0 +1,241 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: (C) 2002 by Malte Starostik +// Adaption : Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <unistd.h> +#include <fcntl.h> +#include <cstring> +#include <sys/un.h> +#include <sys/socket.h> +#include <errno.h> + +#include <qwidget.h> +#include <qdialog.h> +#include <qtooltip.h> +#include <qsocket.h> +#include <qsocketnotifier.h> +#include <qfile.h> + +#include <kapplication.h> +#include <ksystemtray.h> +#include <kiconloader.h> +#include <kpassivepopup.h> +#include <kmessagebox.h> +#include <kpopupmenu.h> +#include <kdebug.h> +#include <klocale.h> +#include <kaboutdialog.h> +#include <kaboutkde.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include "klircclient.h" + + +KLircClient::KLircClient(QWidget *parent, const char *name) : QObject(parent, name), theSocket(0), listIsUpToDate(false) +{ + connectToLirc(); +} + +bool KLircClient::connectToLirc() +{ + int sock = ::socket(PF_UNIX, SOCK_STREAM, 0); + if(sock == -1) return false; + + sockaddr_un addr; + addr.sun_family = AF_UNIX; + strcpy(addr.sun_path, "/dev/lircd"); + if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) + { ::close(sock); + // in case of mandrake... + strcpy(addr.sun_path, "/tmp/.lircd"); + if(::connect(sock, (struct sockaddr *)(&addr), sizeof(addr)) == -1) + { ::close(sock); + return false; + } + } + + theSocket = new QSocket; + theSocket->setSocket(sock); + connect(theSocket, SIGNAL(readyRead()), SLOT(slotRead())); + connect(theSocket, SIGNAL(connectionClosed()), SLOT(slotClosed())); + updateRemotes(); + return true; +} + +KLircClient::~KLircClient() +{ +// if(theSocket) + delete theSocket; +} + +void KLircClient::slotClosed() +{ + delete theSocket; + theSocket = 0; + emit connectionClosed(); +} + +const QStringList KLircClient::remotes() const +{ + QStringList remotes; + for(QMap<QString, QStringList>::ConstIterator i = theRemotes.begin(); i != theRemotes.end(); ++i) + remotes.append(i.key()); + remotes.sort(); + return remotes; +} + +const QStringList KLircClient::buttons(const QString &theRemote) const +{ + return theRemotes[theRemote]; +} + +void KLircClient::slotRead() +{ + while (theSocket->bytesAvailable()) + { + QString line = readLine(); + if (line == "BEGIN") + { + // BEGIN + // <command> + // [SUCCESS|ERROR] + // [DATA + // n + // n lines of data] + // END + line = readLine(); + if (line == "SIGHUP") + { + // Configuration changed + do line = readLine(); + while (!line.isEmpty() && line != "END"); + updateRemotes(); + return; + } + else if (line == "LIST") + { + // remote control list + if (readLine() != "SUCCESS" || readLine() != "DATA") + { + do line = readLine(); + while (!line.isEmpty() && line != "END"); + return; + } + QStringList remotes; + int count = readLine().toInt(); + for (int i = 0; i < count; ++i) + remotes.append(readLine()); + do line = readLine(); + while (!line.isEmpty() && line != "END"); + if (line.isEmpty()) + return; // abort on corrupt data + for (QStringList::ConstIterator it = remotes.begin(); it != remotes.end(); ++it) + sendCommand("LIST " + *it); + return; + } + else if (line.left(4) == "LIST") + { + // button list + if (readLine() != "SUCCESS" || readLine() != "DATA") + { + do line = readLine(); + while (!line.isEmpty() && line != "END"); + return; + } + QString remote = line.mid(5); + QStringList buttons; + int count = readLine().toInt(); + for (int i = 0; i < count; ++i) + { + // <code> <name> + QString btn = readLine().mid(17); + if(btn.isNull()) break; + if(btn.startsWith("'") && btn.endsWith("'")) + btn = btn.mid(1, btn.length() - 2); + buttons.append(btn); + } + theRemotes.insert(remote, buttons); + } + do line = readLine(); + while (!line.isEmpty() && line != "END"); + listIsUpToDate = true; + emit remotesRead(); + } + else + { + // <code> <repeat> <button name> <remote control name> + line.remove(0, 17); // strip code + int pos = line.find(' '); + if (pos < 0) return; + bool ok; + int repeat = line.left(pos).toInt(&ok, 16); + if (!ok) return; + line.remove(0, pos + 1); + + pos = line.find(' '); + if (pos < 0) return; + QString btn = line.left(pos); + if(btn.startsWith("'") && btn.endsWith("'")) + btn = btn.mid(1, btn.length() - 2); + line.remove(0, pos + 1); + + emit commandReceived(line, btn, repeat); + } + } +} + +void KLircClient::updateRemotes() +{ + listIsUpToDate = false; + theRemotes.clear(); + sendCommand("LIST"); +} + +bool KLircClient::isConnected() const +{ + if(!theSocket) return false; + return theSocket->state() == QSocket::Connected; +} + +bool KLircClient::haveFullList() const +{ + return listIsUpToDate; +} + +const QString KLircClient::readLine() +{ + if (!theSocket->canReadLine()) + { bool timeout; + // FIXME: possible race condition - + // more might have arrived between canReadLine and waitForMore + theSocket->waitForMore(500, &timeout); + if (timeout) + { // something's wrong. there ain't no line comin! + return QString::null; + } + } + QString line = theSocket->readLine(); + line.truncate(line.length() - 1); + return line; +} + +void KLircClient::sendCommand(const QString &command) +{ + QString cmd = command + "\n"; + theSocket->writeBlock(QFile::encodeName( cmd ), cmd.length()); +} + + +#include "klircclient.moc" diff --git a/kdelirc/irkick/klircclient.h b/kdelirc/irkick/klircclient.h new file mode 100644 index 0000000..ea5fa75 --- /dev/null +++ b/kdelirc/irkick/klircclient.h @@ -0,0 +1,114 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef KLIRCCLIENT_H +#define KLIRCCLIENT_H + +#include <qobject.h> +#include <qmap.h> +#include <qstring.h> +#include <qstringlist.h> + +class QSocket; +class QSocketNotifier; + +/** +@author Malte Starostik +@author Gav Wood +*/ + +class KLircClient: public QObject +{ + Q_OBJECT + +private: + struct lirc_config *theConfig; + QSocket *theSocket; + QSocketNotifier *theNotifier; + QMap<QString, QStringList> theRemotes; + bool listIsUpToDate; + + void updateRemotes(); + void sendCommand(const QString &command); + const QString readLine(); + +private slots: + void slotRead(); + void slotClosed(); + +signals: + /** + * Emitted when the list of controls / buttons was completely read + */ + void remotesRead(); + + /** + * Emitted when a IR command was received + * + * The arguments are the name of the remote control used, + * the name of the button pressed and the repeat counter. + * + * The signal is emitted repeatedly as long as the button + * on the remote control remains pressed. + * The repeat counter starts with 0 and increases + * every time this signal is emitted. + */ + void commandReceived(const QString &remote, const QString &button, int repeatCounter); + + /** + * Emitted when the Lirc connection is closed. + */ + void connectionClosed(); + +public: + /** + * Query status of connection. + * + * @returns true if connected to lircd. + */ + bool isConnected() const; + + /** + * Query status of remote list. + * + * Make sure this is true before calling remotes()/buttons(...). + * + * @returns true if up to date. + */ + bool haveFullList() const; + + /** + * Retrieve list of remote controls. + * + * @returns said list. + */ + const QStringList remotes() const; + + /** + * Retrieve list of buttons of a praticular remote control. + * + * @returns said list. + */ + const QStringList buttons(const QString &theRemote) const; + + /** + * Connects to lirc. + * + * @returns true if connection is made. + */ + bool connectToLirc(); + + KLircClient(QWidget *parent = 0, const char *name = 0); + ~KLircClient(); +}; + +#endif diff --git a/kdelirc/irkick/lo16-app-irkick.png b/kdelirc/irkick/lo16-app-irkick.png Binary files differnew file mode 100644 index 0000000..d142dff --- /dev/null +++ b/kdelirc/irkick/lo16-app-irkick.png diff --git a/kdelirc/irkick/lo32-app-irkick.png b/kdelirc/irkick/lo32-app-irkick.png Binary files differnew file mode 100644 index 0000000..5ffc180 --- /dev/null +++ b/kdelirc/irkick/lo32-app-irkick.png diff --git a/kdelirc/irkick/main.cpp b/kdelirc/irkick/main.cpp new file mode 100644 index 0000000..956d000 --- /dev/null +++ b/kdelirc/irkick/main.cpp @@ -0,0 +1,39 @@ +/*************************************************************************** + main.cpp - Implementation of the main window + ------------------- + copyright : (C) 2002 by Gav Wood + email : gav@kde.org +***************************************************************************/ + +// This program is free software. + +#include <klocale.h> +#include <kcmdlineargs.h> +#include <kwin.h> +#include <kaboutdata.h> +#include <kglobal.h> +#include <kdebug.h> +#include <kuniqueapplication.h> + +#include "irkick.h" + +extern "C" KDE_EXPORT int kdemain(int argc, char *argv[]) +{ + KAboutData *aboutData = new KAboutData("irkick", I18N_NOOP("IRKick"), VERSION, I18N_NOOP("The KDE Infrared Remote Control Server"), KAboutData::License_GPL, "(c) 2003, Gav Wood", 0, 0, "gav@kde.org"); + aboutData->addAuthor("Gav Wood", I18N_NOOP("Author"), "gav@kde.org", "http://www.indigoarchive.net/gav/"); + aboutData->addCredit("Malte Starostik", I18N_NOOP("Original LIRC interface code"), "malte.starostik@t-online.de"); + aboutData->addCredit("Dirk Ziegelmeier", I18N_NOOP("Ideas, concept code"), "dirk@ziegelmeier.net"); + aboutData->addCredit("Zsolt Rizsanyi", I18N_NOOP("Random patches"), "rizsanyi@myrealbox.com"); + aboutData->addCredit("Antonio Larrosa Jiménez", I18N_NOOP("Ideas"), "larrosa@kde.org"); + + KCmdLineArgs::init( argc, argv, aboutData ); + KUniqueApplication::addCmdLineOptions(); + KUniqueApplication app; + KGlobal::locale()->insertCatalogue( "kdelirc" ); + app.disableSessionManagement(); + IRKick *theIRKick = new IRKick("IRKick"); + + int ret = app.exec(); + delete theIRKick; + return ret; +} diff --git a/kdelirc/kcmlirc/Makefile.am b/kdelirc/kcmlirc/Makefile.am new file mode 100644 index 0000000..57bdef8 --- /dev/null +++ b/kdelirc/kcmlirc/Makefile.am @@ -0,0 +1,15 @@ +INCLUDES = -I../irkick -I$(srcdir)/../irkick -I$(srcdir)/../kdelirc $(all_includes) +METASOURCES = AUTO + +# Install this plugin in the KDE modules directory +kde_module_LTLIBRARIES = kcm_kcmlirc.la + +noinst_HEADERS = kcmlirc.h addaction.h addactionbase.h +kcm_kcmlirc_la_SOURCES = selectprofile.ui newmode.ui kcmlircbase.ui kcmlirc.cpp addactionbase.ui addaction.cpp kcmlirc.skel editactionbase.ui editmodebase.ui editmode.cpp editaction.cpp modeslist.cpp +kcm_kcmlirc_la_LIBADD = $(LIB_KDEUI) $(LIB_KFILE) ../kdelirc/libkdelirc.la +kcm_kcmlirc_la_LDFLAGS = -module -avoid-version $(all_libraries) -no-undefined + +xdg_apps_DATA = kcmlirc.desktop + +messages: rc.cpp + $(XGETTEXT) *.cpp *.h -o $(podir)/kcmlirc.pot diff --git a/kdelirc/kcmlirc/addaction.cpp b/kdelirc/kcmlirc/addaction.cpp new file mode 100644 index 0000000..1a3ecef --- /dev/null +++ b/kdelirc/kcmlirc/addaction.cpp @@ -0,0 +1,375 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * 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. * + ***************************************************************************/ + +#include <qregexp.h> +#include <qlabel.h> +#include <qradiobutton.h> +#include <qwidgetstack.h> +#include <qcheckbox.h> +#include <qbuttongroup.h> + +#include <kdebug.h> +#include <klineedit.h> +#include <klistview.h> +#include <kapplication.h> +#include <kmessagebox.h> +#include <knuminput.h> +#include <keditlistbox.h> +#include <klocale.h> + +#include <dcopclient.h> +#include <irkick_stub.h> + +#include "prototype.h" +#include "addaction.h" +#include "profileserver.h" +#include "remoteserver.h" + +AddAction::AddAction(QWidget *parent, const char *name, const Mode &mode): AddActionBase(parent, name), theMode(mode) +{ + connect(this, SIGNAL( selected(const QString &) ), SLOT( updateForPageChange() )); + connect(this, SIGNAL( selected(const QString &) ), SLOT( slotCorrectPage() )); + curPage = 0; + updateProfiles(); + updateButtons(); + updateObjects(); + updateProfileFunctions(); +} + +AddAction::~AddAction() +{ +} + + +void AddAction::slotNextParam() +{ + // TODO: go on to next parameter +} + +void AddAction::slotModeSelected() +{ + theSwitchMode->setChecked(true); +} + +void AddAction::slotCorrectPage() +{ + int lastPage = curPage; + curPage = indexOf(currentPage()); + + if(curPage == 2 && theUseProfile->isChecked()) + showPage(((QWizard *)this)->page(lastPage > 1 ? 1 : 3)); + if((curPage == 2 || curPage == 5) && theChangeMode->isChecked()) + showPage(((QWizard *)this)->page(lastPage > 1 ? 1 : 6)); + + if(curPage == 3 && theUseDCOP->isChecked()) + showPage(((QWizard *)this)->page(lastPage == 4 ? 2 : 4)); + + if(curPage == 4 && ( + (theUseDCOP->isChecked() && theFunctions->currentItem() && !Prototype(theFunctions->currentItem()->text(2)).count()) || + (theUseProfile->isChecked() && (theProfileFunctions->currentItem() && !theProfileFunctions->currentItem()->text(1).toInt() || theJustStart->isChecked())) + )) + showPage(((QWizard *)this)->page(lastPage == 5 ? (theUseDCOP->isChecked() ? 2 : 3) : 5)); +} + +void AddAction::requestNextPress() +{ + IRKick_stub("irkick", "IRKick").stealNextPress(DCOPClient::mainClient()->appId(), "KCMLirc", "gotButton(QString, QString)"); +} + +void AddAction::cancelRequest() +{ + IRKick_stub("irkick", "IRKick").dontStealNextPress(); +} + +void AddAction::updateButton(const QString &remote, const QString &button) +{ + if(theMode.remote() == remote) + { // note this isn't the "correct" way of doing it; really i should iterate throughg the items and try to find the item which when put through buttonMap[item] returns the current button name. but i cant be arsed. + theButtons->setCurrentItem(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + theButtons->ensureItemVisible(theButtons->findItem(RemoteServer::remoteServer()->getButtonName(remote, button), 0)); + } + else + KMessageBox::error(this, i18n( "You did not select a mode of that remote control. Please use %1, " + "or revert back to select a different mode." ).arg( theMode.remoteName() ), + i18n( "Incorrect Remote Control Detected" )); + + if(indexOf(currentPage()) == 1) + requestNextPress(); +} + +void AddAction::updateButtons() +{ + theButtons->clear(); + buttonMap.clear(); + IRKick_stub IRKick("irkick", "IRKick"); + QStringList buttons = IRKick.buttons(theMode.remote()); + for(QStringList::iterator j = buttons.begin(); j != buttons.end(); ++j) + buttonMap[new QListViewItem(theButtons, RemoteServer::remoteServer()->getButtonName(theMode.remote(), *j))] = *j; +} + +void AddAction::updateForPageChange() +{ + if(indexOf(currentPage()) == 1) requestNextPress(); else cancelRequest(); + switch(indexOf(currentPage())) + { case 0: break; + case 1: break; + case 2: break; + case 3: break; + case 4: break; + } + updateButtonStates(); +} + +void AddAction::updateButtonStates() +{ + switch(indexOf(currentPage())) + { case 0: setNextEnabled(currentPage(), theProfiles->currentItem() != 0 || !theUseProfile->isChecked()); break; + case 1: setNextEnabled(currentPage(), theButtons->currentItem() != 0); break; + case 2: setNextEnabled(currentPage(), theFunctions->currentItem() != 0); break; + case 3: setNextEnabled(currentPage(), theProfileFunctions->currentItem() != 0 || theJustStart->isChecked()); break; + case 4: setNextEnabled(currentPage(), true); break; + case 5: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), true); break; + case 6: setNextEnabled(currentPage(), false); setFinishEnabled(currentPage(), theModes->currentItem() || !theSwitchMode->isChecked()); break; + } +} + +const QStringList AddAction::getFunctions(const QString app, const QString obj) +{ + QStringList ret; + DCOPClient *theClient = KApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->remoteFunctions(app.utf8(), obj.utf8()); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + if( *i != "QCStringList interfaces()" && + *i != "QCStringList functions()" && + *i != "QCStringList objects()" && + *i != "QCStringList find(QCString)" ) + ret += QString::fromUtf8(*i); + return ret; +} + +void AddAction::updateProfiles() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfiles->clear(); + profileMap.clear(); + + QDict<Profile> dict = theServer->profiles(); + QDictIterator<Profile> i(dict); + for(; i.current(); ++i) + profileMap[new QListViewItem(theProfiles, i.current()->name())] = i.currentKey(); +} + +void AddAction::updateOptions() +{ + IfMulti im; + if(theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theProfiles->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + im = p->ifMulti(); + isUnique = p->unique(); + } + else if(theUseDCOP->isChecked()) + { + if(!theObjects->selectedItem()) return; + QListViewItem* i = theObjects->selectedItem()->parent(); + if(!i) return; + isUnique = uniqueProgramMap[i]; + QRegExp r("(.*)-[0-9]+"); + program = r.exactMatch(nameProgramMap[i]) ? r.cap(1) : nameProgramMap[i]; + im = IM_DONTSEND; + } + else return; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theIMLine->setEnabled(!isUnique); + theIMTop->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); + switch(im) + { case IM_DONTSEND: theDontSend->setChecked(true); break; + case IM_SENDTOTOP: theSendToTop->setChecked(true); break; + case IM_SENDTOBOTTOM: theSendToBottom->setChecked(true); break; + case IM_SENDTOALL: theSendToAll->setChecked(true); break; + } +} + +void AddAction::updateProfileFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theProfileFunctions->clear(); + profileFunctionMap.clear(); + if(!theProfiles->currentItem()) return; + + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + QDict<ProfileAction> dict = p->actions(); + for(QDictIterator<ProfileAction> i(dict); i.current(); ++i) + profileFunctionMap[new QListViewItem(theProfileFunctions, i.current()->name(), QString().setNum(i.current()->arguments().count()), i.current()->comment())] = i.currentKey(); + updateParameters(); + updateOptions(); +} + +void AddAction::updateParameters() +{ + theParameters->clear(); + theArguments.clear(); + if(theUseDCOP->isChecked() && theFunctions->currentItem()) + { + Prototype p(theFunctions->currentItem()->text(2)); + for(unsigned k = 0; k < p.count(); k++) + { new KListViewItem(theParameters, p.name(k).isEmpty() ? i18n( "<anonymous>" ) : p.name(k), "", p.type(k), QString().setNum(k + 1)); + theArguments.append(QVariant("")); + theArguments.back().cast(QVariant::nameToType(p.type(k).utf8())); + } + } + else if(theUseProfile->isChecked() && theProfiles->currentItem()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(!theProfiles->currentItem()) return; + if(!theProfileFunctions->currentItem()) return; + const Profile *p = theServer->profiles()[profileMap[theProfiles->currentItem()]]; + const ProfileAction *pa = p->actions()[profileFunctionMap[theProfileFunctions->currentItem()]]; + + int index = 1; + for(QValueList<ProfileActionArgument>::const_iterator i = pa->arguments().begin(); i != pa->arguments().end(); ++i, index++) + { theArguments.append(QVariant((*i).getDefault())); + theArguments.back().cast(QVariant::nameToType((*i).type().utf8())); + new QListViewItem(theParameters, (*i).comment(), theArguments.back().toString(), (*i).type(), QString().setNum(index)); + } + + // quicky update options too... + theRepeat->setChecked(pa->repeat()); + theAutoStart->setChecked(pa->autoStart()); + } + + updateParameter(); +} + +void AddAction::updateParameter() +{ + if(theParameters->currentItem()) + { QString type = theParameters->currentItem()->text(2); + int index = theParameters->currentItem()->text(3).toInt() - 1; + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + { theValue->raiseWidget(2); + theValueIntNumInput->setValue(theArguments[index].toInt()); + } + else if(type.find("double") != -1 || type.find("float") != -1) + { theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(theArguments[index].toDouble()); + } + else if(type.find("bool") != -1) + { theValue->raiseWidget(1); + theValueCheckBox->setChecked(theArguments[index].toBool()); + } + else if(type.find("QStringList") != -1) + { theValue->raiseWidget(4); + QStringList backup = theArguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + theArguments[index].asStringList() = backup; + } + else + { theValue->raiseWidget(0); + theValueLineEdit->setText(theArguments[index].toString()); + } + theCurParameter->setText(theParameters->currentItem()->text(0)); + theCurParameter->setEnabled(true); + theValue->setEnabled(true); + } + else + { theCurParameter->setText(""); + theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theCurParameter->setEnabled(false); + theValue->setEnabled(false); + } +} + +// called when the textbox/checkbox/whatever changes value +void AddAction::slotParameterChanged() +{ + if(!theParameters->currentItem()) return; + int index = theParameters->currentItem()->text(3).toInt() - 1; + QString type = theParameters->currentItem()->text(2); + if(type.find("int") != -1 || type.find("short") != -1 || type.find("long") != -1) + theArguments[index].asInt() = theValueIntNumInput->value(); + else if(type.find("double") != -1 || type.find("float") != -1) + theArguments[index].asDouble() = theValueDoubleNumInput->value(); + else if(type.find("bool") != -1) + theArguments[index].asBool() = theValueCheckBox->isChecked(); + else if(type.find("QStringList") != -1) + theArguments[index].asStringList() = theValueEditListBox->items(); + else + theArguments[index].asString() = theValueLineEdit->text(); + + theArguments[theParameters->currentItem()->text(3).toInt() - 1].cast(QVariant::nameToType(theParameters->currentItem()->text(2).utf8())); + updateArgument(theParameters->currentItem()); +} + +// takes theArguments[theIndex] and puts it into theItem +void AddAction::updateArgument(QListViewItem *theItem) +{ + theItem->setText(1, theArguments[theItem->text(3).toInt() - 1].toString()); +} + +void AddAction::updateObjects() +{ + QStringList names; + theObjects->clear(); + uniqueProgramMap.clear(); + nameProgramMap.clear(); + + DCOPClient *theClient = KApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!QString(*i).find("anonymous")) continue; + if(!QString(*i).find(i18n( "anonymous" ))) continue; + QRegExp r("(.*)-[0-9]+"); + QString name = r.exactMatch(QString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + KListViewItem *a = new KListViewItem(theObjects, name); + uniqueProgramMap[a] = name == QString(*i); + nameProgramMap[a] = *i; + + QCStringList theObjects = theClient->remoteObjects(*i); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "ksycoca" && *j != "qt")// && getFunctions(*i, *j).count()) + new KListViewItem(a, *j); + } + updateFunctions(); +} + +void AddAction::updateFunctions() +{ + theFunctions->clear(); + if(theObjects->currentItem() && theObjects->currentItem()->parent()) + { QStringList functions = getFunctions(nameProgramMap[theObjects->currentItem()->parent()], theObjects->currentItem()->text(0)); + for(QStringList::iterator i = functions.begin(); i != functions.end(); ++i) + { Prototype p((QString)(*i)); + new KListViewItem(theFunctions, p.name(), p.argumentList(), *i); + } + } + updateOptions(); +} + + +#include "addaction.moc" diff --git a/kdelirc/kcmlirc/addaction.h b/kdelirc/kcmlirc/addaction.h new file mode 100644 index 0000000..4d13659 --- /dev/null +++ b/kdelirc/kcmlirc/addaction.h @@ -0,0 +1,73 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * 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. * + ***************************************************************************/ +#ifndef ADDACTION_H +#define ADDACTION_H + +#include <qvaluelist.h> +#include <qpair.h> + +#include <addactionbase.h> + +#include "mode.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class QListViewItem; + +class AddAction : public AddActionBase +{ + Q_OBJECT + + int curPage; + Mode theMode; + +public slots: + virtual void slotCorrectPage(); + virtual void slotModeSelected(); + virtual void slotNextParam(); + virtual void slotParameterChanged(); + + // connected to KCMLirc class to receive DCOP calls to tell it what button has been pressed + virtual void updateForPageChange(); + virtual void updateButton(const QString &remote, const QString &button); + virtual void updateButtons(); + virtual void updateFunctions(); + virtual void updateObjects(); + virtual void updateButtonStates(); + virtual void updateParameters(); + virtual void updateParameter(); + virtual void updateProfiles(); + virtual void updateProfileFunctions(); + virtual void updateOptions(); + +public: + Arguments theArguments; + QString program; + bool isUnique; + + static const QStringList getFunctions(const QString app, const QString obj); + void updateArgument(QListViewItem *theItem); + void requestNextPress(); + void cancelRequest(); + + QMap<QListViewItem *, QString> profileMap; + QMap<QListViewItem *, QString> profileFunctionMap; + QMap<QListViewItem *, QString> buttonMap; + QMap<QListViewItem *, bool> uniqueProgramMap; + QMap<QListViewItem *, QString> nameProgramMap; + + AddAction(QWidget *parent, const char *name, const Mode &mode); + ~AddAction(); +}; + +#endif diff --git a/kdelirc/kcmlirc/addactionbase.ui b/kdelirc/kcmlirc/addactionbase.ui new file mode 100644 index 0000000..092463a --- /dev/null +++ b/kdelirc/kcmlirc/addactionbase.ui @@ -0,0 +1,1608 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>AddActionBase</class> +<author>Gav Wood</author> +<widget class="QWizard"> + <property name="name"> + <cstring>AddActionBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>723</width> + <height>593</height> + </rect> + </property> + <property name="caption"> + <string>Add Action</string> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Action to Carry Out on Button Press</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theUseProfile</cstring> + </property> + <property name="text"> + <string>I wish to select an &application below for usage:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout14</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>81</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="KListView"> + <column> + <property name="text"> + <string>Applications</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfiles</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>101</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>311</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theUseDCOP</cstring> + </property> + <property name="text"> + <string>I wish to manually select a &function from a running program</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>321</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theChangeMode</cstring> + </property> + <property name="text"> + <string>I wish to change the remote control's &mode</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>20</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Button to Configure</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>theButtonText</cstring> + </property> + <property name="text"> + <string>You are attempting to configure an action for a button on [remote] (in mode [mode]). Press a button on this remote control or select from the list.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer12_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>41</height> + </size> + </property> + </spacer> + <widget class="KListView"> + <column> + <property name="text"> + <string>Button</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theButtons</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Program Function</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSplitter"> + <property name="name"> + <cstring>splitter8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Program</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <item> + <property name="text"> + <string>IR Kick</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Xine</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>kicker</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <item> + <property name="text"> + <string>kicker</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + </item> + <item> + <property name="text"> + <string>noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + <item> + <property name="text"> + <string>Marquis</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>Noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + <item> + <property name="text"> + <string>noatun</string> + </property> + <property name="pixmap"> + <pixmap></pixmap> + </property> + </item> + </item> + <property name="name"> + <cstring>theObjects</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>false</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Parameter</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Prototype</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </vbox> + </widget> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Program Function</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup4</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theNotJustStart</cstring> + </property> + <property name="text"> + <string>&Perform a function in the application:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout37</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer39</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KListView"> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Options</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfileFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>7</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theJustStart</cstring> + </property> + <property name="text"> + <string>&Just start the application. Do not do anything else.</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer40</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>81</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Populate Parameters</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Option Description</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Value</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Type</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Place</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theParameters</cstring> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout35</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout34</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer32</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>111</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>theCurParameter</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Parameter:</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer27</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>146</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QWidgetStack"> + <property name="name"> + <cstring>theValue</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer28</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="KLineEdit"> + <property name="name"> + <cstring>theValueLineEdit</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer29</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theValueCheckBox</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer30</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>61</height> + </size> + </property> + </spacer> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>theValueIntNumInput</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <spacer> + <property name="name"> + <cstring>spacer31</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>51</height> + </size> + </property> + </spacer> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>theValueDoubleNumInput</cstring> + </property> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>4</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KEditListBox" row="0" column="0"> + <property name="name"> + <cstring>theValueEditListBox</cstring> + </property> + <property name="title"> + <string></string> + </property> + </widget> + </grid> + </widget> + </widget> + <spacer> + <property name="name"> + <cstring>spacer26</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>147</width> + <height>21</height> + </size> + </property> + </spacer> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Finishing Up</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Miscellaneous Options</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line1_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theRepeat</cstring> + </property> + <property name="text"> + <string>This action is &repeatable if the button is held down</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theAutoStart</cstring> + </property> + <property name="text"> + <string>This action causes the application to &start if not already running</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>670</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>theIMTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Multiple Instances</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>theIMLine</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>theIMLabel</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>theIMGroup</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theDontSend</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Ignore the action</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance hi&ghest in the window stacking order</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToBottom</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance &lowest in window stacking order</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToAll</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to &all instances</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>170</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="title"> + <string>Select Required Mode Change</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup" row="0" column="0"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSwitchMode</cstring> + </property> + <property name="text"> + <string>&Switch to mode:</string> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout13</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer8</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + <widget class="KListView"> + <column> + <property name="text"> + <string>Mode</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>3</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>131</width> + <height>31</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theExitMode</cstring> + </property> + <property name="text"> + <string>&Exit current mode</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer15_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>551</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theDoBefore</cstring> + </property> + <property name="text"> + <string>E&xecute all other actions before mode change (in original mode)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theDoAfter</cstring> + </property> + <property name="text"> + <string>Exec&ute all actions after mode change (in new mode)</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </grid> + </widget> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>theObjects</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateFunctions()</slot> + </connection> + <connection> + <sender>theParameters</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameter()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theSwitchMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theExitMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>stateChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateButtonStates()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>clicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>slotModeSelected()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theProfiles</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theValueDoubleNumInput</sender> + <signal>valueChanged(double)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueIntNumInput</sender> + <signal>valueChanged(int)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueLineEdit</sender> + <signal>textChanged(const QString&)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameters()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateParameters()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateProfileFunctions()</slot> + </connection> + <connection> + <sender>theValueEditListBox</sender> + <signal>changed()</signal> + <receiver>AddActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theProfileFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>currentChanged(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theProfiles</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theButtons</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theProfileFunctions</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>next()</slot> + </connection> + <connection> + <sender>theModes</sender> + <signal>doubleClicked(QListViewItem*)</signal> + <receiver>AddActionBase</receiver> + <slot>accept()</slot> + </connection> +</connections> +<slots> + <slot>updateFunctions()</slot> + <slot>updateParameter()</slot> + <slot>updateParameters()</slot> + <slot>updateButtonStates()</slot> + <slot>updateCurrentParam(const QString &)</slot> + <slot>slotNextParam()</slot> + <slot>slotCorrectPage()</slot> + <slot>slotModeSelected()</slot> + <slot>updateProfileFunctions()</slot> + <slot>updateForPageChange()</slot> + <slot>slotParameterChanged()</slot> + <slot>updateOptions()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kcmlirc/editaction.cpp b/kdelirc/kcmlirc/editaction.cpp new file mode 100644 index 0000000..5a2a28b --- /dev/null +++ b/kdelirc/kcmlirc/editaction.cpp @@ -0,0 +1,362 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <qregexp.h> +#include <qlabel.h> +#include <qradiobutton.h> +#include <qcombobox.h> +#include <qcheckbox.h> +#include <qwidgetstack.h> +#include <qbuttongroup.h> + +#include <kdebug.h> +#include <klineedit.h> +#include <klistview.h> +#include <kapplication.h> +#include <kmessagebox.h> +#include <knuminput.h> +#include <keditlistbox.h> + +#include <dcopclient.h> +#include <irkick_stub.h> + +#include "prototype.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "editaction.h" +#include "addaction.h" + +EditAction::EditAction(IRAIt action, QWidget *parent, const char *name) : EditActionBase(parent, name) +{ + theAction = action; + + updateApplications(); + updateDCOPApplications(); +} + +EditAction::~EditAction() +{ +} + +void EditAction::readFrom() +{ + theRepeat->setChecked((*theAction).repeat()); + theAutoStart->setChecked((*theAction).autoStart()); + theDoBefore->setChecked((*theAction).doBefore()); + theDoAfter->setChecked((*theAction).doAfter()); + theDontSend->setChecked((*theAction).ifMulti() == IM_DONTSEND); + theSendToTop->setChecked((*theAction).ifMulti() == IM_SENDTOTOP); + theSendToBottom->setChecked((*theAction).ifMulti() == IM_SENDTOBOTTOM); + theSendToAll->setChecked((*theAction).ifMulti() == IM_SENDTOALL); + + if((*theAction).isModeChange()) + { // change mode + theChangeMode->setChecked(true); + if((*theAction).object().isEmpty()) + theModes->setCurrentText(i18n("[Exit current mode]")); + else + theModes->setCurrentText((*theAction).object()); + } + else if((*theAction).isJustStart()) + { // profile action + theUseProfile->setChecked(true); + const Profile *p = ProfileServer::profileServer()->profiles()[(*theAction).program()]; + theApplications->setCurrentText(p->name()); + updateFunctions(); + updateArguments(); + theJustStart->setChecked(true); + } + else if(ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype())) + { // profile action + theUseProfile->setChecked(true); + const ProfileAction *a = ProfileServer::profileServer()->getAction((*theAction).program(), (*theAction).object(), (*theAction).method().prototype()); + theApplications->setCurrentText(a->profile()->name()); + updateFunctions(); + theFunctions->setCurrentText(a->name()); + arguments = (*theAction).arguments(); + updateArguments(); + theNotJustStart->setChecked(true); + } + else + { // dcop action + theUseDCOP->setChecked(true); + theDCOPApplications->setCurrentText((*theAction).program()); + updateDCOPObjects(); + theDCOPObjects->setCurrentText((*theAction).object()); + updateDCOPFunctions(); + theDCOPFunctions->setCurrentText((*theAction).method().prototype()); + arguments = (*theAction).arguments(); + updateArguments(); + } + updateOptions(); +} + +void EditAction::writeBack() +{ + if(theChangeMode->isChecked()) + { + (*theAction).setProgram(""); + if(theModes->currentText() == i18n("[Exit current mode]")) + (*theAction).setObject(""); + else + (*theAction).setObject(theModes->currentText()); + (*theAction).setDoBefore(theDoBefore->isChecked()); + (*theAction).setDoAfter(theDoAfter->isChecked()); + } + else if(theUseProfile->isChecked() && ( + ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]) + || + theJustStart->isChecked() && ProfileServer::profileServer()->profiles()[theApplications->currentText()] + ) + ) + { if(theJustStart->isChecked()) + { (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(""); + } + else + { const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + (*theAction).setProgram(ProfileServer::profileServer()->profiles()[applicationMap[theApplications->currentText()]]->id()); + (*theAction).setObject(a->objId()); + (*theAction).setMethod(a->prototype()); + (*theAction).setArguments(arguments); + } + } + else + { + (*theAction).setProgram(program);//theDCOPApplications->currentText()); + (*theAction).setObject(theDCOPObjects->currentText()); + (*theAction).setMethod(theDCOPFunctions->currentText()); + (*theAction).setArguments(arguments); + } + (*theAction).setRepeat(theRepeat->isChecked()); + (*theAction).setAutoStart(theAutoStart->isChecked()); + (*theAction).setUnique(isUnique); + (*theAction).setIfMulti(theDontSend->isChecked() ? IM_DONTSEND : theSendToTop->isChecked() ? IM_SENDTOTOP : theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); +} + +void EditAction::updateArguments() +{ + kdDebug() << k_funcinfo << endl; + if(theUseProfile->isChecked()) + { + theArguments->clear(); + const ProfileAction *a = ProfileServer::profileServer()->getAction(applicationMap[theApplications->currentText()], functionMap[theFunctions->currentText()]); + if(!a) { arguments.clear(); return; } + const QValueList<ProfileActionArgument> &p = a->arguments(); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(QVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(p[i].comment() + " (" + p[i].type() + ")"); + arguments[i].cast(QVariant::nameToType(p[i].type().utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } + else if(theUseDCOP->isChecked()) + { + theArguments->clear(); + Prototype p(theDCOPFunctions->currentText()); + if(p.count() != arguments.count()) + { arguments.clear(); + for(unsigned i = 0; i < p.count(); i++) + arguments.append(QVariant("")); + } + theArguments->setEnabled(p.count()); + for(unsigned i = 0; i < p.count(); i++) + { theArguments->insertItem(QString().setNum(i + 1) + ": " + (p.name(i).isEmpty() ? p.type(i) : p.name(i) + " (" + p.type(i) + ")")); + arguments[i].cast(QVariant::nameToType(p.type(i).utf8())); + } + if(p.count()) updateArgument(0); else updateArgument(-1); + } +} + +void EditAction::updateOptions() +{ + if (theUseProfile->isChecked()) + { + ProfileServer *theServer = ProfileServer::profileServer(); + if(!theApplications->currentItem()) return; + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + isUnique = p->unique(); + } + else if (theUseDCOP->isChecked()) + { + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + program = theDCOPApplications->currentText(); + isUnique = uniqueProgramMap[theDCOPApplications->currentText()]; + } + else + isUnique = true; + + theIMLabel->setEnabled(!isUnique); + theIMGroup->setEnabled(!isUnique); + theDontSend->setEnabled(!isUnique); + theSendToTop->setEnabled(!isUnique); + theSendToBottom->setEnabled(!isUnique); + theSendToAll->setEnabled(!isUnique); +} + +// called when the textbox/checkbox/whatever changes value +void EditAction::slotParameterChanged() +{ + kdDebug() << "in: " << arguments[theArguments->currentItem()].toString() << endl; + int type = arguments[theArguments->currentItem()].type(); + kdDebug() << type << endl; + switch(type) + { + case QVariant::Int: case QVariant::UInt: + arguments[theArguments->currentItem()].asInt() = theValueIntNumInput->value(); + break; + case QVariant::Double: + arguments[theArguments->currentItem()].asDouble() = theValueDoubleNumInput->value(); + break; + case QVariant::Bool: + arguments[theArguments->currentItem()].asBool() = theValueCheckBox->isChecked(); + break; + case QVariant::StringList: + arguments[theArguments->currentItem()].asStringList() = theValueEditListBox->items(); + break; + default: + arguments[theArguments->currentItem()].asString() = theValueLineEdit->text(); + } + arguments[theArguments->currentItem()].cast(QVariant::Type(type)); + kdDebug() << "out: " << arguments[theArguments->currentItem()].toString() << endl; + +} + +void EditAction::updateArgument(int index) +{ + kdDebug() << k_funcinfo << " i: " << index << endl; + if(index >= 0) + { switch(arguments[index].type()) + { + case QVariant::Int: case QVariant::UInt: + theValue->raiseWidget(2); + theValueIntNumInput->setValue(arguments[index].toInt()); + break; + case QVariant::Double: + theValue->raiseWidget(3); + theValueDoubleNumInput->setValue(arguments[index].toDouble()); + break; + case QVariant::Bool: + theValue->raiseWidget(1); + theValueCheckBox->setChecked(arguments[index].toBool()); + break; + case QVariant::StringList: + { theValue->raiseWidget(4); + QStringList backup = arguments[index].toStringList(); + // backup needed because calling clear will kill what ever has been saved. + theValueEditListBox->clear(); + theValueEditListBox->insertStringList(backup); + arguments[index].asStringList() = backup; + break; + } + default: + theValue->raiseWidget(0); + theValueLineEdit->setText(arguments[index].toString()); + } + theValue->setEnabled(true); + } + else + { theValueLineEdit->setText(""); + theValueCheckBox->setChecked(false); + theValueIntNumInput->setValue(0); + theValueDoubleNumInput->setValue(0.0); + theValue->setEnabled(false); + } +} + +void EditAction::updateApplications() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theApplications->clear(); + applicationMap.clear(); + + QDict<Profile> dict = theServer->profiles(); + QDictIterator<Profile> i(dict); + for(; i.current(); ++i) + { theApplications->insertItem(i.current()->name()); + applicationMap[i.current()->name()] = i.currentKey(); + } + updateFunctions(); +} + +void EditAction::updateFunctions() +{ + ProfileServer *theServer = ProfileServer::profileServer(); + theFunctions->clear(); + functionMap.clear(); + if(theApplications->currentText().isNull() || theApplications->currentText().isEmpty()) return; + + const Profile *p = theServer->profiles()[applicationMap[theApplications->currentText()]]; + + QDict<ProfileAction> dict = p->actions(); + for(QDictIterator<ProfileAction> i(dict); i.current(); ++i) + { theFunctions->insertItem(i.current()->name()); + functionMap[i.current()->name()] = i.currentKey(); + } + updateArguments(); +} + +void EditAction::updateDCOPApplications() +{ + QStringList names; + + theDCOPApplications->clear(); + DCOPClient *theClient = KApplication::kApplication()->dcopClient(); + QCStringList theApps = theClient->registeredApplications(); + for(QCStringList::iterator i = theApps.begin(); i != theApps.end(); ++i) + { + if(!QString(*i).find("anonymous")) continue; + QRegExp r("(.*)-[0-9]+"); + QString name = r.exactMatch(QString(*i)) ? r.cap(1) : *i; + if(names.contains(name)) continue; + names += name; + + theDCOPApplications->insertItem(name); + uniqueProgramMap[name] = name == QString(*i); + nameProgramMap[name] = *i; + + + } + updateDCOPObjects(); +} + +void EditAction::updateDCOPObjects() +{ + theDCOPObjects->clear(); + DCOPClient *theClient = KApplication::kApplication()->dcopClient(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + QCStringList theObjects = theClient->remoteObjects(nameProgramMap[theDCOPApplications->currentText()].utf8()); + if(!theObjects.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPObjects->insertItem((*theAction).object()); + for(QCStringList::iterator j = theObjects.begin(); j != theObjects.end(); ++j) + if(*j != "ksycoca" && *j != "qt" && AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], *j).count()) + theDCOPObjects->insertItem(QString::fromUtf8(*j)); + updateDCOPFunctions(); +} + +void EditAction::updateDCOPFunctions() +{ + theDCOPFunctions->clear(); + if(theDCOPApplications->currentText().isNull() || theDCOPApplications->currentText().isEmpty()) return; + QStringList functions = AddAction::getFunctions(nameProgramMap[theDCOPApplications->currentText()], theDCOPObjects->currentText()); + if(!functions.size() && theDCOPApplications->currentText() == (*theAction).program()) theDCOPFunctions->insertItem((*theAction).method().prototype()); + for(QStringList::iterator i = functions.begin(); i != functions.end(); ++i) + theDCOPFunctions->insertItem(*i); + updateArguments(); +} + + +#include "editaction.moc" diff --git a/kdelirc/kcmlirc/editaction.h b/kdelirc/kcmlirc/editaction.h new file mode 100644 index 0000000..1a7aa00 --- /dev/null +++ b/kdelirc/kcmlirc/editaction.h @@ -0,0 +1,55 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITACTION_H +#define EDITACTION_H + +#include <qstring.h> + +#include "iractions.h" +#include "editactionbase.h" +#include "arguments.h" + +/** +@author Gav Wood +*/ + +class EditAction : public EditActionBase +{ + Q_OBJECT + IRAIt theAction; + QMap<QString, QString> applicationMap, functionMap; + QMap<QString, QString> nameProgramMap; + QMap<QString, bool> uniqueProgramMap; + Arguments arguments; + QString program; + bool isUnique; + +public: + void writeBack(); + void readFrom(); + + virtual void slotParameterChanged(); + virtual void updateArgument(int index); + virtual void updateArguments(); + virtual void updateApplications(); + virtual void updateFunctions(); + virtual void updateOptions(); + virtual void updateDCOPApplications(); + virtual void updateDCOPObjects(); + virtual void updateDCOPFunctions(); + + EditAction(IRAIt action, QWidget *parent = 0, const char *name = 0); + ~EditAction(); +}; + +#endif diff --git a/kdelirc/kcmlirc/editactionbase.ui b/kdelirc/kcmlirc/editactionbase.ui new file mode 100644 index 0000000..02e238c --- /dev/null +++ b/kdelirc/kcmlirc/editactionbase.ui @@ -0,0 +1,1287 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EditActionBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>EditActionBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>754</width> + <height>715</height> + </rect> + </property> + <property name="caption"> + <string>Edit Action</string> + </property> + <property name="sizeGripEnabled"> + <bool>true</bool> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QTabWidget"> + <property name="name"> + <cstring>tabWidget3</cstring> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Function</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>buttonGroup3</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout40</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QComboBox" row="2" column="3"> + <property name="name"> + <cstring>theDCOPApplications</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QLabel" row="3" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4_3</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>O&bject:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPObjects</cstring> + </property> + </widget> + <widget class="QButtonGroup" row="1" column="1" rowspan="1" colspan="3"> + <property name="name"> + <cstring>buttonGroup5</cstring> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="title"> + <string></string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>theNotJustStart</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>&Perform function:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>theFunctions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>theJustStart</cstring> + </property> + <property name="text"> + <string>Just start application</string> + </property> + </widget> + </grid> + </widget> + <widget class="QLabel" row="4" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel4_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Fu&nction:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPFunctions</cstring> + </property> + </widget> + <widget class="QLabel" row="0" column="1"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>&Application:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theApplications</cstring> + </property> + </widget> + <widget class="QComboBox" row="0" column="2" rowspan="1" colspan="2"> + <property name="name"> + <cstring>theApplications</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="QComboBox" row="4" column="3"> + <property name="name"> + <cstring>theDCOPFunctions</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QRadioButton" row="0" column="0"> + <property name="name"> + <cstring>theUseProfile</cstring> + </property> + <property name="text"> + <string>&Use application:</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QLabel" row="2" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>textLabel5_2</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>App&lication:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theDCOPApplications</cstring> + </property> + </widget> + <widget class="QRadioButton" row="2" column="0"> + <property name="name"> + <cstring>theUseDCOP</cstring> + </property> + <property name="text"> + <string>Use &DCOP:</string> + </property> + </widget> + <widget class="QComboBox" row="3" column="3"> + <property name="name"> + <cstring>theDCOPObjects</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + </grid> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout36</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QWidgetStack" row="0" column="2" rowspan="2" colspan="1"> + <property name="name"> + <cstring>theValue</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>0</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KLineEdit"> + <property name="name"> + <cstring>theValueLineEdit</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer35</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>91</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>1</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theValueCheckBox</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer36</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>2</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KIntNumInput"> + <property name="name"> + <cstring>theValueIntNumInput</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer37</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>3</number> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KDoubleNumInput"> + <property name="name"> + <cstring>theValueDoubleNumInput</cstring> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer38</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>page</cstring> + </property> + <attribute name="id"> + <number>4</number> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="KEditListBox" row="0" column="0"> + <property name="name"> + <cstring>theValueEditListBox</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>3</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string></string> + </property> + </widget> + </grid> + </widget> + </widget> + <spacer row="1" column="0"> + <property name="name"> + <cstring>spacer33</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>111</height> + </size> + </property> + </spacer> + <widget class="QComboBox" row="0" column="1"> + <property name="name"> + <cstring>theArguments</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>3</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>106</width> + <height>0</height> + </size> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>spacer34</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>101</height> + </size> + </property> + </spacer> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel8</cstring> + </property> + <property name="text"> + <string>A&pplication/DCOP options:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theArguments</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer14</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>481</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout17</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theChangeMode</cstring> + </property> + <property name="text"> + <string>Change &mode to:</string> + </property> + </widget> + <widget class="QComboBox"> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + </hbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer15</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>21</width> + <height>30</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Options</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel3</cstring> + </property> + <property name="text"> + <string><b>DCOP/Application Action Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theRepeat</cstring> + </property> + <property name="text"> + <string>&Action repeats if button is held down</string> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theAutoStart</cstring> + </property> + <property name="text"> + <string>&Start program/service if not already running</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer20</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>491</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string><b>Mode Change Options</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theDoBefore</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>E&xecute all other actions before mode change (in original mode)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theDoAfter</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Exec&ute all actions after mode change (in new mode)</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer22</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>670</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>theIMTop</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="text"> + <string>Multiple Instances</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>theIMLine</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLabel"> + <property name="name"> + <cstring>theIMLabel</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>This application may have multiple instances. In the case of having multiple instances at once when this action should be executed, choose a course of action:</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="QButtonGroup"> + <property name="name"> + <cstring>theIMGroup</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="lineWidth"> + <number>0</number> + </property> + <property name="title"> + <string></string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theDontSend</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Ignore the action</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToTop</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance hi&ghest in window stacking order</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToBottom</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to the instance &lowest in window stacking order</string> + </property> + </widget> + <widget class="QRadioButton"> + <property name="name"> + <cstring>theSendToAll</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Send the action to all i&nstances</string> + </property> + </widget> + </vbox> + </widget> + <spacer> + <property name="name"> + <cstring>spacer3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>150</height> + </size> + </property> + </spacer> + </vbox> + </widget> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>Layout1</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <property name="spacing"> + <number>6</number> + </property> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonHelp</cstring> + </property> + <property name="text"> + <string>&Help</string> + </property> + <property name="accel"> + <string>F1</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Horizontal Spacing2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonOk</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="QPushButton"> + <property name="name"> + <cstring>buttonCancel</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + <property name="autoDefault"> + <bool>true</bool> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>buttonOk</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>buttonCancel</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theApplications</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPApplications</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPObjects</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theDCOPFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theModes</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theApplications</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateFunctions()</slot> + </connection> + <connection> + <sender>theDCOPApplications</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateDCOPObjects()</slot> + </connection> + <connection> + <sender>theDCOPObjects</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateDCOPFunctions()</slot> + </connection> + <connection> + <sender>theFunctions</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theDCOPFunctions</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theArguments</sender> + <signal>activated(int)</signal> + <receiver>EditActionBase</receiver> + <slot>updateArgument(int)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>clicked()</signal> + <receiver>EditActionBase</receiver> + <slot>updateArguments()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theDoAfter</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>theDoBefore</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theValueDoubleNumInput</sender> + <signal>valueChanged(double)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueLineEdit</sender> + <signal>textChanged(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueCheckBox</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueIntNumInput</sender> + <signal>valueChanged(int)</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theValueEditListBox</sender> + <signal>changed()</signal> + <receiver>EditActionBase</receiver> + <slot>slotParameterChanged()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theFunctions</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theAutoStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theRepeat</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theArguments</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>theValue</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theNotJustStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theJustStart</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>theNotJustStart</receiver> + <slot>setChecked(bool)</slot> + </connection> + <connection> + <sender>theDCOPApplications</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theApplications</sender> + <signal>activated(const QString&)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theNotJustStart</sender> + <signal>toggled(bool)</signal> + <receiver>EditActionBase</receiver> + <slot>updateOptions()</slot> + </connection> + <connection> + <sender>theUseProfile</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel5</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel5_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel4_3</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theUseDCOP</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel4_2</receiver> + <slot>setEnabled(bool)</slot> + </connection> + <connection> + <sender>theChangeMode</sender> + <signal>toggled(bool)</signal> + <receiver>textLabel8</receiver> + <slot>setDisabled(bool)</slot> + </connection> +</connections> +<tabstops> + <tabstop>tabWidget3</tabstop> + <tabstop>theUseProfile</tabstop> + <tabstop>theApplications</tabstop> + <tabstop>theFunctions</tabstop> + <tabstop>theDCOPApplications</tabstop> + <tabstop>theDCOPObjects</tabstop> + <tabstop>theDCOPFunctions</tabstop> + <tabstop>theModes</tabstop> + <tabstop>theRepeat</tabstop> + <tabstop>theAutoStart</tabstop> + <tabstop>buttonHelp</tabstop> + <tabstop>buttonOk</tabstop> + <tabstop>buttonCancel</tabstop> +</tabstops> +<slots> + <slot>updateFunctions()</slot> + <slot>updateApplications()</slot> + <slot>updateDCOPApplications()</slot> + <slot>updateDCOPObjects()</slot> + <slot>updateDCOPFunctions()</slot> + <slot>updateArguments()</slot> + <slot>updateArgument(int)</slot> + <slot>slotParameterChanged()</slot> + <slot>updateOptions()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klineedit.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>knuminput.h</includehint> + <includehint>keditlistbox.h</includehint> + <includehint>klineedit.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kcmlirc/editmode.cpp b/kdelirc/kcmlirc/editmode.cpp new file mode 100644 index 0000000..3fba8f0 --- /dev/null +++ b/kdelirc/kcmlirc/editmode.cpp @@ -0,0 +1,38 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kicondialog.h> +#include <kiconloader.h> +#include <kpushbutton.h> + +#include "editmode.h" + +EditMode::EditMode(QWidget *parent, const char *name, bool modal, WFlags fl) : EditModeBase(parent, name, modal, fl) +{ + theIcon->setIconType(KIcon::Panel, KIcon::Any); +} + +EditMode::~EditMode() +{ +} + +void EditMode::slotClearIcon() +{ + theIcon->resetIcon(); +} + +void EditMode::slotCheckText(const QString &newText) +{ + theOK->setEnabled(!newText.isEmpty()); +} + +#include "editmode.moc" diff --git a/kdelirc/kcmlirc/editmode.h b/kdelirc/kcmlirc/editmode.h new file mode 100644 index 0000000..14a709d --- /dev/null +++ b/kdelirc/kcmlirc/editmode.h @@ -0,0 +1,33 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef EDITMODE_H +#define EDITMODE_H + +#include "editmodebase.h" + +/** +@author Gav Wood +*/ +class EditMode : public EditModeBase +{ + Q_OBJECT + +public: + void slotCheckText(const QString &newText); + void slotClearIcon(); + + EditMode(QWidget *parent = 0, const char *name = 0, bool modal = false, WFlags fl = 0); + ~EditMode(); +}; + +#endif diff --git a/kdelirc/kcmlirc/editmodebase.ui b/kdelirc/kcmlirc/editmodebase.ui new file mode 100644 index 0000000..dd26940 --- /dev/null +++ b/kdelirc/kcmlirc/editmodebase.ui @@ -0,0 +1,303 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>EditModeBase</class> +<widget class="QDialog"> + <property name="name"> + <cstring>EditModeBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>461</width> + <height>334</height> + </rect> + </property> + <property name="caption"> + <string>Edit Mode</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel1</cstring> + </property> + <property name="text"> + <string><b>Description</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line3_2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout25</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel4</cstring> + </property> + <property name="text"> + <string>&Icon for system tray:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theIcon</cstring> + </property> + </widget> + <widget class="QLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>layout24</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer11</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>110</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KIconButton"> + <property name="name"> + <cstring>theIcon</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton9</cstring> + </property> + <property name="text"> + <string></string> + </property> + <property name="pixmap"> + <pixmap>image0</pixmap> + </property> + </widget> + </hbox> + </widget> + <widget class="QLineEdit" row="0" column="1"> + <property name="name"> + <cstring>theName</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + </widget> + <widget class="QLabel" row="0" column="0"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>&Mode name:</string> + </property> + <property name="buddy" stdset="0"> + <cstring>theName</cstring> + </property> + </widget> + </grid> + </widget> + <spacer> + <property name="name"> + <cstring>spacer4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>410</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel2</cstring> + </property> + <property name="text"> + <string><b>Behavior</b></string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QCheckBox"> + <property name="name"> + <cstring>theDefault</cstring> + </property> + <property name="text"> + <string>Mo&de is the default for its remote control</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>spacer9</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>90</height> + </size> + </property> + </spacer> + <widget class="Line"> + <property name="name"> + <cstring>line3</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout15</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>231</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>theOK</cstring> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton8</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<images> + <image name="image0"> + <data format="XPM.GZ" length="620">789c7dd0cd4e84301405e03d4fd17077c438201421c647d0b834312efa03c31d0648745c18e3bbcbb905fc8d0768fa1d202dec12757f77a3925df47c322776ca75e64925fe65185e1f1eafdfa2382b15ce4b95c567517cae9cba9dc606739ae7944ac009cc2a1ce008e6599ee6f2e20016599116c223a88df6da803d589ab22e851d58d9aaae2c7800eba2d67501ee856ea6033d680b5b5ab9db08fd4c0fba8526d02e6c020de8b46d9c065bd06b7fe1850cb612f9f61fd93afaccdad1ef8ec858e74de36cbb7644fb8eb93b60583aa2be3f32b35ca1231ae68c8c8cc3d24d129aab791a3a0ecbc973dbbabc5414cab02e4bb70ecbfef88f3d7f2bb7efe52df4ef7ff9dabd5f451f45248a2d</data> + </image> +</images> +<connections> + <connection> + <sender>theName</sender> + <signal>textChanged(const QString&)</signal> + <receiver>EditModeBase</receiver> + <slot>slotCheckText(const QString&)</slot> + </connection> + <connection> + <sender>theOK</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton8</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>kPushButton9</sender> + <signal>clicked()</signal> + <receiver>EditModeBase</receiver> + <slot>slotClearIcon()</slot> + </connection> +</connections> +<slots> + <slot>slotCheckText(const QString &)</slot> + <slot>slotClearIcon()</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>kicondialog.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kcmlirc/kcmlirc.cpp b/kdelirc/kcmlirc/kcmlirc.cpp new file mode 100644 index 0000000..1686bcd --- /dev/null +++ b/kdelirc/kcmlirc/kcmlirc.cpp @@ -0,0 +1,544 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * 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. * + ***************************************************************************/ + +#include <qcheckbox.h> +#include <qlabel.h> +#include <qlayout.h> +#include <qlineedit.h> +#include <qradiobutton.h> +#include <qcombobox.h> +#include <qevent.h> +#include <qlistview.h> + +#include <kpushbutton.h> +#include <kapplication.h> +#include <klocale.h> +#include <kglobal.h> +#include <kconfig.h> +#include <kicondialog.h> +#include <kiconloader.h> +#include <kdebug.h> +#include <ksimpleconfig.h> +#include <kgenericfactory.h> +#include <klistview.h> +#include <kmessagebox.h> +#include <kpushbutton.h> + +#include <dcopclient.h> +#include <dcopref.h> + +#include <irkick_stub.h> + +#include "addaction.h" +#include "newmode.h" +#include "profileserver.h" +#include "remoteserver.h" +#include "kcmlirc.h" +#include "editaction.h" +#include "editmode.h" +#include "modeslist.h" +#include "selectprofile.h" + +typedef KGenericFactory<KCMLirc, QWidget> theFactory; +K_EXPORT_COMPONENT_FACTORY(kcmlirc, theFactory("kcmlirc")) + +KCMLirc::KCMLirc(QWidget *parent, const char *name, QStringList /*args*/) : DCOPObject("KCMLirc"), KCModule(parent, name) +{ + KGlobal::locale()->insertCatalogue( "kcmlirc" ); + setAboutData(new KAboutData("kcmlirc", I18N_NOOP("KDE Lirc"), VERSION, I18N_NOOP("The KDE IR Remote Control System"), KAboutData::License_GPL_V2, "Copyright (c)2003 Gav Wood", I18N_NOOP("Use this to configure KDE's infrared remote control system in order to control any KDE application with your infrared remote control."), "http://www.kde.org")); + setButtons(KCModule::Help); + setQuickHelp(i18n("<h1>Remote Controls</h1><p>This module allows you to configure bindings between your remote controls and KDE applications. Simply select your remote control and click Add under the Actions/Buttons list. If you want KDE to attempt to automatically assign buttons to a supported application's actions, try clicking the Auto-Populate button.</p><p>To view the recognised applications and remote controls, simply select the <em>Loaded Extensions</em> tab.</p>")); + bool ok; + KApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + if(!ok) + if(KMessageBox::questionYesNo(this, i18n("The Infrared Remote Control software is not currently running. This configuration module will not work properly without it. Would you like to start it now?"), i18n("Software Not Running"), i18n("Start"), i18n("Do Not Start")) == KMessageBox::Yes) + { kdDebug() << "S" << KApplication::startServiceByDesktopName("irkick") << endl; + KSimpleConfig theConfig("irkickrc"); + theConfig.setGroup("General"); + if(theConfig.readBoolEntry("AutoStart", true) == false) + if(KMessageBox::questionYesNo(this, i18n("Would you like the infrared remote control software to start automatically when you begin KDE?"), i18n("Automatically Start?"), i18n("Start Automatically"), i18n("Do Not Start")) == KMessageBox::Yes) + theConfig.writeEntry("AutoStart", true); + } + + KApplication::kApplication()->dcopClient()->remoteInterfaces("irkick", "IRKick", &ok); + kdDebug() << "OK" << ok << endl; + + + (new QHBoxLayout(this))->setAutoAdd(true); + theKCMLircBase = new KCMLircBase(this); + connect(theKCMLircBase->theModes, SIGNAL( selectionChanged(QListViewItem *) ), this, SLOT( updateActions() )); + connect(theKCMLircBase->theModes, SIGNAL( selectionChanged(QListViewItem *) ), this, SLOT( updateModesStatus(QListViewItem *) )); + connect(theKCMLircBase->theActions, SIGNAL( currentChanged(QListViewItem *) ), this, SLOT( updateActionsStatus(QListViewItem *) )); + connect(theKCMLircBase->theExtensions, SIGNAL( selectionChanged(QListViewItem *) ), this, SLOT( updateInformation() )); + connect(theKCMLircBase->theModes, SIGNAL( itemRenamed(QListViewItem *) ), this, SLOT( slotRenamed(QListViewItem *) )); + connect(theKCMLircBase->theModes, SIGNAL(dropped(KListView*, QDropEvent*, QListViewItem*, QListViewItem*)), this, SLOT(slotDrop(KListView*, QDropEvent*, QListViewItem*, QListViewItem*))); + connect((QObject *)(theKCMLircBase->theAddActions), SIGNAL( clicked() ), this, SLOT( slotAddActions() )); + connect((QObject *)(theKCMLircBase->theAddAction), SIGNAL( clicked() ), this, SLOT( slotAddAction() )); + connect((QObject *)(theKCMLircBase->theEditAction), SIGNAL( clicked() ), this, SLOT( slotEditAction() )); + connect((QObject *)(theKCMLircBase->theActions), SIGNAL( doubleClicked(QListViewItem *) ), this, SLOT( slotEditAction() )); + connect((QObject *)(theKCMLircBase->theRemoveAction), SIGNAL( clicked() ), this, SLOT( slotRemoveAction() )); + connect((QObject *)(theKCMLircBase->theAddMode), SIGNAL( clicked() ), this, SLOT( slotAddMode() )); + connect((QObject *)(theKCMLircBase->theEditMode), SIGNAL( clicked() ), this, SLOT( slotEditMode() )); + connect((QObject *)(theKCMLircBase->theRemoveMode), SIGNAL( clicked() ), this, SLOT( slotRemoveMode() )); + load(); +} + +KCMLirc::~KCMLirc() +{ +} + +void KCMLirc::updateModesStatus(QListViewItem *item) +{ + theKCMLircBase->theModes->setItemsRenameable(item && item->parent()); + theKCMLircBase->theAddActions->setEnabled(ProfileServer::profileServer()->profiles().count() && theKCMLircBase->theModes->selectedItem() && RemoteServer::remoteServer()->remotes()[modeMap[theKCMLircBase->theModes->selectedItem()].remote()]); + theKCMLircBase->theAddAction->setEnabled(item); + theKCMLircBase->theAddMode->setEnabled(item); + theKCMLircBase->theRemoveMode->setEnabled(item && item->parent()); + theKCMLircBase->theEditMode->setEnabled(item); +} + +void KCMLirc::updateActionsStatus(QListViewItem *item) +{ + theKCMLircBase->theRemoveAction->setEnabled(item); + theKCMLircBase->theEditAction->setEnabled(item); +} + +void KCMLirc::slotRenamed(QListViewItem *item) +{ + if(!item) return; + + if(item->parent() && item->text(0) != modeMap[item].name()) + { allActions.renameMode(modeMap[item], item->text(0)); + allModes.rename(modeMap[item], item->text(0)); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotEditAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + EditAction theDialog(actionMap[theKCMLircBase->theActions->currentItem()], this); + QListViewItem *item = theKCMLircBase->theModes->currentItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->insertItem(i18n("[Exit current mode]")); + for(item = item->firstChild(); item; item = item->nextSibling()) + theDialog.theModes->insertItem(item->text(0)); + theDialog.readFrom(); + if(theDialog.exec() == QDialog::Accepted) { theDialog.writeBack(); emit changed(true); updateActions(); } +} + +void KCMLirc::slotAddActions() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + if(!RemoteServer::remoteServer()->remotes()[m.remote()]) return; + + SelectProfile theDialog(this, 0); + + QMap<QListViewItem *, Profile *> profileMap; + QDict<Profile> dict = ProfileServer::profileServer()->profiles(); + for(QDictIterator<Profile> i(dict); i.current(); ++i) profileMap[new QListViewItem(theDialog.theProfiles, i.current()->name())] = i.current(); + + if(theDialog.exec() == QDialog::Accepted && theDialog.theProfiles->currentItem()) + { autoPopulate(*(profileMap[theDialog.theProfiles->currentItem()]), *(RemoteServer::remoteServer()->remotes()[m.remote()]), m.name()); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotAddAction() +{ + kdDebug() << k_funcinfo << endl; + if(!theKCMLircBase->theModes->selectedItem()) return; + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + + AddAction theDialog(this, 0, m); + connect(this, SIGNAL(haveButton(const QString &, const QString &)), &theDialog, SLOT(updateButton(const QString &, const QString &))); + + // populate the modes list box + QListViewItem *item = theKCMLircBase->theModes->selectedItem(); + if(item->parent()) item = item->parent(); + theDialog.theModes->setEnabled(item->firstChild()); + theDialog.theSwitchMode->setEnabled(item->firstChild()); + for(item = item->firstChild(); item; item = item->nextSibling()) + { KListViewItem *a = new KListViewItem(theDialog.theModes, item->text(0)); + if(item->isSelected()) { a->setSelected(true); theDialog.theModes->setCurrentItem(a); } + } + + if(theDialog.exec() == QDialog::Accepted && theDialog.theButtons->selectedItem()) + { IRAction a; + a.setRemote(m.remote()); + a.setMode(m.name()); + a.setButton(theDialog.buttonMap[theDialog.theButtons->selectedItem()]); + a.setRepeat(theDialog.theRepeat->isChecked()); + a.setAutoStart(theDialog.theAutoStart->isChecked()); + a.setDoBefore(theDialog.theDoBefore->isChecked()); + a.setDoAfter(theDialog.theDoAfter->isChecked()); + a.setUnique(theDialog.isUnique); + a.setIfMulti(theDialog.theDontSend->isChecked() ? IM_DONTSEND : theDialog.theSendToTop->isChecked() ? IM_SENDTOTOP : theDialog.theSendToBottom->isChecked() ? IM_SENDTOBOTTOM : IM_SENDTOALL); + // change mode? + if(theDialog.theChangeMode->isChecked()) + { + if(theDialog.theSwitchMode->isChecked() && theDialog.theModes->selectedItem()) + { + a.setProgram(""); + a.setObject(theDialog.theModes->selectedItem()->text(0)); + } + else if(theDialog.theExitMode->isChecked()) + { + a.setProgram(""); + a.setObject(""); + } + a.setAutoStart(false); + a.setRepeat(false); + } + // DCOP? + else if(theDialog.theUseDCOP->isChecked() && theDialog.theObjects->selectedItem() && theDialog.theObjects->selectedItem()->parent() && theDialog.theFunctions->selectedItem()) + { + a.setProgram(theDialog.program); + a.setObject(theDialog.theObjects->selectedItem()->text(0)); + a.setMethod(theDialog.theFunctions->selectedItem()->text(2)); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + // profile? + else if(theDialog.theUseProfile->isChecked() && theDialog.theProfiles->selectedItem() && (theDialog.theProfileFunctions->selectedItem() || theDialog.theJustStart->isChecked())) + { + ProfileServer *theServer = ProfileServer::profileServer(); + + if(theDialog.theNotJustStart->isChecked()) + { const ProfileAction *theAction = theServer->getAction(theDialog.profileMap[theDialog.theProfiles->selectedItem()], theDialog.profileFunctionMap[theDialog.theProfileFunctions->selectedItem()]); + a.setProgram(theAction->profile()->id()); + a.setObject(theAction->objId()); + a.setMethod(theAction->prototype()); + theDialog.theParameters->setSorting(3); + a.setArguments(theDialog.theArguments); + } + else + { a.setProgram(theServer->profiles()[theDialog.profileMap[theDialog.theProfiles->selectedItem()]]->id()); + a.setObject(""); + } + } + + // save our new action + allActions.addAction(a); + updateActions(); + emit changed(true); + } +} + +void KCMLirc::slotRemoveAction() +{ + if(!theKCMLircBase->theActions->currentItem()) return; + + IRAIt i = actionMap[theKCMLircBase->theActions->currentItem()]; + allActions.erase(i); + updateActions(); + emit changed(true); +} + +void KCMLirc::autoPopulate(const Profile &profile, const Remote &remote, const QString &mode) +{ + QDict<RemoteButton> d = remote.buttons(); + for(QDictIterator<RemoteButton> i(d); i.current(); ++i) + { const ProfileAction *pa = profile.searchClass(i.current()->getClass()); + if(pa) + { + IRAction a; + a.setRemote(remote.id()); + a.setMode(mode); + a.setButton(i.current()->id()); + a.setRepeat(pa->repeat()); + a.setAutoStart(pa->autoStart()); + a.setProgram(pa->profile()->id()); + a.setObject(pa->objId()); + a.setMethod(pa->prototype()); + a.setUnique(pa->profile()->unique()); + a.setIfMulti(pa->profile()->ifMulti()); + Arguments l; + // argument count should be either 0 or 1. undefined if > 1. + if(Prototype(pa->prototype()).argumentCount() == 1) + { l.append(QString().setNum(i.current()->parameter().toFloat() * pa->multiplier())); + l.back().cast(QVariant::nameToType(Prototype(pa->prototype()).type(0).utf8())); + } + a.setArguments(l); + allActions.addAction(a); + } + } +} + +void KCMLirc::slotAddMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + NewMode theDialog(this, 0); + QMap<QListViewItem *, QString> remoteMap; + QListViewItem *tr = theKCMLircBase->theModes->selectedItem(); + if(tr) if(tr->parent()) tr = tr->parent(); + for(QListViewItem *i = theKCMLircBase->theModes->firstChild(); i; i = i->nextSibling()) + { KListViewItem *a = new KListViewItem(theDialog.theRemotes, i->text(0)); + remoteMap[a] = modeMap[i].remote(); + if(i == tr) { a->setSelected(true); theDialog.theRemotes->setCurrentItem(a); } + } + if(theDialog.exec() == QDialog::Accepted && theDialog.theRemotes->selectedItem() && !theDialog.theName->text().isEmpty()) + { + allModes.add(Mode(remoteMap[theDialog.theRemotes->selectedItem()], theDialog.theName->text())); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotEditMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + + EditMode theDialog(this, 0); + + Mode &mode = modeMap[theKCMLircBase->theModes->selectedItem()]; + theDialog.theName->setEnabled(theKCMLircBase->theModes->selectedItem()->parent()); + theDialog.theName->setText(mode.name().isEmpty() ? mode.remoteName() : mode.name()); + if(!mode.iconFile().isNull()) + theDialog.theIcon->setIcon(mode.iconFile()); + else + theDialog.theIcon->resetIcon(); + theDialog.theDefault->setChecked(allModes.isDefault(mode)); + theDialog.theDefault->setEnabled(!allModes.isDefault(mode)); + + if(theDialog.exec() == QDialog::Accepted) + { kdDebug() << "Setting icon : " << theDialog.theIcon->icon() << endl; + mode.setIconFile(theDialog.theIcon->icon().isEmpty() ? QString::null : theDialog.theIcon->icon()); + allModes.updateMode(mode); + if(!mode.name().isEmpty()) + { allActions.renameMode(mode, theDialog.theName->text()); + allModes.rename(mode, theDialog.theName->text()); + } + if(theDialog.theDefault->isChecked()) allModes.setDefault(mode); + emit changed(true); + updateModes(); + } +} + +void KCMLirc::slotRemoveMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + if(!theKCMLircBase->theModes->selectedItem()->parent()) return; + + if(KMessageBox::warningContinueCancel(this, i18n("Are you sure you want to remove %1 and all its actions?").arg(theKCMLircBase->theModes->selectedItem()->text(0)), i18n("Erase Actions?")) == KMessageBox::Continue) + { + allModes.erase(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); + } +} + +void KCMLirc::slotSetDefaultMode() +{ + if(!theKCMLircBase->theModes->selectedItem()) return; + allModes.setDefault(modeMap[theKCMLircBase->theModes->selectedItem()]); + updateModes(); + emit changed(true); +} + +void KCMLirc::slotDrop(KListView *, QDropEvent *, QListViewItem *, QListViewItem *after) +{ + Mode m = modeMap[after]; + + if(modeMap[theKCMLircBase->theModes->selectedItem()].remote() != m.remote()) + { + KMessageBox::error(this, i18n("You may only drag the selected items onto a mode of the same remote control"), i18n("You May Not Drag Here")); + return; + } + for(QListViewItem *i = theKCMLircBase->theActions->firstChild(); i; i = i->nextSibling()) + if(i->isSelected()) + (*(actionMap[i])).setMode(m.name()); + + updateActions(); + emit changed(true); +} + +void KCMLirc::updateActions() +{ + IRAIt oldCurrent; + if(theKCMLircBase->theActions->selectedItem()) oldCurrent = actionMap[theKCMLircBase->theActions->selectedItem()]; + + theKCMLircBase->theActions->clear(); + actionMap.clear(); + + if(!theKCMLircBase->theModes->selectedItem()) { updateActionsStatus(0); return; } + + Mode m = modeMap[theKCMLircBase->theModes->selectedItem()]; + theKCMLircBase->theModeLabel->setText(m.remoteName() + ": " + (m.name().isEmpty() ? i18n("Actions <i>always</i> available") : i18n("Actions available only in mode <b>%1</b>").arg(m.name()))); + IRAItList l = allActions.findByMode(m); + for(IRAItList::iterator i = l.begin(); i != l.end(); ++i) + { QListViewItem *b = new KListViewItem(theKCMLircBase->theActions, (**i).buttonName(), (**i).application(), (**i).function(), (**i).arguments().toString(), (**i).notes()); + actionMap[b] = *i; + if(*i == oldCurrent) { b->setSelected(true); theKCMLircBase->theActions->setCurrentItem(b); } + } + + if(theKCMLircBase->theActions->currentItem()) + theKCMLircBase->theActions->currentItem()->setSelected(true); + updateActionsStatus(theKCMLircBase->theActions->currentItem()); +} + +void KCMLirc::gotButton(QString remote, QString button) +{ + emit haveButton(remote, button); +} + +void KCMLirc::updateModes() +{ + Mode oldCurrent; + if(theKCMLircBase->theModes->selectedItem()) oldCurrent = modeMap[theKCMLircBase->theModes->selectedItem()]; + + theKCMLircBase->theModes->clear(); + modeMap.clear(); + + IRKick_stub IRKick("irkick", "IRKick"); + QStringList remotes = IRKick.remotes(); + if(remotes.begin() == remotes.end()) + theKCMLircBase->theMainLabel->setMaximumSize(32767, 32767); + else + theKCMLircBase->theMainLabel->setMaximumSize(0, 0); + for(QStringList::iterator i = remotes.begin(); i != remotes.end(); ++i) + { Mode mode = allModes.getMode(*i, ""); + QListViewItem *a = new KListViewItem(theKCMLircBase->theModes, RemoteServer::remoteServer()->getRemoteName(*i), allModes.isDefault(mode) ? "Default" : "", mode.iconFile().isNull() ? "" : ""); + if(!mode.iconFile().isNull()) + a->setPixmap(2, KIconLoader().loadIcon(mode.iconFile(), KIcon::Panel)); + modeMap[a] = mode; // the null mode + if(modeMap[a] == oldCurrent) { a->setSelected(true); theKCMLircBase->theModes->setCurrentItem(a); } + a->setOpen(true); + ModeList l = allModes.getModes(*i); + for(ModeList::iterator j = l.begin(); j != l.end(); ++j) + if(!(*j).name().isEmpty()) + { QListViewItem *b = new KListViewItem(a, (*j).name(), allModes.isDefault(*j) ? i18n("Default") : "", (*j).iconFile().isNull() ? "" : ""); + if(!(*j).iconFile().isNull()) + b->setPixmap(2, KIconLoader().loadIcon((*j).iconFile(), KIcon::Panel)); + modeMap[b] = *j; + if(*j == oldCurrent) { b->setSelected(true); theKCMLircBase->theModes->setCurrentItem(b); } + } + } + if(theKCMLircBase->theModes->currentItem()) + theKCMLircBase->theModes->currentItem()->setSelected(true); + updateModesStatus(theKCMLircBase->theModes->currentItem()); + updateActions(); +} + +void KCMLirc::updateExtensions() +{ + theKCMLircBase->theExtensions->clear(); + + { ProfileServer *theServer = ProfileServer::profileServer(); + QListViewItem *a = new QListViewItem(theKCMLircBase->theExtensions, i18n("Applications")); + a->setOpen(true); + profileMap.clear(); + QDict<Profile> dict = theServer->profiles(); + QDictIterator<Profile> i(dict); + for(; i.current(); ++i) + profileMap[new QListViewItem(a, i.current()->name())] = i.currentKey(); + } + { RemoteServer *theServer = RemoteServer::remoteServer(); + QListViewItem *a = new QListViewItem(theKCMLircBase->theExtensions, i18n("Remote Controls")); + a->setOpen(true); + remoteMap.clear(); + QDict<Remote> dict = theServer->remotes(); + QDictIterator<Remote> i(dict); + for(; i.current(); ++i) + remoteMap[new QListViewItem(a, i.current()->name())] = i.currentKey(); + } + updateInformation(); +} + +void KCMLirc::updateInformation() +{ + theKCMLircBase->theInformation->clear(); + theKCMLircBase->theInformationLabel->setText(""); + + if(!theKCMLircBase->theExtensions->selectedItem()) return; + + if(!theKCMLircBase->theExtensions->selectedItem()->parent()) + { + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(theKCMLircBase->theExtensions->selectedItem()->text(0))); + if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Applications")) + new QListViewItem(theKCMLircBase->theInformation, i18n("Number of Applications"), QString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + else if(theKCMLircBase->theExtensions->selectedItem()->text(0) == i18n("Remote Controls")) + new QListViewItem(theKCMLircBase->theInformation, i18n("Number of Remote Controls"), QString().setNum(theKCMLircBase->theExtensions->selectedItem()->childCount())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Applications")) + { + ProfileServer *theServer = ProfileServer::profileServer(); + const Profile *p = theServer->profiles()[profileMap[theKCMLircBase->theExtensions->selectedItem()]]; + new QListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Application Identifier"), p->id()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Number of Actions"), QString().setNum(p->actions().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(p->name())); + } + else if(theKCMLircBase->theExtensions->selectedItem()->parent()->text(0) == i18n("Remote Controls")) + { + RemoteServer *theServer = RemoteServer::remoteServer(); + const Remote *p = theServer->remotes()[remoteMap[theKCMLircBase->theExtensions->selectedItem()]]; + new QListViewItem(theKCMLircBase->theInformation, i18n("Extension Name"), p->name()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Extension Author"), p->author()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Remote Control Identifier"), p->id()); + new QListViewItem(theKCMLircBase->theInformation, i18n("Number of Buttons"), QString().setNum(p->buttons().count())); + theKCMLircBase->theInformationLabel->setText(i18n("Information on <b>%1</b>:").arg(p->name())); + } +} + +void KCMLirc::load() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.loadFromConfig(theConfig); + allModes.loadFromConfig(theConfig); + allModes.generateNulls(IRKick_stub("irkick", "IRKick").remotes()); + + updateExtensions(); + updateModes(); + updateActions(); +} + +void KCMLirc::defaults() +{ + // insert your default settings code here... + emit changed(true); +} + +void KCMLirc::save() +{ + KSimpleConfig theConfig("irkickrc"); + allActions.saveToConfig(theConfig); + allModes.saveToConfig(theConfig); + + theConfig.sync(); + IRKick_stub("irkick", "IRKick").reloadConfiguration(); + + emit changed(true); +} + +void KCMLirc::configChanged() +{ + // insert your saving code here... + emit changed(true); +} + +// TODO: Take this out when I know how +extern "C" +{ + KDE_EXPORT KCModule *create_kcmlirc(QWidget *parent, const char *) + { KGlobal::locale()->insertCatalogue("kcmlirc"); + return new KCMLirc(parent, "KCMLirc"); + } +} + +#include <irkick_stub.cpp> + +#include "kcmlirc.moc" diff --git a/kdelirc/kcmlirc/kcmlirc.desktop b/kdelirc/kcmlirc/kcmlirc.desktop new file mode 100644 index 0000000..3e50fae --- /dev/null +++ b/kdelirc/kcmlirc/kcmlirc.desktop @@ -0,0 +1,119 @@ +[Desktop Entry] +Icon=irkick +Comment=Configure your remote controls for use with applications +Comment[ar]=إعداد التØكّم عن بعد لاستخدامه ÙÙŠ تطبيقاتك +Comment[bg]=ÐаÑтройване на диÑтанционното управление +Comment[bs]=Podesite vaÅ¡ daljinski upravljaÄ za upotrebu sa programima +Comment[ca]=Configura els teus controls remots per usar amb aplicacions +Comment[cs]=Nastavenà dálkových ovladaÄů +Comment[cy]=Ffurfweddu eich rheolyddion pell ar gyfer ddefnydd efo cymhwysiadau +Comment[da]=Indstil dine fjernbetjeninger til brug for programmer +Comment[de]=Einrichtung diverser Applikationen zur Bedienung mit einer Fernsteuerung +Comment[el]=Ρυθμίστε τα τηλεχειÏιστήÏια σας για χÏήση σε εφαÏμογÎÏ‚ +Comment[es]=Configurar sus controles remotos para usarlos en las aplicaciones +Comment[et]=Kaugjuhtimise seadistamine rakenduste jaoks +Comment[eu]=Konfiguratu zure urruneko kontrolak aplikazioekin erabiltzeko +Comment[fa]=برای استÙاده با کاربردها، کنترلهای از راه دورتان را پیکربندی کنید +Comment[fi]=Muokkaa kauko-ohjaimesi toimimaan ohjelmien kanssa +Comment[fr]=Configurer vos contrôleurs distants pour l'utiliser avec vos applications +Comment[ga]=Cumraigh do chuid cianrialtáin chun iad a úsáid le feidhmchláir +Comment[he]=הגדרת שלט רחוק לשימוש ×‘×™×™×©×•×ž×™× +Comment[hi]=अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤—ों के साथ उपयोग के लिठअपने रिमोट नियंतà¥à¤°à¤£ को कॉनà¥à¤«à¤¼à¤¿à¤—र करें +Comment[hu]=Az infravörös távirányÃtók jellemzÅ‘i +Comment[is]=Her má stilla fjarstýringar ýmissa forrita +Comment[it]=Configura i telecomandi per l'uso con le applicazioni +Comment[ja]=アプリケーションã§ä½¿ç”¨ã™ã‚‹ãƒªãƒ¢ãƒ¼ãƒˆã‚³ãƒ³ãƒˆãƒãƒ¼ãƒ«ã‚’è¨å®š +Comment[ka]=დáƒáƒáƒ™áƒáƒœáƒ¤áƒ˜áƒ’ურირეთ თქვენი დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვრáƒáƒ› პრáƒáƒ’რáƒáƒ›áƒ˜áƒ— +Comment[kk]=Қашықтан баÑқаруды қолданбалармен қолдану үшін баптау +Comment[km]=កំណážáŸ‹â€‹ážšáž…នាសម្ពáŸáž“្ធ​ការបញ្ជា​ពី​ចម្ងាយ​របស់​អ្នក សម្រាប់​ការប្រើ​ជាមួយនឹង​កម្មវិធី +Comment[lt]=Nuotolinio valdymo programomis konfigÅ«ravimas +Comment[mk]=Конфигурирајте ги вашите далечинÑки управувачи за кориÑтење Ñо апликации +Comment[nb]=Sett opp fjernkontroll for bruk mot programmer +Comment[nds]=Feernbedeners för den Bruuk mit Programmen instellen +Comment[ne]=अनà¥à¤ªà¥à¤°à¤¯à¥‹à¤—सà¤à¤— पà¥à¤°à¤¯à¥‹à¤— गरà¥à¤¨ तपाईंको टाढाको नियनà¥à¤¤à¥à¤°à¤£ कनà¥à¤«à¤¿à¤—र गरà¥à¤¨à¥à¤¹à¥‹à¤¸à¥ +Comment[nl]=Uw afstandsbedieningen instellen voor gebruik in KDE +Comment[nn]=Set opp bruken av fjernkontroll i ulike program +Comment[pa]=ਕਾਰਜਾਂ ਨਾਲ ਵਰਤਣ ਲਈ ਆਪਣੇ ਰਿਮੋਟ ਕੰਟਰੋਲ ਦੀ ਸੰਰਚਨਾ ਕਰੋ +Comment[pl]=Konfiguruje piloty do użycia w programach +Comment[pt]=Configure os seus comandos à distância para os usar nas aplicações +Comment[pt_BR]=Configura seus controles remotos para o uso com as aplicações +Comment[ro]=Configurează telecomneziile de utilizat cu aplicaÅ£ii +Comment[ru]=ÐаÑтройка удалённого ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñми +Comment[sk]=Nastavenie diaľkového ovládania pre vaÅ¡e aplikácie +Comment[sl]=Nastavite vaÅ¡ daljinski upravljalnik za uporabo v programih +Comment[sr]=ПодеÑите контроле вашег даљинÑког управљача за употребу у програмима +Comment[sr@Latn]=Podesite kontrole vaÅ¡eg daljinskog upravljaÄa za upotrebu u programima +Comment[sv]=Ställ in fjärrkontroller att använda med program +Comment[ta]=பயனà¯à®ªà®¾à®Ÿà¯à®•à®³à¯à®Ÿà®©à¯ பயனà¯à®ªà®Ÿà¯à®¤à¯à®¤ தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®•à®³à¯ˆ வடிவமை +Comment[tg]=Ба воÑитаи замимаҳо танзимкунии идоракунии дурдаÑти шумо +Comment[tr]=Uzaktan kontrol ayarlarınızı uygulamalarla kullanmak için ayarla +Comment[uk]=ÐÐ°Ð»Ð°ÑˆÑ‚ÑƒÐ²Ð°Ð½Ð½Ñ ÐµÐ»ÐµÐ¼ÐµÐ½Ñ‚Ñ–Ð² диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ Ð´Ð»Ñ Ð²Ð¸ÐºÐ¾Ñ€Ð¸ÑÑ‚Ð°Ð½Ð½Ñ Ð· програмами +Comment[zh_CN]=é…置您的远程控制以供应用程åºä½¿ç”¨ +Comment[zh_TW]=è¨å®šé™æŽ§æŒ‰éµèˆ‡æ‡‰ç”¨ç¨‹å¼çš„é—œè¯ +Exec=kcmshell kcmlirc +Keywords=KCMLirc,kcmlirc +Keywords[bg]=диÑтанционно уÑтройÑтво, диÑтанционно, инфрачервени, лъчи, KCMLirc, kcmlirc +Keywords[nl]=kcmlirc,linux infrarood,infrarood,afstandsbediening +Keywords[pl]=KCMLirc,kcmlirc,piloty,podczerwieÅ„ +Keywords[pt]=kcmlirc +Keywords[ta]= KCMLirc,kcmlirc +Keywords[uz]=KCMLirc,kcmlirc,infraqizil nur +Keywords[uz@cyrillic]=KCMLirc,kcmlirc,инфрақизил нур +Name=Remote Controls +Name[ar]=التØكّم عن بعد +Name[bg]=ДиÑтанционно +Name[bs]=Daljinsko upravljanje +Name[ca]=Controls remots +Name[cs]=Dálková ovládánà +Name[cy]=Rheolyddion Pell +Name[da]=Fjernbetjeninger +Name[de]=Fernsteuerungen +Name[el]=ΤηλεχειÏιστήÏια +Name[eo]=Teleregiloj +Name[es]=Controles remotos +Name[et]=Kaugjuhtimine +Name[eu]=Urruneko Aginteak +Name[fa]=کنترلهای از راه دور +Name[fi]=Kauko-ohjaimet +Name[fr]=Contrôleurs distants +Name[ga]=Cianrialtáin +Name[he]=שליטה מרחוק +Name[hi]=रिमोट नियंतà¥à¤°à¤£ +Name[hu]=TávirányÃtó +Name[is]=Fjarstýringar +Name[it]=Telecomandi +Name[ja]=リモートコントãƒãƒ¼ãƒ« +Name[ka]=დáƒáƒ¨áƒáƒ ებული მáƒáƒ თვრ+Name[kk]=Қашықтан баÑқару +Name[km]=បញ្ជា​ពី​ចម្ងាយ +Name[lt]=Nuotolinis valdymas +Name[mk]=ДалечинÑки управувачи +Name[nb]=Fjernkontroll +Name[nds]=Feernbedeners +Name[ne]=टाढाको नियनà¥à¤¤à¥à¤°à¤£ +Name[nl]=Afstandsbediening +Name[nn]=Fjernkontrollar +Name[pa]=ਰਿਮੋਟ ਕੰਟਰੋਲ +Name[pl]=Piloty +Name[pt]=Comandos à Distância +Name[pt_BR]=Controles Remotos +Name[ro]=Telecomenzi +Name[ru]=Удалённое управление +Name[sk]=Diaľkový ovládaÄ +Name[sl]=Daljinski upravljalci +Name[sr]=ДаљинÑки управљачи +Name[sr@Latn]=Daljinski upravljaÄi +Name[sv]=Fjärrkontroller +Name[ta]= தொலைதூர கடà¯à®Ÿà¯à®ªà¯à®ªà®¾à®Ÿà¯à®•à®³à¯ +Name[tg]=Идоракунии ДурдаÑÑ‚ +Name[tr]=Uzaktan Kontroller +Name[uk]=Елементи диÑтанційного ÐºÐµÑ€ÑƒÐ²Ð°Ð½Ð½Ñ +Name[zh_CN]=远程控制 +Name[zh_TW]=é™æŽ§éµ +Terminal=false +Type=Application +X-KDE-FactoryName=kcmlirc +X-KDE-Library=kcmlirc +X-KDE-ModuleType=Library +DocPath=kcmlirc/index.html +Categories=Qt;KDE;X-KDE-settings-peripherals; diff --git a/kdelirc/kcmlirc/kcmlirc.h b/kdelirc/kcmlirc/kcmlirc.h new file mode 100644 index 0000000..ba88ae2 --- /dev/null +++ b/kdelirc/kcmlirc/kcmlirc.h @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org + * * + * 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. * + ***************************************************************************/ + +#ifndef _KCMLIRC_H_ +#define _KCMLIRC_H_ + +#include <qstringlist.h> +#include <qmap.h> + +#include <kcmodule.h> + +#include <dcopobject.h> + +#include "kcmlircbase.h" +#include "iractions.h" +#include "modes.h" + +class QListViewItem; +class KListView; +class QDropEvent; +class Profile; +class Remote; + +class KCMLirc: public KCModule, virtual public DCOPObject +{ + Q_OBJECT + K_DCOP + +private: + KCMLircBase *theKCMLircBase; + IRActions allActions; + Modes allModes; + QMap<QListViewItem *, IRAIt > actionMap; + QMap<QListViewItem *, Mode> modeMap; + QMap<QListViewItem *, QString> profileMap, remoteMap; + + void autoPopulate(const Profile &profile, const Remote &remote, const QString &mode); + +public slots: + void updateActions(); + void updateModesStatus(QListViewItem *); + void updateActionsStatus(QListViewItem *); + void updateModes(); + void updateExtensions(); + void updateInformation(); + void slotAddMode(); + void slotRemoveMode(); + void slotSetDefaultMode(); + void slotAddAction(); + void slotAddActions(); + void slotEditAction(); + void slotRemoveAction(); + void slotDrop(KListView *, QDropEvent *, QListViewItem *, QListViewItem *after); + void slotRenamed(QListViewItem *item); + void slotEditMode(); + + +// MOC_SKIP_BEGIN +k_dcop: +// MOC_SKIP_END + // now just used as a proxy to AddAction class + virtual void gotButton(QString remote, QString button); +signals: + void haveButton(const QString &remote, const QString &button); + +public: + virtual void load(); + virtual void save(); + virtual void defaults(); + virtual void configChanged(); + + KCMLirc(QWidget *parent = 0, const char *name = 0, QStringList args = QStringList()); + ~KCMLirc(); +}; + +#endif diff --git a/kdelirc/kcmlirc/kcmlircbase.ui b/kdelirc/kcmlirc/kcmlircbase.ui new file mode 100644 index 0000000..c4b0b81 --- /dev/null +++ b/kdelirc/kcmlirc/kcmlircbase.ui @@ -0,0 +1,506 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>KCMLircBase</class> +<author>Gav Wood</author> +<widget class="QWidget"> + <property name="name"> + <cstring>KCMLircBase</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>469</width> + <height>326</height> + </rect> + </property> + <property name="caption"> + <string>Linux Infrared Remote Control</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QTabWidget" row="0" column="0"> + <property name="name"> + <cstring>tabWidget2</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Controller Functions</string> + </attribute> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>theMainLabel</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="paletteForegroundColor"> + <color> + <red>138</red> + <green>0</green> + <blue>0</blue> + </color> + </property> + <property name="font"> + <font> + <bold>1</bold> + </font> + </property> + <property name="frameShape"> + <enum>NoFrame</enum> + </property> + <property name="margin"> + <number>1</number> + </property> + <property name="text"> + <string>There are currently no remote controls available. You must first set up LIRC correctly; see www.lirc.org for more information.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop</set> + </property> + </widget> + <widget class="QSplitter"> + <property name="name"> + <cstring>splitter4</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>modeLayout</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>theRemotesLabel</cstring> + </property> + <property name="text"> + <string>Remote controls and modes:</string> + </property> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>New Column</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>New Column</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theModes</cstring> + </property> + <property name="acceptDrops"> + <bool>true</bool> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="itemsRenameable"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>modeButtonLayout</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer6</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>17</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>theAddMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Add...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>theEditMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Edit...</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>theRemoveMode</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&Remove</string> + </property> + </widget> + </hbox> + </widget> + </vbox> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>theModeLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>Button</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Program</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Function</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Options</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Notes</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theActions</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>2</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="dragAutoScroll"> + <bool>true</bool> + </property> + <property name="selectionMode" stdset="0"> + <enum>FileManager</enum> + </property> + <property name="dragEnabled"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>240</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout6</cstring> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KPushButton" row="0" column="0" rowspan="1" colspan="3"> + <property name="name"> + <cstring>theAddActions</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Auto-Populate...</string> + </property> + <property name="accel"> + <string></string> + </property> + </widget> + <widget class="KPushButton" row="1" column="0"> + <property name="name"> + <cstring>theAddAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>A&dd...</string> + </property> + </widget> + <widget class="QPushButton" row="1" column="1"> + <property name="name"> + <cstring>theEditAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Ed&it...</string> + </property> + </widget> + <widget class="KPushButton" row="1" column="2"> + <property name="name"> + <cstring>theRemoveAction</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>Re&move</string> + </property> + </widget> + </grid> + </widget> + </hbox> + </widget> + </vbox> + </widget> + </widget> + </vbox> + </widget> + <widget class="QWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Loaded Extensions</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QSplitter" row="0" column="0"> + <property name="name"> + <cstring>splitter5</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theExtensions</cstring> + </property> + <property name="rootIsDecorated"> + <bool>true</bool> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout9</cstring> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <property name="margin"> + <number>0</number> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>theInformationLabel</cstring> + </property> + <property name="text"> + <string></string> + </property> + </widget> + <widget class="KListView"> + <column> + <property name="text"> + <string>Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <column> + <property name="text"> + <string>Information</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theInformation</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + </vbox> + </widget> + </widget> + </grid> + </widget> + </widget> + </grid> +</widget> +<includes> + <include location="local" impldecl="in implementation">kcmlircbase.ui.h</include> +</includes> +<functions> + <function access="private" specifier="non virtual">init()</function> +</functions> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>klistview.h</includehint> + <includehint>klistview.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kcmlirc/kcmlircbase.ui.h b/kdelirc/kcmlirc/kcmlircbase.ui.h new file mode 100644 index 0000000..f9082b6 --- /dev/null +++ b/kdelirc/kcmlirc/kcmlircbase.ui.h @@ -0,0 +1,37 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * 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. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + +#include "modeslist.h" + +void KCMLircBase::init() +{ + delete theModes; + modeLayout->removeItem(modeButtonLayout); + theModes = new ModesList(dynamic_cast<QWidget *>(modeLayout->parent()), "theModes"); + theModes->addColumn(i18n("Remote Control")); + theModes->addColumn(i18n("Default")); + theModes->addColumn(i18n("Icon")); + theModes->setAcceptDrops(true); + theModes->setRootIsDecorated(true); + theModes->setItemsRenameable(true); + modeLayout->addWidget(theModes); + modeLayout->addLayout(modeButtonLayout); + modeLayout->invalidate(); + modeLayout->activate(); +} diff --git a/kdelirc/kcmlirc/modeslist.cpp b/kdelirc/kcmlirc/modeslist.cpp new file mode 100644 index 0000000..6150705 --- /dev/null +++ b/kdelirc/kcmlirc/modeslist.cpp @@ -0,0 +1,33 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <qwidget.h> + +#include <kdebug.h> + +#include "modeslist.h" + +ModesList::ModesList(QWidget *parent, const char *name) : KListView(parent, name) +{ + setAcceptDrops(true); + setDropVisualizer(false); + setDropHighlighter(true); +} + +bool ModesList::acceptDrag(QDropEvent *) const +{ + // TODO: make safer by checking source/mime type + // TODO: make safer by only allowing drops on the correct remote control's modes + return true; +} + +#include "modeslist.moc" diff --git a/kdelirc/kcmlirc/modeslist.h b/kdelirc/kcmlirc/modeslist.h new file mode 100644 index 0000000..2fee458 --- /dev/null +++ b/kdelirc/kcmlirc/modeslist.h @@ -0,0 +1,33 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODESLIST_H +#define MODESLIST_H + +#include <klistview.h> + +#include <klistview.h> + +/** + +@author Gav Wood +*/ + +class ModesList : public KListView +{ + Q_OBJECT +public: + virtual bool acceptDrag(QDropEvent *) const; + ModesList(QWidget *parent = 0, const char *name = 0); +}; + +#endif diff --git a/kdelirc/kcmlirc/newmode.ui b/kdelirc/kcmlirc/newmode.ui new file mode 100644 index 0000000..e3da8ef --- /dev/null +++ b/kdelirc/kcmlirc/newmode.ui @@ -0,0 +1,158 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>NewMode</class> +<widget class="QDialog"> + <property name="name"> + <cstring>NewMode</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>309</width> + <height>341</height> + </rect> + </property> + <property name="caption"> + <string>New Mode</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Remote Controls</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theRemotes</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout11</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="QLabel"> + <property name="name"> + <cstring>textLabel5</cstring> + </property> + <property name="text"> + <string>Name:</string> + </property> + </widget> + <widget class="QLineEdit"> + <property name="name"> + <cstring>theName</cstring> + </property> + </widget> + </hbox> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line2</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout12</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer7</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>61</width> + <height>21</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton6</cstring> + </property> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string>&OK</string> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton5</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<connections> + <connection> + <sender>kPushButton6</sender> + <signal>clicked()</signal> + <receiver>NewMode</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton5</sender> + <signal>clicked()</signal> + <receiver>NewMode</receiver> + <slot>reject()</slot> + </connection> + <connection> + <sender>theName</sender> + <signal>textChanged(const QString&)</signal> + <receiver>NewMode</receiver> + <slot>slotTextChanged(const QString&)</slot> + </connection> +</connections> +<includes> + <include location="local" impldecl="in implementation">newmode.ui.h</include> +</includes> +<slots> + <slot>slotTextChanged( const QString & newText )</slot> +</slots> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kcmlirc/newmode.ui.h b/kdelirc/kcmlirc/newmode.ui.h new file mode 100644 index 0000000..96c1eb4 --- /dev/null +++ b/kdelirc/kcmlirc/newmode.ui.h @@ -0,0 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2003 by Gav Wood * + * gav@kde.org * + * * + * 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. * + ***************************************************************************/ + +/**************************************************************************** +** ui.h extension file, included from the uic-generated form implementation. +** +** If you wish to add, delete or rename functions or slots use +** Qt Designer which will update this file, preserving your code. Create an +** init() function in place of a constructor, and a destroy() function in +** place of a destructor. +*****************************************************************************/ + + +void NewMode::slotTextChanged( const QString &newText ) +{ + kPushButton6->setEnabled(newText != ""); +} diff --git a/kdelirc/kcmlirc/selectprofile.ui b/kdelirc/kcmlirc/selectprofile.ui new file mode 100644 index 0000000..2d4ac18 --- /dev/null +++ b/kdelirc/kcmlirc/selectprofile.ui @@ -0,0 +1,128 @@ +<!DOCTYPE UI><UI version="3.2" stdsetdef="1"> +<class>SelectProfile</class> +<widget class="QDialog"> + <property name="name"> + <cstring>SelectProfile</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>263</width> + <height>328</height> + </rect> + </property> + <property name="caption"> + <string>Select Profile to Add</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KListView"> + <column> + <property name="text"> + <string>Profile Name</string> + </property> + <property name="clickable"> + <bool>true</bool> + </property> + <property name="resizable"> + <bool>true</bool> + </property> + </column> + <property name="name"> + <cstring>theProfiles</cstring> + </property> + <property name="fullWidth"> + <bool>true</bool> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>line8</cstring> + </property> + <property name="frameShape"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="QLayoutWidget"> + <property name="name"> + <cstring>layout47</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>spacer53</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton12</cstring> + </property> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="text"> + <string>&OK</string> + </property> + <property name="default"> + <bool>true</bool> + </property> + </widget> + <widget class="KPushButton"> + <property name="name"> + <cstring>kPushButton13</cstring> + </property> + <property name="text"> + <string>&Cancel</string> + </property> + </widget> + </hbox> + </widget> + </vbox> +</widget> +<customwidgets> +</customwidgets> +<connections> + <connection> + <sender>kPushButton12</sender> + <signal>clicked()</signal> + <receiver>SelectProfile</receiver> + <slot>accept()</slot> + </connection> + <connection> + <sender>kPushButton13</sender> + <signal>clicked()</signal> + <receiver>SelectProfile</receiver> + <slot>reject()</slot> + </connection> +</connections> +<layoutdefaults spacing="6" margin="11"/> +<includehints> + <includehint>klistview.h</includehint> + <includehint>kpushbutton.h</includehint> + <includehint>kpushbutton.h</includehint> +</includehints> +</UI> diff --git a/kdelirc/kdelirc/Makefile.am b/kdelirc/kdelirc/Makefile.am new file mode 100644 index 0000000..ccbe9e4 --- /dev/null +++ b/kdelirc/kdelirc/Makefile.am @@ -0,0 +1,45 @@ +####### kdevelop will overwrite this part!!! (begin)########## +noinst_LTLIBRARIES = libkdelirc.la + +noinst_HEADERS = iraction.h arguments.h iractions.h prototype.h modes.h mode.h profileserver.h remoteserver.h + +libkdelirc_la_SOURCES = iraction.cpp arguments.cpp iractions.cpp prototype.cpp modes.cpp mode.cpp profileserver.cpp remoteserver.cpp +libkdelirc_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_KDEUI) $(LIBSOCKET) + +####### kdevelop will overwrite this part!!! (end)############ +# These paths are KDE specific. Use them: +# kde_appsdir Where your application's menu entry (.desktop) should go to. +# kde_icondir Where your icon should go to - better use KDE_ICON. +# kde_sounddir Where your sounds should go to. +# kde_htmldir Where your docs should go to. (contains lang subdirs) +# kde_datadir Where you install application data. (Use a subdir) +# kde_locale Where translation files should go to. (contains lang subdirs) +# kde_cgidir Where cgi-bin executables should go to. +# kde_confdir Where config files should go to (system-wide ones with default values). +# kde_mimedir Where mimetypes .desktop files should go to. +# kde_servicesdir Where services .desktop files should go to. +# kde_servicetypesdir Where servicetypes .desktop files should go to. +# kde_toolbardir Where general toolbar icons should go to (deprecated, use KDE_ICON). +# kde_wallpaperdir Where general wallpapers should go to. +# kde_irkicksdir Where irkicks for the "New" menu (Konqueror/KDesktop) should go to. +# kde_bindir Where executables should go to. Use bin_PROGRAMS or bin_SCRIPTS. +# kde_libdir Where shared libraries should go to. Use lib_LTLIBRARIES. +# kde_moduledir Where modules (e.g. parts) should go to. Use kde_module_LTLIBRARIES. +# kde_styledir Where Qt/KDE widget styles should go to (new in KDE 3). +# kde_designerdir Where Qt Designer plugins should go to (new in KDE 3). + +# set the include path for X, qt and KDE +INCLUDES = $(all_includes) + +METASOURCES = AUTO + +# the library search path. +libkdelirc_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) + +# Uncomment the following two lines if you add a ui.rc file for your application to make use of +# KDE´s XML GUI builing +#rcdir = $(kde_datadir)/irkick +#rc_DATA = irkickui.rc + +messages: + $(XGETTEXT) *.cpp *.h -o $(podir)/kdelirc.pot diff --git a/kdelirc/kdelirc/arguments.cpp b/kdelirc/kdelirc/arguments.cpp new file mode 100644 index 0000000..10fc69b --- /dev/null +++ b/kdelirc/kdelirc/arguments.cpp @@ -0,0 +1,36 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <qstring.h> + +#include "arguments.h" + +Arguments::Arguments() +{ +} + +Arguments::~Arguments() +{ +} + +const QString Arguments::toString() const +{ + QString ret = ""; + for(Arguments::const_iterator i = begin(); i != end(); ++i) + { QString s = (*i).toString(); + if(s.isNull()) s = "..."; + if(i != begin()) ret += ", "; + ret += s; + } + return ret; +} + diff --git a/kdelirc/kdelirc/arguments.h b/kdelirc/kdelirc/arguments.h new file mode 100644 index 0000000..97448a5 --- /dev/null +++ b/kdelirc/kdelirc/arguments.h @@ -0,0 +1,32 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef ARGUMENTS_H +#define ARGUMENTS_H + +#include <qvaluelist.h> +#include <qvariant.h> + +/** +@author Gav Wood +*/ + +class Arguments : public QValueList<QVariant> +{ +public: + const QString toString() const; + + Arguments(); + ~Arguments(); +}; + +#endif diff --git a/kdelirc/kdelirc/iraction.cpp b/kdelirc/kdelirc/iraction.cpp new file mode 100644 index 0000000..9081a2e --- /dev/null +++ b/kdelirc/kdelirc/iraction.cpp @@ -0,0 +1,155 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <qvariant.h> + +#include <kconfig.h> +#include <klocale.h> + +#include "iraction.h" +#include "profileserver.h" +#include "remoteserver.h" + +IRAction::IRAction(const QString &newProgram, const QString &newObject, const QString &newMethod, const Arguments &newArguments, const QString &newRemote, const QString &newMode, const QString &newButton, const bool newRepeat, const bool newAutoStart, const bool newDoBefore, const bool newDoAfter, const bool newUnique, const IfMulti newIfMulti) +{ + theProgram = newProgram; + theObject = newObject; + theMethod = newMethod; + theArguments = newArguments; + theRemote = newRemote; + theMode = newMode; + theButton = newButton; + theRepeat = newRepeat; + theDoAfter = newDoAfter; + theDoBefore = newDoBefore; + theAutoStart = newAutoStart; + theUnique = newUnique; + theIfMulti = newIfMulti; +} + +const IRAction &IRAction::loadFromConfig(KConfig &theConfig, int index) +{ + QString Binding = "Binding" + QString().setNum(index); + int numArguments = theConfig.readNumEntry(Binding + "Arguments"); + theArguments.clear(); + for(int j = 0; j < numArguments; j++) + { QVariant::Type theType = (QVariant::Type)theConfig.readNumEntry(Binding + "ArgumentType" + QString().setNum(j), QVariant::String); + theArguments += theConfig.readPropertyEntry(Binding + "Argument" + QString().setNum(j), theType == QVariant::CString ? QVariant::String : theType); + theArguments.last().cast(theType); + } + + theProgram = theConfig.readEntry(Binding + "Program"); + theObject = theConfig.readEntry(Binding + "Object"); + theMethod.setPrototype(theConfig.readEntry(Binding + "Method")); + theRemote = theConfig.readEntry(Binding + "Remote"); + theMode = theConfig.readEntry(Binding + "Mode"); + theButton = theConfig.readEntry(Binding + "Button"); + theRepeat = theConfig.readBoolEntry(Binding + "Repeat"); + theDoBefore = theConfig.readBoolEntry(Binding + "DoBefore"); + theDoAfter = theConfig.readBoolEntry(Binding + "DoAfter"); + theAutoStart = theConfig.readBoolEntry(Binding + "AutoStart"); + theUnique = theConfig.readBoolEntry(Binding + "Unique", true); + theIfMulti = (IfMulti)theConfig.readNumEntry(Binding + "IfMulti", IM_DONTSEND); + + return *this; +} + +void IRAction::saveToConfig(KConfig &theConfig, int index) const +{ + QString Binding = "Binding" + QString().setNum(index); + + theConfig.writeEntry(Binding + "Arguments", theArguments.count()); + for(unsigned j = 0; j < theArguments.count(); j++) + { QVariant arg = theArguments[j]; + QVariant::Type preType = arg.type(); + if(preType == QVariant::CString) arg.cast(QVariant::String); + theConfig.writeEntry(Binding + "Argument" + QString().setNum(j), arg); + theConfig.writeEntry(Binding + "ArgumentType" + QString().setNum(j), preType); + } + theConfig.writeEntry(Binding + "Program", theProgram); + theConfig.writeEntry(Binding + "Object", theObject); + theConfig.writeEntry(Binding + "Method", theMethod.prototype()); + theConfig.writeEntry(Binding + "Remote", theRemote); + theConfig.writeEntry(Binding + "Mode", theMode); + theConfig.writeEntry(Binding + "Button", theButton); + theConfig.writeEntry(Binding + "Repeat", theRepeat); + theConfig.writeEntry(Binding + "DoBefore", theDoBefore); + theConfig.writeEntry(Binding + "DoAfter", theDoAfter); + theConfig.writeEntry(Binding + "AutoStart", theAutoStart); + theConfig.writeEntry(Binding + "Unique", theUnique); + theConfig.writeEntry(Binding + "IfMulti", theIfMulti); +} + +const QString IRAction::function() const +{ + ProfileServer *theServer = ProfileServer::profileServer(); + if(theProgram.isEmpty()) + if(theObject.isEmpty()) + return i18n("Exit mode"); + else + return i18n("Switch to %1").arg(theObject); + else + if(theObject.isEmpty()) + return i18n("Just start"); + else + { + const ProfileAction *a = theServer->getAction(theProgram, theObject, theMethod.prototype()); + if(a) + return a->name(); + else + return theObject + "::" + theMethod.name(); + } +} + +const QString IRAction::notes() const +{ + + if(isModeChange()) + return QString(theDoBefore ? i18n("Do actions before. ") : "") + + QString(theDoAfter ? i18n("Do actions after. ") : ""); + else if(isJustStart()) + return ""; + else + return QString(theAutoStart ? i18n("Auto-start. ") : "") + + QString(theRepeat ? i18n("Repeatable. ") : "") + + QString(!theUnique ? (theIfMulti == IM_DONTSEND ? i18n("Do nothing if many instances. ") + : theIfMulti == IM_SENDTOTOP ? i18n("Send to top instance. ") + : theIfMulti == IM_SENDTOBOTTOM ? i18n("Send to bottom instance. ") : i18n("Send to all instances. ")) + : ""); +} + +const QString IRAction::application() const +{ + ProfileServer *theServer = ProfileServer::profileServer(); + if(theProgram.isEmpty()) + return ""; + else + { + const Profile *a = theServer->profiles()[theProgram]; + if(a) + return a->name(); + else + return theProgram; + } +} + +const QString IRAction::remoteName() const +{ + return RemoteServer::remoteServer()->getRemoteName(theRemote); +} + +const QString IRAction::buttonName() const +{ + return RemoteServer::remoteServer()->getButtonName(theRemote, theButton); +} + diff --git a/kdelirc/kdelirc/iraction.h b/kdelirc/kdelirc/iraction.h new file mode 100644 index 0000000..f7008ff --- /dev/null +++ b/kdelirc/kdelirc/iraction.h @@ -0,0 +1,88 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef IRACTION_H +#define IRACTION_H + +#include <qstring.h> + +#include "prototype.h" +#include "arguments.h" +#include "profileserver.h" + +/** +@author Gav Wood +*/ + +class KConfig; + +class IRAction +{ + QString theProgram, theObject, theRemote, theButton, theMode; + Prototype theMethod; + Arguments theArguments; + bool theRepeat, theAutoStart, theDoBefore, theDoAfter; + IfMulti theIfMulti; + bool theUnique; + +public: + // load/save convenience functions + const IRAction &loadFromConfig(KConfig &theConfig, int index); + void saveToConfig(KConfig &theConfig, int index) const; + + // may be changed to a profile-based representation in the future. + const QString function() const; + const QString application() const; + const QString buttonName() const; + const QString remoteName() const; + const QString notes() const; + + // bog standard raw DCOP stuff + const QString &program() const { return theProgram; } + const QString &object() const { return theObject; } + const Prototype &method() const { return theMethod; } + const QString &remote() const { return theRemote; } + const QString &mode() const { return theMode; } + const QString &button() const { return theButton; } + const Arguments arguments() const { if(theProgram != "" && theObject != "") return theArguments; return Arguments(); } + const bool repeat() const { return theRepeat; } + const bool autoStart() const { return theAutoStart; } + const IfMulti ifMulti() const { return theIfMulti; } + const bool unique() const { return theUnique; } + + const QString &modeChange() const { return theObject; } + const bool doBefore() const { return theDoBefore; } + const bool doAfter() const { return theDoAfter; } + + bool isModeChange() const { return theProgram == ""; } + bool isJustStart() const { return theProgram != "" && theObject == ""; } + + void setProgram(const QString &newProgram) { theProgram = newProgram; } + void setObject(const QString &newObject) { theObject = newObject; } + void setMethod(const Prototype &newMethod) { theMethod = newMethod; } + void setRemote(const QString &newRemote) { theRemote = newRemote; } + void setMode(const QString &newMode) { theMode = newMode; } + void setButton(const QString &newButton) { theButton = newButton; } + void setArguments(const Arguments &newArguments) { theArguments = newArguments; } + void setRepeat(bool newRepeat) { theRepeat = newRepeat; } + void setDoBefore(bool a) { theDoBefore = a; } + void setDoAfter(bool a) { theDoAfter = a; } + void setAutoStart(bool newAutoStart) { theAutoStart = newAutoStart; } + void setModeChange(const QString &a) { theObject = a; } + void setIfMulti(const IfMulti a) { theIfMulti = a; } + void setUnique(const bool a) { theUnique = a; } + + IRAction(const QString &newProgram, const QString &newObject, const QString &newMethod, const Arguments &newArguments, const QString &newRemote, const QString &newMode, const QString &newButton, const bool newRepeat, const bool newAutoStart, const bool newDoBefore, const bool newDoAfter, const bool newUnique, const IfMulti newIfMulti); + IRAction() { theProgram = QString::null; } +}; + +#endif diff --git a/kdelirc/kdelirc/iractions.cpp b/kdelirc/kdelirc/iractions.cpp new file mode 100644 index 0000000..9bc03e3 --- /dev/null +++ b/kdelirc/kdelirc/iractions.cpp @@ -0,0 +1,90 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kconfig.h> +#include <kdebug.h> + +#include "iractions.h" +#include "iraction.h" + +void IRActions::loadFromConfig(KConfig &theConfig) +{ + clear(); + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + addAction(IRAction().loadFromConfig(theConfig, i)); +} + +void IRActions::purgeAllBindings(KConfig &theConfig) +{ + int numBindings = theConfig.readNumEntry("Bindings"); + for(int i = 0; i < numBindings; i++) + { QString Binding = "Binding" + QString().setNum(i); + int numArguments = theConfig.readNumEntry(Binding + "Arguments"); + for(int j = 0; j < numArguments; j++) + { theConfig.deleteEntry(Binding + "Argument" + QString().setNum(j)); + theConfig.deleteEntry(Binding + "ArgumentType" + QString().setNum(j)); + } + theConfig.deleteEntry(Binding + "Arguments"); theConfig.deleteEntry(Binding + "Program"); + theConfig.deleteEntry(Binding + "Object"); theConfig.deleteEntry(Binding + "Method"); + theConfig.deleteEntry(Binding + "Remote"); theConfig.deleteEntry(Binding + "Button"); + theConfig.deleteEntry(Binding + "Repeat"); theConfig.deleteEntry(Binding + "Mode"); + } +} + +void IRActions::saveToConfig(KConfig &theConfig) +{ + int index = 0; + purgeAllBindings(theConfig); + for(iterator i = begin(); i != end(); ++i,index++) + (*i).saveToConfig(theConfig, index); + theConfig.writeEntry("Bindings", index); +} + +IRAIt IRActions::addAction(const IRAction &theAction) +{ + return append(theAction); +} + +IRAItList IRActions::findByButton(const QString &remote, const QString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == remote && (*i).button() == button) + ret += i; + return ret; +} + +void IRActions::renameMode(const Mode &mode, const QString &to) +{ + for(iterator i = begin(); i != end(); ++i) + { if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) (*i).setMode(to); + if((*i).isModeChange() && (*i).modeChange() == mode.name()) (*i).setModeChange(to); + } +} + +IRAItList IRActions::findByMode(const Mode &mode) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name()) ret += i; + return ret; +} + +IRAItList IRActions::findByModeButton(const Mode &mode, const QString &button) +{ + IRAItList ret; + for(iterator i = begin(); i != end(); ++i) + if((*i).remote() == mode.remote() && (*i).mode() == mode.name() && (*i).button() == button) + ret += i; + return ret; +} diff --git a/kdelirc/kdelirc/iractions.h b/kdelirc/kdelirc/iractions.h new file mode 100644 index 0000000..24174d9 --- /dev/null +++ b/kdelirc/kdelirc/iractions.h @@ -0,0 +1,52 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef IRACTIONS_H +#define IRACTIONS_H + +#include <qvaluelist.h> +#include <qpair.h> +#include <qstring.h> +#include <qmap.h> + +#include "iraction.h" +#include "mode.h" + +/** +@author Gav Wood +*/ + +class KConfig; + +typedef QValueListIterator<IRAction> IRAIt; +typedef QValueList<IRAIt> IRAItList; + +class IRActions: protected QValueList<IRAction> +{ +private: + void purgeAllBindings(KConfig &theConfig); + +public: + IRAIt addAction(const IRAction &theAction); + IRAItList findByButton(const QString &remote, const QString &button); + IRAItList findByMode(const Mode &mode); + IRAItList findByModeButton(const Mode &mode, const QString &button); + + void erase(const IRAIt &action) { QValueList<IRAction>::erase(action); } + void renameMode(const Mode &mode, const QString &to); + + void loadFromConfig(KConfig &theConfig); + void saveToConfig(KConfig &theConfig); +}; + + +#endif diff --git a/kdelirc/kdelirc/mode.cpp b/kdelirc/kdelirc/mode.cpp new file mode 100644 index 0000000..1f4c34a --- /dev/null +++ b/kdelirc/kdelirc/mode.cpp @@ -0,0 +1,51 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <kconfig.h> + +#include "modes.h" +#include "mode.h" + +Mode::Mode() : theName(QString::null) +{ +} + +Mode::Mode(const QString &remote, const QString &name, const QString &iconFile) +{ + theRemote = remote; + theName = name; + theIconFile = iconFile; +} + +Mode::~Mode() +{ +} + +const Mode &Mode::loadFromConfig(KConfig &theConfig, int index) +{ + QString Prefix = "Mode" + QString().setNum(index); + theName = theConfig.readEntry(Prefix + "Name"); + theRemote = theConfig.readEntry(Prefix + "Remote"); + theIconFile = theConfig.readEntry(Prefix + "IconFile"); + if(theIconFile.isEmpty()) theIconFile = QString::null; + return *this; +} + +void Mode::saveToConfig(KConfig &theConfig, int index) +{ + QString Prefix = "Mode" + QString().setNum(index); + theConfig.writeEntry(Prefix + "Name", theName); + theConfig.writeEntry(Prefix + "Remote", theRemote); + theConfig.writeEntry(Prefix + "IconFile", theIconFile); +} + diff --git a/kdelirc/kdelirc/mode.h b/kdelirc/kdelirc/mode.h new file mode 100644 index 0000000..e52c042 --- /dev/null +++ b/kdelirc/kdelirc/mode.h @@ -0,0 +1,50 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODE_H +#define MODE_H + +#include <qstring.h> + +#include "remoteserver.h" + +/** +@author Gav Wood +*/ + +class KConfig; + +class Mode +{ + QString theName, theRemote, theIconFile; + +public: + void setName(const QString &a) { theName = a; } + void setRemote(const QString &a) { theRemote = a; } + void setIconFile(const QString &a) { theIconFile = a; } + + const QString &name() const { return theName; } + const QString &remote() const { return theRemote; } + const QString &iconFile() const { return theIconFile; } + const QString &remoteName() const { return RemoteServer::remoteServer()->getRemoteName(theRemote); } + + const Mode &loadFromConfig(KConfig &theConfig, int index); + void saveToConfig(KConfig &theConfig, int index); + + bool operator==(const Mode &mode) const { return mode.theName == theName && mode.theRemote == theRemote; } + + Mode(); + Mode(const QString &remote, const QString &name, const QString &iconFile = QString::null); + ~Mode(); +}; + +#endif diff --git a/kdelirc/kdelirc/modes.cpp b/kdelirc/kdelirc/modes.cpp new file mode 100644 index 0000000..1b60647 --- /dev/null +++ b/kdelirc/kdelirc/modes.cpp @@ -0,0 +1,128 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <kconfig.h> +#include <kdebug.h> + +#include "modes.h" +#include "mode.h" + +Modes::Modes() +{ +} + + +Modes::~Modes() +{ +} + +void Modes::loadFromConfig(KConfig &theConfig) +{ + clear(); + int numModes = theConfig.readNumEntry("Modes"); + for(int i = 0; i < numModes; i++) + { + add(Mode().loadFromConfig(theConfig, i)); + } + + for(iterator i = begin(); i != end(); ++i) + theDefaults[i.key()] = theConfig.readEntry("Default" + i.key()); +} + +void Modes::generateNulls(const QStringList &theRemotes) +{ + for(QStringList::const_iterator i = theRemotes.begin(); i != theRemotes.end(); ++i) + { if(!contains(*i) || !operator[](*i).contains("")) operator[](*i)[""] = Mode(*i, ""); + if(!theDefaults.contains(*i)) theDefaults[*i].isEmpty(); + } +} + +bool Modes::isDefault(const Mode &mode) const +{ + if(theDefaults[mode.remote()] == mode.name()) + return true; +// if(theDefaults[mode.remote()].isEmpty() || theDefaults[mode.remote()].isNull()) +// return mode.name().isEmpty(); + return false; +} + +const Mode Modes::getDefault(const QString &remote) const +{ +// if(theDefaults[remote] == QString()) +// return Mode(remote, ""); + if(contains(remote)) + if(operator[](remote).contains(theDefaults[remote])) + return operator[](remote)[theDefaults[remote]]; + else return Mode(remote, ""); + else return Mode(remote, ""); + +} + +void Modes::purgeAllModes(KConfig &theConfig) +{ + int numModes = theConfig.readNumEntry("Modes"); + for(int i = 0; i < numModes; i++) + { QString Prefix = "Mode" + QString().setNum(i); + theConfig.deleteEntry(Prefix + "Name"); + theConfig.deleteEntry(Prefix + "Remote"); + } +} + +void Modes::saveToConfig(KConfig &theConfig) +{ + int index = 0; + purgeAllModes(theConfig); + for(iterator i = begin(); i != end(); ++i) + for(QMap<QString, Mode>::iterator j = (*i).begin(); j != (*i).end(); ++j,index++) + (*j).saveToConfig(theConfig, index); + theConfig.writeEntry("Modes", index); + + for(iterator i = begin(); i != end(); ++i) + if(theDefaults[i.key()] == QString()) + theConfig.writeEntry("Default" + i.key(), ""); + else + theConfig.writeEntry("Default" + i.key(), theDefaults[i.key()]); +} + +const Mode &Modes::getMode(const QString &remote, const QString &mode) const +{ + return operator[](remote)[mode]; +} + +ModeList Modes::getModes(const QString &remote) const +{ + ModeList ret; + for(QMap<QString, Mode>::const_iterator i = operator[](remote).begin(); i != operator[](remote).end(); ++i) + ret += *i; + return ret; +} + +void Modes::erase(const Mode &mode) +{ + operator[](mode.remote()).erase(mode.name()); +} + +void Modes::add(const Mode &mode) +{ + kdDebug() << "adding a mode " << mode.name() << " to remote " << mode.remote() << endl; + operator[](mode.remote())[mode.name()] = mode; +} + +void Modes::rename(Mode &mode, const QString name) +{ + bool was = isDefault(mode); + erase(mode); + mode.setName(name); + if(was) setDefault(mode); + add(mode); +} + diff --git a/kdelirc/kdelirc/modes.h b/kdelirc/kdelirc/modes.h new file mode 100644 index 0000000..9eabd4b --- /dev/null +++ b/kdelirc/kdelirc/modes.h @@ -0,0 +1,62 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef MODES_H +#define MODES_H + +#include <qstring.h> +#include <qmap.h> +#include <qpair.h> +#include <qvaluelist.h> + +#include "mode.h" + +/** +@author Gav Wood +*/ + +class KConfig; + +typedef QValueList<Mode> ModeList; + +class Modes : protected QMap<QString, QMap<QString, Mode> > +{ + void purgeAllModes(KConfig &theConfig); + QMap<QString, QString> theDefaults; + +public: + void loadFromConfig(KConfig &theConfig); + void saveToConfig(KConfig &theConfig); + void generateNulls(const QStringList &theRemotes); + + const Mode &getMode(const QString &remote, const QString &mode) const; + ModeList getModes(const QString &remote) const; + const Mode getDefault(const QString &remote) const; + bool isDefault(const Mode &mode) const; + + /** + * Call when you've changed a previously getMode'd mode and you want the changes + * to be recorded + **/ + void updateMode(const Mode &mode) { operator[](mode.remote())[mode.name()] = mode; } + void setDefault(const Mode &mode) { theDefaults[mode.remote()] = mode.name(); } + void erase(const Mode &mode); + void add(const Mode &mode); + + // dont use this without renaming all the modes in the actions!!! + void rename(Mode &mode, const QString name); + + Modes(); + ~Modes(); +}; + +#endif diff --git a/kdelirc/kdelirc/profileserver.cpp b/kdelirc/kdelirc/profileserver.cpp new file mode 100644 index 0000000..484deac --- /dev/null +++ b/kdelirc/kdelirc/profileserver.cpp @@ -0,0 +1,159 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <qfile.h> +#include <qxml.h> + +#include <kglobal.h> +#include <kstandarddirs.h> +#include <kdebug.h> + +#include "profileserver.h" + +ProfileServer *ProfileServer::theInstance = 0; + +ProfileServer::ProfileServer() +{ + theProfiles.setAutoDelete(true); + loadProfiles(); +} + +ProfileServer::~ProfileServer() +{ +} + +void ProfileServer::loadProfiles() +{ + QStringList theFiles = KGlobal::dirs()->findAllResources("data", "profiles/*.profile.xml"); + for(QStringList::iterator i = theFiles.begin(); i != theFiles.end(); ++i) + { kdDebug() << "Found data file: " << *i << endl; + Profile *p = new Profile(); + p->loadFromFile(*i); + theProfiles.insert(p->id(), p); + } +} + +Profile::Profile() +{ + // set up defaults + theUnique = true; + theIfMulti = IM_DONTSEND; + + theActions.setAutoDelete(true); +} + +const ProfileAction *Profile::searchClass(const QString &c) const +{ + for(QDictIterator<ProfileAction> i(theActions); i.current(); ++i) + if(i.current()->getClass() == c) return i; + return 0; +} + +void Profile::loadFromFile(const QString &fileName) +{ + charBuffer = ""; + curPA = 0; + curPAA = 0; + + QFile xmlFile(fileName); + QXmlInputSource source(&xmlFile); + QXmlSimpleReader reader; + reader.setContentHandler(this); + reader.parse(source); +} + +const ProfileAction *ProfileServer::getAction(const QString &appId, const QString &actionId) const +{ + if(theProfiles[appId]) + if(theProfiles[appId]->theActions[actionId]) + return theProfiles[appId]->theActions[actionId]; + return 0; +} + +const QString &ProfileServer::getServiceName(const QString &appId) const +{ + if(theProfiles[appId]) + return theProfiles[appId]->serviceName(); + return QString::null; +} + +const ProfileAction *ProfileServer::getAction(const QString &appId, const QString &objId, const QString &prototype) const +{ + return getAction(appId, objId + "::" + prototype); +} + +bool Profile::characters(const QString &data) +{ + charBuffer += data; + return true; +} + +bool Profile::startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attributes) +{ + if(name == "profile") + { theId = attributes.value("id"); + theServiceName = attributes.value("servicename"); + } + else if(name == "action") + { curPA = new ProfileAction; + curPA->setObjId(attributes.value("objid")); + curPA->setPrototype(attributes.value("prototype")); + curPA->setClass(attributes.value("class")); + curPA->setMultiplier(attributes.value("multiplier").isEmpty() ? 1.0 : attributes.value("multiplier").toFloat()); + curPA->setRepeat(attributes.value("repeat") == "1"); + curPA->setAutoStart(attributes.value("autostart") == "1"); + } + else if(name == "instances") + { theUnique = attributes.value("unique") == "1"; + theIfMulti = attributes.value("ifmulti") == "sendtotop" ? IM_SENDTOTOP : attributes.value("ifmulti") == "sendtobottom" ? IM_SENDTOBOTTOM : attributes.value("ifmulti") == "sendtoall" ? IM_SENDTOALL : IM_DONTSEND; + } + else if(name == "argument") + { curPA->theArguments.append(ProfileActionArgument()); + curPAA = &(curPA->theArguments.last()); + curPAA->setAction(curPA); + curPAA->setType(attributes.value("type")); + } + else if(name == "range" && curPAA) + curPAA->setRange(qMakePair(attributes.value("min").toInt(), attributes.value("max").toInt())); + + charBuffer = ""; + return true; +} + +bool Profile::endElement(const QString &, const QString &, const QString &name) +{ + if(name == "name") + if(curPA) + curPA->setName(charBuffer); + else + theName = charBuffer; + else if(name == "author") + theAuthor = charBuffer; + else if(name == "comment" && curPA && !curPAA) + curPA->setComment(charBuffer); + else if(name == "default" && curPA && curPAA) + curPAA->setDefault(charBuffer); + else if(name == "comment" && curPA && curPAA) + curPAA->setComment(charBuffer); + else if(name == "action") + { + curPA->setProfile(this); + theActions.insert(curPA->objId() + "::" + curPA->prototype(), curPA); + curPA = 0; + } + else if(name == "argument") + curPAA = 0; + + charBuffer = ""; + return true; +} diff --git a/kdelirc/kdelirc/profileserver.h b/kdelirc/kdelirc/profileserver.h new file mode 100644 index 0000000..f906dd0 --- /dev/null +++ b/kdelirc/kdelirc/profileserver.h @@ -0,0 +1,142 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef PROFILESERVER_H +#define PROFILESERVER_H + +#include <qpair.h> +#include <qstring.h> +#include <qvaluelist.h> +#include <qmap.h> +#include <qxml.h> +#include <qdict.h> + +/** +@author Gav Wood +*/ + +enum IfMulti {IM_DONTSEND, IM_SENDTOALL, IM_SENDTOTOP, IM_SENDTOBOTTOM}; + +typedef QPair<int,int> Range; + +class ProfileAction; +class Profile; + +class ProfileActionArgument +{ + QString theComment, theType; + Range theRange; + QString theDefault; // should be QVariant? + const ProfileAction *parent; + + friend class Profile; +public: + const QString &comment() const { return theComment; } + void setComment(const QString &a) { theComment = a; } + const QString &type() const { return theType; } + void setType(const QString &a) { theType = a; } + const QString &getDefault() const { return theDefault; } + void setDefault(const QString &a) { theDefault = a; } + const Range &range() const { return theRange; } + void setRange(const Range &a) { theRange = a; } + + const ProfileAction *action() const { return parent; } + void setAction(const ProfileAction *a) { parent = a; } +}; + +class ProfileAction +{ + QString theObjId, thePrototype, theName, theComment, theClass; + float theMultiplier; + const Profile *parent; + bool theRepeat, theAutoStart; + QValueList<ProfileActionArgument> theArguments; + + friend class Profile; +public: + const QString &objId() const { return theObjId; } + void setObjId(const QString &a) { theObjId = a; } + const QString &prototype() const { return thePrototype; } + void setPrototype(const QString &a) { thePrototype = a; } + const QString &name() const { return theName; } + void setName(const QString &a) { theName = a; } + const QString &comment() const { return theComment; } + void setComment(const QString &a) { theComment = a; } + const QString &getClass() const { return theClass; } + void setClass(const QString &a) { theClass = a; } + const float multiplier() const { return theMultiplier; } + void setMultiplier(const float a) { theMultiplier = a; } + bool repeat() const { return theRepeat; } + void setRepeat(bool a) { theRepeat = a; } + bool autoStart() const { return theAutoStart; } + void setAutoStart(bool a) { theAutoStart = a; } + const QValueList<ProfileActionArgument> &arguments() const { return theArguments; } + + const Profile *profile() const { return parent; } + void setProfile(const Profile *a) { parent = a; } +}; + +class Profile : public QXmlDefaultHandler +{ + QString theId, theName, theAuthor, theServiceName; + IfMulti theIfMulti; + bool theUnique; + QString charBuffer; + + ProfileAction *curPA; + ProfileActionArgument *curPAA; + QDict<ProfileAction> theActions; // objid+"::"+prototype => ProfileAction + + friend class ProfileServer; +public: + bool characters(const QString &data); + bool startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attributes); + bool endElement(const QString &, const QString &, const QString &name); + + const QString &id() const { return theId; } + void setId(const QString &a) { theId = a; } + const QString &name() const { return theName; } + void setName(const QString &a) { theName = a; } + const QString &author() const { return theAuthor; } + void setAuthor(const QString &a) { theAuthor = a; } + const bool unique() const { return theUnique; } + void setUnique(const bool a) { theUnique = a; } + const IfMulti ifMulti() const { return theIfMulti; } + void setIfMulti(const IfMulti a) { theIfMulti = a; } + const QString &serviceName() const { if(theServiceName != QString::null) return theServiceName; return theName; } + void setServiceName(const QString &a) { theServiceName = a; } + const QDict<ProfileAction> &actions() const { return theActions; } + const ProfileAction *searchClass(const QString &c) const; + + void loadFromFile(const QString &fileName); + + Profile(); +}; + +class ProfileServer +{ + static ProfileServer *theInstance; + void loadProfiles(); + QDict<Profile> theProfiles; // id => Profile + +public: + static ProfileServer *profileServer() { if(!theInstance) theInstance = new ProfileServer(); return theInstance; } + const QDict<Profile> profiles() const { return theProfiles; } + const ProfileAction *getAction(const QString &appId, const QString &objId, const QString &prototype) const; + const ProfileAction *getAction(const QString &appId, const QString &actionId) const; + const QString &getServiceName(const QString &appId) const; + + ProfileServer(); + ~ProfileServer(); +}; + +#endif diff --git a/kdelirc/kdelirc/prototype.cpp b/kdelirc/kdelirc/prototype.cpp new file mode 100644 index 0000000..9b0a09b --- /dev/null +++ b/kdelirc/kdelirc/prototype.cpp @@ -0,0 +1,67 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#include <qregexp.h> + +#include "prototype.h" + +Prototype::Prototype() +{ + original = ""; +} + +Prototype::Prototype(const QString &source) +{ + original = source; + parse(); +} + +Prototype::~Prototype() +{ +} + +const QString Prototype::argumentList() const +{ + QString ret = ""; + for(unsigned i = 0; i < theTypes.count(); i++) + ret += (i ? ", " : "") + theTypes[i] + " " + theNames[i]; + return ret; +} + +const QString Prototype::argumentListNN() const +{ + QString ret = ""; + for(unsigned i = 0; i < theTypes.count(); i++) + ret += (i ? ", " : "") + theTypes[i]; + return ret; +} + +void Prototype::parse() +{ + theNames.clear(); + theTypes.clear(); + + QRegExp main("^(.*) (\\w[\\d\\w]*)\\((.*)\\)"); + QRegExp parameters("^\\s*([^,\\s]+)(\\s+(\\w[\\d\\w]*))?(,(.*))?$"); + + if(main.search(original) == -1) return; + theReturn = main.cap(1); + theName = main.cap(2); + + QString args = main.cap(3); + while(parameters.search(args) != -1) + { theTypes += parameters.cap(1); + theNames += parameters.cap(3); + args = parameters.cap(5); + } +} + diff --git a/kdelirc/kdelirc/prototype.h b/kdelirc/kdelirc/prototype.h new file mode 100644 index 0000000..22c1123 --- /dev/null +++ b/kdelirc/kdelirc/prototype.h @@ -0,0 +1,54 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef PROTOTYPE_H +#define PROTOTYPE_H + +#include <qstringlist.h> +#include <qpair.h> +#include <qstring.h> + +/** +@author Gav Wood +*/ + +class Prototype +{ + QString original, theName, theReturn; + QStringList theNames, theTypes; + + void parse(); + +public: + unsigned count() const{ return theTypes.count(); } + const QPair<QString, QString> operator[](int i) const { return qMakePair(theTypes[i], theNames[i]); } + const QString &name(int i) const { return theNames[i]; } + const QString &type(int i) const { return theTypes[i]; } + const QString &returnType() const { return theReturn; } + const QString &name() const { return theName; } + const QString &prototype() const { return original; } + const QString argumentList() const; + const QString argumentListNN() const; + const int argumentCount() { return theTypes.count(); } + const QString prototypeNR() const { return theName + "(" + argumentListNN() + ")"; } + + void setPrototype(const QString &source) { original = source; parse(); } + + Prototype &operator=(const QString &source) { setPrototype(source); return *this; } + + Prototype(const QString &source); + Prototype(); + ~Prototype(); + +}; + +#endif diff --git a/kdelirc/kdelirc/remoteserver.cpp b/kdelirc/kdelirc/remoteserver.cpp new file mode 100644 index 0000000..25d8f44 --- /dev/null +++ b/kdelirc/kdelirc/remoteserver.cpp @@ -0,0 +1,109 @@ +// +// +// C++ Implementation: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// + +#include <qfile.h> +#include <qxml.h> + +#include <kglobal.h> +#include <kstandarddirs.h> +#include <kdebug.h> + +#include "remoteserver.h" + +RemoteServer *RemoteServer::theInstance = 0; + +RemoteServer::RemoteServer() +{ + theRemotes.setAutoDelete(true); + loadRemotes(); +} + +RemoteServer::~RemoteServer() +{ +} + +void RemoteServer::loadRemotes() +{ + QStringList theFiles = KGlobal::dirs()->findAllResources("data", "remotes/*.remote.xml"); + for(QStringList::iterator i = theFiles.begin(); i != theFiles.end(); ++i) + { kdDebug() << "Found data file: " << *i << endl; + Remote *p = new Remote(); + p->loadFromFile(*i); + theRemotes.insert(p->id(), p); + } +} + +Remote::Remote() +{ + theButtons.setAutoDelete(true); +} + +Remote::~Remote() +{ +} + +void Remote::loadFromFile(const QString &fileName) +{ + charBuffer = ""; + curRB = 0; + + QFile xmlFile(fileName); + QXmlInputSource source(&xmlFile); + QXmlSimpleReader reader; + reader.setContentHandler(this); + reader.parse(source); +} + +bool Remote::characters(const QString &data) +{ + charBuffer += data; + return true; +} + +bool Remote::startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attributes) +{ + if(name == "remote") + theId = theName = attributes.value("id"); + else if(name == "button") + { + curRB = new RemoteButton(); + curRB->setId(attributes.value("id")); + curRB->setClass(attributes.value("id")); + if(attributes.index("class") > -1) + curRB->setClass(attributes.value("class")); + curRB->setParameter(attributes.value("parameter")); + curRB->setName(attributes.value("id")); + } + + charBuffer = ""; + return true; +} + +bool Remote::endElement(const QString &, const QString &, const QString &name) +{ + if(name == "name") + if(curRB) + curRB->setName(charBuffer); + else + theName = charBuffer; + else if(name == "author") + theAuthor = charBuffer; + else if(name == "button") + { + theButtons.insert(curRB->id(), curRB); + curRB = 0; + } + + charBuffer = ""; + return true; +} diff --git a/kdelirc/kdelirc/remoteserver.h b/kdelirc/kdelirc/remoteserver.h new file mode 100644 index 0000000..3700acd --- /dev/null +++ b/kdelirc/kdelirc/remoteserver.h @@ -0,0 +1,89 @@ +// +// +// C++ Interface: $MODULE$ +// +// Description: +// +// +// Author: Gav Wood <gav@kde.org>, (C) 2003 +// +// Copyright: See COPYING file that comes with this distribution +// +// +#ifndef REMOTESERVER_H +#define REMOTESERVER_H + +#include <qstring.h> +#include <qxml.h> +#include <qdict.h> + +/** +@author Gav Wood +*/ + + +class RemoteButton +{ + QString theName, theId, theClass, theParameter; + + friend class Remote; +public: + void setName(const QString &a) { theName = a; } + const QString &name(void) const { return theName; } + void setClass(const QString &a) { theClass = a; } + const QString &getClass(void) const { return theClass; } + void setParameter(const QString &a) { theParameter = a; } + const QString ¶meter(void) const { return theParameter; } + void setId(const QString &a) { theId = a; } + const QString &id(void) const { return theId; } +}; + +class Remote : public QXmlDefaultHandler +{ + QString theName, theId, theAuthor; + QDict<RemoteButton> theButtons; + + QString charBuffer; + RemoteButton *curRB; + + friend class RemoteServer; +public: + bool characters(const QString &data); + bool startElement(const QString &, const QString &, const QString &name, const QXmlAttributes &attributes); + bool endElement(const QString &, const QString &, const QString &name); + + void setName(const QString &a) { theName = a; } + const QString &name(void) const { return theName; } + void setId(const QString &a) { theId = a; } + const QString &id(void) const { return theId; } + void setAuthor(const QString &a) { theAuthor = a; } + const QString &author(void) const { return theAuthor; } + const QDict<RemoteButton> &buttons() const { return theButtons; } + + void loadFromFile(const QString &fileName); + + const QString &getButtonName(const QString &id) const { if(theButtons[id]) return theButtons[id]->name(); return id; } + + Remote(); + ~Remote(); +}; + +class RemoteServer +{ + static RemoteServer *theInstance; + void loadRemotes(); + QDict<Remote> theRemotes; + +public: + static RemoteServer *remoteServer() { if(!theInstance) theInstance = new RemoteServer(); return theInstance; } + + const QDict<Remote> &remotes() const { return theRemotes; } + + const QString &getRemoteName(const QString &id) const { if(theRemotes[id]) return theRemotes[id]->name(); return id; } + const QString &getButtonName(const QString &remote, const QString &button) const { if(theRemotes[remote]) return theRemotes[remote]->getButtonName(button); return button; } + + RemoteServer(); + ~RemoteServer(); +}; + +#endif diff --git a/kdelirc/profiles/Makefile.am b/kdelirc/profiles/Makefile.am new file mode 100644 index 0000000..e25d1d4 --- /dev/null +++ b/kdelirc/profiles/Makefile.am @@ -0,0 +1,5 @@ +profiledata_DATA = profile.dtd noatun.profile.xml klauncher.profile.xml konqueror.profile.xml +profiledatadir = $(kde_datadir)/profiles + +EXTRA_DIST = $(profiledata_DATA) + diff --git a/kdelirc/profiles/klauncher.profile.xml b/kdelirc/profiles/klauncher.profile.xml new file mode 100644 index 0000000..436a04d --- /dev/null +++ b/kdelirc/profiles/klauncher.profile.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" ?> +<!DOCTYPE profile SYSTEM "profile.dtd"> +<profile id="klauncher"> + <name>KDE Program Launcher</name> + <author>Gav Wood</author> + <action objid="default" prototype="void kdeinit_exec(QString, QStringList)" repeat="0" autostart="0"> + <name>Execute</name> + <comment>Runs a program or script</comment> + <argument type="QString"><comment>The executable name and path of the program or script to run</comment></argument> + <argument type="QStringList"><comment>Parameters for the program or script</comment></argument> + </action> + <action objid="default" prototype="void kdeinit_exec_wait(QString, QStringList)" repeat="0" autostart="0"> + <name>Execute and Wait</name> + <comment>Runs a program or script and waits for it to finish</comment> + <argument type="QString"><comment>The executable name and path of the program or script to run</comment></argument> + <argument type="QStringList"><comment>Parameters for the program or script</comment></argument> + </action> +</profile> diff --git a/kdelirc/profiles/konqueror.profile.xml b/kdelirc/profiles/konqueror.profile.xml new file mode 100644 index 0000000..7dfd78c --- /dev/null +++ b/kdelirc/profiles/konqueror.profile.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!DOCTYPE profile SYSTEM "profile.dtd"> + +<profile id="konqueror" servicename="konqueror"> + <name>Konqueror</name> + <author>Gav Wood</author> + <instances uniqueapp="0" ifmulti="sendtotop"/> + <action objid="KonquerorIface" prototype="void createNewWindow(QString)" repeat="0" autostart="0"> + <name>Create New Window</name> + <comment>Creates a new window and loads an arbitrary URL.</comment> + <argument type="QString"><comment>The URL to load in the window initially.</comment></argument> + </action> + <action objid="MainApplication-Interface" prototype="void quit()" repeat="0" autostart="0"> + <name>Quit</name> + <comment>Closes the Konqueror window.</comment> + </action> +</profile> diff --git a/kdelirc/profiles/noatun.profile.xml b/kdelirc/profiles/noatun.profile.xml new file mode 100644 index 0000000..a9b204b --- /dev/null +++ b/kdelirc/profiles/noatun.profile.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" ?> +<!DOCTYPE profile SYSTEM "profile.dtd"> + +<profile id="noatun" servicename="noatun"> + <name>Noatun</name> + <author>Gav Wood</author> + <action objid="Noatun" prototype="void playpause()" class="pause"> + <name>Play/Pause</name> + <comment>Toggles the current track between playing and pausing.</comment> + </action> + <action objid="Noatun" prototype="void stop()" class="stop"> + <name>Stop</name> + <comment>Stops current playback, if any.</comment> + </action> + <action objid="Noatun" prototype="void clear()" class="eject"> + <name>Clear Playlist</name> + <comment>Clears the playlist of all items.</comment> + </action> + <action objid="Noatun" prototype="void back()" class="previous"> + <name>Back</name> + <comment>Skips to the start of the last track.</comment> + </action> + <action objid="Noatun" prototype="void forward()" class="next"> + <name>Forward</name> + <comment>Skips to the start of the next track.</comment> + </action> + <action objid="Noatun" prototype="void loop()"> + <name>Playback Mode</name> + <comment>Cycles through the playback modes of Noatun.</comment> + </action> + <action objid="Noatun" prototype="void play()" class="play"> + <name>Play</name> + <comment>Starts playback.</comment> + </action> + <action objid="Noatun" prototype="void removeCurrent()"> + <name>Remove Current</name> + <comment>Removes only the current track from the play list.</comment> + </action> + <action objid="Noatun" prototype="void toggleMute()" class="mute"> + <name>Mute</name> + <comment>Toggle sound muting</comment> + </action> + <action objid="Noatun" prototype="void volumeUp()" class="volumeup" repeat="1"> + <name>Volume Up</name> + <comment>Increase volume</comment> + </action> + <action objid="Noatun" prototype="void volumeDown()" class="volumedown" repeat="1"> + <name>Volume Down</name> + <comment>Decrease volume</comment> + </action> + <action objid="Noatun" prototype="void setVolume(int volume)"> + <name>Set Volume</name> + <comment>Sets the volume to a configurable amount.</comment> + <argument type="int"> + <comment>The required percentage of the volume.</comment> + <range min="0" max="100"/> + </argument> + </action> + <action objid="Noatun" prototype="void toggleListView()"> + <name>Toggle Playlist View</name> + <comment>Toggles the visiblility of the playlist window.</comment> + </action> + <action objid="Noatun" prototype="void skipto(int)"> + <name>Skip To</name> + <comment>Skips to a configurable point in the current track.</comment> + <argument type="int"> + <comment>The percentage of the track to move through.</comment> + <range min="0" max="100"/> + </argument> + </action> + <action objid="MainApplication-Interface" prototype="void quit()" class="off"> + <name>Quit</name> + <comment>Exit Noatun</comment> + </action> +</profile> diff --git a/kdelirc/profiles/profile.dtd b/kdelirc/profiles/profile.dtd new file mode 100644 index 0000000..070fd14 --- /dev/null +++ b/kdelirc/profiles/profile.dtd @@ -0,0 +1,28 @@ +<!DOCTYPE profile [ + +<!ELEMENT profile (action+, name, author)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT author (#PCDATA)> +<!ELEMENT action (name, comment, argument*)> +<!ELEMENT argument (comment, range?, default?)> +<!ELEMENT comment (#PCDATA)> +<!ELEMENT type (#PCDATA)> +<!ELEMENT instances> +<!ELEMENT default (#PCDATA)> + +<!ATTLIST profile id CDATA #REQUIRED> +<!ATTLIST profile servicename CDATA #REQUIRED> +<!ATTLIST action objid CDATA #REQUIRED> +<!ATTLIST action prototype CDATA #REQUIRED> +<!ATTLIST argument type (int|QString|QCString|QStringList|bool|double) #REQUIRED> +<!ATTLIST range min CDATA #REQUIRED> +<!ATTLIST range max CDATA #REQUIRED> +<!ATTLIST action class (captions|teletext|fullscreen|scan|finetuneup|finetunedown|recall|enter|number|play|stop|pause|record|previous|next|rewind|forward|eject|mute|volumedown|volumeup|channeldown|channelup|red|yellow|green|blue|on|off) #IMPLIED> +<!ATTLIST action multiplier CDATA "1" #IMPLIED> +<!ATTLIST action repeat (0|1) "0"> +<!ATTLIST instances uniqueapp (0|1) "1" #REQUIRED> +<!ATTLIST instances ifmulti (sendtotop|sendtobottom|sendtoall|dontsend) "dontsend"> + +]> + + diff --git a/kdelirc/remotes/Makefile.am b/kdelirc/remotes/Makefile.am new file mode 100644 index 0000000..b040270 --- /dev/null +++ b/kdelirc/remotes/Makefile.am @@ -0,0 +1,6 @@ +remotedata_DATA = RM-0010.remote.xml cimr100.remote.xml sherwood.remote.xml \ + hauppauge.remote.xml sonytv.remote.xml remote.dtd +remotedatadir = $(kde_datadir)/remotes + +EXTRA_DIST = $(remotedata_DATA) + diff --git a/kdelirc/remotes/RM-0010.remote.xml b/kdelirc/remotes/RM-0010.remote.xml new file mode 100644 index 0000000..64146e5 --- /dev/null +++ b/kdelirc/remotes/RM-0010.remote.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="RM-0010"> + <name>Leadtek CoolCommand RM-0010</name> + <author>Zsolt Rizsanyi</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="POWER" class="off"><name>Power</name></button> + <button id="TV/FM"><name>TV/FM</name></button> + <button id="SCAN" class="scan"><name>Scan</name></button> + <button id="DISPLAY"><name>Display</name></button> + <button id="RECALL" class="recall"><name>Recall</name></button> + <button id="ENTER" class="enter"><name>Enter</name></button> + <button id="CC" class="captions"><name>Closed Captions</name></button> + <button id="MTS"><name>MTS</name></button> + <button id="FINE_DOWN" class="finetunedown"><name>Fine Tune Down</name></button> + <button id="FINE_UP" class="finetuneup"><name>Fine Tune Up</name></button> + <button id="VIDEO"><name>Video</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="CH_UP" class="channelup"><name>Channel Up</name></button> + <button id="CH_DOWN" class="channeldown"><name>Channel Down</name></button> + <button id="VOL_UP" class="volumeup"><name>Volume Up</name></button> + <button id="VOL_DOWN" class="volumedown"><name>Volume Down</name></button> + <button id="FULLSCREEN" class="fullscreen"><name>Full Screen</name></button> + <button id="SLEEP"><name>Sleep</name></button> + <button id="BOSS_KEY"><name>Boss key</name></button> + <button id="RED" class="red"><name>Red</name></button> + <button id="GREEN" class="green"><name>Green</name></button> + <button id="YELLOW" class="yellow"><name>Yellow</name></button> + <button id="BLUE" class="blue"><name>Blue</name></button> + <button id="PIP"><name>Pip</name></button> + <button id="."><name>Dot (.)</name></button> + <button id="BACK" class="previous"><name>Back</name></button> + <button id="PLAY" class="play"><name>Play</name></button> + <button id="NEXT" class="next"><name>Next</name></button> + <button id="TIMESHIFT"><name>Timeshift</name></button> + <button id="STOP" class="stop"><name>Stop</name></button> + <button id="REC" class="record"><name>Record</name></button> + <button id="SNAPSHOT"><name>Snapshot</name></button> +</remote> diff --git a/kdelirc/remotes/cimr100.remote.xml b/kdelirc/remotes/cimr100.remote.xml new file mode 100644 index 0000000..5dfc36d --- /dev/null +++ b/kdelirc/remotes/cimr100.remote.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="cimr100"> + <name>Creative CIMR-100</name> + <author>Gav Wood</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="back" class="previous"><name>Back</name></button> + <button id="eject" class="eject"><name>Eject</name></button> + <button id="fastforward" class="forward"><name>Fast Forward</name></button> + <button id="mouse"><name>Mouse</name></button> + <button id="mute" class="mute"><name>Mute</name></button> + <button id="pause" class="pause"><name>Pause</name></button> + <button id="play" class="play"><name>Play</name></button> + <button id="next" class="next"><name>Next</name></button> + <button id="rewind" class="rewind"><name>Rewind</name></button> + <button id="shift"><name>Shift</name></button> + <button id="start"><name>Start</name></button> + <button id="stop" class="stop"><name>Stop</name></button> + <button id="voldown" class="volumedown"><name>Volume Down</name></button> + <button id="volup" class="volumeup"><name>Volume Up</name></button> +</remote> diff --git a/kdelirc/remotes/hauppauge.remote.xml b/kdelirc/remotes/hauppauge.remote.xml new file mode 100644 index 0000000..4d2a402 --- /dev/null +++ b/kdelirc/remotes/hauppauge.remote.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="Hauppauge"> + <name>Hauppauge</name> + <author>Dirk Ziegelmeier</author> + <information>Bundled with WinTV PCI, PVR</information> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="TV"><name>TV</name></button> + <button id="RADIO"><name>Radio</name></button> + <button id="CH-" class="channeldown"><name>Channel Down</name></button> + <button id="CH+" class="channelup"><name>Channel Up</name></button> + <button id="VOL-" class="volumedown"><name>Volume Down</name></button> + <button id="VOL+" class="volumeup"><name>Volume Up</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="SOURCE"><name>Source</name></button> + <button id="FULL_SCREEN" class="fullscreen"><name>Fullscreen</name></button> + <button id="RESERVED"><name>Reserved</name></button> + <button id="MINIMIZE"><name>Minimize</name></button> +</remote> diff --git a/kdelirc/remotes/remote.dtd b/kdelirc/remotes/remote.dtd new file mode 100644 index 0000000..a09b4b6 --- /dev/null +++ b/kdelirc/remotes/remote.dtd @@ -0,0 +1,15 @@ +<!-- +<!DOCTYPE remote SYSTEM "remote.dtd"> +--> + +<!ELEMENT remote (name, author, information?, button+)> +<!ELEMENT button (name?)> +<!ELEMENT name (#PCDATA)> +<!ELEMENT author (#PCDATA)> +<!ELEMENT information (#PCDATA)> + +<!ATTLIST remote id CDATA #REQUIRED> +<!ATTLIST button id CDATA #REQUIRED> +<!ATTLIST button class (captions|teletext|fullscreen|scan|finetuneup|finetunedown|recall|enter|number|play|stop|pause|record|previous|next|rewind|forward|eject|mute|volumedown|volumeup|channeldown|channelup|red|yellow|green|blue|on|off) #IMPLIED> +<!ATTLIST button option (0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20) #IMPLIED> +<!ATTLIST button parameter CDATA #IMPLIED> diff --git a/kdelirc/remotes/sherwood.remote.xml b/kdelirc/remotes/sherwood.remote.xml new file mode 100644 index 0000000..db628ba --- /dev/null +++ b/kdelirc/remotes/sherwood.remote.xml @@ -0,0 +1,61 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="sherwood"> + <name>Sherwood RM-RD-61</name> + <author>Gav Wood</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="6chdirect"><name>Input - 6 Channel Direct</name></button> + <button id="adjust"><name>Adjust</name></button> + <button id="auto"><name>Auto</name></button> + <button id="aux"><name>Input - Aux</name></button> + <button id="cd"><name>Input - CD</name></button> + <button id="chdown" class="channeldown"><name>Channel Down</name></button> + <button id="chup" class="channelup"><name>Channel Up</name></button> + <button id="chsel"><name>Channel Select</name></button> + <button id="decka"><name>Deck A Select</name></button> + <button id="deckb"><name>Deck B Select</name></button> + <button id="deckforward"><name>Deck - Forward</name></button> + <button id="deckpause"><name>Deck - Pause</name></button> + <button id="deckplay"><name>Deck - Play</name></button> + <button id="deckplayback"><name>Deck - Play Reverse</name></button> + <button id="deckrecord"><name>Deck - Record</name></button> + <button id="deckrewind"><name>Deck - Rewind</name></button> + <button id="deckstop"><name>Deck - Stop</name></button> + <button id="display"><name>Equalizer - Display</name></button> + <button id="displaysys"><name>System Display</name></button> + <button id="dspmode"><name>DSP Mode</name></button> + <button id="dtime"><name>Date Time</name></button> + <button id="file"><name>Equalizer - File</name></button> + <button id="masterdown"><name>Master Down</name></button> + <button id="masterup"><name>Master Up</name></button> + <button id="mute"><name>Mute</name></button> + <button id="preset"><name>Equalizer - Preset</name></button> + <button id="sleep"><name>Sleep</name></button> + <button id="stereo"><name>Stereo</name></button> + <button id="tapemon"><name>Input - Tape Monitor</name></button> + <button id="tmon"><name>Equalizer - Monitor</name></button> + <button id="ttone"><name>Test Tone</name></button> + <button id="tuner"><name>Input - Tuner</name></button> + <button id="user"><name>Equalizer - User</name></button> + <button id="video1"><name>Input - Video 1</name></button> + <button id="video2"><name>Input - Video 2</name></button> + <button id="video3"><name>Input - Video 3</name></button> + <button id="disc" class="eject"><name>CD Select</name></button> + <button id="discplay" class="play"><name>CD - Play</name></button> + <button id="discstop" class="stop"><name>CD - Stop</name></button> + <button id="discback" class="previous"><name>CD - Back</name></button> + <button id="discnext" class="next"><name>CD - Next</name></button> + <button id="discpause" class="pause"><name>CD - Pause</name></button> + <button id="discrepeat"><name>CD - Repeat</name></button> + <button id="discintro"><name>CD - Intro</name></button> +</remote> diff --git a/kdelirc/remotes/sonytv.remote.xml b/kdelirc/remotes/sonytv.remote.xml new file mode 100644 index 0000000..4e5ee97 --- /dev/null +++ b/kdelirc/remotes/sonytv.remote.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" ?> +<!DOCTYPE remote SYSTEM "remote.dtd"> + +<remote id="SONY-TV"> + <name>SonyTV</name> + <information>Bundled with some Sony TVs</information> + <author>Dirk Ziegelmeier</author> + <button id="0" class="number" parameter="0"/> + <button id="1" class="number" parameter="1"/> + <button id="2" class="number" parameter="2"/> + <button id="3" class="number" parameter="3"/> + <button id="4" class="number" parameter="4"/> + <button id="5" class="number" parameter="5"/> + <button id="6" class="number" parameter="6"/> + <button id="7" class="number" parameter="7"/> + <button id="8" class="number" parameter="8"/> + <button id="9" class="number" parameter="9"/> + <button id="TV"><name>TV</name></button> + <button id="CHANNELDOWN" class="channeldown"><name>Channel Down</name></button> + <button id="CHANNELUP" class="channelup"><name>Channel Up</name></button> + <button id="VOLUMEDOWN" class="volumedown"><name>Volume Down</name></button> + <button id="VOLUMEUP" class="volumeup"><name>Volume Up</name></button> + <button id="MUTE" class="mute"><name>Mute</name></button> + <button id="EXT"><name>EXT</name></button> + <button id="-/--"><name>-/--</name></button> + <button id="RED"><name>Red</name></button> + <button id="YELLOW"><name>Yellow</name></button> + <button id="BLUE"><name>Blue</name></button> + <button id="GREEN"><name>Green</name></button> +</remote> |