import git checkouts of krdc and krfb

This commit is contained in:
Ivailo Monev 2014-12-27 19:00:04 +00:00
parent 342e06218e
commit 88f3fb3ea8
210 changed files with 25662 additions and 0 deletions

6
krdc/.directory Normal file
View file

@ -0,0 +1,6 @@
[Dolphin]
Timestamp=2014,12,27,18,58,21
Version=3
[Settings]
HiddenFilesShown=true

132
krdc/CMakeLists.txt Normal file
View file

@ -0,0 +1,132 @@
project(krdc)
if(NOT INSIDE_KDENETWORK)
message("Not building inside KDENetwork, loading KDE CMake Macros.")
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
include(CheckIncludeFile)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckPrototypeExists)
include(CheckTypeSize)
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
if(WIN32)
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
endif(WIN32)
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
endif(NOT INSIDE_KDENETWORK)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
macro_optional_find_package(LibVNCServer)
macro_log_feature(LIBVNCSERVER_FOUND "libvncserver" "VNC server / client library" "http://libvncserver.sourceforge.net/" FALSE "0.9.8" "Needed to build VNC client support in KRDC")
FIND_PROGRAM(FREERDP_EXECUTABLE xfreerdp)
if(FREERDP_EXECUTABLE)
set(FREERDP_EXECUTABLE_FOUND true)
endif(FREERDP_EXECUTABLE)
macro_log_feature(FREERDP_EXECUTABLE_FOUND "freerdp" "A free Remote Desktop Protocol (RDP) Implementation" "http://www.freerdp.com" FALSE "1.0.2" "Needed for RDP support in KRDC (at runtime)")
# NX support is not ready for KDE 4.2; disabled (uwolfer)
# macro_optional_find_package(LibNXCL)
# macro_log_feature(LIBNXCL_FOUND "libnxcl" "NX X compression client library" "http://svn.berlios.de/svnroot/repos/freenx/trunk/freenx-client/nxcl/" FALSE "1.0" "Needed to build Krdc with NX support")
macro_optional_find_package(TelepathyQt4)
macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
if(TelepathyQt4_FOUND)
add_definitions(-DTELEPATHY_SUPPORT)
include_directories(${TELEPATHY_QT4_INCLUDE_DIR})
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/core/
${CMAKE_CURRENT_BINARY_DIR}/core/
${CMAKE_CURRENT_BINARY_DIR}
)
add_subdirectory(core)
add_subdirectory(vnc)
add_subdirectory(nx)
add_subdirectory(rdp)
add_subdirectory(test)
add_subdirectory(doc)
if(TelepathyQt4_FOUND)
add_subdirectory(krdc_approver)
endif()
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5010)
add_definitions(-DBUILD_ZEROCONF)
set(krdc_SRCS
config/hostpreferenceslist.cpp
config/preferencesdialog.cpp
floatingtoolbar.cpp
bookmarkmanager.cpp
connectiondelegate.cpp
remotedesktopsmodel.cpp
systemtrayicon.cpp
tabbedviewwidget.cpp
mainwindow.cpp
main.cpp
)
if(TelepathyQt4_FOUND)
set(krdc_SRCS ${krdc_SRCS}
tubesmanager.cpp
)
endif()
kde4_add_ui_files(krdc_SRCS
config/general.ui
)
kde4_add_app_icon(krdc_SRCS "${KDE4_INSTALL_DIR}/share/icons/oxygen/*/apps/krdc.png")
kde4_add_executable(krdc ${krdc_SRCS})
target_link_libraries(krdc
${KDE4_KFILE_LIBS}
${KDE4_KIO_LIBS}
${KDE4_KNOTIFYCONFIG_LIBS}
${KDE4_KCMUTILS_LIBS}
krdccore
)
if(TelepathyQt4_FOUND)
target_link_libraries(krdc
${TELEPATHY_QT4_LIBRARIES}
)
endif()
target_link_libraries(krdc ${KDE4_KDNSSD_LIBS})
install(TARGETS krdc ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES krdcui.rc DESTINATION ${DATA_INSTALL_DIR}/krdc)
install(PROGRAMS krdc.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
install(FILES pointcursor.png pointcursormask.png DESTINATION ${DATA_INSTALL_DIR}/krdc/pics)
if(TelepathyQt4_FOUND)
configure_file(org.freedesktop.Telepathy.Client.krdc_rfb_handler.service.in
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_handler.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_handler.service
DESTINATION ${DBUS_SERVICES_INSTALL_DIR})
install(FILES krdc_rfb_handler.client DESTINATION ${SHARE_INSTALL_PREFIX}/telepathy/clients/)
endif()
if(NOT INSIDE_KDENETWORK)
macro_display_feature_log()
endif(NOT INSIDE_KDENETWORK)

347
krdc/COPYING Normal file
View file

@ -0,0 +1,347 @@
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
the instance of code that it refers to (the kde programs) are copyrighted
by the authors who actually wrote it.
---------------------------------------------------------------------------
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which 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) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

397
krdc/COPYING.DOC Normal file
View file

@ -0,0 +1,397 @@
GNU Free Documentation License
Version 1.2, November 2002
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
51 Franklin St, 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.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other
functional and useful document "free" in the sense of freedom: to
assure everyone the effective freedom to copy and redistribute it,
with or without modifying it, either commercially or noncommercially.
Secondarily, this License preserves for the author and publisher a way
to get credit for their work, while not being considered responsible
for modifications made by others.
This License is a kind of "copyleft", which means that derivative
works of the document must themselves be free in the same sense. It
complements the GNU General Public License, which is a copyleft
license designed for free software.
We have designed this License in order to use it for manuals for free
software, because free software needs free documentation: a free
program should come with manuals providing the same freedoms that the
software does. But this License is not limited to software manuals;
it can be used for any textual work, regardless of subject matter or
whether it is published as a printed book. We recommend this License
principally for works whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONS
This License applies to any manual or other work, in any medium, that
contains a notice placed by the copyright holder saying it can be
distributed under the terms of this License. Such a notice grants a
world-wide, royalty-free license, unlimited in duration, to use that
work under the conditions stated herein. The "Document", below,
refers to any such manual or work. Any member of the public is a
licensee, and is addressed as "you". You accept the license if you
copy, modify or distribute the work in a way requiring permission
under copyright law.
A "Modified Version" of the Document means any work containing the
Document or a portion of it, either copied verbatim, or with
modifications and/or translated into another language.
A "Secondary Section" is a named appendix or a front-matter section of
the Document that deals exclusively with the relationship of the
publishers or authors of the Document to the Document's overall subject
(or to related matters) and contains nothing that could fall directly
within that overall subject. (Thus, if the Document is in part a
textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical
connection with the subject or with related matters, or of legal,
commercial, philosophical, ethical or political position regarding
them.
The "Invariant Sections" are certain Secondary Sections whose titles
are designated, as being those of Invariant Sections, in the notice
that says that the Document is released under this License. If a
section does not fit the above definition of Secondary then it is not
allowed to be designated as Invariant. The Document may contain zero
Invariant Sections. If the Document does not identify any Invariant
Sections then there are none.
The "Cover Texts" are certain short passages of text that are listed,
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
the Document is released under this License. A Front-Cover Text may
be at most 5 words, and a Back-Cover Text may be at most 25 words.
A "Transparent" copy of the Document means a machine-readable copy,
represented in a format whose specification is available to the
general public, that is suitable for revising the document
straightforwardly with generic text editors or (for images composed of
pixels) generic paint programs or (for drawings) some widely available
drawing editor, and that is suitable for input to text formatters or
for automatic translation to a variety of formats suitable for input
to text formatters. A copy made in an otherwise Transparent file
format whose markup, or absence of markup, has been arranged to thwart
or discourage subsequent modification by readers is not Transparent.
An image format is not Transparent if used for any substantial amount
of text. A copy that is not "Transparent" is called "Opaque".
Examples of suitable formats for Transparent copies include plain
ASCII without markup, Texinfo input format, LaTeX input format, SGML
or XML using a publicly available DTD, and standard-conforming simple
HTML, PostScript or PDF designed for human modification. Examples of
transparent image formats include PNG, XCF and JPG. Opaque formats
include proprietary formats that can be read and edited only by
proprietary word processors, SGML or XML for which the DTD and/or
processing tools are not generally available, and the
machine-generated HTML, PostScript or PDF produced by some word
processors for output purposes only.
The "Title Page" means, for a printed book, the title page itself,
plus such following pages as are needed to hold, legibly, the material
this License requires to appear in the title page. For works in
formats which do not have any title page as such, "Title Page" means
the text near the most prominent appearance of the work's title,
preceding the beginning of the body of the text.
A section "Entitled XYZ" means a named subunit of the Document whose
title either is precisely XYZ or contains XYZ in parentheses following
text that translates XYZ in another language. (Here XYZ stands for a
specific section name mentioned below, such as "Acknowledgements",
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
of such a section when you modify the Document means that it remains a
section "Entitled XYZ" according to this definition.
The Document may include Warranty Disclaimers next to the notice which
states that this License applies to the Document. These Warranty
Disclaimers are considered to be included by reference in this
License, but only as regards disclaiming warranties: any other
implication that these Warranty Disclaimers may have is void and has
no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either
commercially or noncommercially, provided that this License, the
copyright notices, and the license notice saying this License applies
to the Document are reproduced in all copies, and that you add no other
conditions whatsoever to those of this License. You may not use
technical measures to obstruct or control the reading or further
copying of the copies you make or distribute. However, you may accept
compensation in exchange for copies. If you distribute a large enough
number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and
you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have
printed covers) of the Document, numbering more than 100, and the
Document's license notice requires Cover Texts, you must enclose the
copies in covers that carry, clearly and legibly, all these Cover
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
the back cover. Both covers must also clearly and legibly identify
you as the publisher of these copies. The front cover must present
the full title with all words of the title equally prominent and
visible. You may add other material on the covers in addition.
Copying with changes limited to the covers, as long as they preserve
the title of the Document and satisfy these conditions, can be treated
as verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit
legibly, you should put the first ones listed (as many as fit
reasonably) on the actual cover, and continue the rest onto adjacent
pages.
If you publish or distribute Opaque copies of the Document numbering
more than 100, you must either include a machine-readable Transparent
copy along with each Opaque copy, or state in or with each Opaque copy
a computer-network location from which the general network-using
public has access to download using public-standard network protocols
a complete Transparent copy of the Document, free of added material.
If you use the latter option, you must take reasonably prudent steps,
when you begin distribution of Opaque copies in quantity, to ensure
that this Transparent copy will remain thus accessible at the stated
location until at least one year after the last time you distribute an
Opaque copy (directly or through your agents or retailers) of that
edition to the public.
It is requested, but not required, that you contact the authors of the
Document well before redistributing any large number of copies, to give
them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under
the conditions of sections 2 and 3 above, provided that you release
the Modified Version under precisely this License, with the Modified
Version filling the role of the Document, thus licensing distribution
and modification of the Modified Version to whoever possesses a copy
of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct
from that of the Document, and from those of previous versions
(which should, if there were any, be listed in the History section
of the Document). You may use the same title as a previous version
if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities
responsible for authorship of the modifications in the Modified
Version, together with at least five of the principal authors of the
Document (all of its principal authors, if it has fewer than five),
unless they release you from this requirement.
C. State on the Title page the name of the publisher of the
Modified Version, as the publisher.
D. Preserve all the copyright notices of the Document.
E. Add an appropriate copyright notice for your modifications
adjacent to the other copyright notices.
F. Include, immediately after the copyright notices, a license notice
giving the public permission to use the Modified Version under the
terms of this License, in the form shown in the Addendum below.
G. Preserve in that license notice the full lists of Invariant Sections
and required Cover Texts given in the Document's license notice.
H. Include an unaltered copy of this License.
I. Preserve the section Entitled "History", Preserve its Title, and add
to it an item stating at least the title, year, new authors, and
publisher of the Modified Version as given on the Title Page. If
there is no section Entitled "History" in the Document, create one
stating the title, year, authors, and publisher of the Document as
given on its Title Page, then add an item describing the Modified
Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for
public access to a Transparent copy of the Document, and likewise
the network locations given in the Document for previous versions
it was based on. These may be placed in the "History" section.
You may omit a network location for a work that was published at
least four years before the Document itself, or if the original
publisher of the version it refers to gives permission.
K. For any section Entitled "Acknowledgements" or "Dedications",
Preserve the Title of the section, and preserve in the section all
the substance and tone of each of the contributor acknowledgements
and/or dedications given therein.
L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers
or the equivalent are not considered part of the section titles.
M. Delete any section Entitled "Endorsements". Such a section
may not be included in the Modified Version.
N. Do not retitle any existing section to be Entitled "Endorsements"
or to conflict in title with any Invariant Section.
O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or
appendices that qualify as Secondary Sections and contain no material
copied from the Document, you may at your option designate some or all
of these sections as invariant. To do this, add their titles to the
list of Invariant Sections in the Modified Version's license notice.
These titles must be distinct from any other section titles.
You may add a section Entitled "Endorsements", provided it contains
nothing but endorsements of your Modified Version by various
parties--for example, statements of peer review or that the text has
been approved by an organization as the authoritative definition of a
standard.
You may add a passage of up to five words as a Front-Cover Text, and a
passage of up to 25 words as a Back-Cover Text, to the end of the list
of Cover Texts in the Modified Version. Only one passage of
Front-Cover Text and one of Back-Cover Text may be added by (or
through arrangements made by) any one entity. If the Document already
includes a cover text for the same cover, previously added by you or
by arrangement made by the same entity you are acting on behalf of,
you may not add another; but you may replace the old one, on explicit
permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License
give permission to use their names for publicity for or to assert or
imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this
License, under the terms defined in section 4 above for modified
versions, provided that you include in the combination all of the
Invariant Sections of all of the original documents, unmodified, and
list them all as Invariant Sections of your combined work in its
license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and
multiple identical Invariant Sections may be replaced with a single
copy. If there are multiple Invariant Sections with the same name but
different contents, make the title of each such section unique by
adding at the end of it, in parentheses, the name of the original
author or publisher of that section if known, or else a unique number.
Make the same adjustment to the section titles in the list of
Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled "History"
in the various original documents, forming one section Entitled
"History"; likewise combine any sections Entitled "Acknowledgements",
and any sections Entitled "Dedications". You must delete all sections
Entitled "Endorsements".
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents
released under this License, and replace the individual copies of this
License in the various documents with a single copy that is included in
the collection, provided that you follow the rules of this License for
verbatim copying of each of the documents in all other respects.
You may extract a single document from such a collection, and distribute
it individually under this License, provided you insert a copy of this
License into the extracted document, and follow this License in all
other respects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate
and independent documents or works, in or on a volume of a storage or
distribution medium, is called an "aggregate" if the copyright
resulting from the compilation is not used to limit the legal rights
of the compilation's users beyond what the individual works permit.
When the Document is included in an aggregate, this License does not
apply to the other works in the aggregate which are not themselves
derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these
copies of the Document, then if the Document is less than one half of
the entire aggregate, the Document's Cover Texts may be placed on
covers that bracket the Document within the aggregate, or the
electronic equivalent of covers if the Document is in electronic form.
Otherwise they must appear on printed covers that bracket the whole
aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may
distribute translations of the Document under the terms of section 4.
Replacing Invariant Sections with translations requires special
permission from their copyright holders, but you may include
translations of some or all Invariant Sections in addition to the
original versions of these Invariant Sections. You may include a
translation of this License, and all the license notices in the
Document, and any Warranty Disclaimers, provided that you also include
the original English version of this License and the original versions
of those notices and disclaimers. In case of a disagreement between
the translation and the original version of this License or a notice
or disclaimer, the original version will prevail.
If a section in the Document is Entitled "Acknowledgements",
"Dedications", or "History", the requirement (section 4) to Preserve
its Title (section 1) will typically require changing the actual
title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except
as expressly provided for under this License. Any other attempt to
copy, modify, sublicense or distribute the Document 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.
10. FUTURE REVISIONS OF THIS LICENSE
The Free Software Foundation may publish new, revised versions
of the GNU Free Documentation 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. See
http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number.
If the Document specifies that a particular numbered version of this
License "or any later version" applies to it, you have the option of
following the terms and conditions either of that specified version or
of any later version that has been published (not as a draft) by the
Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not
as a draft) by the Free Software Foundation.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and
license notices just after the title page:
Copyright (c) YEAR YOUR NAME.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.2
or any later version published by the Free Software Foundation;
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled "GNU
Free Documentation License".
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
replace the "with...Texts." line with this:
with the Invariant Sections being LIST THEIR TITLES, with the
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.
If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License,
to permit their use in free software.

510
krdc/COPYING.LIB Normal file
View file

@ -0,0 +1,510 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin St, 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.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations
below.
When we speak of free software, we are referring to freedom of use,
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 and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs must
be allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, 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 library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete 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 distribute a copy of this License along with the
Library.
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 Library or any portion
of it, thus forming a work based on the Library, 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) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
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 Library, 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 Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you 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.
If distribution of 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 satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at least
three years, to give the same user the materials specified in
Subsection 6a, above, for a charge no more than the cost of
performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be 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.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library 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.
9. 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 Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
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 with
this License.
11. 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 Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library 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 Library.
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.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library 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.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser 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 Library
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 Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
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
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "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
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. 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 LIBRARY 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
LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), 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 Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms
of the ordinary General Public License).
To apply these terms, attach the following notices to the library.
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 library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or
your school, if any, to sign a "copyright disclaimer" for the library,
if necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

5
krdc/Mainpage.dox Normal file
View file

@ -0,0 +1,5 @@
/** @mainpage KRDC API Reference
*
* KRDC is a remote desktop client for KDE.
*
*/

6
krdc/Messages.sh Executable file
View file

@ -0,0 +1,6 @@
#! /bin/sh
$EXTRACTRC *.ui */*.ui >> rc.cpp || exit 11
$EXTRACTRC *.rc */*.rc >> rc.cpp || exit 12
$EXTRACTRC */*.kcfg >> rc.cpp
$XGETTEXT *.cpp */*.cpp -o $podir/krdc.pot
rm -f rc.cpp

219
krdc/bookmarkmanager.cpp Normal file
View file

@ -0,0 +1,219 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "bookmarkmanager.h"
#include "mainwindow.h"
#include <KBookmarkMenu>
#include <KStandardDirs>
#include <KDebug>
BookmarkManager::BookmarkManager(KActionCollection *collection, KMenu *menu, MainWindow *parent)
: QObject(parent),
KBookmarkOwner(),
m_mainWindow(parent)
{
const QString file = KStandardDirs::locateLocal("data", "krdc/bookmarks.xml");
m_manager = KBookmarkManager::managerForFile(file, "krdc");
m_manager->setUpdate(true);
m_bookmarkMenu = new KBookmarkMenu(m_manager, this, menu, collection);
KBookmarkGroup root = m_manager->root();
KBookmark bm = root.first();
while (!bm.isNull()) {
if (bm.metaDataItem("krdc-history") == "historyfolder") // get it also when user renamed it
break;
bm = root.next(bm);
}
if (bm.isNull()) {
kDebug(5010) << "History folder not found. Create it.";
bm = m_manager->root().createNewFolder(i18n("History"));
bm.setMetaDataItem("krdc-history", "historyfolder");
m_manager->emitChanged();
}
m_historyGroup = bm.toGroup();
}
BookmarkManager::~BookmarkManager()
{
delete m_bookmarkMenu;
}
void BookmarkManager::addHistoryBookmark(RemoteView *view)
{
KBookmark bm = m_historyGroup.first();
const QString urlString = urlForView(view);
const KUrl url = KUrl(urlString);
while (!bm.isNull()) {
if (bm.url() == url) {
kDebug(5010) << "Found URL. Move it at the history start.";
m_historyGroup.moveBookmark(bm, KBookmark());
bm.updateAccessMetadata();
m_manager->emitChanged(m_historyGroup);
return;
}
bm = m_historyGroup.next(bm);
}
if (bm.isNull()) {
kDebug(5010) << "Add new history bookmark.";
bm = m_historyGroup.addBookmark(titleForUrl(urlString), urlString);
bm.updateAccessMetadata();
m_historyGroup.moveBookmark(bm, KBookmark());
m_manager->emitChanged(m_historyGroup);
}
}
void BookmarkManager::openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers)
{
emit openUrl(bm.url());
}
void BookmarkManager::openFolderinTabs(const KBookmarkGroup &bookmarkGroup)
{
KBookmark bm = bookmarkGroup.first();
while (!bm.isNull()) {
emit openUrl(bm.url());
bm = bookmarkGroup.next(bm);
}
}
bool BookmarkManager::addBookmarkEntry() const
{
return true;
}
bool BookmarkManager::editBookmarkEntry() const
{
return true;
}
QString BookmarkManager::currentUrl() const
{
RemoteView *view = m_mainWindow->currentRemoteView();
if (view)
return urlForView(view);
else
return QString();
}
QString BookmarkManager::urlForView(RemoteView *view) const
{
return view->url().prettyUrl(KUrl::RemoveTrailingSlash);
}
QString BookmarkManager::currentTitle() const
{
return titleForUrl(currentUrl());
}
QString BookmarkManager::titleForUrl(const QString &url) const
{
return QUrl::fromPercentEncoding(url.toUtf8());
}
bool BookmarkManager::supportsTabs() const
{
return true;
}
QList<QPair<QString, QString> > BookmarkManager::currentBookmarkList() const
{
QList<QPair<QString, QString> > list;
QMapIterator<QWidget *, RemoteView *> iter(m_mainWindow->remoteViewList());
while (iter.hasNext()) {
RemoteView *next = iter.next().value();
const QString url = next->url().prettyUrl(KUrl::RemoveTrailingSlash);
list << QPair<QString, QString>(url, url);
}
return list;
}
void BookmarkManager::addManualBookmark(const QString &url, const QString &text)
{
m_manager->root().addBookmark(url, text);
emit m_manager->emitChanged();
}
KBookmarkManager* BookmarkManager::getManager()
{
return m_manager;
}
const QStringList BookmarkManager::findBookmarkAddresses(const KBookmarkGroup &group, const QString &url)
{
QStringList bookmarkAddresses = QStringList();
KBookmark bm = group.first();
while (!bm.isNull()) {
if (bm.isGroup()) {
bookmarkAddresses.append(findBookmarkAddresses(bm.toGroup(), url));
}
if (bm.url() == url) {
bookmarkAddresses.append(bm.address());
}
bm = group.next(bm);
}
return bookmarkAddresses;
}
void BookmarkManager::removeByUrl(KBookmarkManager *manager, const QString &url, bool ignoreHistory, const QString updateTitle)
{
foreach(const QString &address, findBookmarkAddresses(manager->root(), url)) {
KBookmark bm = manager->findByAddress(address);
if (ignoreHistory && bm.parentGroup().metaDataItem("krdc-history") == "historyfolder") {
if (!updateTitle.isEmpty()) {
kDebug(5010) << "Update" << bm.fullText();
bm.setFullText(updateTitle);
}
} else {
if (!bm.isGroup()) { // please don't delete groups... happened in testing
kDebug(5010) << "Delete" << bm.fullText();
bm.parentGroup().deleteBookmark(bm);
}
}
}
manager->emitChanged();
}
void BookmarkManager::updateTitle(KBookmarkManager *manager, const QString &url, const QString &title)
{
foreach(const QString &address, findBookmarkAddresses(manager->root(), url)) {
KBookmark bm = manager->findByAddress(address);
bm.setFullText(title);
kDebug(5010) << "Update" << bm.fullText();
}
manager->emitChanged();
}
#include "bookmarkmanager.moc"

77
krdc/bookmarkmanager.h Normal file
View file

@ -0,0 +1,77 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef BOOKMARKMANAGER_H
#define BOOKMARKMANAGER_H
#include "core/remoteview.h"
#include <KBookmarkManager>
class KActionCollection;
class KBookmarkMenu;
class MainWindow;
class BookmarkManager : public QObject, public KBookmarkOwner
{
Q_OBJECT
public:
BookmarkManager(KActionCollection *collection, KMenu *menu, MainWindow *parent);
~BookmarkManager();
virtual QString currentUrl() const;
virtual QString currentTitle() const;
virtual bool addBookmarkEntry() const;
virtual bool editBookmarkEntry() const;
virtual bool supportsTabs() const;
virtual QList<QPair<QString, QString> > currentBookmarkList() const;
void addHistoryBookmark(RemoteView *view);
void addManualBookmark(const QString &url, const QString &text);
KBookmarkManager* getManager();
// removes all bookmarks with url, possibly ignore the history folder and update it's title there if it's set
static void removeByUrl(KBookmarkManager *manager, const QString &url, bool ignoreHistory = false, const QString updateTitle = QString());
static void updateTitle(KBookmarkManager *manager, const QString &url, const QString &title);
// returns a QStringList for all bookmarks that point to this url using KBookmark::address()
static const QStringList findBookmarkAddresses(const KBookmarkGroup &group, const QString &url);
signals:
void openUrl(const KUrl &url);
private slots:
void openBookmark(const KBookmark &bm, Qt::MouseButtons, Qt::KeyboardModifiers);
void openFolderinTabs(const KBookmarkGroup &bookmarkGroup);
private:
QString urlForView(RemoteView *view) const;
QString titleForUrl(const QString &url) const;
KBookmarkMenu *m_bookmarkMenu;
KBookmarkManager *m_manager;
KBookmarkGroup m_historyGroup;
MainWindow *m_mainWindow;
};
#endif

View file

@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -0,0 +1,38 @@
# cmake macro to test LIB NXCL
# Copyright (c) 2008, David Gross <gdavid.devel@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include(CheckStructMember)
IF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
# Already in cache, be silent
SET(LIBNBXCL_FIND_QUIETLY TRUE)
ENDIF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
FIND_PATH(LIBNXCL_INCLUDE_DIR nxcl/nxclientlib.h)
FIND_LIBRARY(LIBNXCL_LIBRARIES NAMES nxcl libnxcl)
IF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
SET(CMAKE_REQUIRED_LIBRARIES "${LIBNXCL_LIBRARIES}" "${CMAKE_REQUIRED_LIBRARIES}")
SET(CMAKE_REQUIRED_INCLUDES "${LIBNXCL_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
CHECK_STRUCT_MEMBER(nxcl::NXClientLib "getNXSSHProcess()" nxcl/nxclientlib.h LIBNXCL_NXSSHPROCESS_FOUND)
CHECK_STRUCT_MEMBER(nxcl::NXClientLib "getXID()" nxcl/nxclientlib.h LIBNXCL_XID_FOUND)
ENDIF (LIBNXCL_INCLUDE_DIR AND LIBNXCL_LIBRARIES)
IF (LIBNXCL_NXSSHPROCESS_FOUND AND LIBNXCL_XID_FOUND)
SET(LIBNXCL_FOUND TRUE)
IF (NOT LIBNXCL_FIND_QUIETLY)
MESSAGE(STATUS "Found LibNXCL: ${LIBNXCL_LIBRARIES}")
ENDIF (NOT LIBNXCL_FIND_QUIETLY)
ELSE (LIBNXCL_NXSSHPROCESS_FOUND AND LIBNXCL_XID_FOUND)
SET(LIBNXCL_FOUND FALSE)
IF (LIBNXCL_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find acceptable version of LibNXCL (version 1.0).")
ENDIF (LIBNXCL_FIND_REQUIRED)
ENDIF (LIBNXCL_NXSSHPROCESS_FOUND AND LIBNXCL_XID_FOUND)
MARK_AS_ADVANCED(LIBNXCL_INCLUDE_DIR LIBNXCL_LIBRARIES)

View file

@ -0,0 +1,41 @@
# cmake macro to test LIBVNCSERVER LIB
# Copyright (c) 2006, Alessandro Praduroux <pradu@pradu.it>
# Copyright (c) 2007, Urs Wolfer <uwolfer @ kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(CheckPointerMember)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
# Already in cache, be silent
SET(LIBVNCSERVER_FIND_QUIETLY TRUE)
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
FIND_PATH(LIBVNCSERVER_INCLUDE_DIR rfb/rfb.h)
FIND_LIBRARY(LIBVNCSERVER_LIBRARIES NAMES vncserver libvncserver)
# libvncserver and libvncclient are in the same package, so it does
# not make sense to add a new cmake script for finding libvncclient.
# instead just find the libvncclient also in this file.
FIND_PATH(LIBVNCCLIENT_INCLUDE_DIR rfb/rfbclient.h)
FIND_LIBRARY(LIBVNCCLIENT_LIBRARIES NAMES vncclient libvncclient)
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
CHECK_POINTER_MEMBER(rfbClient* GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
IF (LIBVNCSERVER_FOUND)
IF (NOT LIBVNCSERVER_FIND_QUIETLY)
MESSAGE(STATUS "Found LibVNCServer: ${LIBVNCSERVER_LIBRARIES}")
ENDIF (NOT LIBVNCSERVER_FIND_QUIETLY)
ELSE (LIBVNCSERVER_FOUND)
IF (LIBVNCSERVER_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could NOT find acceptable version of LibVNCServer (version 0.9 or later required).")
ENDIF (LIBVNCSERVER_FIND_REQUIRED)
ENDIF (LIBVNCSERVER_FOUND)
MARK_AS_ADVANCED(LIBVNCSERVER_INCLUDE_DIR LIBVNCSERVER_LIBRARIES)

View file

@ -0,0 +1 @@
install(FILES krdc.kcfg DESTINATION ${KCFG_INSTALL_DIR})

220
krdc/config/general.ui Normal file
View file

@ -0,0 +1,220 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>General</class>
<widget class="QWidget" name="General">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>363</width>
<height>464</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QCheckBox" name="kcfg_RememberSessions">
<property name="text">
<string>Remember open sessions for next startup</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_RememberHistory">
<property name="text">
<string>Remember connection history</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_WalletSupport">
<property name="text">
<string>Remember passwords (KWallet)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_SystemTrayIcon">
<property name="text">
<string>Enable system tray icon</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_ShowStatusBar">
<property name="text">
<string>Show status bar</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_KeepAspectRatio">
<property name="text">
<string>Keep aspect ratio when scaling</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="backgroundLabel">
<property name="text">
<string>Background color of empty place:</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="KColorButton" name="kcfg_BackgroundColor">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="connectionGroupBox">
<property name="title">
<string>When Connecting</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QCheckBox" name="kcfg_ShowPreferencesForNewConnections">
<property name="text">
<string>Show the preferences dialog for new connections</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_ResizeOnConnect">
<property name="toolTip">
<string>This option will resize the window to fit the connection size. If it is too big, it will maximize the window.</string>
</property>
<property name="text">
<string>Resize to fit</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_FullscreenOnConnect">
<property name="toolTip">
<string>This option switches to fullscreen only if the connection resolution is the same as the current screen resolution</string>
</property>
<property name="text">
<string>Switch to Fullscreen if appropriate</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="tabGroupBox">
<property name="title">
<string>Tab Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="kcfg_ShowTabBar">
<property name="text">
<string>Always show tab bar</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_TabCloseButton">
<property name="text">
<string>Show close button on tabs</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="kcfg_TabMiddleClick">
<property name="text">
<string>Middle-click on a tab closes it</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="tabOrientationLabel">
<property name="text">
<string>Tab position:</string>
</property>
</widget>
</item>
<item>
<widget class="KComboBox" name="kcfg_TabPosition">
<item>
<property name="text">
<string>Top</string>
</property>
</item>
<item>
<property name="text">
<string>Bottom</string>
</property>
</item>
<item>
<property name="text">
<string>Left</string>
</property>
</item>
<item>
<property name="text">
<string>Right</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KColorButton</class>
<extends>QPushButton</extends>
<header>kcolorbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,147 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "hostpreferenceslist.h"
#include "hostpreferences.h"
#include <KDebug>
#include <KIcon>
#include <KLocale>
#include <KMessageBox>
#include <KPushButton>
#include <KStandardDirs>
#include <QFile>
#include <QLayout>
#include <QListWidget>
HostPreferencesList::HostPreferencesList(QWidget *parent, MainWindow *mainWindow, KConfigGroup hostPrefsConfig)
: QWidget(parent)
, m_hostPrefsConfig(hostPrefsConfig)
, m_mainWindow(mainWindow)
{
hostList = new QListWidget(this);
connect(hostList, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged()));
connect(hostList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(configureHost()));
configureButton = new KPushButton(this);
configureButton->setEnabled(false);
configureButton->setText(i18n("Configure..."));
configureButton->setIcon(KIcon("configure"));
connect(configureButton, SIGNAL(clicked()), SLOT(configureHost()));
removeButton = new KPushButton(this);
removeButton->setEnabled(false);
removeButton->setText(i18n("Remove"));
removeButton->setIcon(KIcon("list-remove"));
connect(removeButton, SIGNAL(clicked()), SLOT(removeHost()));
QVBoxLayout *buttonLayout = new QVBoxLayout;
buttonLayout->addWidget(configureButton);
buttonLayout->addWidget(removeButton);
buttonLayout->addStretch();
QHBoxLayout *mainLayout = new QHBoxLayout(this);
mainLayout->addWidget(hostList);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
readConfig();
}
HostPreferencesList::~HostPreferencesList()
{
}
void HostPreferencesList::readConfig()
{
QStringList urls = m_hostPrefsConfig.groupList();
for (int i = 0; i < urls.size(); ++i)
hostList->addItem(new QListWidgetItem(urls.at(i)));
}
void HostPreferencesList::saveSettings()
{
m_hostPrefsConfig.sync();
}
void HostPreferencesList::configureHost()
{
QList<QListWidgetItem *> selectedItems = hostList->selectedItems();
foreach(QListWidgetItem *selectedItem, selectedItems) {
const QString url = selectedItem->text();
kDebug(5010) << "Configure host: " << url;
HostPreferences* prefs = 0;
const QList<RemoteViewFactory *> remoteViewFactories(m_mainWindow->remoteViewFactoriesList());
foreach(RemoteViewFactory *factory, remoteViewFactories) {
if (factory->supportsUrl(url)) {
prefs = factory->createHostPreferences(m_hostPrefsConfig.group(url), this);
if (prefs) {
kDebug(5010) << "Found plugin to handle url (" + url + "): " + prefs->metaObject()->className();
} else {
kDebug(5010) << "Found plugin to handle url (" + url + "), but plugin does not provide preferences";
}
}
}
if (prefs) {
prefs->showDialog(this);
delete prefs;
} else {
KMessageBox::error(this,
i18n("The selected host cannot be handled."),
i18n("Unusable URL"));
}
}
}
void HostPreferencesList::removeHost()
{
const QList<QListWidgetItem *> selectedItems = hostList->selectedItems();
foreach(QListWidgetItem *selectedItem, selectedItems) {
kDebug(5010) << "Remove host: " << selectedItem->text();
m_hostPrefsConfig.deleteGroup(selectedItem->text());
delete(selectedItem);
}
saveSettings();
hostList->clearSelection();
}
void HostPreferencesList::selectionChanged()
{
const bool enabled = hostList->selectedItems().isEmpty() ? false : true;
configureButton->setEnabled(enabled);
removeButton->setEnabled(enabled);
}
#include "hostpreferenceslist.moc"

View file

@ -0,0 +1,62 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef HOSTPREFERENCESLIST_H
#define HOSTPREFERENCESLIST_H
#include "mainwindow.h"
#include <KConfigGroup>
#include <QDomDocument>
#include <QWidget>
class KPushButton;
class QListWidget;
class HostPreferencesList : public QWidget
{
Q_OBJECT
public:
HostPreferencesList(QWidget *parent, MainWindow *mainWindow, KConfigGroup hostPrefsConfig);
~HostPreferencesList();
private slots:
void readConfig();
void saveSettings();
void configureHost();
void removeHost();
void selectionChanged();
private:
KConfigGroup m_hostPrefsConfig;
KPushButton *configureButton;
KPushButton *removeButton;
QListWidget *hostList;
MainWindow *m_mainWindow;
};
#endif // HOSTPREFERENCESLIST_H

View file

@ -0,0 +1,83 @@
/****************************************************************************
**
** Copyright (C) 2007 - 2010 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "preferencesdialog.h"
#include "hostpreferenceslist.h"
#include "ui_general.h"
#include <KConfigSkeleton>
#include <KDebug>
#include <KPluginSelector>
#include <KService>
#include <KServiceTypeTrader>
#include <KPluginInfo>
PreferencesDialog::PreferencesDialog(QWidget *parent, KConfigSkeleton *skeleton)
: KConfigDialog(parent, "preferences", skeleton)
, m_settingsChanged(false)
{
QWidget *generalPage = new QWidget(this);
Ui::General generalUi;
generalUi.setupUi(generalPage);
addPage(generalPage, i18nc("General Config", "General"), "krdc", i18n("General Configuration"));
HostPreferencesList *hostPreferencesList = new HostPreferencesList(this,
qobject_cast<MainWindow *>(parent),
skeleton->config()->group("hostpreferences"));
addPage(hostPreferencesList, i18n("Hosts"), "computer", i18n("Host Configuration"));
m_pluginSelector = new KPluginSelector();
KService::List offers = KServiceTypeTrader::self()->query("KRDC/Plugin");
m_pluginSelector->addPlugins(KPluginInfo::fromServices(offers), KPluginSelector::ReadConfigFile,
i18n("Plugins"), "Service", KGlobal::config());
m_pluginSelector->load();
addPage(m_pluginSelector, i18n("Plugins"), "preferences-plugin", i18n("Plugin Configuration"));
connect(this, SIGNAL(accepted()), SLOT(saveState()));
connect(this, SIGNAL(defaultClicked()), SLOT(loadDefaults()));
connect(m_pluginSelector, SIGNAL(changed(bool)), SLOT(settingsChanged()));
}
void PreferencesDialog::saveState()
{
//TODO: relaod plugins at runtime?
m_pluginSelector->save();
}
void PreferencesDialog::loadDefaults()
{
m_pluginSelector->defaults();
enableButton(Default, false);
}
void PreferencesDialog::settingsChanged()
{
enableButton(Apply, true);
enableButton(Default, true);
}
bool PreferencesDialog::isDefault()
{
return KConfigDialog::isDefault() && m_pluginSelector->isDefault();
}

View file

@ -0,0 +1,52 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef PREFERENCESDIALOG_H
#define PREFERENCESDIALOG_H
#include <KConfigDialog>
class KConfigSkeleton;
class KPluginSelector;
class PreferencesDialog : public KConfigDialog
{
Q_OBJECT
public:
PreferencesDialog(QWidget *parent, KConfigSkeleton *config);
protected:
virtual bool isDefault();
private slots:
void saveState();
void loadDefaults();
void settingsChanged();
private:
KPluginSelector *m_pluginSelector;
bool m_settingsChanged;
};
#endif

View file

@ -0,0 +1,89 @@
/****************************************************************************
**
** Copyright (C) 2009 Tony Murray <murraytony@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "connectiondelegate.h"
#include "remotedesktopsmodel.h"
#include <KDateTime>
#include <KDebug>
#include <KIcon>
#include <KIconLoader>
#include <KLocale>
ConnectionDelegate::ConnectionDelegate(QObject *parent) :
QStyledItemDelegate(parent)
{
}
QString ConnectionDelegate::displayText(const QVariant &value, const QLocale& locale) const
{
if (value.type() == QVariant::DateTime) {
KDateTime lastConnected = KDateTime(value.toDateTime());
KDateTime currentTime = KDateTime::currentUtcDateTime();
int daysAgo = lastConnected.daysTo(currentTime);
if (daysAgo <= 1 && lastConnected.secsTo(currentTime) < 86400) {
int minutesAgo = lastConnected.secsTo(currentTime) / 60;
int hoursAgo = minutesAgo / 60;
if (hoursAgo < 1) {
if (minutesAgo < 1)
return i18n("Less than a minute ago");
return i18np("A minute ago", "%1 minutes ago", minutesAgo);
} else {
return i18np("An hour ago", "%1 hours ago", hoursAgo);
}
} else { // 1 day or more
if (daysAgo < 30)
return i18np("Yesterday", "%1 days ago", daysAgo);
if (daysAgo < 365)
return i18np("Over a month ago", "%1 months ago", daysAgo / 30);
return i18np("A year ago", "%1 years ago", daysAgo / 365);
}
}
// These aren't the strings you're looking for, move along.
return QStyledItemDelegate::displayText(value, locale);
}
void ConnectionDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.column() == RemoteDesktopsModel::Favorite) {
QVariant value = index.data(Qt::CheckStateRole);
if (value.isValid()) {
Qt::CheckState checkState = static_cast<Qt::CheckState>(value.toInt());
KIcon favIcon = KIcon("bookmarks");
KIcon::Mode mode = (checkState == Qt::Checked) ? KIcon::Active : KIcon::Disabled;
favIcon.paint(painter, option.rect, option.decorationAlignment, mode);
}
} else {
QStyledItemDelegate::paint(painter, option, index);
}
}
QSize ConnectionDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
if (index.column() == RemoteDesktopsModel::Favorite)
return QSize(KIconLoader::SizeSmall, KIconLoader::SizeSmall);
return QStyledItemDelegate::sizeHint(option, index);
}

43
krdc/connectiondelegate.h Normal file
View file

@ -0,0 +1,43 @@
/****************************************************************************
**
** Copyright (C) 2009 Tony Murray <murraytony@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef CONNECTIONDELEGATE_H
#define CONNECTIONDELEGATE_H
#include <QStyledItemDelegate>
class ConnectionDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit ConnectionDelegate(QObject *parent = 0);
QString displayText(const QVariant &value, const QLocale& locale) const;
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
signals:
public slots:
};
#endif // CONNECTIONDELEGATE_H

29
krdc/core/CMakeLists.txt Normal file
View file

@ -0,0 +1,29 @@
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5010)
set(krdccore_SRCS
remoteviewfactory.cpp
remoteview.cpp
hostpreferences.cpp
)
kde4_add_kcfg_files(krdccore_SRCS settings.kcfgc)
kde4_add_library(krdccore SHARED ${krdccore_SRCS})
target_link_libraries(krdccore ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBS})
set_target_properties(krdccore PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION})
install(TARGETS krdccore ${INSTALL_TARGETS_DEFAULT_ARGS})
# Install headers
set(krdccore_HDRS
remoteviewfactory.h
remoteview.h
hostpreferences.h
)
install(FILES ${krdccore_HDRS} DESTINATION ${INCLUDE_INSTALL_DIR}/krdc COMPONENT Devel)
install(FILES krdc_plugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES krdc.kcfg DESTINATION ${KCFG_INSTALL_DIR})

View file

@ -0,0 +1,239 @@
/****************************************************************************
**
** Copyright (C) 2007 - 2010 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "hostpreferences.h"
#include "settings.h"
#include <KDebug>
#include <KLocale>
#include <KStandardDirs>
#include <KTitleWidget>
#include <QCheckBox>
#include <QFile>
#include <QVBoxLayout>
HostPreferences::HostPreferences(KConfigGroup configGroup, QObject *parent)
: QObject(parent),
m_configGroup(configGroup),
m_connected(false),
showAgainCheckBox(0),
walletSupportCheckBox(0)
{
m_hostConfigured = m_configGroup.hasKey("showConfigAgain");
}
HostPreferences::~HostPreferences()
{
}
KConfigGroup HostPreferences::configGroup()
{
return m_configGroup;
}
void HostPreferences::acceptConfig()
{
setShowConfigAgain(showAgainCheckBox->isChecked());
setWalletSupport(walletSupportCheckBox->isChecked());
}
bool HostPreferences::hostConfigured()
{
return m_hostConfigured;
}
void HostPreferences::setShowConfigAgain(bool show)
{
m_configGroup.writeEntry("showConfigAgain", show);
}
bool HostPreferences::showConfigAgain()
{
return m_configGroup.readEntry("showConfigAgain", true);
}
void HostPreferences::setWalletSupport(bool walletSupport)
{
m_configGroup.writeEntry("walletSupport", walletSupport);
}
bool HostPreferences::walletSupport()
{
return m_configGroup.readEntry("walletSupport", true);
}
void HostPreferences::setHeight(int height)
{
if (height >= 0)
m_configGroup.writeEntry("height", height);
}
int HostPreferences::height()
{
return m_configGroup.readEntry("height", Settings::height());
}
void HostPreferences::setWidth(int width)
{
if (width >= 0)
m_configGroup.writeEntry("width", width);
}
int HostPreferences::width()
{
return m_configGroup.readEntry("width", Settings::width());
}
bool HostPreferences::fullscreenScale()
{
return m_configGroup.readEntry("fullscreenScale", false);
}
void HostPreferences::setFullscreenScale(bool scale)
{
m_configGroup.writeEntry("fullscreenScale", scale);
}
bool HostPreferences::windowedScale()
{
return m_configGroup.readEntry("windowedScale", false);
}
void HostPreferences::setWindowedScale(bool scale)
{
m_configGroup.writeEntry("windowedScale", scale);
}
bool HostPreferences::grabAllKeys()
{
return m_configGroup.readEntry("grabAllKeys", false);
}
void HostPreferences::setGrabAllKeys(bool grab)
{
m_configGroup.writeEntry("grabAllKeys", grab);
}
bool HostPreferences::showLocalCursor()
{
return m_configGroup.readEntry("showLocalCursor", false);
}
void HostPreferences::setShowLocalCursor(bool show)
{
m_configGroup.writeEntry("showLocalCursor", show);
}
bool HostPreferences::viewOnly()
{
return m_configGroup.readEntry("viewOnly", false);
}
void HostPreferences::setViewOnly(bool view)
{
m_configGroup.writeEntry("viewOnly", view);
}
bool HostPreferences::showDialogIfNeeded(QWidget *parent)
{
if (hostConfigured()) {
if (showConfigAgain()) {
kDebug(5010) << "Show config dialog again";
return showDialog(parent);
} else
return true; // no changes, no need to save
} else {
kDebug(5010) << "No config found, create new";
if (Settings::showPreferencesForNewConnections())
return showDialog(parent);
else
return true;
}
}
bool HostPreferences::showDialog(QWidget *parent)
{
// Prepare dialog
KDialog *dialog = new KDialog(parent);
dialog->setCaption(i18n("Host Configuration"));
QWidget *mainWidget = dialog->mainWidget();
QVBoxLayout *layout = new QVBoxLayout(mainWidget);
KTitleWidget *titleWidget = new KTitleWidget(dialog);
titleWidget->setText(i18n("Host Configuration"));
if (m_connected) {
titleWidget->setComment(QString("<i>%1</i>").arg(
i18n("Note that settings might only apply when you connect next time to this host.")));
}
titleWidget->setPixmap(KIcon("krdc"));
layout->addWidget(titleWidget);
QWidget* widget = createProtocolSpecificConfigPage();
if (widget) {
if (widget->layout())
widget->layout()->setMargin(0);
layout->addWidget(widget);
}
showAgainCheckBox = new QCheckBox(mainWidget);
showAgainCheckBox->setText(i18n("Show this dialog again for this host"));
showAgainCheckBox->setChecked(showConfigAgain());
walletSupportCheckBox = new QCheckBox(mainWidget);
walletSupportCheckBox->setText(i18n("Remember password (KWallet)"));
walletSupportCheckBox->setChecked(walletSupport());
layout->addWidget(showAgainCheckBox);
layout->addWidget(walletSupportCheckBox);
layout->addStretch(1);
// WORKAROUND: it seems that KDialog does not set the minimum size properly in some cases.
// see for example issue #244539. also it looks like KTitleWidget returns a too small size hint when a comment is shown.
QSize minimumSize = dialog->sizeHint();
if (m_connected) {
minimumSize += QSize(0, 50);
}
dialog->setMinimumSize(minimumSize);
// Show dialog
if (dialog->exec() == KDialog::Accepted) {
kDebug(5010) << "HostPreferences config dialog accepted";
acceptConfig();
return true;
} else {
return false;
}
}
void HostPreferences::setShownWhileConnected(bool connected)
{
m_connected = connected;
}
#include "hostpreferences.moc"

114
krdc/core/hostpreferences.h Normal file
View file

@ -0,0 +1,114 @@
/****************************************************************************
**
** Copyright (C) 2007 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef HOSTPREFERENCES_H
#define HOSTPREFERENCES_H
#include "remoteview.h"
#include <kdemacros.h>
#include <KDE/KDialog>
#include <QDomDocument>
#include <QSize>
class QCheckBox;
class QWidget;
class KConfig;
class KConfigGroup;
class KRDCCORE_EXPORT HostPreferences : public QObject
{
Q_OBJECT
public:
~HostPreferences();
KConfigGroup configGroup();
bool walletSupport();
/** Whether scaling is enabled when session is full screen. Note: only windowedScale seems to be used. */
bool fullscreenScale();
void setFullscreenScale(bool scale);
/** Whether scaling is enabled when session is not full screen */
bool windowedScale();
void setWindowedScale(bool scale);
bool grabAllKeys();
void setGrabAllKeys(bool grab);
bool showLocalCursor();
void setShowLocalCursor(bool show);
bool viewOnly();
void setViewOnly(bool view);
/** Saved height. Generally used for the viewsize. */
int height();
void setHeight(int height);
/** Saved width. Generally used for the viewsize. */
int width();
void setWidth(int width);
/**
* Show the configuration dialog if needed, ie. if the user did
* check "show this dialog again for this host".
* Returns true if user pressed ok.
*/
bool showDialogIfNeeded(QWidget *parent);
/** Show the configuration dialog */
bool showDialog(QWidget *parent);
/** If @p connected is true, a message is shown that settings might only apply after a reconnect. */
void setShownWhileConnected(bool connected);
protected:
HostPreferences(KConfigGroup configGroup, QObject *parent);
virtual QWidget* createProtocolSpecificConfigPage() = 0;
/** Called when the user validates the config dialog. */
virtual void acceptConfig();
bool hostConfigured();
bool showConfigAgain();
KConfigGroup m_configGroup;
private:
void setShowConfigAgain(bool show);
void setWalletSupport(bool walletSupport);
bool m_hostConfigured;
bool m_connected;
QCheckBox *showAgainCheckBox;
QCheckBox *walletSupportCheckBox;
};
#endif

132
krdc/core/krdc.kcfg Normal file
View file

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name="krdcrc"/>
<group name="General">
<entry name="RememberSessions" type="Bool">
<default>false</default>
</entry>
<entry name="RememberHistory" type="Bool">
<default>true</default>
</entry>
<entry name="OpenSessions" type="StringList" key="Items">
<label>Sessions</label>
</entry>
<entry name="NormalUrlInputLine" type="Bool">
<default>true</default>
</entry>
<entry name="ShowPreferencesForNewConnections" type="Bool">
<default>true</default>
</entry>
<entry name="ResizeOnConnect" type="Bool">
<default>true</default>
</entry>
<entry name="FullscreenOnConnect" type="Bool">
<default>false</default>
</entry>
<entry name="BackgroundColor" type="Color">
<default>#00417F</default>
</entry>
<entry name="WalletSupport" type="Bool">
<default>true</default>
</entry>
<entry name="SystemTrayIcon" type="Bool">
<default>false</default>
</entry>
<entry name="KeepAspectRatio" type="Bool">
<default>true</default>
</entry>
<entry name="TabCloseButton" type="Bool">
<default>true</default>
</entry>
<entry name="TabMiddleClick" type="Bool">
<default>true</default>
</entry>
<entry name="TabPosition" type="Int">
<default>0</default>
</entry>
<entry name="ShowTabBar" type="Bool">
<default>false</default>
</entry>
<entry name="ShowStatusBar" type="Bool">
<default>false</default>
</entry>
<entry name="ConnectionListSortColumn" type="Int">
<default>2</default>
</entry>
<entry name="ConnectionListSortOrder" type="Int">
<default>1</default>
</entry>
</group>
<group name="VNC">
<entry name="Quality" type="Int">
<default>1</default>
</entry>
<entry name="Scaling" type="Bool">
<default>false</default>
</entry>
<entry name="ScalingWidth" type="Int">
<default>800</default>
</entry>
<entry name="ScalingHeight" type="Int">
<default>600</default>
</entry>
</group>
<group name="RDP">
<entry name="Width" type="Int">
<default>800</default>
</entry>
<entry name="Height" type="Int">
<default>600</default>
</entry>
<entry name="KeyboardLayout" type="Int">
<default>7</default>
</entry>
<entry name="ColorDepth" type="Int">
<default>2</default>
</entry>
<entry name="Sound" type="Int">
<default>0</default>
</entry>
<entry name="Console" type="Bool">
<default>false</default>
</entry>
<entry name="ExtraOptions" type="String">
<default></default>
</entry>
<entry name="DefaultRdpUserName" type="String">
<default></default>
</entry>
<entry name="RecognizeLdapLogins" type="Bool">
<default>true</default>
</entry>
<entry name="RemoteFX" type="Bool">
<default>true</default>
</entry>
<entry name="Performance" type="Int">
<default>2</default>
</entry>
<entry name="ShareMedia" type="String">
<default>/media</default>
</entry>
</group>
<group name="NX">
<entry name="NxWidth" type="Int">
<default>800</default>
</entry>
<entry name="NxHeight" type="Int">
<default>600</default>
</entry>
<entry name="NxDesktopType" type="Int">
<default>0</default>
</entry>
<entry name="NxKeyboardLayout" type="Int">
<default>7</default>
</entry>
<entry name="NxPrivateKey" type="String">
<default>default</default>
</entry>
</group>
</kcfg>

39
krdc/core/krdc_export.h Normal file
View file

@ -0,0 +1,39 @@
/* This file is part of the KDE project
Copyright (C) 2006 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KRDCCORE_EXPORT_H
#define KRDCCORE_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifndef KRDCCORE_EXPORT
# if defined(KDELIBS_STATIC_LIBS)
/* No export/import for static libraries */
# define KRDCCORE_EXPORT
# elif defined(MAKE_KRDCCORE_LIB)
/* We are building this library */
# define KRDCCORE_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define KRDCCORE_EXPORT KDE_IMPORT
# endif
#endif
#endif

View file

@ -0,0 +1,63 @@
[Desktop Entry]
Type=ServiceType
X-KDE-ServiceType=KRDC/Plugin
Name=KRDC Plugin
Name[ast]=Complemente KRDC
Name[bg]=Приставка KRDC
Name[bs]=KRDC Dodatak
Name[ca]=Connector del KRDC
Name[ca@valencia]=Connector del KRDC
Name[cs]=Modul KRDC
Name[da]=KRDC-plugin
Name[de]=KRDC-Modul
Name[el]=Πρόσθετο KRDC
Name[en_GB]=KRDC Plugin
Name[es]=Complemento de KRDC
Name[et]=KRDC plugin
Name[eu]=KRDC plugina
Name[fi]=Kopete-liitännäinen
Name[fr]=Module externe KRDC
Name[ga]=Breiseán KRDC
Name[gl]=Engadido KRDC
Name[hr]=Priključak KRDC
Name[hu]=KRDC-bővítmény
Name[ia]=Plug-in de KRDC
Name[is]=KRDC íforrit
Name[it]=Estensione di KRDC
Name[ja]=KRDC
Name[kk]=KRDC плагині
Name[km]= KRDC
Name[ko]=KRDC
Name[lt]=KRDC priedas
Name[lv]=KRDC spraudnis
Name[mr]=---
Name[nb]=KRDC programtillegg
Name[nds]=KRDC-Moduul
Name[nl]=KRDC-plugin
Name[nn]=KRDC-programtillegg
Name[pa]=KRDC
Name[pl]=Wtyczka KRDC
Name[pt]='Plugin' do KRDC
Name[pt_BR]=Plugin KRDC
Name[ro]=Extensie KRDC
Name[ru]=Модуль KRDC
Name[si]=KRDC
Name[sk]=Modul KRDC
Name[sl]=Vstavek za KRDC
Name[sr]=Прикључак КРДЦа
Name[sr@ijekavian]=Прикључак КРДЦа
Name[sr@ijekavianlatin]=Priključak KRDCa
Name[sr@latin]=Priključak KRDCa
Name[sv]=Insticksprogram för KRDC
Name[th]= KRDC
Name[tr]=KRDC Eklentisi
Name[ug]=KRDC قىستۇرما
Name[uk]=Додаток KRDC
Name[x-test]=xxKRDC Pluginxx
Name[zh_CN]=KRDC
Name[zh_TW]=KRDC
# Sorting of the plugin.
# 0 is the highest value.
[PropertyDef::X-KDE-KRDC-Sorting]
Type=int

283
krdc/core/remoteview.cpp Normal file
View file

@ -0,0 +1,283 @@
/****************************************************************************
**
** Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "remoteview.h"
#ifndef QTONLY
#include <KDebug>
#include <KStandardDirs>
#endif
#include <QBitmap>
RemoteView::RemoteView(QWidget *parent)
: QWidget(parent),
m_status(Disconnected),
m_host(QString()),
m_port(0),
m_viewOnly(false),
m_grabAllKeys(false),
m_scale(false),
m_keyboardIsGrabbed(false),
#ifndef QTONLY
m_wallet(0),
#endif
m_dotCursorState(CursorOff)
{
}
RemoteView::~RemoteView()
{
#ifndef QTONLY
delete m_wallet;
#endif
}
RemoteView::RemoteStatus RemoteView::status()
{
return m_status;
}
void RemoteView::setStatus(RemoteView::RemoteStatus s)
{
if (m_status == s)
return;
if (((1+ m_status) != s) && (s != Disconnected)) {
// follow state transition rules
if (s == Disconnecting) {
if (m_status == Disconnected)
return;
} else {
Q_ASSERT(((int) s) >= 0);
if (m_status > s) {
m_status = Disconnected;
emit statusChanged(Disconnected);
}
// smooth state transition
RemoteStatus origState = m_status;
for (int i = origState; i < s; ++i) {
m_status = (RemoteStatus) i;
emit statusChanged((RemoteStatus) i);
}
}
}
m_status = s;
emit statusChanged(m_status);
}
bool RemoteView::supportsScaling() const
{
return false;
}
bool RemoteView::supportsLocalCursor() const
{
return false;
}
QString RemoteView::host()
{
return m_host;
}
QSize RemoteView::framebufferSize()
{
return QSize(0, 0);
}
void RemoteView::startQuitting()
{
}
bool RemoteView::isQuitting()
{
return false;
}
int RemoteView::port()
{
return m_port;
}
void RemoteView::updateConfiguration()
{
}
void RemoteView::keyEvent(QKeyEvent *)
{
}
bool RemoteView::viewOnly()
{
return m_viewOnly;
}
void RemoteView::setViewOnly(bool viewOnly)
{
m_viewOnly = viewOnly;
}
bool RemoteView::grabAllKeys()
{
return m_grabAllKeys;
}
void RemoteView::setGrabAllKeys(bool grabAllKeys)
{
m_grabAllKeys = grabAllKeys;
if (grabAllKeys) {
m_keyboardIsGrabbed = true;
grabKeyboard();
} else if (m_keyboardIsGrabbed) {
releaseKeyboard();
}
}
QPixmap RemoteView::takeScreenshot()
{
return QPixmap::grabWidget(this);
}
void RemoteView::showDotCursor(DotCursorState state)
{
m_dotCursorState = state;
}
RemoteView::DotCursorState RemoteView::dotCursorState() const
{
return m_dotCursorState;
}
bool RemoteView::scaling() const
{
return m_scale;
}
void RemoteView::enableScaling(bool scale)
{
m_scale = scale;
}
void RemoteView::switchFullscreen(bool)
{
}
void RemoteView::scaleResize(int, int)
{
}
KUrl RemoteView::url()
{
return m_url;
}
#ifndef QTONLY
QString RemoteView::readWalletPassword(bool fromUserNameOnly)
{
const QString KRDCFOLDER = "KRDC";
window()->setDisabled(true); // WORKAROUND: disable inputs so users cannot close the current tab (see #181230)
m_wallet = KWallet::Wallet::openWallet(KWallet::Wallet::NetworkWallet(), window()->winId());
window()->setDisabled(false);
if (m_wallet) {
bool walletOK = m_wallet->hasFolder(KRDCFOLDER);
if (!walletOK) {
walletOK = m_wallet->createFolder(KRDCFOLDER);
kDebug(5010) << "Wallet folder created";
}
if (walletOK) {
kDebug(5010) << "Wallet OK";
m_wallet->setFolder(KRDCFOLDER);
QString password;
QString key;
if (fromUserNameOnly)
key = m_url.userName();
else
key = m_url.prettyUrl(KUrl::RemoveTrailingSlash);
if (m_wallet->hasEntry(key) &&
!m_wallet->readPassword(key, password)) {
kDebug(5010) << "Password read OK";
return password;
}
}
}
return QString();
}
void RemoteView::saveWalletPassword(const QString &password, bool fromUserNameOnly)
{
QString key;
if (fromUserNameOnly)
key = m_url.userName();
else
key = m_url.prettyUrl(KUrl::RemoveTrailingSlash);
if (m_wallet && m_wallet->isOpen()) {
kDebug(5010) << "Write wallet password";
m_wallet->writePassword(key, password);
}
}
#endif
QCursor RemoteView::localDotCursor() const
{
#ifdef QTONLY
return QCursor(); //TODO
#else
QBitmap cursorBitmap(KGlobal::dirs()->findResource("appdata",
"pics/pointcursor.png"));
QBitmap cursorMask(KGlobal::dirs()->findResource("appdata",
"pics/pointcursormask.png"));
return QCursor(cursorBitmap, cursorMask);
#endif
}
void RemoteView::focusInEvent(QFocusEvent *event)
{
if (m_grabAllKeys) {
m_keyboardIsGrabbed = true;
grabKeyboard();
}
QWidget::focusInEvent(event);
}
void RemoteView::focusOutEvent(QFocusEvent *event)
{
if (m_grabAllKeys || m_keyboardIsGrabbed) {
m_keyboardIsGrabbed = false;
releaseKeyboard();
}
QWidget::focusOutEvent(event);
}
#include "moc_remoteview.cpp"

415
krdc/core/remoteview.h Normal file
View file

@ -0,0 +1,415 @@
/****************************************************************************
**
** Copyright (C) 2002-2003 Tim Jansen <tim@tjansen.de>
** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef REMOTEVIEW_H
#define REMOTEVIEW_H
#ifdef QTONLY
#include <QUrl>
#define KUrl QUrl
#define KRDCCORE_EXPORT
#else
#include <KDE/KUrl>
#include <KDE/KWallet/Wallet>
#include <krdc_export.h>
#endif
#include <QWidget>
class HostPreferences;
/**
* Generic widget that displays a remote framebuffer.
* Implement this if you want to add another backend.
*
* Things to take care of:
* @li The RemoteView is responsible for its size. In
* non-scaling mode, set the fixed size of the widget
* to the remote resolution. In scaling mode, set the
* maximum size to the remote size and minimum size to the
* smallest resolution that your scaler can handle.
* @li if you override mouseMoveEvent()
* you must ignore the QEvent, because the KRDC widget will
* need it for stuff like toolbar auto-hide and bump
* scrolling. If you use x11Event(), make sure that
* MotionNotify events will be forwarded.
*
*/
class KRDCCORE_EXPORT RemoteView : public QWidget
{
Q_OBJECT
public:
Q_ENUMS(Quality)
enum Quality {
Unknown,
High,
Medium,
Low
};
/**
* Describes the state of a local cursor, if there is such a concept in the backend.
* With local cursors, there are two cursors: the cursor on the local machine (client),
* and the cursor on the remote machine (server). Because there is usually some lag,
* some backends show both cursors simultanously. In the VNC backend the local cursor
* is a dot and the remote cursor is the 'real' cursor, usually an arrow.
*/
Q_ENUMS(DotCursorState)
enum DotCursorState {
CursorOn, ///< Always show local cursor (and the remote one).
CursorOff, ///< Never show local cursor, only the remote one.
/// Try to measure the lag and enable the local cursor if the latency is too high.
CursorAuto
};
/**
* State of the connection. The state of the connection is returned
* by @ref RemoteView::status().
*
* Not every state transition is allowed. You are only allowed to transition
* a state to the following state, with three exceptions:
* @li You can move from every state directly to Disconnected
* @li You can move from every state except Disconnected to
* Disconnecting
* @li You can move from Disconnected to Connecting
*
* @ref RemoteView::setStatus() will follow this rules for you.
* (If you add/remove a state here, you must adapt it)
*/
Q_ENUMS(RemoteStatus)
enum RemoteStatus {
Connecting = 0,
Authenticating = 1,
Preparing = 2,
Connected = 3,
Disconnecting = -1,
Disconnected = -2
};
Q_ENUMS(ErrorCode)
enum ErrorCode {
None = 0,
Internal,
Connection,
Protocol,
IO,
Name,
NoServer,
ServerBlocked,
Authentication
};
virtual ~RemoteView();
/**
* Checks whether the backend supports scaling. The
* default implementation returns false.
* @return true if scaling is supported
* @see scaling()
*/
virtual bool supportsScaling() const;
/**
* Checks whether the widget is in scale mode. The
* default implementation always returns false.
* @return true if scaling is activated. Must always be
* false if @ref supportsScaling() returns false
* @see supportsScaling()
*/
virtual bool scaling() const;
/**
* Checks whether the backend supports the concept of local cursors. The
* default implementation returns false.
* @return true if local cursors are supported/known
* @see DotCursorState
* @see showDotCursor()
* @see dotCursorState()
*/
virtual bool supportsLocalCursor() const;
/**
* Sets the state of the dot cursor, if supported by the backend.
* The default implementation does nothing.
* @param state the new state (CursorOn, CursorOff or
* CursorAuto)
* @see dotCursorState()
* @see supportsLocalCursor()
*/
virtual void showDotCursor(DotCursorState state);
/**
* Returns the state of the local cursor. The default implementation returns
* always CursorOff.
* @return true if local cursors are supported/known
* @see showDotCursor()
* @see supportsLocalCursor()
*/
virtual DotCursorState dotCursorState() const;
/**
* Checks whether the view is in view-only mode. This means
* that all input is ignored.
*/
virtual bool viewOnly();
/**
* Checks whether grabbing all possible keys is enabled.
*/
virtual bool grabAllKeys();
/**
* Returns the resolution of the remote framebuffer.
* It should return a null @ref QSize when the size
* is not known.
* The backend must also emit a @ref framebufferSizeChanged()
* when the size of the framebuffer becomes available
* for the first time or the size changed.
* @return the remote framebuffer size, a null QSize
* if unknown
*/
virtual QSize framebufferSize();
/**
* Initiate the disconnection. This doesn't need to happen
* immediately. The call must not block.
* @see isQuitting()
*/
virtual void startQuitting();
/**
* Checks whether the view is currently quitting.
* @return true if it is quitting
* @see startQuitting()
* @see setStatus()
*/
virtual bool isQuitting();
/**
* @return the host the view is connected to
*/
virtual QString host();
/**
* @return the port the view is connected to
*/
virtual int port();
/**
* Initialize the view (for example by showing configuration
* dialogs to the user) and start connecting. Should not block
* without running the event loop (so displaying a dialog is ok).
* When the view starts connecting the application must call
* @ref setStatus() with the status Connecting.
* @return true if successful (so far), false
* otherwise
* @see connected()
* @see disconnected()
* @see disconnectedError()
* @see statusChanged()
*/
virtual bool start() = 0;
/**
* Called when the configuration is changed.
* The default implementation does nothing.
*/
virtual void updateConfiguration();
/**
* @return screenshot of the view
*/
virtual QPixmap takeScreenshot();
#ifndef QTONLY
/**
* Returns the current host preferences of this view.
*/
virtual HostPreferences* hostPreferences() = 0;
#endif
/**
* Returns the current status of the connection.
* @return the status of the connection
* @see setStatus()
*/
RemoteStatus status();
/**
* @return the current url
*/
KUrl url();
public slots:
/**
* Called to enable or disable scaling.
* Ignored if @ref supportsScaling() is false.
* The default implementation does nothing.
* @param s true to enable, false to disable.
* @see supportsScaling()
* @see scaling()
*/
virtual void enableScaling(bool scale);
/**
* Enables/disables the view-only mode.
* Ignored if @ref supportsScaling() is false.
* The default implementation does nothing.
* @param viewOnly true to enable, false to disable.
* @see supportsScaling()
* @see viewOnly()
*/
virtual void setViewOnly(bool viewOnly);
/**
* Enables/disables grabbing all possible keys.
* @param grabAllKeys true to enable, false to disable.
* Default is false.
* @see grabAllKeys()
*/
virtual void setGrabAllKeys(bool grabAllKeys);
/**
* Called to let the backend know it when
* we switch from/to fullscreen.
* @param on true when switching to fullscreen,
* false when switching from fullscreen.
*/
virtual void switchFullscreen(bool on);
/**
* Sends a QKeyEvent to the remote server.
* @param event the key to send
*/
virtual void keyEvent(QKeyEvent *event);
/**
* Called when the visible place changed so remote
* view can resize itself.
*/
virtual void scaleResize(int w, int h);
Q_SIGNALS:
/**
* Emitted when the size of the remote screen changes. Also
* called when the size is known for the first time.
* @param x the width of the screen
* @param y the height of the screen
*/
void framebufferSizeChanged(int w, int h);
/**
* Emitted when the view connected successfully.
*/
void connected();
/**
* Emitted when the view disconnected without error.
*/
void disconnected();
/**
* Emitted when the view disconnected with error.
*/
void disconnectedError();
/**
* Emitted when the view has a specific error.
*/
void errorMessage(const QString &title, const QString &message);
/**
* Emitted when the status of the view changed.
* @param s the new status
*/
void statusChanged(RemoteView::RemoteStatus s);
/**
* Emitted when the password dialog is shown or hidden.
* @param b true when the dialog is shown, false when it has been hidden
*/
void showingPasswordDialog(bool b);
/**
* Emitted when the mouse on the remote side has been moved.
* @param x the new x coordinate
* @param y the new y coordinate
* @param buttonMask the mask of mouse buttons (bit 0 for first mouse
* button, 1 for second button etc)a
*/
void mouseStateChanged(int x, int y, int buttonMask);
protected:
RemoteView(QWidget *parent = 0);
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
/**
* The status of the remote view.
*/
RemoteStatus m_status;
/**
* Set the status of the connection.
* Emits a statusChanged() signal.
* Note that the states need to be set in a certain order,
* see @ref Status. setStatus() will try to do this
* transition automatically, so if you are in Connecting
* and call setStatus(Preparing), setStatus() will
* emit a Authenticating and then Preparing.
* If you transition backwards, it will emit a
* Disconnected before doing the transition.
* @param s the new status
*/
virtual void setStatus(RemoteStatus s);
QCursor localDotCursor() const;
QString m_host;
int m_port;
bool m_viewOnly;
bool m_grabAllKeys;
bool m_scale;
bool m_keyboardIsGrabbed;
KUrl m_url;
#ifndef QTONLY
QString readWalletPassword(bool fromUserNameOnly = false);
void saveWalletPassword(const QString &password, bool fromUserNameOnly = false);
KWallet::Wallet *m_wallet;
#endif
DotCursorState m_dotCursorState;
};
#endif

View file

@ -0,0 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "remoteviewfactory.h"
#include <KDebug>
RemoteViewFactory::RemoteViewFactory(QObject *parent)
: QObject(parent)
{
}
RemoteViewFactory::~RemoteViewFactory()
{
}
#include "moc_remoteviewfactory.cpp"

View file

@ -0,0 +1,107 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef REMOTEVIEWFACTORY_H
#define REMOTEVIEWFACTORY_H
#include "remoteview.h"
#include <kdemacros.h>
#include <KDE/KPluginFactory>
#include <KDE/KPluginLoader>
class KUrl;
/**
* Convenience macros to export a KRDC plugin. Suppose you created the plugin
* FooRemoteViewFactory. In FooRemoteViewFactory you will have to put the following line:
*
* @code
* KRDC_PLUGIN_EXPORT(FooRemoteViewFactory)
* @endcode
*
* The rest will be done for you.
*/
#define KRDC_PLUGIN_EXPORT( c ) \
K_PLUGIN_FACTORY( KrdcFactory, registerPlugin< c >(); ) \
K_EXPORT_PLUGIN( KrdcFactory("c") )
/**
* Factory to be implemented by any plugin.
*/
class KRDCCORE_EXPORT RemoteViewFactory : public QObject
{
Q_OBJECT
public:
/**
* Deconstructor.
*/
virtual ~RemoteViewFactory();
/**
* Returns true if the provided @p url is supported by the current plugin.
*/
virtual bool supportsUrl(const KUrl &url) const = 0;
/**
* Returns a new RemoteView implementing object.
*/
virtual RemoteView *createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup) = 0;
/**
* Returns a new HostPreferences implementing object or 0 if no settings are available.
*/
virtual HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent) = 0;
/**
* Returns the supported scheme.
* @see KUrl::scheme()
*/
virtual QString scheme() const = 0;
/**
* Returns the text of the action in the file menu (by default).
*/
virtual QString connectActionText() const = 0;
/**
* Returns the text of the connect button on the startscreen.
*/
virtual QString connectButtonText() const = 0;
/**
* Returns the tooltip next to the url navigator when the user presses
* the connect action.
*/
virtual QString connectToolTipText() const = 0;
protected:
/**
* Protected constructor so it cannot be instantiated.
*/
RemoteViewFactory(QObject *parent = 0);
};
#endif // REMOTEVIEWFACTORY_H

5
krdc/core/settings.kcfgc Normal file
View file

@ -0,0 +1,5 @@
ClassName=Settings
File=krdc.kcfg
Mutators=true
Singleton=true
Visibility=KDE_EXPORT

2
krdc/doc/CMakeLists.txt Normal file
View file

@ -0,0 +1,2 @@
########### install files ###############
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krdc)

BIN
krdc/doc/address_input.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
krdc/doc/bookmarks_menu.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

608
krdc/doc/index.docbook Normal file
View file

@ -0,0 +1,608 @@
<?xml version="1.0" ?>
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
<!ENTITY kappname "&krdc;">
<!ENTITY package "kdenetwork">
<!ENTITY % addindex "IGNORE">
<!ENTITY % English "INCLUDE"> <!-- ONLY If you are writing non-English
original documentation, change
the language here -->
<!-- Do not define any other entities; instead, use the entities
from entities/general.entities and $LANG/user.entities. -->
]>
<!-- Based on kdoctemplate v0.9 January 10 2003 -->
<book id="krdc" lang="&language;">
<!-- This header contains all of the meta-information for the document such
as Authors, publish date, the abstract, and Keywords -->
<bookinfo>
<title>The &krdc; Handbook</title>
<authorgroup>
<author>
&Brad.Hards;
&Brad.Hards.mail;
</author>
<author>
<firstname>Urs</firstname>
<surname>Wolfer</surname>
<affiliation>
<address><email>uwolfer @ kde.org</email></address>
</affiliation>
</author>
<!-- TRANS:ROLES_OF_TRANSLATORS -->
</authorgroup>
<legalnotice>&FDLNotice;</legalnotice>
<date>2013-06-19</date>
<releaseinfo>&kde; 4.11</releaseinfo>
<copyright>
<year>2003, 2008</year>
</copyright>
<abstract>
<para>
&krdc; is a client application that allows you to view or even control
the desktop session on another machine that is running a compatible server.
<acronym>VNC</acronym> and <acronym>RDP</acronym> is supported.
</para>
</abstract>
<keywordset>
<keyword>KDE</keyword>
<keyword>kdenetwork</keyword>
<keyword>krfb</keyword>
<keyword>VNC</keyword>
<keyword>RFB</keyword>
<keyword>krdc</keyword>
<keyword>Desktop Sharing</keyword>
<keyword>Remote Control</keyword>
<keyword>Remote Assistance</keyword>
<keyword>Remote Desktop</keyword>
<keyword>RDP</keyword>
<keyword>Remote Administration</keyword>
</keywordset>
</bookinfo>
<chapter id="introduction">
<title>Introduction</title>
<para>
&krdc; is a client application that allows you to view or even control
the desktop session on another machine that is running a compatible
server.
</para>
<para>
You would typically use &krdc; with the &kde; <acronym>VNC</acronym> server (&krfb;), which is
also known as Krfb, since it closely matches the special features of &krdc;.
</para>
<para>
If you want to start &krdc; from &konsole;, the command is <userinput><command>krdc</command></userinput>.
</para>
<para>
Please report any problems or feature requests to the &kde; mailing
lists or file a bug at <ulink
url="http://bugs.kde.org">http://bugs.kde.org</ulink>.
</para>
</chapter>
<chapter id="what-is-RFB">
<title>The Remote Frame Buffer protocol</title>
<para>
This chapter provides a brief description of the Remote Frame Buffer
protocol used by &krdc; and by other compatible systems. If you are
already familiar with Remote Frame Buffer, you can safely skip this
chapter.
</para>
<para>
The high level implementation of a system using the Remote Frame
Buffer protocol is known as Virtual Network Computer, or more often
just as <acronym>VNC</acronym>.
</para>
<para>
Remote Frame Buffer (or <acronym>RFB</acronym> for short) is a simple
protocol for remote access to graphical user interfaces. It works at
the frame-buffer level, which roughly corresponds to the rendered
screen image, which means that it can be applied to all windowing
systems (including X11, &MacOS; and &Microsoft; &Windows;). Remote
Frame Buffer applications exist for many platforms, and can often be
free re-distributed.
</para>
<para>
In the Remote Frame Buffer protocol, the application that runs on the
machine where the user sits (containing the display, keyboard and
pointer) is called the client. The application that runs on the
machine where the framebuffer is located (which is running the
windowing system and applications that the user is remotely
controlling) is called the server. &krdc; is the &kde; client for the
Remote Frame Buffer protocol. &krfb; is the &kde; server for the
Remote Frame Buffer protocol.
</para>
<para>
It takes a reasonable amount of network traffic to send an image of
the framebuffer, so Remote Frame Buffer works best over high
bandwidth links, such as a local area network. It is still possible to
use &krdc; over other links, but performance is unlikely to be as good.
</para>
</chapter>
<chapter id="using-krdc">
<title>Using &krdc;</title>
<para>
It is very easy to use &krdc; - it has a simple interface, as shown in
the screenshot below.
</para>
<para>
<screenshot>
<screeninfo>Here's a screenshot of &krdc;</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="krdc_mainwindow.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; main window</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<sect1 id="compatible-versions"><title>Connecting &krdc; to compatible servers</title>
<para>
&krdc; is a client, and it needs to be used with compatible
servers. There are different ways to connect to those servers:
</para>
<itemizedlist>
<listitem>
<para>Directly typing the server name (or IP address) into the
<guilabel>Connect to:</guilabel> input.</para>
</listitem>
<listitem>
<para>By using an invitation that you received. &krfb; uses
invitations, and can send them by email.</para>
</listitem>
</itemizedlist>
<para>
Let's look at each of these in turn.
</para>
<sect2><title>Server name entry</title>
<para>
If you know the host name (or IP address) of the server you want to
connect to, you can enter it directly into the <guilabel>Connect to:</guilabel> input.
</para>
<para>
If you want to connect to a machine named megan, which is
running a <acronym>VNC</acronym> server on screen 1 (5901), you can enter
<userinput>megan:1</userinput> or <userinput>megan:5901</userinput> and
choose <guilabel>vnc</guilabel> as the protocol in the
drop down box.
</para>
<para>
<screenshot>
<screeninfo>Entering a hostname into &krdc;</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="address_input.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>Entering a hostname into &krdc;</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
Similary, if you are using a <acronym>RDP</acronym> server on that
machine, you can enter <userinput>megan</userinput>. Choose <guilabel>rdp</guilabel> as
the protocol. <acronym>RDP</acronym> does not need the screen number to be specified.
If the server runs the <acronym>RDP</acronym> server not on the default port, you may
specify it in the following way: <userinput>megan:3910</userinput>
</para>
<para>You need to enter an &URL; in percent encoded syntax, i.e. @ as %40, for &eg;
<userinput>username%40ad.domain.example</userinput>
</para>
<!--https://bugs.kde.org/show_bug.cgi?id=261076-->
</sect2>
<sect2><title>Using an invitation</title>
<para>
Within the &krfb; server application, it is possible to send
invitations over email (and in other ways, although email is the most
useful). If you receive this type of email invitation, you can just
click on the link provided in the mail.
This will start &krdc; if it is not already running, and connect to
the server specified in the invitation.
</para>
</sect2>
</sect1>
<sect1 id="connection"><title>What happens when you connect</title>
<para>
Notice: Before connecting, ensure that the target computer (server) is
available on the network and, if necessary, that its firewall has
been correctly configured or disabled.
</para>
<para>
No matter how you select the server to connect to, the next thing that
happens is that &krdc; asks you about the network connection to the
server, as shown below:
</para>
<para>
<screenshot>
<screeninfo>&krdc; connection speed selection</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="vnc_host_configuration.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; connection speed selection</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
There are three speed settings for the <acronym>VNC</acronym> protocol:
</para>
<itemizedlist>
<listitem><para>High Quality (LAN, direct connection), which is the
default, and you should evaluate how well this setting performs before
selecting a lower performance option that uses less bandwidth.
</para></listitem>
<listitem><para>Medium Quality (DSL, Cable, fast
Internet).</para></listitem>
<listitem><para>Low Quality (Modem, ISDN, slow
Internet).</para></listitem>
</itemizedlist>
<para>
If you always operate over the same link type, you can deselect the
checkbox labeled <guilabel>Show this dialog again for this
host</guilabel>, which means that you won't be asked about the
connection type again for this host, providing you identify it in the
same way. For example, if a host has two names, and deselect the
checkbox when connecting using one name, you won't get asked if you
connect using that name, although you will be asked if you use the
other name, or the IP address.
</para>
<para>
You select the appropriate speed setting, and select the
<guibutton>OK</guibutton> to proceed.
</para>
<para>
You can see the connection status in the icon in the tab.
</para>
<para>
Depending on the configuration of the server, you may (and almost
certainly will) need to provide a password to authenticate to the
server. &krdc; will provide a password dialog similar to that shown
below.
</para>
<para>
&krdc; has the ability to save the password for further connections
to the same host. It uses KWallet for doing this. You need to check the
<guibutton>Remember password (KWallet)</guibutton> check box if you like
to use this feature.
</para>
<para>
<screenshot>
<screeninfo>&krdc; password entry</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="password_entry.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; password entry</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
After authentication, you will be connected to the remote server, and
can begin using &krdc; to observe or control the remote desktop.
</para>
</sect1>
<sect1 id="controlling-remote"><title>Controlling the remote desktop connection</title>
<para>
Having connected to the remote server, you would normally use the
keyboard and mouse to control the windowing system and applications on
that remote machine.
</para>
<para>
You can view the remote desktop either as a full screen, or as a
window on the local desktop. You can change between these modes using
icons shown below.
</para>
<para>
<screenshot>
<screeninfo>&krdc; full screen mode selection</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="view-fullscreen.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; full screen mode selection</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>&krdc; window mode selection</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="view-restore.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; window mode selection</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
Full screen mode is normally better when you are helping a remote
user, because you can see all of what they can see. Window mode is
most useful when you are working both remotely and locally - perhaps
referring to some local documentation and then using those
instructions on the remote machine.
</para>
<sect2><title>Using window mode</title>
<para>
In window mode, you can terminate the connection by closing the window, by clicking
on the logout button.
</para>
</sect2>
<sect2><title>Using full screen mode</title>
<para>
In full screen mode, you can change the appearance of the toolbar.
The transparency of the toolbar can be changed with scrollwheel.
</para>
</sect2>
</sect1>
<sect1 id="bookmarks"><title>Bookmarks</title>
<para>
&krdc; has the ability to manage bookmarks. If you need to connect often to
the same remote desktop, you can add an entry for this connection to the
bookmark list. You can do so with a click on <menuchoice><guimenu>Bookmarks</guimenu>
<guimenuitem>Add Bookmark</guimenuitem></menuchoice>.
</para>
<para>
<screenshot>
<screeninfo>&krdc; bookmarks menu</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="bookmarks_menu.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; bookmarks menu</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<sect2><title>History Bookmarks</title>
<para>
&krdc; saves last used remote desktop connections. You can access these special
bookmarks at <menuchoice><guimenu>Bookmarks</guimenu><guimenuitem>History</guimenuitem></menuchoice>. Of course you can also
delete a bookmark of this list if you don't need it anymore in the list. Just click
<guibutton>Delete Bookmark</guibutton> which appears after a click with the right mouse button on
the bookmark you would like to delete.
</para>
</sect2>
</sect1>
<sect1 id="managing-configuration"><title>Managing &krdc; configuration</title>
<para>
Using <menuchoice><guimenu>Settings</guimenu><guimenuitem>Configure KRDC...</guimenuitem></menuchoice>,
you can open a dialog to modify the behavior of &krdc;. Selecting that button brings up a
window as shown below:
</para>
<para>
<screenshot>
<screeninfo>&krdc; preferences - General tab</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="general_preferences.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; preferences - <guilabel>General</guilabel> tab</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>&krdc; preferences - <guilabel>VNC Defaults</guilabel> tab</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="vnc_preferences.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; preferences - <guilabel>VNC
Defaults</guilabel> profiles tab</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
<para>
<screenshot>
<screeninfo>&krdc; preferences - <guilabel>RDP Defaults</guilabel> tab</screeninfo>
<mediaobject>
<imageobject>
<imagedata fileref="rdp_preferences.png" format="PNG"/>
</imageobject>
<textobject>
<phrase>&krdc; preferences - <guilabel>RDP
Defaults</guilabel> profiles tab</phrase>
</textobject>
</mediaobject>
</screenshot>
</para>
</sect1>
</chapter>
<chapter id="faq">
<title>Questions and Answers</title>
<!-- (OPTIONAL but recommended) This chapter should include all of the silly
(and not-so-silly) newbie questions that fill up your mailbox. This chapter
should be reserved for BRIEF questions and answers! If one question uses more
than a page or so then it should probably be part of the
"Using this Application" chapter instead. You should use links to
cross-reference questions to the parts of your documentation that answer them.
This is also a great place to provide pointers to other FAQ's if your users
must do some complicated configuration on other programs in order for your
application work. -->
&reporting.bugs;
&updating.documentation;
<qandaset id="faqlist">
<qandaentry>
<question>
<para>Why does <acronym>RDP</acronym> support not work?</para>
</question>
<answer>
<para><acronym>RDP</acronym> support in &krdc; depends on xfreerdp (FreeRDP). Make sure that you have installed
this runtime dependency.
</para>
</answer>
</qandaentry>
</qandaset>
</chapter>
<chapter id="credits">
<!-- Include credits for the programmers, documentation writers, and
contributors here. The license for your software should then be included below
the credits with a reference to the appropriate license file included in the K D E
distribution. -->
<title>Credits and License</title>
<para>
&krdc;
</para>
<para>
The &krdc; project has been started by Tim Jansen <email>tim@tjansen.de</email>.
As a Google Summer of Code 2007 project, Urs Wolfer <email>uwolfer @ kde.org</email>
has completely rewritten &krdc;. Thanks to Google for making this possible, and thanks
to the great mentor of this Summer of Code project, &Brad.Hards; &Brad.Hards.mail;.
</para>
<para>
Documentation Copyright &copy; 2003 &Brad.Hards; &Brad.Hards.mail;
Documentation Copyright &copy; 2007 Urs Wolfer <email>uwolfer @ kde.org</email>
</para>
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
&underFDL; <!-- FDL: do not remove -->
&underGPL; <!-- GPL License -->
</chapter>
<appendix id="installation">
<title>Installation</title>
<sect1 id="getting-krdc">
<title>How to obtain &krdc;</title>
<!-- This first entity contains boiler plate for applications that are
part of K D E CVS. You should remove it if you are releasing your
application -->
&install.intro.documentation;
</sect1>
<sect1 id="compilation">
<title>Compilation and Installation</title>
<!-- This entity contains the boilerplate text for standard -->
<!-- compilation instructions. If your application requires any -->
<!-- special handling, remove it, and replace with your own text. -->
&install.compile.documentation;
</sect1>
</appendix>
&documentation.index;
</book>
<!--
Local Variables:
mode: xml
sgml-minimize-attributes:nil
sgml-general-insert-case:lower
sgml-indent-step:0
sgml-indent-data:nil
End:
vim:tabstop=2:shiftwidth=2:expandtab
-->

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
krdc/doc/password_entry.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

BIN
krdc/doc/view-restore.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 899 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

486
krdc/floatingtoolbar.cpp Normal file
View file

@ -0,0 +1,486 @@
/****************************************************************************
**
** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
** Parts of this file have been take from okular:
** Copyright (C) 2004-2005 Enrico Ros <eros.kde@email.it>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "floatingtoolbar.h"
#include <KDebug>
#include <KGlobalSettings>
#include <QApplication>
#include <QBitmap>
#include <QDesktopWidget>
#include <QMouseEvent>
#include <QPainter>
#include <QTimer>
static const int actionIconSize = 22;
static const int toolBarRBMargin = 2;
static const double toolBarOpacity = 0.8;
static const int visiblePixelWhenAutoHidden = 6;
static const int autoHideTimeout = 500;
static const int initialAutoHideTimeout = 2000;
/**
* Denotes the verious states of the animation.
*/
enum AnimState {
Hiding,
Showing,
Still
};
class FloatingToolBarPrivate
{
public:
FloatingToolBarPrivate(FloatingToolBar *qq)
: q(qq)
, anchorSide(FloatingToolBar::Left)
, offsetPlaceHolder(new QWidget(qq))
, animState(Still)
, toDelete(false)
, visible(false)
, sticky(false)
, opacity(toolBarOpacity)
// set queuedShow to true so we show the toolbar if we get a resize event on the anchorWidget
, queuedShow(true) {
}
// rebuild contents and reposition then widget
void buildToolBar();
void reposition();
// compute the visible and hidden positions along current side
QPoint getInnerPoint() const;
QPoint getOuterPoint() const;
FloatingToolBar *q;
QWidget *anchorWidget;
FloatingToolBar::Side anchorSide;
QWidget *offsetPlaceHolder;
QTimer *animTimer;
QTimer *autoHideTimer;
QPoint currentPosition;
QPoint endPosition;
AnimState animState;
bool toDelete;
bool visible;
bool sticky;
qreal opacity;
bool queuedShow;
QPixmap backgroundPixmap;
};
FloatingToolBar::FloatingToolBar(QWidget *parent, QWidget *anchorWidget)
: QToolBar(parent), d(new FloatingToolBarPrivate(this))
{
;
addWidget(d->offsetPlaceHolder);
setMouseTracking(true);
setIconSize(QSize(actionIconSize, actionIconSize));
d->anchorWidget = anchorWidget;
d->animTimer = new QTimer(this);
connect(d->animTimer, SIGNAL(timeout()), this, SLOT(animate()));
d->autoHideTimer = new QTimer(this);
connect(d->autoHideTimer, SIGNAL(timeout()), this, SLOT(hide()));
// apply a filter to get notified when anchor changes geometry
d->anchorWidget->installEventFilter(this);
}
FloatingToolBar::~FloatingToolBar()
{
delete d;
}
void FloatingToolBar::addAction(QAction *action)
{
QToolBar::addAction(action);
// rebuild toolbar shape and contents only if the toolbar is already visible,
// otherwise it will be done in showAndAnimate()
if (isVisible())
d->reposition();
}
void FloatingToolBar::setSide(Side side)
{
d->anchorSide = side;
if (isVisible())
d->reposition();
}
void FloatingToolBar::setSticky(bool sticky)
{
d->sticky = sticky;
if (sticky)
d->autoHideTimer->stop();
}
void FloatingToolBar::showAndAnimate()
{
if (d->animState == Showing)
return;
d->animState = Showing;
show();
// force update for case when toolbar has not been built yet
d->reposition();
// start scrolling in
d->animTimer->start(20);
// This permits to show the toolbar for a while when going full screen.
if (!d->sticky)
d->autoHideTimer->start(initialAutoHideTimeout);
}
void FloatingToolBar::hideAndDestroy()
{
if (d->animState == Hiding)
return;
// set parameters for sliding out
d->animState = Hiding;
d->toDelete = true;
d->endPosition = d->getOuterPoint();
// start scrolling out
d->animTimer->start(20);
}
void FloatingToolBar::hide()
{
if (underMouse())
return;
if (d->visible) {
QPoint diff;
switch (d->anchorSide) {
case Left:
diff = QPoint(visiblePixelWhenAutoHidden, 0);
break;
case Right:
diff = QPoint(-visiblePixelWhenAutoHidden, 0);
break;
case Top:
diff = QPoint(0, visiblePixelWhenAutoHidden);
break;
case Bottom:
diff = QPoint(0, -visiblePixelWhenAutoHidden);
break;
}
d->animState = Hiding;
d->endPosition = d->getOuterPoint() + diff;
// start scrolling out
d->animTimer->start(20);
}
}
bool FloatingToolBar::eventFilter(QObject *obj, QEvent *e)
{
if (obj == d->anchorWidget && e->type() == QEvent::Resize) {
if (d->queuedShow) { // if the toolbar is not visible yet, try to show it if the anchor widget is in fullscreen already
d->queuedShow = false;
showAndAnimate();
return true;
}
// if anchorWidget changed geometry reposition toolbar
d->animTimer->stop();
if ((d->animState == Hiding || !d->visible) && d->toDelete)
deleteLater();
else
d->reposition();
}
return QToolBar::eventFilter(obj, e);
}
void FloatingToolBar::paintEvent(QPaintEvent *e)
{
QToolBar::paintEvent(e);
// paint the internal pixmap over the widget
QPainter p(this);
p.setOpacity(d->opacity);
p.drawImage(e->rect().topLeft(), d->backgroundPixmap.toImage(), e->rect());
}
void FloatingToolBar::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton)
setCursor(Qt::SizeAllCursor);
QToolBar::mousePressEvent(e);
}
void FloatingToolBar::mouseMoveEvent(QMouseEvent *e)
{
// show the toolbar again when it is auto-hidden
if (!d->visible) {
showAndAnimate();
return;
}
if ((QApplication::mouseButtons() & Qt::LeftButton) != Qt::LeftButton)
return;
// compute the nearest side to attach the widget to
const QPoint parentPos = mapToParent(e->pos());
const float nX = (float)parentPos.x() / (float)d->anchorWidget->width();
const float nY = (float)parentPos.y() / (float)d->anchorWidget->height();
if (nX > 0.3 && nX < 0.7 && nY > 0.3 && nY < 0.7)
return;
bool LT = nX < (1.0 - nY);
bool LB = nX < (nY);
Side side = LT ? (LB ? Left : Top) : (LB ? Bottom : Right);
// check if side changed
if (side == d->anchorSide)
return;
d->anchorSide = side;
d->reposition();
emit orientationChanged((int)side);
QToolBar::mouseMoveEvent(e);
}
void FloatingToolBar::enterEvent(QEvent *e)
{
// Stop the autohide timer while the mouse is inside
d->autoHideTimer->stop();
if (!d->visible)
showAndAnimate();
QToolBar::enterEvent(e);
}
void FloatingToolBar::leaveEvent(QEvent *e)
{
if (!d->sticky)
d->autoHideTimer->start(autoHideTimeout);
QToolBar::leaveEvent(e);
}
void FloatingToolBar::mouseReleaseEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton)
setCursor(Qt::ArrowCursor);
QToolBar::mouseReleaseEvent(e);
}
void FloatingToolBar::wheelEvent(QWheelEvent *e)
{
e->accept();
const qreal diff = e->delta() / 100.0 / 15.0;
// kDebug(5010) << diff;
if (((d->opacity <= 1) && (diff > 0)) || ((d->opacity >= 0) && (diff < 0)))
d->opacity += diff;
update();
QToolBar::wheelEvent(e);
}
void FloatingToolBarPrivate::buildToolBar()
{
const bool prevUpdates = q->updatesEnabled();
q->setUpdatesEnabled(false);
// 1. init numbers we are going to use
const bool topLeft = anchorSide == FloatingToolBar::Left || anchorSide == FloatingToolBar::Top;
const bool vertical = anchorSide == FloatingToolBar::Left || anchorSide == FloatingToolBar::Right;
if (vertical) {
offsetPlaceHolder->setFixedSize(1, 7);
q->setOrientation(Qt::Vertical);
} else {
offsetPlaceHolder->setFixedSize(7, 1);
q->setOrientation(Qt::Horizontal);
}
// 2. compute widget size
const int myWidth = q->sizeHint().width() - 1;
const int myHeight = q->sizeHint().height() - 1;
// 3. resize pixmap, mask and widget
QBitmap mask(myWidth + 1, myHeight + 1);
backgroundPixmap = QPixmap(myWidth + 1, myHeight + 1);
backgroundPixmap.fill(Qt::transparent);
q->resize(myWidth + 1, myHeight + 1);
// 4. create and set transparency mask
QPainter maskPainter(&mask);
mask.fill(Qt::white);
maskPainter.setBrush(Qt::black);
if (vertical)
maskPainter.drawRoundRect(topLeft ? -10 : 0, 0, myWidth + 10, myHeight, 2000 / (myWidth + 10), 2000 / myHeight);
else
maskPainter.drawRoundRect(0, topLeft ? -10 : 0, myWidth, myHeight + 10, 2000 / myWidth, 2000 / (myHeight + 10));
maskPainter.end();
q->setMask(mask);
// 5. draw background
QPainter bufferPainter(&backgroundPixmap);
bufferPainter.translate(0.5, 0.5);
QPalette pal = q->palette();
// 5.1. draw horizontal/vertical gradient
QLinearGradient grad;
switch (anchorSide) {
case FloatingToolBar::Left:
grad = QLinearGradient(0, 1, myWidth + 1, 1);
break;
case FloatingToolBar::Right:
grad = QLinearGradient(myWidth + 1, 1, 0, 1);
break;
case FloatingToolBar::Top:
grad = QLinearGradient(1, 0, 1, myHeight + 1);
break;
case FloatingToolBar::Bottom:
grad = QLinearGradient(1, myHeight + 1, 0, 1);
break;
}
grad.setColorAt(0, pal.color(QPalette::Active, QPalette::Button));
grad.setColorAt(1, pal.color(QPalette::Active, QPalette::Light));
bufferPainter.setBrush(QBrush(grad));
// 5.2. draw rounded border
bufferPainter.setPen( pal.color(QPalette::Active, QPalette::Dark).lighter(40));
bufferPainter.setRenderHints(QPainter::Antialiasing);
if (vertical)
bufferPainter.drawRoundRect(topLeft ? -10 : 0, 0, myWidth + 10, myHeight, 2000 / (myWidth + 10), 2000 / myHeight);
else
bufferPainter.drawRoundRect(0, topLeft ? -10 : 0, myWidth, myHeight + 10, 2000 / myWidth, 2000 / (myHeight + 10));
// 5.3. draw handle
bufferPainter.translate(-0.5, -0.5);
bufferPainter.setPen(pal.color(QPalette::Active, QPalette::Mid));
if (vertical) {
int dx = anchorSide == FloatingToolBar::Left ? 2 : 4;
bufferPainter.drawLine(dx, 6, dx + myWidth - 8, 6);
bufferPainter.drawLine(dx, 9, dx + myWidth - 8, 9);
bufferPainter.setPen(pal.color(QPalette::Active, QPalette::Light));
bufferPainter.drawLine(dx + 1, 7, dx + myWidth - 7, 7);
bufferPainter.drawLine(dx + 1, 10, dx + myWidth - 7, 10);
} else {
int dy = anchorSide == FloatingToolBar::Top ? 2 : 4;
bufferPainter.drawLine(6, dy, 6, dy + myHeight - 8);
bufferPainter.drawLine(9, dy, 9, dy + myHeight - 8);
bufferPainter.setPen(pal.color(QPalette::Active, QPalette::Light));
bufferPainter.drawLine(7, dy + 1, 7, dy + myHeight - 7);
bufferPainter.drawLine(10, dy + 1, 10, dy + myHeight - 7);
}
q->setUpdatesEnabled(prevUpdates);
}
void FloatingToolBarPrivate::reposition()
{
// note: hiding widget here will gives better gfx, but ends drag operation
// rebuild widget and move it to its final place
buildToolBar();
if (!visible) {
currentPosition = getOuterPoint();
endPosition = getInnerPoint();
} else {
currentPosition = getInnerPoint();
endPosition = getOuterPoint();
}
q->move(currentPosition);
}
QPoint FloatingToolBarPrivate::getInnerPoint() const
{
// returns the final position of the widget
if (anchorSide == FloatingToolBar::Left)
return QPoint(0, (anchorWidget->height() - q->height()) / 2);
if (anchorSide == FloatingToolBar::Top)
return QPoint((anchorWidget->width() - q->width()) / 2, 0);
if (anchorSide == FloatingToolBar::Right)
return QPoint(anchorWidget->width() - q->width() + toolBarRBMargin, (anchorWidget->height() - q->height()) / 2);
return QPoint((anchorWidget->width() - q->width()) / 2, anchorWidget->height() - q->height() + toolBarRBMargin);
}
QPoint FloatingToolBarPrivate::getOuterPoint() const
{
// returns the point from which the transition starts
if (anchorSide == FloatingToolBar::Left)
return QPoint(-q->width(), (anchorWidget->height() - q->height()) / 2);
if (anchorSide == FloatingToolBar::Top)
return QPoint((anchorWidget->width() - q->width()) / 2, -q->height());
if (anchorSide == FloatingToolBar::Right)
return QPoint(anchorWidget->width() + toolBarRBMargin, (anchorWidget->height() - q->height()) / 2);
return QPoint((anchorWidget->width() - q->width()) / 2, anchorWidget->height() + toolBarRBMargin);
}
void FloatingToolBar::animate()
{
if (KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects) {
// move currentPosition towards endPosition
int dX = d->endPosition.x() - d->currentPosition.x();
int dY = d->endPosition.y() - d->currentPosition.y();
dX = dX / 6 + qMax(-1, qMin(1, dX));
dY = dY / 6 + qMax(-1, qMin(1, dY));
d->currentPosition.setX(d->currentPosition.x() + dX);
d->currentPosition.setY(d->currentPosition.y() + dY);
} else {
d->currentPosition = d->endPosition;
}
move(d->currentPosition);
// handle arrival to the end
if (d->currentPosition == d->endPosition) {
d->animTimer->stop();
switch (d->animState) {
case Hiding:
d->visible = false;
d->animState = Still;
if (d->toDelete)
deleteLater();
break;
case Showing:
d->visible = true;
d->animState = Still;
break;
default:
kDebug(5010) << "Illegal state";
}
}
}
#include "floatingtoolbar.moc"

77
krdc/floatingtoolbar.h Normal file
View file

@ -0,0 +1,77 @@
/****************************************************************************
**
** Copyright (C) 2007-2008 Urs Wolfer <uwolfer @ kde.org>
** Parts of this file have been take from okular:
** Copyright (C) 2004-2005 Enrico Ros <eros.kde@email.it>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef FLOATINGTOOLBAR_H
#define FLOATINGTOOLBAR_H
#include <QToolBar>
/**
* @short A toolbar widget that slides in from a side.
*
* This is a shaped widget that slides in from a side of the 'anchor widget'
* it's attached to. It can be dragged and docked on {left,top,right,bottom}
* sides and contains actions.
*/
class FloatingToolBar : public QToolBar
{
Q_OBJECT
public:
FloatingToolBar(QWidget *parent, QWidget *anchorWidget);
~FloatingToolBar();
Q_ENUMS(Side)
enum Side { Left = 0, Top = 1, Right = 2, Bottom = 3 };
void addAction(QAction *action);
void setSide(Side side);
Q_SIGNALS:
void orientationChanged(int side);
public Q_SLOTS:
void setSticky(bool sticky);
void showAndAnimate();
void hideAndDestroy();
protected:
bool eventFilter(QObject *o, QEvent *e);
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *e);
void mouseMoveEvent(QMouseEvent *e);
void enterEvent(QEvent *e);
void leaveEvent(QEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void wheelEvent(QWheelEvent *e);
private:
class FloatingToolBarPrivate *d;
private Q_SLOTS:
void animate();
void hide();
};
#endif

View file

@ -0,0 +1,20 @@
set(BUILD_KONSOLE true)
if(BUILD_KONSOLE)
set(konsoleplugin_SRCS
konsoleviewfactory.cpp
konsoleview.cpp
)
kde4_add_plugin(krdc_konsoleplugin ${konsoleplugin_SRCS})
target_link_libraries(krdc_konsoleplugin
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KPARTS_LIBS}
krdccore
)
install(TARGETS krdc_konsoleplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES krdc_konsole.desktop DESTINATION ${SERVICES_INSTALL_DIR})
endif(BUILD_KONSOLE)

View file

@ -0,0 +1,128 @@
/****************************************************************************
**
** Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "konsoleview.h"
#include <KParts/Part>
#include <KPluginFactory>
#include <KPluginLoader>
#include <KService>
#include <kde_terminal_interface.h>
#include <QDir>
#include <QEvent>
#include <QScrollArea>
#include <QVBoxLayout>
KonsoleView::KonsoleView(QWidget *parent, const KUrl &url, KConfigGroup configGroup)
: RemoteView(parent)
{
m_url = url;
m_host = url.host();
m_port = url.port();
m_hostPreferences = new KonsoleHostPreferences(configGroup, this);
// QSize size = QSize(640, 480);
const QSize size = (qobject_cast<QWidget *>(parent))->size();
setStatus(Connected);
setFixedSize(size);
setFixedSize(size);
emit framebufferSizeChanged(size.width(), size.height());
KPluginFactory* factory = 0;
KService::Ptr service = KService::serviceByDesktopName("konsolepart");
if (service) {
factory = KPluginLoader(service->library()).factory();
}
KParts::ReadOnlyPart* part = factory ? (factory->create<KParts::ReadOnlyPart>(this)) : 0;
if (part != 0) {
// connect(part, SIGNAL(destroyed(QObject*)), this, SLOT(terminalExited()));
QVBoxLayout *mainLayout = new QVBoxLayout(this);
mainLayout->setMargin(0);
mainLayout->setSpacing(0);
m_terminalWidget = part->widget();
mainLayout->addWidget(m_terminalWidget);
m_terminal = qobject_cast<TerminalInterface *>(part);
m_terminal->showShellInDir(QDir::homePath());
m_terminal->sendInput("echo " + url.user() + '@' + url.host()/* + ':' + url.port()*/ + '\n');
// m_terminal->sendInput("clear\n");
m_terminalWidget->resize(size);
}
}
KonsoleView::~KonsoleView()
{
emit disconnected();
setStatus(Disconnected);
}
bool KonsoleView::eventFilter(QObject *obj, QEvent *event)
{
if (m_viewOnly) {
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::KeyRelease ||
event->type() == QEvent::MouseButtonDblClick ||
event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::MouseButtonRelease ||
event->type() == QEvent::MouseMove)
return true;
}
return RemoteView::eventFilter(obj, event);
}
QSize KonsoleView::framebufferSize()
{
return minimumSizeHint();
}
QSize KonsoleView::sizeHint() const
{
return RemoteView::sizeHint();
return maximumSize();
}
bool KonsoleView::isQuitting()
{
return false;
}
bool KonsoleView::start()
{
setStatus(Connected);
emit connected();
m_terminalWidget->setFocus();
return true;
}
HostPreferences* KonsoleView::hostPreferences()
{
return m_hostPreferences;
}
void KonsoleView::switchFullscreen(bool on)
{
Q_UNUSED(on);
}
#include "konsoleview.moc"

View file

@ -0,0 +1,77 @@
/****************************************************************************
**
** Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef KONSOLEVIEW_H
#define KONSOLEVIEW_H
#include "konsoleview.h"
#include "remoteview.h"
#include "hostpreferences.h"
#include <KConfigGroup>
class KonsoleHostPreferences;
class TerminalInterface;
class KonsoleView : public RemoteView
{
Q_OBJECT
public:
explicit KonsoleView(QWidget *parent = 0, const KUrl &url = KUrl(), KConfigGroup configGroup = KConfigGroup());
virtual ~KonsoleView();
virtual QSize framebufferSize();
QSize sizeHint() const;
virtual bool isQuitting();
virtual bool start();
HostPreferences* hostPreferences();
public slots:
virtual void switchFullscreen(bool on);
protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
KonsoleHostPreferences *m_hostPreferences;
TerminalInterface* m_terminal;
QWidget *m_terminalWidget;
};
class KonsoleHostPreferences : public HostPreferences
{
Q_OBJECT
public:
explicit KonsoleHostPreferences(KConfigGroup configGroup, QObject *parent = 0)
: HostPreferences(configGroup, parent) {}
protected:
virtual QWidget* createProtocolSpecificConfigPage() { return 0; };
};
#endif // KONSOLEVIEW_H

View file

@ -0,0 +1,82 @@
/****************************************************************************
**
** Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "konsoleviewfactory.h"
#include <KDebug>
#include <KLocale>
KRDC_PLUGIN_EXPORT(KonsoleViewFactory)
KonsoleViewFactory::KonsoleViewFactory(QObject *parent, const QVariantList &args)
: RemoteViewFactory(parent)
{
Q_UNUSED(args);
KGlobal::locale()->insertCatalog("krdc");
}
KonsoleViewFactory::~KonsoleViewFactory()
{
}
bool KonsoleViewFactory::supportsUrl(const KUrl &url) const
{
return (url.scheme().compare("konsole", Qt::CaseInsensitive) == 0);
}
RemoteView *KonsoleViewFactory::createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup)
{
return new KonsoleView(parent, url, configGroup);
}
HostPreferences *KonsoleViewFactory::createHostPreferences(KConfigGroup configGroup, QWidget *parent)
{
Q_UNUSED(configGroup);
Q_UNUSED(parent);
return 0;
}
QString KonsoleViewFactory::scheme() const
{
return "konsole";
}
QString KonsoleViewFactory::connectActionText() const
{
return i18n("New Konsole Connection..."); //FIXME
}
QString KonsoleViewFactory::connectButtonText() const
{
return i18n("KRDC Konsole Connection");
}
QString KonsoleViewFactory::connectToolTipText() const
{
return i18n("<html>Enter the address here. Port is optional.<br />"
"<i>Example: konsoleserver (host)</i></html>");
}
#include "moc_konsoleviewfactory.cpp"

View file

@ -0,0 +1,55 @@
/****************************************************************************
**
** Copyright (C) 2009 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef KONSOLEVIEWFACTORY_H
#define KONSOLEVIEWFACTORY_H
#include "remoteviewfactory.h"
#include "konsoleview.h"
class KonsoleViewFactory : public RemoteViewFactory
{
Q_OBJECT
public:
explicit KonsoleViewFactory(QObject *parent, const QVariantList &args);
virtual ~KonsoleViewFactory();
virtual bool supportsUrl(const KUrl &url) const;
virtual RemoteView *createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup);
virtual HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent);
virtual QString scheme() const;
virtual QString connectActionText() const;
virtual QString connectButtonText() const;
virtual QString connectToolTipText() const;
};
#endif // KONSOLEVIEWFACTORY_H

View file

@ -0,0 +1,126 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KRDC/Plugin
Icon=krdc
Name=Konsole
Name[ast]=Konsole
Name[bg]=Konsole
Name[bs]=Konzola
Name[ca]=Konsole
Name[ca@valencia]=Konsole
Name[cs]=Konsole
Name[da]=Konsole
Name[de]=Konsole
Name[el]=Konsole
Name[en_GB]=Konsole
Name[eo]=Konsole
Name[es]=Konsole
Name[et]=Konsool
Name[eu]=Konsole
Name[fi]=Konsoli
Name[fr]=Konsole
Name[ga]=Konsole
Name[gl]=Konsole
Name[hr]=Konsole
Name[hsb]=Konsola
Name[hu]=Konsole
Name[ia]=Konsole
Name[is]=Konsole
Name[it]=Konsole
Name[ja]=Konsole
Name[kk]=Konsole
Name[km]=
Name[ko]=Konsole
Name[lt]=Konsole
Name[lv]=Konsole
Name[mai]=
Name[mr]=
Name[nb]=Konsole
Name[nds]=Konsole
Name[nl]=Konsole
Name[nn]=Konsoll
Name[pa]=
Name[pl]=Konsola
Name[pt]=Konsole
Name[pt_BR]=Konsole
Name[ro]=Konsolă
Name[ru]=Konsole
Name[si]=Konsole
Name[sk]=Konsole
Name[sl]=Konsole
Name[sr]=Конзола
Name[sr@ijekavian]=Конзола
Name[sr@ijekavianlatin]=Konsole
Name[sr@latin]=Konsole
Name[sv]=Terminal
Name[th]=-K
Name[tr]=Konsole
Name[ug]=Konsole
Name[uk]=Konsole
Name[x-test]=xxKonsolexx
Name[zh_CN]=Konsole
Name[zh_TW]=_Konsole
Comment=Allows managing SSH or Telnet sessions through KRDC
Comment[ast]=Permite la xestión de sesiones SSH o Telnet per KRDC
Comment[bg]=Управление на сесии на SSH и Telnet през KRDC
Comment[bs]=Dopušta uređivanje SSH ili Telnet sesija kroz KRDC
Comment[ca]=Permet gestionar sessions SSH o Telnet mitjançant el KRDC
Comment[ca@valencia]=Permet gestionar sessions SSH o Telnet mitjançant el KRDC
Comment[cs]=Umožňuje spravovat sezení SSH nebo Telnet pomocí KRDC
Comment[da]=Muliggør håndtering af SSH- eller Telnet-sessioner via KRDC
Comment[de]=Erlaubt die Verwaltung von SSH- und Telnet-Sitzungen über KRDC
Comment[el]=Επιτρέπει τη διαχείριση συνεδριών SSH ή Telnet μέσω του KRDC
Comment[en_GB]=Allows managing SSH or Telnet sessions through KRDC
Comment[es]=Permite la gestión de sesiones SSH o Telnet mediante KRDC
Comment[et]=SSH- või Telneti seansside haldamise võimaldamine KRDC kaudu
Comment[eu]=SSH edo Telnet saioak KRDC bidez kudeatzea baimentzen du
Comment[fi]=Mahdollistaa SSH- ja Telnet-istuntojen hallinnan KRDC:llä
Comment[fr]=Permet de gérer des sessions « SSH » ou « Telnet » au travers de KRDC
Comment[ga]=Ceadaíonn sé duit seisiúin SSH nó Telnet a bhainistiú trí KRDC
Comment[gl]=Permite a xestión de sesións SSH ou Telnet por medio de KRCC
Comment[hr]=Omogućuje upravljanje sjednicama SSH-a i Telneta kroz KRDC
Comment[hu]=SSH vagy telnet használata a KRDC-n keresztül
Comment[ia]=Permitte gerer sessiones SSH o Telnet per medio de KRDC
Comment[is]=Gefur kost á að stjórna SSH eða Telnet setum með KRDC
Comment[it]=Permette la gestione di sessioni SSH o Telnet con KRDC
Comment[ja]=KRDC SSH Telnet
Comment[kk]=KRDC арқылы SSH не Telnet сеанстарын басқаруға мүмкіндік беру
Comment[km]= SSH Telnet KRDC
Comment[ko]=KRDC SSH
Comment[lt]=Leisti valdyti SSH ar Telnet sesijas per KRDC
Comment[lv]=Ļauj pārvaldīt SSH un Telnet sesijas caur KRDC
Comment[nb]=Tillater å styre SSH eller Telnet-økter gjennom KRDC
Comment[nds]=SSH- oder Telnet-Törns över KRDC plegen
Comment[nl]=Staat het beheer van ssh- of telnet-sessies toe via KRDC
Comment[nn]=Lèt deg handtera SSH- eller Telnet-økter gjennom KRDC
Comment[pa]=KRDC SSH (Telnet)
Comment[pl]=Pozwala zarządzać sesjami SSH lub Telnet za pomocą KRDC
Comment[pt]=Permite a gestão de sessões SSH ou Telnet através do KRDC
Comment[pt_BR]=Permite o gerenciamento de sessões SSH ou Telnet através do KRDC
Comment[ro]=Permite gestiunea sesiunilor SSH sau Telnet prin KRDC
Comment[ru]=Разрешить управление сеансами SSH или Telnet через KRDC
Comment[si]=KRDC Telnet SSH
Comment[sk]=Umožňuje spravovanie SSH alebo Telnet sedení pomocou KRDC
Comment[sl]=Omogoča upravljanje sej SSH ali Telnet prek KRDC
Comment[sr]=Управљање ССХ и ТЕЛНЕТ везама кроз КРДЦ
Comment[sr@ijekavian]=Управљање ССХ и ТЕЛНЕТ везама кроз КРДЦ
Comment[sr@ijekavianlatin]=Upravljanje SSH i TELNET vezama kroz KRDC
Comment[sr@latin]=Upravljanje SSH i TELNET vezama kroz KRDC
Comment[sv]=Tillåter hantering av SSH- eller Telnet-sessioner via KRDC
Comment[th]= SSH Telnet KRDC
Comment[tr]=KRDC üzerinden SSH ve Telnet oturumlarını yönetmenizi sağlar
Comment[uk]=Надає змогу керувати сеансами SSH або Telnet за допомогою KRDC
Comment[x-test]=xxAllows managing SSH or Telnet sessions through KRDCxx
Comment[zh_CN]= KRDC SSH Telnet
Comment[zh_TW]= KRDC SSH Telnet
X-KDE-PluginInfo-Author=Urs Wolfer
X-KDE-PluginInfo-Email=uwolfer@kde.org
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Category=Service
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=krdc_konsoleplugin
X-KDE-PluginInfo-Name=krdc_konsoleplugin
X-KDE-KRDC-Sorting=70

126
krdc/krdc.desktop Executable file
View file

@ -0,0 +1,126 @@
# KDE Config File
[Desktop Entry]
Type=Application
Exec=krdc -caption %c %u
Icon=krdc
Terminal=false
Name=KRDC
Name[ar]=KRDC
Name[ast]=KRDC
Name[bg]=KRDC
Name[bs]=KRDC
Name[ca]=KRDC
Name[ca@valencia]=KRDC
Name[cs]=KRDC
Name[da]=KRDC
Name[de]=KRDC
Name[el]=KRDC
Name[en_GB]=KRDC
Name[eo]=KRDC
Name[es]=KRDC
Name[et]=KRDC
Name[eu]=KRDC
Name[fi]=KRDC
Name[fr]=KRDC
Name[ga]=KRDC
Name[gl]=KRDC
Name[hne]=
Name[hr]=KRDC
Name[hu]=KRDC
Name[ia]=KRDC
Name[is]=KRDC
Name[it]=KRDC
Name[ja]=KRDC
Name[kk]=KRDC
Name[km]=KRDC
Name[ko]=KRDC
Name[lt]=KDE nutolusio darbastalio klientas
Name[lv]=KRDC
Name[ml]=ിി
Name[mr]=---
Name[nb]=KRDC
Name[nds]=KRDC
Name[nl]=KRDC
Name[nn]=KRDC
Name[pa]=KRDC
Name[pl]=KRDC
Name[pt]=KRDC
Name[pt_BR]=KRDC
Name[ro]=KRDC
Name[ru]=KRDC
Name[si]=KRDC
Name[sk]=KRDC
Name[sl]=KRDC
Name[sq]=KRDC
Name[sr]=КРДЦ
Name[sr@ijekavian]=КРДЦ
Name[sr@ijekavianlatin]=KRDC
Name[sr@latin]=KRDC
Name[sv]=KRDC
Name[tr]=KRDC
Name[ug]=KRDC
Name[uk]=KRDC
Name[wa]=KRDC
Name[x-test]=xxKRDCxx
Name[zh_CN]=KRDC
Name[zh_TW]=_KRDC
GenericName=Remote Desktop Client
GenericName[ar]=عميل سطح المكتب البعيد
GenericName[ast]=Veceru d'escritoriu remotu
GenericName[bg]=Отдалечен работен плот
GenericName[bs]=Klijent udaljene radne površine
GenericName[ca]=Client d'escriptori remot
GenericName[ca@valencia]=Client d'escriptori remot
GenericName[cs]=Klient vzdálené pracovní plochy
GenericName[da]=Klient til fjernskrivebord
GenericName[de]=Verbindung zu entferntem Rechner
GenericName[el]=Πελάτης απομακρυσμένης επιφάνειας εργασίας
GenericName[en_GB]=Remote Desktop Client
GenericName[es]=Cliente de escritorio remoto
GenericName[et]=Kaugtöölaua klient
GenericName[eu]=Urruneko mahaigainaren bezeroa
GenericName[fi]=Etätyöpöytäasiakas
GenericName[fr]=Connexion à un bureau distant
GenericName[ga]=Cliant Deisce Cianda
GenericName[gl]=Cliente de conexión remota ao escritorio
GenericName[hne]=ि
GenericName[hr]=Klijent za udaljeno povezivanje
GenericName[hu]=Távoli asztal
GenericName[ia]=Cliente de scriptorio remote
GenericName[is]=Tengingar við fjarlæg skjáborð
GenericName[it]=Client per connessione a desktop remoto
GenericName[ja]=
GenericName[kk]=Қашықтан үстелге қосылу клиенті
GenericName[km]=
GenericName[ko]=
GenericName[lt]=Nutolusio darbastalio klientas
GenericName[lv]=Attālinātās darbvirsmas klients
GenericName[ml]=ി ിി
GenericName[mr]=
GenericName[nb]=Tilkobling til annet skrivebord
GenericName[nds]=Schriefdisch-Feernverbinnen
GenericName[nl]=Client voor verbinding met extern bureaublad
GenericName[nn]=Skrivebordssamband over nettverket
GenericName[pa]=ਿ
GenericName[pl]=Klient zdalnego dostępu do pulpitu
GenericName[pt]=Cliente de Ecrãs Remotos
GenericName[pt_BR]=Cliente de área de trabalho remota
GenericName[ro]=Client pentru birou la distanță
GenericName[ru]=Удалённый доступ к рабочему столу
GenericName[si]=
GenericName[sk]=Klient vzdialenej pracovnej plochy
GenericName[sl]=Odjemalec za oddaljena namizja
GenericName[sr]=Клијент удаљене површи
GenericName[sr@ijekavian]=Клијент удаљене површи
GenericName[sr@ijekavianlatin]=Klijent udaljene površi
GenericName[sr@latin]=Klijent udaljene površi
GenericName[sv]=Fjärranslutning till skrivbord
GenericName[th]=
GenericName[tr]=Uzak Masaüstü İstemcisi
GenericName[ug]=يىراقتىكى ئۈستەلئۈستى خېرىدارى
GenericName[uk]=Клієнт з'єднання з віддаленою стільницею
GenericName[x-test]=xxRemote Desktop Clientxx
GenericName[zh_CN]=
GenericName[zh_TW]=
X-DocPath=krdc/index.html
Categories=Qt;KDE;Network;RemoteAccess;

View file

@ -0,0 +1,23 @@
include_directories(${CMAKE_CURRENT_BINARY_DIR})
set (krdc_rfb_approver_SRCS
main.cpp
approvermanager.cpp
approver.cpp
)
kde4_add_executable(krdc_rfb_approver ${krdc_rfb_approver_SRCS})
target_link_libraries(krdc_rfb_approver ${KDE4_KDEUI_LIBS}
${TELEPATHY_QT4_LIBRARIES}
)
install(TARGETS krdc_rfb_approver ${INSTALL_TARGETS_DEFAULT_ARGS})
install(FILES krdc_rfb_approver.notifyrc DESTINATION ${DATA_INSTALL_DIR}/krdc_rfb_approver)
configure_file(org.freedesktop.Telepathy.Client.krdc_rfb_approver.service.in
${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_approver.service)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.freedesktop.Telepathy.Client.krdc_rfb_approver.service
DESTINATION ${DBUS_SERVICES_INSTALL_DIR})
# FIXME any better macro for ${XDG_DATA_DIRS} ?
install(FILES krdc_rfb_approver.client DESTINATION ${SHARE_INSTALL_PREFIX}/telepathy/clients/)

View file

@ -0,0 +1,150 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approver.h"
#include <KDebug>
#include <KNotification>
#include <KLocalizedString>
#include <TelepathyQt/Contact>
#include <TelepathyQt/Connection>
#include <TelepathyQt/ReferencedHandles>
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/ChannelDispatchOperation>
Approver::Approver(const Tp::MethodInvocationContextPtr<> &context,
const QList<Tp::ChannelPtr> &channels,
const Tp::ChannelDispatchOperationPtr &dispatchOperation,
QObject *parent)
: QObject(parent),
m_context(context),
m_channels(channels),
m_dispatchOp(dispatchOperation),
m_notification(0)
{
kDebug() << "Initializing approver";
connect(m_dispatchOp->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onDispatchOperationReady(Tp::PendingOperation*)));
}
void Approver::onDispatchOperationReady(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Dispatch operation failed to become ready"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
emit finished();
return;
}
kDebug() << "DispatchOp ready!";
Tp::ChannelPtr channel = m_dispatchOp->channels()[0];
connect(channel->becomeReady(),
SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onChannelReady(Tp::PendingOperation*)));
}
void Approver::onChannelReady(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Channel failed to become ready"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
emit finished();
return;
}
kDebug() << "Channel ready!";
Tp::ContactPtr contact = m_dispatchOp->channels()[0]->initiatorContact();
KNotification *notification = new KNotification("newrfb", NULL, KNotification::Persistent);
notification->setTitle(i18n("Invitation to view remote desktop"));
notification->setText(i18n("%1 wants to share his/her desktop with you", contact->alias()));
notification->setActions(QStringList() << i18n("Accept") << i18n("Reject"));
Tp::Client::ConnectionInterfaceAvatarsInterface *avatarIface =
m_dispatchOp->channels()[0]->connection()->optionalInterface<Tp::Client::ConnectionInterfaceAvatarsInterface>();
if (avatarIface) {
QDBusPendingReply<QByteArray, QString> reply = avatarIface->RequestAvatar(
contact->handle().takeFirst());
reply.waitForFinished();
if (!reply.isError()) {
QPixmap avatar;
avatar.loadFromData(reply.value());
notification->setPixmap(avatar);
}
}
connect(notification, SIGNAL(action1Activated()), SLOT(onAccepted()));
connect(notification, SIGNAL(action2Activated()), SLOT(onRejected()));
connect(notification, SIGNAL(ignored()), SLOT(onRejected()));
notification->sendEvent();
m_notification = notification;
m_context->setFinished();
}
Approver::~Approver()
{
kDebug() << "Destroying approver";
}
void Approver::onAccepted()
{
kDebug() << "Channel approved";
m_dispatchOp->handleWith(TP_QT_IFACE_CLIENT + ".krdc_rfb_handler");
emit finished();
}
void Approver::onRejected()
{
kDebug() << "Channel rejected";
connect(m_dispatchOp->claim(), SIGNAL(finished(Tp::PendingOperation*)),
SLOT(onClaimFinished(Tp::PendingOperation*)));
}
void Approver::onClaimFinished(Tp::PendingOperation *op)
{
if (op->isError()) {
kError() << "Claim operation failed"
<< op->errorName() << op->errorMessage();
m_context->setFinishedWithError(op->errorName(), op->errorMessage());
}
else {
foreach(const Tp::ChannelPtr &channel, m_channels)
channel->requestClose();
}
emit finished();
}

View file

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef APPROVER_H
#define APPROVER_H
#include <QObject>
#include <TelepathyQt/Channel>
class KNotification;
class Approver : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Approver)
public:
~Approver();
private Q_SLOTS:
void onAccepted();
void onRejected();
void onDispatchOperationReady(Tp::PendingOperation*);
void onChannelReady(Tp::PendingOperation*);
void onClaimFinished(Tp::PendingOperation*);
Q_SIGNALS:
void finished();
private:
Approver(const Tp::MethodInvocationContextPtr<> &context,
const QList<Tp::ChannelPtr> &channels,
const Tp::ChannelDispatchOperationPtr &dispatchOperation,
QObject *parent);
private:
Tp::MethodInvocationContextPtr<> m_context;
QList<Tp::ChannelPtr> m_channels;
Tp::ChannelDispatchOperationPtr m_dispatchOp;
QPointer<KNotification> m_notification;
friend class ApproverManager;
};
#endif

View file

@ -0,0 +1,88 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approvermanager.h"
#include "approver.h"
#include <QDBusObjectPath>
#include <QDBusConnection>
#include <KApplication>
#include <KDebug>
#include <TelepathyQt/Account>
#include <TelepathyQt/ChannelClassSpecList>
#include <TelepathyQt/ChannelDispatchOperation>
#include <TelepathyQt/Connection>
#include <TelepathyQt/PendingOperation>
#include <TelepathyQt/PendingReady>
#include <TelepathyQt/Debug>
static inline Tp::ChannelClassSpecList channelClassSpecList()
{
Tp::ChannelClassSpec spec = Tp::ChannelClassSpec();
spec.setChannelType(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE);
spec.setTargetHandleType(Tp::HandleTypeContact);
spec.setRequested(false);
spec.setProperty(TP_QT_IFACE_CHANNEL_TYPE_STREAM_TUBE + ".Service",
QVariant("rfb"));
return Tp::ChannelClassSpecList() << spec;
}
ApproverManager::ApproverManager(QObject *parent)
: QObject(parent),
AbstractClientApprover(channelClassSpecList())
{
kDebug() << "Initializing approver manager";
}
ApproverManager::~ApproverManager()
{
kDebug() << "Destroying approver manager";
}
void ApproverManager::addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context,
const Tp::ChannelDispatchOperationPtr &dispatchOperation)
{
kDebug() << "New channel for approving arrived";
Approver *approver = new Approver(context, dispatchOperation->channels(), dispatchOperation, this);
connect(approver, SIGNAL(finished()), SLOT(onFinished()));
m_approvers << approver;
}
void ApproverManager::onFinished()
{
kDebug() << "Approver finished";
Approver *approver = qobject_cast<Approver*>(sender());
m_approvers.removeOne(approver);
approver->deleteLater();
if (m_approvers.empty()) {
kDebug() << "Quitting approver manager";
KApplication::kApplication()->quit();
}
}

View file

@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef APPROVERMANAGER_H
#define APPROVERMANAGER_H
#include <TelepathyQt/AbstractClientApprover>
class Approver;
class ApproverManager : public QObject, public Tp::AbstractClientApprover
{
Q_OBJECT
public:
explicit ApproverManager(QObject *parent);
virtual ~ApproverManager();
virtual void addDispatchOperation(const Tp::MethodInvocationContextPtr<> &context,
const Tp::ChannelDispatchOperationPtr &dispatchOperation);
private Q_SLOTS:
void onFinished();
private:
QList<Approver *> m_approvers;
};
#endif

View file

@ -0,0 +1,8 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Approver;
[org.freedesktop.Telepathy.Client.Approver.ApproverChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=false

View file

@ -0,0 +1,173 @@
[Global]
IconName=krdc
Comment=KRDC
Comment[ast]=KRDC
Comment[bg]=KRDC
Comment[bs]=KRDC
Comment[ca]=KRDC
Comment[ca@valencia]=KRDC
Comment[cs]=KRDC
Comment[da]=KRDC
Comment[de]=KRDC
Comment[el]=KRDC
Comment[en_GB]=KRDC
Comment[eo]=KRDC
Comment[es]=KRDC
Comment[et]=KRDC
Comment[eu]=KRDC
Comment[fi]=KRDC
Comment[fr]=KRDC
Comment[ga]=KRDC
Comment[gl]=KRDC
Comment[hr]=KRDC
Comment[hu]=KRDC
Comment[ia]=KRDC
Comment[is]=KRDC
Comment[it]=KRDC
Comment[ja]=KRDC
Comment[kk]=KRDC
Comment[km]=KRDC
Comment[ko]=KRDC
Comment[lt]=KRDC
Comment[lv]=KRDC
Comment[mr]=के-आर-डी-सी
Comment[nb]=KRDC
Comment[nds]=KRDC
Comment[nl]=KRDC
Comment[nn]=KRDC
Comment[pa]=KRDC
Comment[pl]=KRDC
Comment[pt]=KRDC
Comment[pt_BR]=KRDC
Comment[ro]=KRDC
Comment[ru]=KRDC
Comment[si]=KRDC
Comment[sk]=KRDC
Comment[sl]=KRDC
Comment[sr]=КРДЦ
Comment[sr@ijekavian]=КРДЦ
Comment[sr@ijekavianlatin]=KRDC
Comment[sr@latin]=KRDC
Comment[sv]=KRDC
Comment[tr]=KRDC
Comment[ug]=KRDC
Comment[uk]=KRDC
Comment[wa]=KRDC
Comment[x-test]=xxKRDCxx
Comment[zh_CN]=KRDC
Comment[zh_TW]=KRDC 遠端桌面連線遙控
Name=KRDC
Name[ar]=KRDC
Name[ast]=KRDC
Name[bg]=KRDC
Name[bs]=KRDC
Name[ca]=KRDC
Name[ca@valencia]=KRDC
Name[cs]=KRDC
Name[da]=KRDC
Name[de]=KRDC
Name[el]=KRDC
Name[en_GB]=KRDC
Name[eo]=KRDC
Name[es]=KRDC
Name[et]=KRDC
Name[eu]=KRDC
Name[fi]=KRDC
Name[fr]=KRDC
Name[ga]=KRDC
Name[gl]=KRDC
Name[hne]=केआरडीसी
Name[hr]=KRDC
Name[hu]=KRDC
Name[ia]=KRDC
Name[is]=KRDC
Name[it]=KRDC
Name[ja]=KRDC
Name[kk]=KRDC
Name[km]=KRDC
Name[ko]=KRDC
Name[lt]=KDE nutolusio darbastalio klientas
Name[lv]=KRDC
Name[ml]=കെആര്‍ഡിസി
Name[mr]=के-आर-डी-सी
Name[nb]=KRDC
Name[nds]=KRDC
Name[nl]=KRDC
Name[nn]=KRDC
Name[pa]=KRDC
Name[pl]=KRDC
Name[pt]=KRDC
Name[pt_BR]=KRDC
Name[ro]=KRDC
Name[ru]=KRDC
Name[si]=KRDC
Name[sk]=KRDC
Name[sl]=KRDC
Name[sq]=KRDC
Name[sr]=КРДЦ
Name[sr@ijekavian]=КРДЦ
Name[sr@ijekavianlatin]=KRDC
Name[sr@latin]=KRDC
Name[sv]=KRDC
Name[tr]=KRDC
Name[ug]=KRDC
Name[uk]=KRDC
Name[wa]=KRDC
Name[x-test]=xxKRDCxx
Name[zh_CN]=KRDC
Name[zh_TW]=遠端桌面_KRDC
[Event/newrfb]
Name=Incoming RFB Tube
Name[ast]=RFB Tube entrante
Name[bg]=Входяща връзка RFB
Name[bs]=Dolazna RFB cijev
Name[ca]=Tub RFB entrant
Name[ca@valencia]=Tub RFB entrant
Name[cs]=Příchozí kanál RFB
Name[da]=Indkommende RFB-tube
Name[de]=Eingehender RFB-Tunnel
Name[el]=Δίαυλος εισερχόμενου RFB
Name[en_GB]=Incoming RFB Tube
Name[es]=RFB Tube entrante
Name[et]=Sisenev RFB-tube
Name[eu]=Sarrerako RFB hodia
Name[fi]=Saapuva RFB-putki
Name[fr]=Canal entrant « RFB »
Name[ga]=Tiúb RFB Isteach
Name[gl]=Tubo RFB entrante
Name[hr]=Dolazeći RFB Tube
Name[hu]=Bejövő RFB-csatorna
Name[ia]=RFB Tube in arrivata
Name[is]=Innsend RFB-túba
Name[it]=Canale RFB in arrivo
Name[kk]=Кіріс RFB арнасы
Name[km]=RFB Tube ចូល
Name[ko]=들어오는 RFB Tube
Name[lt]=Įeinantis RFB kanalas
Name[lv]=Ienākoša RFB truba
Name[nb]=Innkommende RFB-rør
Name[nds]=Ankamen RFB-Kanaal
Name[nl]=Inkomende RFB-buis
Name[nn]=Innkommande RFB-tube
Name[pa]=ਆ ਰਹੀ RFB ਟਿਊਬ
Name[pl]=Przychodząca RFB Tube
Name[pt]=Ligação de RFB Recebida
Name[pt_BR]=Ligação de RFB recebida
Name[ro]=Tub RFB de intrare
Name[ru]=Входящее подключение RFB
Name[si]=පැමිණෙන RFB නලය
Name[sk]=Prichádzajúci RFB kanál
Name[sl]=Prejet oddaljen slikovni medpomnilnik
Name[sr]=Долазна РФБ цев
Name[sr@ijekavian]=Долазна РФБ цев
Name[sr@ijekavianlatin]=Dolazna RFB cev
Name[sr@latin]=Dolazna RFB cev
Name[sv]=Inkommande RFB-rör
Name[tr]=Gelen RFB Tube
Name[uk]=Вхідний канал RFB
Name[x-test]=xxIncoming RFB Tubexx
Name[zh_CN]=收到的 RFB 点对点请求
Name[zh_TW]=進來的 RFB Tube
Action=Popup
Flags=Persistent

View file

@ -0,0 +1,63 @@
/****************************************************************************
**
** Copyright (C) 2009 Collabora Ltd <info@collabora.co.uk>
** Copyright (C) 2009 Abner Silva <abner.silva@kdemail.net>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "approvermanager.h"
#include <KAboutData>
#include <KCmdLineArgs>
#include <KLocalizedString>
#include <KUniqueApplication>
#include <TelepathyQt/Types>
#include <TelepathyQt/Debug>
#include <TelepathyQt/ClientRegistrar>
int main(int argc, char **argv)
{
KAboutData aboutData("krdc_rfb_approver", "KRDC", ki18n("KRDC"), "0.1",
ki18n("Approver for KRDC"), KAboutData::License_GPL,
ki18n("(C) 2009, Abner Silva"));
aboutData.setProgramIconName("krdc");
aboutData.addAuthor(ki18nc("@info:credit", "Abner Silva"), KLocalizedString(),
"abner.silva@kdemail.net");
KCmdLineArgs::init(argc, argv, &aboutData);
if (!KUniqueApplication::start())
return 0;
KUniqueApplication app;
app.disableSessionManagement();
Tp::registerTypes();
Tp::enableDebug(true);
Tp::enableWarnings(true);
Tp::ClientRegistrarPtr registrar = Tp::ClientRegistrar::create();
Tp::SharedPtr<ApproverManager> approverManager;
approverManager = Tp::SharedPtr<ApproverManager>(new ApproverManager(0));
registrar->registerClient(Tp::AbstractClientPtr::dynamicCast(approverManager), "krdc_rfb_approver");
return app.exec();
}

View file

@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.krdc_rfb_approver
Exec=@CMAKE_INSTALL_PREFIX@/bin/krdc_rfb_approver

View file

@ -0,0 +1,7 @@
[org.freedesktop.Telepathy.Client]
Interfaces=org.freedesktop.Telepathy.Client.Handler;
[org.freedesktop.Telepathy.Client.Handler.HandlerChannelFilter 0]
org.freedesktop.Telepathy.Channel.ChannelType s=org.freedesktop.Telepathy.Channel.Type.StreamTube
org.freedesktop.Telepathy.Channel.Type.StreamTube.Service s=rfb
org.freedesktop.Telepathy.Channel.Requested b=false

33
krdc/krdcui.rc Normal file
View file

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<gui name="krdc" version="10">
<MenuBar>
<Menu name="file">
<Action name="new_connection" />
</Menu>
<Menu noMerge="1" name="session"><text>&amp;Session</text>
<Action name="switch_fullscreen" />
<Action name="take_screenshot" />
<Action name="view_only" />
<Action name="show_local_cursor" />
<Action name="grab_all_keys" />
<Action name="scale" />
<Action name="disconnect" />
</Menu>
<Action name="bookmark" />
<Menu name="settings">
<Action name="remote_desktop_dockwidget" />
</Menu>
</MenuBar>
<ToolBar fullWidth="false" name="krdc_remote_view_toolbar" newline="false"><text>Remote View Toolbar</text>
<Action name="new_connection" />
<Separator />
<Action name="switch_fullscreen" />
<Action name="take_screenshot" />
<Action name="view_only" />
<Action name="show_local_cursor" />
<Action name="grab_all_keys" />
<Action name="scale" />
<Action name="disconnect" />
</ToolBar>
</gui>

105
krdc/main.cpp Normal file
View file

@ -0,0 +1,105 @@
/****************************************************************************
**
** Copyright (C) 2001-2003 Tim Jansen <tim@tjansen.de>
** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "mainwindow.h"
#include <KApplication>
#include <KLocale>
#include <KCmdLineArgs>
#include <KAboutData>
#include <KDebug>
#include <QTime>
int main(int argc, char **argv)
{
QTime startupTimer;
startupTimer.start();
KAboutData aboutData("krdc", 0, ki18n("KRDC"), KDE_VERSION_STRING,
ki18n("KDE Remote Desktop Client"), KAboutData::License_GPL,
ki18n("(c) 2007-2013, Urs Wolfer\n"
"(c) 2001-2003, Tim Jansen\n"
"(c) 2002-2003, Arend van Beelen jr.\n"
"(c) 2000-2002, Const Kaplinsky\n"
"(c) 2000, Tridia Corporation\n"
"(c) 1999, AT&T Laboratories Boston\n"
"(c) 1999-2003, Matthew Chapman\n"
"(c) 2009, Collabora Ltd"));
aboutData.addAuthor(ki18n("Urs Wolfer"), ki18n("Developer, Maintainer"), "uwolfer@kde.org");
aboutData.addAuthor(ki18n("Tony Murray"), ki18n("Developer"), "murraytony@gmail.com");
aboutData.addAuthor(ki18n("Tim Jansen"), ki18n("Former Developer"), "tim@tjansen.de");
aboutData.addAuthor(ki18n("Arend van Beelen jr."), ki18n("Initial RDP backend"), "arend@auton.nl");
aboutData.addCredit(ki18n("Brad Hards"), ki18n("Google Summer of Code 2007 KRDC project mentor"),
"bradh@frogmouth.net");
aboutData.addCredit(ki18n("LibVNCServer / LibVNCClient developers"), ki18n("VNC client library"),
"libvncserver-common@lists.sf.net", "http://libvncserver.sourceforge.net/");
aboutData.addAuthor(ki18n("Abner Silva"), ki18n("Telepathy Tubes Integration"), "abner.silva@kdemail.net");
KCmdLineArgs::init(argc, argv, &aboutData);
KCmdLineOptions options;
options.add("fullscreen", ki18n("Start KRDC with the provided URL in fullscreen mode (works only with one URL)"));
options.add("!+[URL]", ki18n("URLs to connect after startup"));
KCmdLineArgs::addCmdLineOptions(options);
KApplication app;
MainWindow *mainwindow = new MainWindow;
mainwindow->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
if (args->count() > 0) {
for (int i = 0; i < args->count(); ++i) {
KUrl u(args->url(i));
if (u.scheme().isEmpty() || u.host().isEmpty()) { // unusable url; try to recover it...
QString arg(args->url(i).url());
kDebug(5010) << "unusable url; try to recover it:" << arg;
if (arg.lastIndexOf('/') != 0)
arg = arg.right(arg.length() - arg.lastIndexOf('/') - 1);
if (!arg.contains("://"))
arg.prepend("vnc://"); // vnc was default in kde3 times...
kDebug(5010) << "recovered url:" << arg;
u = arg;
}
if (!u.isValid())
continue;
mainwindow->newConnection(u, ((args->isSet("fullscreen")) && (args->count() == 1)));
}
}
kDebug(5010) << "########## KRDC ready:" << startupTimer.elapsed() << "ms ##########";
return app.exec();
}

1229
krdc/mainwindow.cpp Normal file

File diff suppressed because it is too large Load diff

185
krdc/mainwindow.h Normal file
View file

@ -0,0 +1,185 @@
/****************************************************************************
**
** Copyright (C) 2007 - 2013 Urs Wolfer <uwolfer @ kde.org>
** Copyright (C) 2009 - 2010 Tony Murray <murraytony @ gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "remoteview.h"
#include "remoteviewfactory.h"
#include <KService>
#include <KXmlGuiWindow>
class KComboBox;
class KLineEdit;
class KPushButton;
class KToggleAction;
class KTabWidget;
class BookmarkManager;
class FloatingToolBar;
class RemoteDesktopsModel;
class RemoteView;
class SystemTrayIcon;
class TabbedViewWidget;
class QScrollArea;
class QModelIndex;
class QTableView;
#ifdef TELEPATHY_SUPPORT
class TubesManager;
#endif
class MainWindow : public KXmlGuiWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
QMap<QWidget *, RemoteView *> remoteViewList() const;
QList<RemoteViewFactory *> remoteViewFactoriesList() const;
RemoteView* currentRemoteView() const;
public slots:
void newConnection(const KUrl &newUrl = KUrl(), bool switchFullscreenWhenConnected = false, const QString &tabName = QString());
protected:
virtual void closeEvent(QCloseEvent *event);
bool eventFilter(QObject *obj, QEvent *event); // checks for close events on fs window
virtual void saveProperties(KConfigGroup &group);
void saveHostPrefs();
void saveHostPrefs(RemoteView *view);
private slots:
void restoreOpenSessions();
void quit(bool systemEvent = false);
void preferences();
void configureNotifications();
void showMenubar();
void resizeTabWidget(int w, int h);
void statusChanged(RemoteView::RemoteStatus status);
void showRemoteViewToolbar();
void takeScreenshot();
void switchFullscreen();
void disconnectHost();
void closeTab(QWidget *widget);
void openTabSettings(QWidget *widget);
void tabContextMenu(QWidget *widget, const QPoint &point);
void viewOnly(bool viewOnly);
void showLocalCursor(bool showLocalCursor);
void grabAllKeys(bool grabAllKeys);
void scale(bool scale);
void updateActionStatus();
void updateConfiguration();
void tabChanged(int index);
QWidget* newConnectionWidget();
void newConnectionPage(bool clearInput = true);
void openFromRemoteDesktopsModel(const QModelIndex &index);
void createDockWidget();
void showConnectionContextMenu(const QPoint &pos);
void saveConnectionListSort(const int logicalindex, const Qt::SortOrder order);
private:
void setupActions();
void loadAllPlugins();
RemoteViewFactory *createPluginFromService(const KService::Ptr &service);
void showSettingsDialog(const QString &url);
QScrollArea *createScrollArea(QWidget *parent, RemoteView *remoteView);
KUrl getInputUrl();
QWidget *m_fullscreenWindow;
QByteArray m_mainWindowGeometry;
KToggleAction *m_menubarAction;
TabbedViewWidget *m_tabWidget;
KComboBox *m_protocolInput;
KLineEdit *m_addressInput;
FloatingToolBar *m_toolBar;
BookmarkManager *m_bookmarkManager;
QMap<QWidget *, RemoteView *> m_remoteViewMap;
QMap<int, RemoteViewFactory *> m_remoteViewFactories;
int m_currentRemoteView;
bool m_switchFullscreenWhenConnected;
SystemTrayIcon *m_systemTrayIcon;
QTableView *m_dockWidgetTableView;
QTableView *m_newConnectionTableView;
RemoteDesktopsModel *m_remoteDesktopsModel;
#ifdef TELEPATHY_SUPPORT
TubesManager *m_tubesManager;
#endif
QWidget *m_newConnectionWidget;
};
#include <QApplication>
#include <QDesktopWidget>
#include <QMouseEvent>
class MinimizePixel : public QWidget
{
Q_OBJECT
public:
explicit MinimizePixel(QWidget *parent)
: QWidget(parent) {
setFixedSize(1, 1);
move(QApplication::desktop()->screenGeometry().width() - 1, 0);
}
signals:
void rightClicked();
protected:
void mousePressEvent(QMouseEvent *event) {
if (event->button() == Qt::RightButton)
emit rightClicked();
}
};
#include <QScrollArea>
class RemoteViewScrollArea : public QScrollArea
{
Q_OBJECT
public:
explicit RemoteViewScrollArea(QWidget *parent)
: QScrollArea(parent) {
}
signals:
void resized(int w, int h);
protected:
void resizeEvent(QResizeEvent *event) {
QScrollArea::resizeEvent(event);
emit resized(width() - 2*frameWidth(), height() - 2*frameWidth());
}
};
#endif

55
krdc/nx/CMakeLists.txt Normal file
View file

@ -0,0 +1,55 @@
if(LIBNXCL_FOUND)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5013)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${LIBNXCL_INCLUDE_DIR}
)
set(nxplugin_SRCS
nxhostpreferences.cpp
nxclientthread.cpp
nxviewfactory.cpp
nxview.cpp
nxcallbacks.cpp
nxresumesessions.cpp
)
kde4_add_ui_files(nxplugin_SRCS
nxpreferences.ui
nxresumesessions.ui
)
kde4_add_plugin(krdc_nxplugin ${nxplugin_SRCS})
target_link_libraries(krdc_nxplugin
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
${LIBNXCL_LIBRARIES}
krdccore
)
set(kcm_krdc_nxplugin_SRCS
nxpreferences.cpp
)
kde4_add_plugin(kcm_krdc_nxplugin ${kcm_krdc_nxplugin_SRCS})
target_link_libraries(kcm_krdc_nxplugin
${KDE4_KDEUI_LIBS}
krdccore
)
add_dependencies(kcm_krdc_nxplugin krdc_nxplugin)
install(TARGETS kcm_krdc_nxplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(TARGETS krdc_nxplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES krdc_nx.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES krdc_nx_config.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES nx.protocol DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES default.dsa.key DESTINATION ${DATA_INSTALL_DIR}/krdc)
endif(LIBNXCL_FOUND)

12
krdc/nx/default.dsa.key Normal file
View file

@ -0,0 +1,12 @@
-----BEGIN DSA PRIVATE KEY-----
MIIBuwIBAAKBgQCXv9AzQXjxvXWC1qu3CdEqskX9YomTfyG865gb4D02ZwWuRU/9
C3I9/bEWLdaWgJYXIcFJsMCIkmWjjeSZyTmeoypI1iLifTHUxn3b7WNWi8AzKcVF
aBsBGiljsop9NiD1mEpA0G+nHHrhvTXz7pUvYrsrXcdMyM6rxqn77nbbnwIVALCi
xFdHZADw5KAVZI7r6QatEkqLAoGBAI4L1TQGFkq5xQ/nIIciW8setAAIyrcWdK/z
5/ZPeELdq70KDJxoLf81NL/8uIc4PoNyTRJjtT3R4f8Az1TsZWeh2+ReCEJxDWgG
fbk2YhRqoQTtXPFsI4qvzBWct42WonWqyyb1bPBHk+JmXFscJu5yFQ+JUVNsENpY
+Gkz3HqTAoGANlgcCuA4wrC+3Cic9CFkqiwO/Rn1vk8dvGuEQqFJ6f6LVfPfRTfa
QU7TGVLk2CzY4dasrwxJ1f6FsT8DHTNGnxELPKRuLstGrFY/PR7KeafeFZDf+fJ3
mbX5nxrld3wi5titTnX+8s4IKv29HJguPvOK/SI7cjzA+SqNfD7qEo8CFDIm1xRf
8xAPsSKs6yZ6j1FNklfu
-----END DSA PRIVATE KEY-----

123
krdc/nx/krdc_nx.desktop Normal file
View file

@ -0,0 +1,123 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KRDC/Plugin
Icon=krdc
Name=NX
Name[ast]=NX
Name[bg]=NX
Name[bs]=NX
Name[ca]=NX
Name[ca@valencia]=NX
Name[cs]=NX
Name[da]=NX
Name[de]=NX
Name[el]=NX
Name[en_GB]=NX
Name[eo]=NX
Name[es]=NX
Name[et]=NX
Name[eu]=NX
Name[fi]=NX
Name[fr]=NX
Name[ga]=NX
Name[gl]=NX
Name[hr]=NX
Name[hu]=NX
Name[ia]=NX
Name[is]=NX
Name[it]=NX
Name[ja]=NX
Name[kk]=NX
Name[km]=NX
Name[ko]=NX
Name[lt]=NX
Name[lv]=NX
Name[mr]=-
Name[nb]=NX
Name[nds]=NX
Name[nl]=NX
Name[nn]=NX
Name[pa]=NX
Name[pl]=NX
Name[pt]=NX
Name[pt_BR]=NX
Name[ro]=NX
Name[ru]=NX
Name[si]=NX
Name[sk]=NX
Name[sl]=NX
Name[sr]=НИкс
Name[sr@ijekavian]=НИкс
Name[sr@ijekavianlatin]=NX
Name[sr@latin]=NX
Name[sv]=NX
Name[tr]=NX
Name[ug]=NX
Name[uk]=NX
Name[wa]=NX
Name[x-test]=xxNXxx
Name[zh_CN]=NX
Name[zh_TW]=NX
Comment=Allows managing NX sessions through KRDC
Comment[ast]=Permite la xestión de sesiones NX per KRDC
Comment[bg]=Управление на сесии на NX с KRDC
Comment[bs]=Dopušta upravljanje NX sesijama kroz KRDC
Comment[ca]=Permet gestionar sessions NX mitjançant el KRDC
Comment[ca@valencia]=Permet gestionar sessions NX mitjançant el KRDC
Comment[cs]=Umožňuje spravování sezení NX pomocí KRDC
Comment[da]=Muliggør håndtering af NX-sessioner via KRDC
Comment[de]=Erlaubt die Verwaltung von NX-Sitzungen über KRDC
Comment[el]=Επιτρέπει τη διαχείριση συνεδριών NX μέσω του KRDC
Comment[en_GB]=Allows managing NX sessions through KRDC
Comment[es]=Permite la gestión de sesiones NX mediante KRDC
Comment[et]=NX-seansside haldamise võimaldamine KRDC kaudu
Comment[eu]=NX saioak KRDC bidez kudeatzea baimentzen du
Comment[fi]=Mahdollistaa NX-istuntojen hallinnan KRDC:llä
Comment[fr]=Permet de gérer des sessions « NX » au travers de KRDC
Comment[ga]=Ceadaíonn sé duit seisiúin NX a bhainistiú trí KRDC
Comment[gl]=Permite xestionar sesións NX por medio de KRDC
Comment[hr]=Omogućuje upravljanje sjednicama NX-a kroz KRDC
Comment[hu]=NX-elérés KRDC-ből
Comment[ia]=Permitte gerer sessiones NX per medio de KRDC
Comment[is]=Gefur kost á að stjórna NX setum með KRDC
Comment[it]=Permette di gestire sessioni NX con KRDC
Comment[ja]=KRDC NX
Comment[kk]=KRDC арқылы NX сеанстарын басқаруға мүмкіндік беру
Comment[km]= NX KRDC
Comment[ko]=KRDC NX
Comment[lt]=Leidžia valdyti NX sesijas per KRDC
Comment[lv]=Ļauj pārvaldīt NX sesijas caur KRDC
Comment[nb]=Tillater å styre NX-økter gjennom KRDC
Comment[nds]=NX-Törns över KRDC plegen
Comment[nl]=Staat het beheren van NX-sessies toe via KRDC
Comment[nn]=Lèt deg handtera NX-økter gjennom KRDC
Comment[pl]=Pozwala na zarządzanie sesjami NX przez KRDC
Comment[pt]=Permite a gestão de sessões NX através do KRDC
Comment[pt_BR]=Permite o gerenciamento de sessões NX através do KRDC
Comment[ro]=Permite gestiunea sesiunilor NX prin KRDC
Comment[ru]=Разрешить управление сеансами NX через KRDC
Comment[si]=KRDC NX
Comment[sk]=Umožňuje spravovanie NX sedení pomocou KRDC
Comment[sl]=Omogoča upravljanje sej NX prek KRDC
Comment[sr]=Управљање НИкс сесијама кроз КРДЦ
Comment[sr@ijekavian]=Управљање НИкс сесијама кроз КРДЦ
Comment[sr@ijekavianlatin]=Upravljanje NX sesijama kroz KRDC
Comment[sr@latin]=Upravljanje NX sesijama kroz KRDC
Comment[sv]=Tillåter hantering av NX-sessioner via KRDC
Comment[th]= NX KRDC
Comment[tr]=NX oturumlarını KRDC üzerinden yönetmeye izin verir
Comment[uk]=Надає змогу керувати сеансами NX за допомогою KRDC
Comment[x-test]=xxAllows managing NX sessions through KRDCxx
Comment[zh_CN]= KRDC NX
Comment[zh_TW]= KRDC NX
X-KDE-PluginInfo-Author=David Gross
X-KDE-PluginInfo-Email=gdavid.devel@gmail.com
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Category=Service
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=krdc_nxplugin
X-KDE-PluginInfo-Name=krdc_nxplugin
X-KDE-KRDC-Sorting=40

View file

@ -0,0 +1,62 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
Name=NX
Name[ast]=NX
Name[bg]=NX
Name[bs]=NX
Name[ca]=NX
Name[ca@valencia]=NX
Name[cs]=NX
Name[da]=NX
Name[de]=NX
Name[el]=NX
Name[en_GB]=NX
Name[eo]=NX
Name[es]=NX
Name[et]=NX
Name[eu]=NX
Name[fi]=NX
Name[fr]=NX
Name[ga]=NX
Name[gl]=NX
Name[hr]=NX
Name[hu]=NX
Name[ia]=NX
Name[is]=NX
Name[it]=NX
Name[ja]=NX
Name[kk]=NX
Name[km]=NX
Name[ko]=NX
Name[lt]=NX
Name[lv]=NX
Name[mr]=-
Name[nb]=NX
Name[nds]=NX
Name[nl]=NX
Name[nn]=NX
Name[pa]=NX
Name[pl]=NX
Name[pt]=NX
Name[pt_BR]=NX
Name[ro]=NX
Name[ru]=NX
Name[si]=NX
Name[sk]=NX
Name[sl]=NX
Name[sr]=НИкс
Name[sr@ijekavian]=НИкс
Name[sr@ijekavianlatin]=NX
Name[sr@latin]=NX
Name[sv]=NX
Name[tr]=NX
Name[ug]=NX
Name[uk]=NX
Name[wa]=NX
Name[x-test]=xxNXxx
Name[zh_CN]=NX
Name[zh_TW]=NX
X-KDE-Library=kcm_krdc_nxplugin
X-KDE-ParentComponents=krdc_nxplugin

12
krdc/nx/nx.protocol Normal file
View file

@ -0,0 +1,12 @@
[Protocol]
exec=krdc '%u'
protocol=nx
input=none
output=none
helper=true
listing=
reading=false
writing=false
makedir=false
deleting=false
Icon=krdc

91
krdc/nx/nxcallbacks.cpp Normal file
View file

@ -0,0 +1,91 @@
/****************************************************************************
* **
* ** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
* **
* ** This file is part of KDE.
* **
* ** 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; see the file COPYING. If not, write to
* ** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* ** Boston, MA 02110-1301, USA.
* **
* ****************************************************************************/
#include "nxcallbacks.h"
NxCallbacks::NxCallbacks()
{
}
NxCallbacks::~NxCallbacks()
{
}
void NxCallbacks::write(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::write(int num, std::string msg)
{
emit progress(num, QString(msg.c_str()));
}
void NxCallbacks::error(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::debug(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::stdoutSignal(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::stderrSignal(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::stdinSignal(std::string msg)
{
Q_UNUSED(msg);
}
void NxCallbacks::resumeSessionsSignal(std::list<nxcl::NXResumeData> sessions)
{
QList<nxcl::NXResumeData> qsessions;
for (std::list<nxcl::NXResumeData>::const_iterator it = sessions.begin(); it != sessions.end(); ++it)
qsessions << (*it);
emit suspendedSessions(qsessions);
}
void NxCallbacks::noSessionsSignal()
{
emit noSessions();
}
void NxCallbacks::serverCapacitySignal()
{
emit atCapacity();
}
void NxCallbacks::connectedSuccessfullySignal()
{
}

64
krdc/nx/nxcallbacks.h Normal file
View file

@ -0,0 +1,64 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXCALLBACKS_H
#define NXCALLBACKS_H
#include <nxcl/nxclientlib.h>
#include <nxcl/nxdata.h>
#include <list>
#include <string>
#include <QList>
#include <QObject>
class NxCallbacks : public QObject, public nxcl::NXClientLibExternalCallbacks
{
Q_OBJECT
public:
NxCallbacks();
virtual ~NxCallbacks();
virtual void write(std::string msg);
virtual void write(int num, std::string msg);
virtual void error(std::string msg);
virtual void debug(std::string msg);
virtual void stdoutSignal(std::string msg);
virtual void stderrSignal(std::string msg);
virtual void stdinSignal(std::string msg);
virtual void resumeSessionsSignal(std::list<nxcl::NXResumeData> sessions);
virtual void noSessionsSignal();
virtual void serverCapacitySignal();
virtual void connectedSuccessfullySignal();
signals:
void progress(int, QString);
void suspendedSessions(QList<nxcl::NXResumeData>);
void noSessions();
void atCapacity();
};
#endif

200
krdc/nx/nxclientthread.cpp Normal file
View file

@ -0,0 +1,200 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxclientthread.h"
#include "nxcallbacks.h"
#include <kglobal.h>
#include <kstandarddirs.h>
#include <QDesktopWidget>
#include <QApplication>
#include <QFile>
NxClientThread::NxClientThread(QObject *parent)
: QThread(parent),
m_host(std::string()),
m_port(0),
m_privateKey(std::string()),
m_xid(0),
m_stopped(false)
{
m_client.setSessionData(&m_data);
QDesktopWidget *desktop = QApplication::desktop();
int currentScreen = desktop->screenNumber();
QRect rect = desktop->screenGeometry(currentScreen);
m_client.setResolution(rect.width(), rect.height());
m_client.setDepth(24);
m_client.setRender(true);
m_data.sessionName = "krdcSession";
m_data.cache = 8;
m_data.images = 32;
m_data.linkType = "adsl";
m_data.render = true;
m_data.backingstore = "when_requested";
m_data.imageCompressionMethod = 2;
m_data.keyboard = "defkeymap";
m_data.media = false;
m_data.agentServer = "";
m_data.agentUser = "";
m_data.agentPass = "";
m_data.cups = 0;
m_data.suspended = false;
m_data.fullscreen = false;
m_data.encryption = true;
m_data.terminate = false;
}
NxClientThread::~NxClientThread()
{
stop();
wait(500);
}
void NxClientThread::setCallbacks(NxCallbacks *callbacks)
{
m_client.setExternalCallbacks(callbacks);
}
void NxClientThread::setHost(const QString &host)
{
QMutexLocker locker(&m_mutex);
QByteArray tmp = host.toAscii();
m_host = tmp.data();
}
void NxClientThread::setPort(int port)
{
QMutexLocker locker(&m_mutex);
m_port = port;
}
void NxClientThread::setUserName(const QString &userName)
{
QMutexLocker locker(&m_mutex);
std::string userNameStr = std::string(userName.toAscii().data());
m_client.setUsername(userNameStr);
}
void NxClientThread::setPassword(const QString &password)
{
QMutexLocker locker(&m_mutex);
std::string passwordStr = std::string(password.toAscii());
m_client.setPassword(passwordStr);
}
void NxClientThread::setResolution(int width, int height)
{
QMutexLocker locker(&m_mutex);
m_data.geometry = width + 'x' + height + "+0+0";
}
void NxClientThread::setDesktopType(const QString &desktopType)
{
QMutexLocker locker(&m_mutex);
QByteArray tmp = desktopType.toAscii();
m_data.sessionType = tmp.data();
}
void NxClientThread::setKeyboardLayout(const QString &keyboardLayout)
{
QMutexLocker locker(&m_mutex);
QByteArray tmp = keyboardLayout.toAscii();
m_data.kbtype = tmp.data();
}
void NxClientThread::setPrivateKey(const QString &privateKey)
{
QMutexLocker locker(&m_mutex);
QByteArray tmp = privateKey.toAscii();
m_privateKey = tmp.data();
}
void NxClientThread::setSuspended(bool suspended)
{
QMutexLocker locker(&m_mutex);
m_data.suspended = suspended;
}
void NxClientThread::setId(const QString &id)
{
QMutexLocker locker(&m_mutex);
QByteArray tmp = id.toAscii();
m_data.id = tmp.data();
}
void NxClientThread::stop()
{
QMutexLocker locker(&m_mutex);
m_stopped = true;
}
void NxClientThread::run()
{
if (m_privateKey.compare("default") == 0) {
const QString keyfilename = QString("default.dsa.key");
const QString keyfilepath = KGlobal::dirs()->findResource("appdata", keyfilename);
QFile file(keyfilepath);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QByteArray key;
while (!file.atEnd())
key += file.readLine();
m_client.invokeNXSSH("supplied", m_host, true, key.data(), m_port);
} else
m_client.invokeNXSSH("supplied", m_host, true, m_privateKey, m_port);
nxcl::notQProcess* p;
while (!m_client.getIsFinished() && !m_stopped) {
if (!m_client.getReadyForProxy()) {
p = m_client.getNXSSHProcess();
p->probeProcess();
} else {
p = m_client.getNXSSHProcess();
p->probeProcess();
p = m_client.getNXProxyProcess();
p->probeProcess();
}
if (!this->m_xid) {
this->m_xid = m_client.getXID();
if (this->m_xid)
emit hasXid(this->m_xid);
}
usleep(1000);
}
}
void NxClientThread::startSession()
{
m_client.runSession();
}
#include "moc_nxclientthread.cpp"

90
krdc/nx/nxclientthread.h Normal file
View file

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXCLIENTTHREAD_H
#define NXCLIENTTHREAD_H
#include <KDebug>
#include <KLocale>
#include <KUrl>
#include "remoteview.h"
#include <QThread>
#include <QMutex>
#include <QString>
#include <string>
#include <nxcl/nxclientlib.h>
#include <nxcl/nxdata.h>
class NxCallbacks;
class NxClientThread: public QThread
{
Q_OBJECT
public:
explicit NxClientThread(QObject *parent = 0);
~NxClientThread();
void setCallbacks(NxCallbacks *callbacks);
void setHost(const QString &host);
void setPort(int port);
void setUserName(const QString &userName);
void setPassword(const QString &password);
void setResolution(int width, int height);
void setDesktopType(const QString &desktopType);
void setKeyboardLayout(const QString &keyboardLayout);
void setPrivateKey(const QString &privateKey);
void setSuspended(bool suspended);
void setId(const QString &id);
void stop();
void startSession();
protected:
void run();
signals:
/**
* Emitted when the X Window ID of the main NX
* window is received.
* @param xid the X Window ID of the main NX window
*/
void hasXid(int xid);
private:
nxcl::NXClientLib m_client;
nxcl::NXSessionData m_data;
std::string m_host;
int m_port;
std::string m_privateKey;
int m_xid;
bool m_stopped;
QMutex m_mutex;
};
#endif

View file

@ -0,0 +1,298 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxhostpreferences.h"
#include "settings.h"
#include <KDebug>
#include <kfiledialog.h>
#include <QDesktopWidget>
#include <QFile>
#include <QByteArray>
#include <QTextEdit>
static const QStringList keymaps = (QStringList()
<< "ar"
<< "cs"
<< "da"
<< "de"
<< "de-ch"
<< "en-dv"
<< "en-gb"
<< "en-us"
<< "es"
<< "et"
<< "fi"
<< "fo"
<< "fr"
<< "fr-be"
<< "fr-ca"
<< "fr-ch"
<< "he"
<< "hr"
<< "hu"
<< "is"
<< "it"
<< "ja"
<< "ko"
<< "lt"
<< "lv"
<< "mk"
<< "nl"
<< "nl-be"
<< "no"
<< "pl"
<< "pt"
<< "pt-br"
<< "ru"
<< "sl"
<< "sv"
<< "th"
<< "tr"
);
static const int defaultKeymap = 7; // en-us
inline int keymap2int(const QString &keymap)
{
const int index = keymaps.lastIndexOf(keymap);
return (index == -1) ? defaultKeymap : index;
}
inline QString int2keymap(int layout)
{
if (layout >= 0 && layout < keymaps.count())
return keymaps.at(layout);
else
return keymaps.at(defaultKeymap);
}
static const QStringList desktopTypes = (QStringList()
<< "unix-kde"
<< "unix-gnome"
<< "unix-cde"
<< "unix-xdm"
);
static const int defaultDesktopType = 0;
inline int desktopType2int(const QString &desktopType)
{
const int index = desktopTypes.lastIndexOf(desktopType);
return (index == -1) ? defaultDesktopType : index;
}
inline QString int2desktopType(int index)
{
if (index >= 0 && index < desktopTypes.count())
return desktopTypes.at(index);
else
return desktopTypes.at(defaultDesktopType);
}
NxHostPreferences::NxHostPreferences(KConfigGroup configGroup, QObject *parent)
: HostPreferences(configGroup, parent)
{
}
NxHostPreferences::~NxHostPreferences()
{
}
QWidget* NxHostPreferences::createProtocolSpecificConfigPage()
{
nxPage = new QWidget();
nxUi.setupUi(nxPage);
nxUi.kcfg_NxHeight->setValue(height());
nxUi.kcfg_NxWidth->setValue(width());
nxUi.kcfg_NxDesktopType->setCurrentIndex(desktopType2int(desktopType()));
nxUi.kcfg_NxKeyboardLayout->setCurrentIndex(keymap2int(keyboardLayout()));
if (privateKey() == "default") {
nxUi.checkboxDefaultPrivateKey->setChecked(true);
nxUi.groupboxPrivateKey->setEnabled(false);
setDefaultPrivateKey(Qt::Checked);
} else {
nxUi.checkboxDefaultPrivateKey->setChecked(false);
nxUi.groupboxPrivateKey->setEnabled(true);
setDefaultPrivateKey(Qt::Unchecked);
}
connect(nxUi.resolutionComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateWidthHeight(int)));
connect(nxUi.checkboxDefaultPrivateKey, SIGNAL(stateChanged(int)), SLOT(setDefaultPrivateKey(int)));
connect(nxUi.buttonImportPrivateKey, SIGNAL(pressed()), SLOT(chooseKeyFile()));
connect(nxUi.kcfg_NxPrivateKey, SIGNAL(textChanged()), SLOT(updatePrivateKey()));
const QString resolutionString = QString::number(width()) + 'x' + QString::number(height());
const int resolutionIndex = nxUi.resolutionComboBox->findText(resolutionString, Qt::MatchContains);
nxUi.resolutionComboBox->setCurrentIndex((resolutionIndex == -1) ? 5 : resolutionIndex);
return nxPage;
}
void NxHostPreferences::updateWidthHeight(int index)
{
switch (index) {
case 0:
nxUi.kcfg_NxHeight->setValue(480);
nxUi.kcfg_NxWidth->setValue(640);
break;
case 1:
nxUi.kcfg_NxHeight->setValue(600);
nxUi.kcfg_NxWidth->setValue(800);
break;
case 2:
nxUi.kcfg_NxHeight->setValue(768);
nxUi.kcfg_NxWidth->setValue(1024);
break;
case 3:
nxUi.kcfg_NxHeight->setValue(1024);
nxUi.kcfg_NxWidth->setValue(1280);
break;
case 4:
nxUi.kcfg_NxHeight->setValue(1200);
nxUi.kcfg_NxWidth->setValue(1600);
break;
case 5: {
QDesktopWidget *desktop = QApplication::desktop();
int currentScreen = desktop->screenNumber(nxUi.kcfg_NxHeight);
nxUi.kcfg_NxHeight->setValue(desktop->screenGeometry(currentScreen).height());
nxUi.kcfg_NxWidth->setValue(desktop->screenGeometry(currentScreen).width());
break;
}
case 6:
default:
break;
}
bool enabled = (index == 6) ? true : false;
nxUi.kcfg_NxHeight->setEnabled(enabled);
nxUi.kcfg_NxWidth->setEnabled(enabled);
nxUi.heightLabel->setEnabled(enabled);
nxUi.widthLabel->setEnabled(enabled);
}
void NxHostPreferences::setDefaultPrivateKey(int state)
{
if (state == Qt::Checked) {
setPrivateKey("default");
nxUi.groupboxPrivateKey->setEnabled(false);
} else if (state == Qt::Unchecked) {
setPrivateKey("");
nxUi.groupboxPrivateKey->setEnabled(true);
}
}
void NxHostPreferences::updatePrivateKey()
{
m_privateKey = nxUi.kcfg_NxPrivateKey->toPlainText();
}
void NxHostPreferences::chooseKeyFile()
{
const QString fileName = KFileDialog::getOpenFileName(KUrl(QDir::homePath()),
"*.key|" + i18n("Key Files (*.key)"),
nxPage, i18n("Open DSA Key File"));
QFile file(fileName);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QByteArray key;
while (!file.atEnd())
key += file.readLine();
nxUi.kcfg_NxPrivateKey->setPlainText(QString(key));
setPrivateKey(QString(key));
}
void NxHostPreferences::acceptConfig()
{
HostPreferences::acceptConfig();
setHeight(nxUi.kcfg_NxHeight->value());
setWidth(nxUi.kcfg_NxWidth->value());
setDesktopType(int2desktopType(nxUi.kcfg_NxDesktopType->currentIndex()));
setKeyboardLayout(int2keymap(nxUi.kcfg_NxKeyboardLayout->currentIndex()));
}
void NxHostPreferences::setHeight(int height)
{
if (height >= 0)
m_configGroup.writeEntry("height", height);
}
int NxHostPreferences::height()
{
return m_configGroup.readEntry("height", Settings::nxHeight());
}
void NxHostPreferences::setWidth(int width)
{
if (width >= 0)
m_configGroup.writeEntry("width", width);
}
int NxHostPreferences::width()
{
return m_configGroup.readEntry("width", Settings::nxWidth());
}
void NxHostPreferences::setDesktopType(const QString &desktopType)
{
if (!desktopType.isNull())
m_configGroup.writeEntry("desktopType", desktopType2int(desktopType));
}
QString NxHostPreferences::desktopType() const
{
return int2desktopType(m_configGroup.readEntry("desktopType", Settings::nxDesktopType()));
}
void NxHostPreferences::setKeyboardLayout(const QString &keyboardLayout)
{
if (!keyboardLayout.isNull())
m_configGroup.writeEntry("keyboardLayout", keymap2int(keyboardLayout));
}
QString NxHostPreferences::keyboardLayout() const
{
return int2keymap(m_configGroup.readEntry("keyboardLayout", Settings::nxKeyboardLayout()));
}
void NxHostPreferences::setPrivateKey(const QString &privateKey)
{
if (!privateKey.isNull())
m_configGroup.writeEntry("privateKey", privateKey);
}
QString NxHostPreferences::privateKey() const
{
return m_configGroup.readEntry("privateKey", Settings::nxPrivateKey());
}
#include "nxhostpreferences.moc"

View file

@ -0,0 +1,65 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXHOSTPREFERENCES_H
#define NXHOSTPREFERENCES_H
#include "hostpreferences.h"
#include "ui_nxpreferences.h"
class NxHostPreferences : public HostPreferences
{
Q_OBJECT
public:
explicit NxHostPreferences(KConfigGroup configGroup, QObject *parent = 0);
~NxHostPreferences();
void setHeight(int height);
int height();
void setWidth(int width);
int width();
void setDesktopType(const QString &desktopType);
QString desktopType() const;
void setKeyboardLayout(const QString &keyboardLayout);
QString keyboardLayout() const;
void setPrivateKey(const QString &privateKey);
QString privateKey() const;
protected:
QWidget* createProtocolSpecificConfigPage();
void acceptConfig();
private:
QString m_privateKey;
Ui::NxPreferences nxUi;
QWidget *nxPage;
private slots:
void updateWidthHeight(int index);
void setDefaultPrivateKey(int state);
void updatePrivateKey();
void chooseKeyFile();
};
#endif

66
krdc/nx/nxpreferences.cpp Normal file
View file

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxpreferences.h"
#include "remoteviewfactory.h"
#include "settings.h"
#include "ui_nxpreferences.h"
#include <KDebug>
KRDC_PLUGIN_EXPORT(NxPreferences)
NxPreferences::NxPreferences(QWidget *parent, const QVariantList &args)
: KCModule(KrdcFactory::componentData(), parent, args)
{
Ui::NxPreferences nxUi;
nxUi.setupUi(this);
nxUi.resolutionComboBox->hide();
nxUi.checkboxDefaultPrivateKey->hide();
nxUi.buttonImportPrivateKey->hide();
nxUi.labelPrivateKey->hide();
nxUi.groupboxPrivateKey->hide();
nxUi.kcfg_NxHeight->setEnabled(true);
nxUi.kcfg_NxWidth->setEnabled(true);
nxUi.heightLabel->setEnabled(true);
nxUi.widthLabel->setEnabled(true);
addConfig(Settings::self(), this);
}
NxPreferences::~NxPreferences()
{
}
void NxPreferences::load()
{
KCModule::load();
}
void NxPreferences::save()
{
KCModule::save();
}
#include "nxpreferences.moc"

44
krdc/nx/nxpreferences.h Normal file
View file

@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXPREFERENCES_H
#define NXPREFERENCES_H
#include "nxhostpreferences.h"
#include <KCModule>
class NxPreferences : public KCModule
{
Q_OBJECT
public:
explicit NxPreferences(QWidget *parent = 0, const QVariantList &args = QVariantList());
~NxPreferences();
virtual void save();
virtual void load();
};
#endif // NXPREFERENCES_H

533
krdc/nx/nxpreferences.ui Normal file
View file

@ -0,0 +1,533 @@
<ui version="4.0" >
<class>NxPreferences</class>
<widget class="QWidget" name="NxPreferences" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>561</width>
<height>471</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QGroupBox" name="connectionGroupBox" >
<property name="title" >
<string>Connection</string>
</property>
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="resolutionLabel" >
<property name="text" >
<string>Desktop &amp;resolution:</string>
</property>
<property name="buddy" >
<cstring>resolutionComboBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="resolutionDummyLabel" />
</item>
</layout>
</item>
<item row="0" column="1" >
<layout class="QVBoxLayout" >
<item>
<widget class="KComboBox" name="resolutionComboBox" >
<property name="minimumSize" >
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis" >
<string>Here you can specify the resolution of the remote desktop. This resolution determines the size of the desktop that will be presented to you.</string>
</property>
<property name="currentIndex" >
<number>1</number>
</property>
<item>
<property name="text" >
<string>Minimal (640x480)</string>
</property>
</item>
<item>
<property name="text" >
<string>Small (800x600)</string>
</property>
</item>
<item>
<property name="text" >
<string>Normal (1024x768)</string>
</property>
</item>
<item>
<property name="text" >
<string>Large (1280x1024)</string>
</property>
</item>
<item>
<property name="text" >
<string>Very Large (1600x1200)</string>
</property>
</item>
<item>
<property name="text" >
<string>Current Screen Resolution</string>
</property>
</item>
<item>
<property name="text" >
<string>Custom Resolution (...)</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="widthLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>&amp;Width:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>kcfg_NxWidth</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_NxWidth" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="whatsThis" >
<string>This is the width of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above.</string>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="value" >
<number>800</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="heightLabel" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>H&amp;eight:</string>
</property>
<property name="alignment" >
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy" >
<cstring>kcfg_NxHeight</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_NxHeight" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="whatsThis" >
<string>This is the height of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above.</string>
</property>
<property name="maximum" >
<number>9999</number>
</property>
<property name="value" >
<number>600</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="desktopTypeLabel" >
<property name="text" >
<string>Desktop &amp;type:</string>
</property>
<property name="buddy" >
<cstring>kcfg_NxDesktopType</cstring>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="KComboBox" name="kcfg_NxDesktopType" >
<property name="minimumSize" >
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis" >
<string>Here you can specify the desktop environment of the remote desktop.</string>
</property>
<item>
<property name="text" >
<string>KDE</string>
</property>
</item>
<item>
<property name="text" >
<string>Gnome</string>
</property>
</item>
<item>
<property name="text" >
<string>CDE</string>
</property>
</item>
<item>
<property name="text" >
<string>XDM</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0" >
<widget class="QLabel" name="layoutLabel" >
<property name="text" >
<string>&amp;Keyboard layout:</string>
</property>
<property name="buddy" >
<cstring>kcfg_NxKeyboardLayout</cstring>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="KComboBox" name="kcfg_NxKeyboardLayout" >
<property name="minimumSize" >
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis" >
<string>Use this to specify your keyboard layout. This layout setting is used to send the correct keyboard codes to the server.</string>
</property>
<property name="currentIndex" >
<number>7</number>
</property>
<item>
<property name="text" >
<string>Arabic (ar)</string>
</property>
</item>
<item>
<property name="text" >
<string>Czech (cs)</string>
</property>
</item>
<item>
<property name="text" >
<string>Danish (da)</string>
</property>
</item>
<item>
<property name="text" >
<string>German (de)</string>
</property>
</item>
<item>
<property name="text" >
<string>Swiss German (de-ch)</string>
</property>
</item>
<item>
<property name="text" >
<string>American Dvorak (en-dv)</string>
</property>
</item>
<item>
<property name="text" >
<string>British English (en-gb)</string>
</property>
</item>
<item>
<property name="text" >
<string>US English (en-us)</string>
</property>
</item>
<item>
<property name="text" >
<string>Spanish (es)</string>
</property>
</item>
<item>
<property name="text" >
<string>Estonian (et)</string>
</property>
</item>
<item>
<property name="text" >
<string>Finnish (fi)</string>
</property>
</item>
<item>
<property name="text" >
<string>Faroese (fo)</string>
</property>
</item>
<item>
<property name="text" >
<string>French (fr)</string>
</property>
</item>
<item>
<property name="text" >
<string>Belgian (fr-be)</string>
</property>
</item>
<item>
<property name="text" >
<string>French Canadian (fr-ca)</string>
</property>
</item>
<item>
<property name="text" >
<string>Swiss French (fr-ch)</string>
</property>
</item>
<item>
<property name="text" >
<string>Hebrew (he)</string>
</property>
</item>
<item>
<property name="text" >
<string>Croatian (hr)</string>
</property>
</item>
<item>
<property name="text" >
<string>Hungarian (hu)</string>
</property>
</item>
<item>
<property name="text" >
<string>Icelandic (is)</string>
</property>
</item>
<item>
<property name="text" >
<string>Italian (it)</string>
</property>
</item>
<item>
<property name="text" >
<string>Japanese (ja)</string>
</property>
</item>
<item>
<property name="text" >
<string>Korean (ko)</string>
</property>
</item>
<item>
<property name="text" >
<string>Lithuanian (lt)</string>
</property>
</item>
<item>
<property name="text" >
<string>Latvian (lv)</string>
</property>
</item>
<item>
<property name="text" >
<string>Macedonian (mk)</string>
</property>
</item>
<item>
<property name="text" >
<string>Dutch (nl)</string>
</property>
</item>
<item>
<property name="text" >
<string>Belgian Dutch (nl-be)</string>
</property>
</item>
<item>
<property name="text" >
<string>Norwegian (no)</string>
</property>
</item>
<item>
<property name="text" >
<string>Polish (pl)</string>
</property>
</item>
<item>
<property name="text" >
<string>Portuguese (pt)</string>
</property>
</item>
<item>
<property name="text" >
<string>Brazilian (pt-br)</string>
</property>
</item>
<item>
<property name="text" >
<string>Russian (ru)</string>
</property>
</item>
<item>
<property name="text" >
<string>Slovenian (sl)</string>
</property>
</item>
<item>
<property name="text" >
<string>Swedish (sv)</string>
</property>
</item>
<item>
<property name="text" >
<string>Thai (th)</string>
</property>
</item>
<item>
<property name="text" >
<string>Turkish (tr)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0" >
<widget class="QLabel" name="labelPrivateKey" >
<property name="text" >
<string comment="label for soundsettings in preferences dialog" >Private key:</string>
</property>
</widget>
</item>
<item row="3" column="1" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<widget class="QCheckBox" name="checkboxDefaultPrivateKey" >
<property name="whatsThis" >
<string>The authentication on the NX server requires a private key. By default, it is the NoMachine DSA key. Use this box to choose the default key, or configure it by importing from a file or editing directly the textbox. </string>
</property>
<property name="text" >
<string>NoMachine Key</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupboxPrivateKey" >
<property name="title" >
<string>Private Key Management</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="1" >
<widget class="KTextEdit" name="kcfg_NxPrivateKey" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="whatsThis" >
<string>Use this textbox to edit the private key for the authentication on the NX server.</string>
</property>
</widget>
</item>
<item row="0" column="0" >
<layout class="QVBoxLayout" name="verticalLayout_2" >
<item>
<widget class="QLabel" name="label" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text" >
<string>Private DSA Key :</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonImportPrivateKey" >
<property name="whatsThis" >
<string>Use this button to import the private key from a file.</string>
</property>
<property name="text" >
<string>Import ...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>428</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KTextEdit</class>
<extends>QTextEdit</extends>
<header>ktextedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>resolutionComboBox</tabstop>
<tabstop>kcfg_NxWidth</tabstop>
<tabstop>kcfg_NxHeight</tabstop>
<tabstop>kcfg_NxKeyboardLayout</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View file

@ -0,0 +1,105 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxresumesessions.h"
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QVBoxLayout>
#include <KTitleWidget>
NxResumeSessions::NxResumeSessions()
{
QWidget *nxPage = new QWidget();
nxUi.setupUi(nxPage);
setCaption(i18n("Available NX Sessions"));
setButtons(KDialog::None);
QVBoxLayout *layout = new QVBoxLayout();
KTitleWidget *titleWidget = new KTitleWidget();
titleWidget->setText(i18n("Available NX Sessions"));
titleWidget->setPixmap(KIcon("krdc"));
layout->addWidget(titleWidget);
layout->addWidget(nxPage);
QWidget *mainWidget = new QWidget();
mainWidget->setLayout(layout);
setMainWidget(mainWidget);
connect(nxUi.buttonNew, SIGNAL(pressed()), this, SLOT(pressedNew()));
connect(nxUi.buttonResume, SIGNAL(pressed()), this, SLOT(pressedResume()));
}
NxResumeSessions::~NxResumeSessions()
{
if (!empty())
clear();
}
bool NxResumeSessions::empty() const
{
return nxUi.sessionsList->topLevelItemCount() == 0;
}
void NxResumeSessions::clear()
{
nxUi.sessionsList->clear();
}
void NxResumeSessions::addSessions(QList<nxcl::NXResumeData> sessions)
{
for (int i = 0; i < sessions.size(); ++i) {
const nxcl::NXResumeData session = sessions.at(i);
QTreeWidgetItem *tmp = new QTreeWidgetItem();
tmp->setText(0, QString::number(session.display));
tmp->setText(1, QString(session.sessionType.c_str()));
tmp->setText(2, QString(session.sessionID.c_str()));
tmp->setText(3, QString::number(session.depth));
tmp->setText(4, QString(session.screen.c_str()));
tmp->setText(5, QString(session.sessionName.c_str()));
nxUi.sessionsList->addTopLevelItem(tmp);
}
}
void NxResumeSessions::show()
{
adjustSize();
if (exec() == KDialog::Rejected)
pressedNew();
}
void NxResumeSessions::pressedNew()
{
emit newSession();
}
void NxResumeSessions::pressedResume()
{
emit resumeSession(QString(""));
}

View file

@ -0,0 +1,58 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXRESUMESESSIONS_H
#define NXRESUMESESSIONS_H
#include "ui_nxresumesessions.h"
#include <QList>
#include <QWidget>
#include <KDialog>
#include <nxcl/nxdata.h>
class NxResumeSessions : public KDialog
{
Q_OBJECT
public:
explicit NxResumeSessions();
~NxResumeSessions();
bool empty() const;
void clear();
void addSessions(QList<nxcl::NXResumeData> sessions);
void show();
private:
Ui::NxSessions nxUi;
private slots:
void pressedNew();
void pressedResume();
signals:
void newSession();
void resumeSession(QString);
};
#endif

View file

@ -0,0 +1,94 @@
<ui version="4.0" >
<class>NxSessions</class>
<widget class="QWidget" name="NxSessions" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>725</width>
<height>260</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<widget class="QTreeWidget" name="sessionsList" >
<column>
<property name="text" >
<string>Display</string>
</property>
</column>
<column>
<property name="text" >
<string>Type</string>
</property>
</column>
<column>
<property name="text" >
<string>Session ID</string>
</property>
</column>
<column>
<property name="text" >
<string>Colour Depth</string>
</property>
</column>
<column>
<property name="text" >
<string>Resolution</string>
</property>
</column>
<column>
<property name="text" >
<string>Session Name</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonNew" >
<property name="text" >
<string>&amp;New</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonResume" >
<property name="text" >
<string>&amp;Resume</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

278
krdc/nx/nxview.cpp Normal file
View file

@ -0,0 +1,278 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxview.h"
#include "settings.h"
#include <nxcl/nxdata.h>
#include <KInputDialog>
#include <KMessageBox>
#include <KPasswordDialog>
#include <QEvent>
#include <QMetaType>
NxView::NxView(QWidget *parent, const KUrl &url, KConfigGroup configGroup)
: RemoteView(parent),
m_quitFlag(false),
m_container(NULL),
m_hostPreferences(NULL)
{
m_url = url;
m_host = url.host();
m_port = url.port();
if (m_port <= 0 || m_port >= 65536)
m_port = TCP_PORT_NX;
m_container = new QX11EmbedContainer(this);
m_container->installEventFilter(this);
qRegisterMetaType<QList<nxcl::NXResumeData> >("QList<nxcl::NXResumeData>");
m_clientThread.setCallbacks(&m_callbacks);
connect(&m_clientThread, SIGNAL(hasXid(int)), this, SLOT(hasXid(int)));
connect(&m_callbacks, SIGNAL(progress(int,QString)), this, SLOT(handleProgress(int,QString)));
connect(&m_callbacks, SIGNAL(suspendedSessions(QList<nxcl::NXResumeData>)), this, SLOT(handleSuspendedSessions(QList<nxcl::NXResumeData>)));
connect(&m_callbacks, SIGNAL(noSessions()), this, SLOT(handleNoSessions()));
connect(&m_callbacks, SIGNAL(atCapacity()), this, SLOT(handleAtCapacity()));
connect(&m_resumeSessions, SIGNAL(newSession()), this, SLOT(handleNewSession()));
connect(&m_resumeSessions, SIGNAL(resumeSession(QString)), this, SLOT(handleResumeSession(QString)));
m_hostPreferences = new NxHostPreferences(configGroup, this);
}
NxView::~NxView()
{
}
// filter out key and mouse events to the container if we are view only
//FIXME: X11 events are passed to the app before getting caught in the Qt event processing
bool NxView::eventFilter(QObject *obj, QEvent *event)
{
if (m_viewOnly) {
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::KeyRelease ||
event->type() == QEvent::MouseButtonDblClick ||
event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::MouseButtonRelease ||
event->type() == QEvent::MouseMove)
return true;
}
return RemoteView::eventFilter(obj, event);
}
void NxView::startQuitting()
{
kDebug(5013) << "about to quit";
const bool connected = status() == RemoteView::Connected;
setStatus(Disconnecting);
m_quitFlag = true;
if (connected)
m_clientThread.stop();
else
m_clientThread.quit();
m_clientThread.wait(500);
setStatus(Disconnected);
m_container->discardClient();
}
bool NxView::isQuitting()
{
return m_quitFlag;
}
bool NxView::start()
{
m_clientThread.setResolution(m_hostPreferences->width(), m_hostPreferences->height());
m_clientThread.setDesktopType(m_hostPreferences->desktopType());
m_clientThread.setKeyboardLayout(m_hostPreferences->keyboardLayout());
m_clientThread.setPrivateKey(m_hostPreferences->privateKey());
m_container->show();
if (m_hostPreferences->walletSupport()) {
if (m_url.userName().isEmpty()) {
QString userName;
bool ok = false;
userName = KInputDialog::getText(i18n("Enter Username"),
i18n("Please enter the username you would like to use for login."),
QString(), &ok, this);
if (ok)
m_url.setUserName(userName);
}
if (!m_url.userName().isEmpty()) {
QString walletPassword = readWalletPassword();
if (!walletPassword.isNull())
m_url.setPassword(walletPassword);
else {
KPasswordDialog dialog(this);
dialog.setPrompt(i18n("Access to the system requires a password."));
if (dialog.exec() == KPasswordDialog::Accepted) {
m_url.setPassword(dialog.password());
if (m_hostPreferences->walletSupport())
saveWalletPassword(dialog.password());
}
}
}
}
m_clientThread.setHost(m_host);
m_clientThread.setPort(m_port);
m_clientThread.setUserName(m_url.userName());
m_clientThread.setPassword(m_url.password());
m_clientThread.setResolution(m_hostPreferences->width(), m_hostPreferences->height());
setStatus(Connecting);
m_clientThread.start();
connect(m_container, SIGNAL(clientIsEmbedded()), SLOT(connectionOpened()));
connect(m_container, SIGNAL(clientClosed()), SLOT(connectionClosed()));
return true;
}
HostPreferences* NxView::hostPreferences()
{
return m_hostPreferences;
}
QSize NxView::framebufferSize()
{
return m_container->minimumSizeHint();
}
QSize NxView::sizeHint() const
{
return maximumSize();
}
void NxView::switchFullscreen(bool on)
{
setGrabAllKeys(on);
}
void NxView::setGrabAllKeys(bool grabAllKeys)
{
m_grabAllKeys = grabAllKeys;
if (grabAllKeys) {
m_keyboardIsGrabbed = true;
m_container->grabKeyboard();
} else if (m_keyboardIsGrabbed)
m_container->releaseKeyboard();
}
void NxView::hasXid(int xid)
{
m_container->embedClient(xid);
}
void NxView::handleProgress(int id, QString msg)
{
Q_UNUSED(msg);
switch (id) {
case NXCL_AUTH_FAILED:
KMessageBox::error(this, i18n("The authentication key is invalid."), i18n("Invalid authentication key"));
break;
case NXCL_LOGIN_FAILED:
KMessageBox::error(this, i18n("The username or password that you have entered is invalid."), i18n("Invalid username or password"));
break;
case NXCL_HOST_KEY_VERIFAILED:
KMessageBox::error(this, i18n("The host key verification has failed."), i18n("Host key verification failed"));
break;
case NXCL_PROCESS_ERROR:
KMessageBox::error(this, i18n("An error has occurred during the connection to the NX server."), i18n("Process error"));
break;
default:
break;
}
}
void NxView::handleSuspendedSessions(QList<nxcl::NXResumeData> sessions)
{
if (!m_resumeSessions.empty())
m_resumeSessions.clear();
m_resumeSessions.addSessions(sessions);
m_resumeSessions.show();
}
void NxView::handleNoSessions()
{
m_clientThread.setSuspended(false);
m_clientThread.startSession();
}
void NxView::handleAtCapacity()
{
KMessageBox::error(this, i18n("This NX server is running at capacity."), i18n("Server at capacity"));
}
void NxView::handleNewSession()
{
m_clientThread.setSuspended(false);
m_clientThread.startSession();
}
void NxView::handleResumeSession(QString id)
{
m_clientThread.setId(id);
m_clientThread.setSuspended(true);
m_clientThread.startSession();
}
void NxView::connectionOpened()
{
kDebug(5013) << "Connection opened";
QSize size(m_hostPreferences->width(), m_hostPreferences->height());
kDebug(5013) << "Size hint: " << size.width() << size.height();
setStatus(Connected);
setFixedSize(size);
resize(size);
m_container->setFixedSize(size);
emit framebufferSizeChanged(size.width(), size.height());
emit connected();
setFocus();
}
void NxView::connectionClosed()
{
emit disconnected();
setStatus(Disconnected);
m_quitFlag = true;
}
#include "nxview.moc"

90
krdc/nx/nxview.h Normal file
View file

@ -0,0 +1,90 @@
/****************************************************************************
**
** Copyright (C) 2008 David Gross <gdavid.devel@gmail.com>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXVIEW_H
#define NXVIEW_H
#include "remoteview.h"
#include "nxcallbacks.h"
#include "nxclientthread.h"
#include "nxhostpreferences.h"
#include "nxresumesessions.h"
#include <QX11EmbedContainer>
#define TCP_PORT_NX 22
class NxView : public RemoteView
{
Q_OBJECT
public:
explicit NxView(QWidget *parent = 0, const KUrl &url = KUrl(), KConfigGroup configGroup = KConfigGroup());
virtual ~NxView();
// Start closing the connection
virtual void startQuitting();
// If we are currently closing the connection
virtual bool isQuitting();
// Open a connection
virtual bool start();
// Returns the size of the remote view
virtual QSize framebufferSize();
// Returns the suggested size of the remote view
QSize sizeHint() const;
virtual void setGrabAllKeys(bool grabAllKeys);
HostPreferences* hostPreferences();
public slots:
void switchFullscreen(bool on);
void hasXid(int xid);
void handleProgress(int id, QString msg);
void handleSuspendedSessions(QList<nxcl::NXResumeData> sessions);
void handleNoSessions();
void handleAtCapacity();
void handleNewSession();
void handleResumeSession(QString id);
void connectionOpened();
void connectionClosed();
protected:
bool eventFilter(QObject *obj, QEvent *event);
private:
// Thread that manage NX connection
NxClientThread m_clientThread;
// NX Callbacks
NxCallbacks m_callbacks;
// If we are currently closing the connection
bool m_quitFlag;
// Widget which contains the NX Window
QX11EmbedContainer *m_container;
// Dialog which allows user to choose NX preferences.
NxHostPreferences *m_hostPreferences;
// Dialog which allows user to resume NX sessions.
NxResumeSessions m_resumeSessions;
};
#endif

78
krdc/nx/nxviewfactory.cpp Normal file
View file

@ -0,0 +1,78 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "nxviewfactory.h"
#include <KDebug>
KRDC_PLUGIN_EXPORT(NxViewFactory)
NxViewFactory::NxViewFactory(QObject *parent, const QVariantList &args)
: RemoteViewFactory(parent)
{
Q_UNUSED(args);
KGlobal::locale()->insertCatalog("krdc");
}
NxViewFactory::~NxViewFactory()
{
}
bool NxViewFactory::supportsUrl(const KUrl &url) const
{
return (url.scheme().compare("nx", Qt::CaseInsensitive) == 0);
}
RemoteView *NxViewFactory::createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup)
{
return new NxView(parent, url, configGroup);
}
HostPreferences *NxViewFactory::createHostPreferences(KConfigGroup configGroup, QWidget *parent)
{
return new NxHostPreferences(configGroup, parent);
}
QString NxViewFactory::scheme() const
{
return "nx";
}
QString NxViewFactory::connectActionText() const
{
return i18n("New NX Connection...");
}
QString NxViewFactory::connectButtonText() const
{
return i18n("Connect to a NX Remote Desktop");
}
QString NxViewFactory::connectToolTipText() const
{
return i18n("<html>Enter the address here.<br />"
"<i>Example: nxserver (host)</i></html>");
}
#include "moc_nxviewfactory.cpp"

56
krdc/nx/nxviewfactory.h Normal file
View file

@ -0,0 +1,56 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef NXVIEWFACTORY_H
#define NXVIEWFACTORY_H
#include "remoteviewfactory.h"
#include "nxview.h"
#include "nxpreferences.h"
class NxViewFactory : public RemoteViewFactory
{
Q_OBJECT
public:
explicit NxViewFactory(QObject *parent, const QVariantList &args);
virtual ~NxViewFactory();
virtual bool supportsUrl(const KUrl &url) const;
virtual RemoteView *createView(QWidget *parent, const KUrl &url, KConfigGroup configGroup);
virtual HostPreferences *createHostPreferences(KConfigGroup configGroup, QWidget *parent);
virtual QString scheme() const;
virtual QString connectActionText() const;
virtual QString connectButtonText() const;
virtual QString connectToolTipText() const;
};
#endif // NXVIEWFACTORY_H

View file

@ -0,0 +1,3 @@
[D-BUS Service]
Name=org.freedesktop.Telepathy.Client.krdc_rfb_handler
Exec=@CMAKE_INSTALL_PREFIX@/bin/krdc

BIN
krdc/pointcursor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

BIN
krdc/pointcursormask.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 146 B

52
krdc/rdp/CMakeLists.txt Normal file
View file

@ -0,0 +1,52 @@
if(Q_WS_X11)
set(HAVE_XFREERDP true)
endif(Q_WS_X11)
if(HAVE_XFREERDP)
add_definitions(-DKDE_DEFAULT_DEBUG_AREA=5012)
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
set(rdpplugin_SRCS
rdphostpreferences.cpp
rdpviewfactory.cpp
rdpview.cpp
)
kde4_add_ui_files(rdpplugin_SRCS
rdppreferences.ui
)
kde4_add_plugin(krdc_rdpplugin ${rdpplugin_SRCS})
target_link_libraries(krdc_rdpplugin
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
krdccore
)
set(kcm_krdc_rdpplugin_SRCS
rdppreferences.cpp
)
kde4_add_plugin(kcm_krdc_rdpplugin ${kcm_krdc_rdpplugin_SRCS})
target_link_libraries(kcm_krdc_rdpplugin
${KDE4_KDEUI_LIBS}
krdccore
)
add_dependencies(kcm_krdc_rdpplugin krdc_rdpplugin)
install(TARGETS kcm_krdc_rdpplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(TARGETS krdc_rdpplugin DESTINATION ${PLUGIN_INSTALL_DIR})
install(FILES krdc_rdp.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES krdc_rdp_config.desktop DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES rdp.protocol DESTINATION ${SERVICES_INSTALL_DIR})
install(FILES smb2rdc.desktop DESTINATION ${SERVICES_INSTALL_DIR}/ServiceMenus)
endif(HAVE_XFREERDP)

124
krdc/rdp/krdc_rdp.desktop Normal file
View file

@ -0,0 +1,124 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KRDC/Plugin
Icon=krdc
Name=RDP
Name[ast]=RDP
Name[bg]=RDP
Name[bs]=RDP
Name[ca]=RDP
Name[ca@valencia]=RDP
Name[cs]=RDP
Name[da]=RDP
Name[de]=RDP
Name[el]=RDP
Name[en_GB]=RDP
Name[eo]=RDP
Name[es]=RDP
Name[et]=RDP
Name[eu]=RDP
Name[fi]=RDP
Name[fr]=RDP
Name[ga]=RDP
Name[gl]=RDP
Name[hr]=RDP
Name[hu]=RDP
Name[ia]=RDP
Name[is]=RDP
Name[it]=RDP
Name[ja]=RDP
Name[kk]=RDP
Name[km]=RDP
Name[ko]=RDP
Name[lt]=RDP
Name[lv]=RDP
Name[mr]=--
Name[nb]=RDP
Name[nds]=RDP
Name[nl]=RDP
Name[nn]=RDP
Name[pa]=RDP
Name[pl]=RDP
Name[pt]=RDP
Name[pt_BR]=RDP
Name[ro]=RDP
Name[ru]=Базовая программа RDP
Name[si]=RDP
Name[sk]=RDP
Name[sl]=RDP
Name[sr]=РДП
Name[sr@ijekavian]=РДП
Name[sr@ijekavianlatin]=RDP
Name[sr@latin]=RDP
Name[sv]=RDP
Name[tr]=RDP
Name[ug]=RDP
Name[uk]=RDP
Name[wa]=RDP
Name[x-test]=xxRDPxx
Name[zh_CN]=RDP
Name[zh_TW]=RDP
Comment=Allows managing RDP sessions through KRDC
Comment[ast]=Permite la xestión de sesiones RDP per KRDC
Comment[bg]=Управление на сесии на RDP с KRDC
Comment[bs]=Dopušta upravljanje RPD sesijama kroz KRDC
Comment[ca]=Permet gestionar sessions RDP mitjançant el KRDC
Comment[ca@valencia]=Permet gestionar sessions RDP mitjançant el KRDC
Comment[cs]=Umožňuje spravování sezení RDP pomocí KRDC
Comment[da]=Muliggør håndtering af RDP-sessioner via KRDC
Comment[de]=Erlaubt die Verwaltung von RDP-Sitzungen über KRDC
Comment[el]=Επιτρέπει τη διαχείριση συνεδριών RDP μέσω του KRDC
Comment[en_GB]=Allows managing RDP sessions through KRDC
Comment[es]=Permite la gestión de sesiones RDP mediante KRDC
Comment[et]=RDP-seansside haldamise võimaldamine KRDC kaudu
Comment[eu]=RDP saioak KRDC bidez kudeatzea baimentzen du
Comment[fi]=Sallii RDP-istuntojen hallinnan KRDC:n kautta
Comment[fr]=Permet de gérer des sessions « RDP » au travers de KRDC
Comment[ga]=Ceadaíonn sé duit seisiúin RDP a bhainistiú trí KRDC
Comment[gl]=Permite xestionar sesións RDP por medio de KRDC
Comment[hr]=Omogućuje upravljanje sjednicama RDP-a kroz KRDC
Comment[hu]=RDP-kezelés KRDC-ből
Comment[ia]=Permitte gerer sessiones RDP per medio de KRDC
Comment[is]=Gefur kost á að stjórna RDP setum með KRDC
Comment[it]=Permette di gestire sessioni RDP con KRDC
Comment[ja]=KRDC RDP
Comment[kk]=KRDC арқылы RDP сеанстарын басқаруға мүмкіндік беру
Comment[km]= RDP KRDC
Comment[ko]=KRDC RDP
Comment[lt]=Leidžia valdyti RDP sesijas per KRDC
Comment[lv]=Ļauj pārvaldīt RDP sesijas caur KRDC
Comment[nb]=Tillater å styre RDP-økter gjennom KRDC
Comment[nds]=RDP-Törns över KRDC plegen
Comment[nl]=Staat het beheer van RDP-sessies toe via KRDC
Comment[nn]=Lèt deg handtera RDP-økter gjennom KRDC
Comment[pa]=KRDC RDP
Comment[pl]=Pozwala na zarządzanie sesjami RDP przez KRDC
Comment[pt]=Permite a gestão de sessões RDP através do KRDC
Comment[pt_BR]=Permite o gerenciamento de sessões RDP através do KRDC
Comment[ro]=Permite gestiunea sesiunilor RDP prin KRDC
Comment[ru]=Разрешить управление сеансами RDP через KRDC
Comment[si]=KRDC RDP
Comment[sk]=Umožňuje spravovanie RDP sedení pomocou KRDC
Comment[sl]=Omogoča upravljanje sej RDP prek KRDC
Comment[sr]=Управљање РДП сесијама кроз КРДЦ
Comment[sr@ijekavian]=Управљање РДП сесијама кроз КРДЦ
Comment[sr@ijekavianlatin]=Upravljanje RDP sesijama kroz KRDC
Comment[sr@latin]=Upravljanje RDP sesijama kroz KRDC
Comment[sv]=Tillåter hantering av RDP-sessioner via KRDC
Comment[th]= RDP KRDC
Comment[tr]=RDP oturumlarını KRDC üzerinden yönetmeye izin verir
Comment[uk]=Надає змогу керувати сеансами RDP за допомогою KRDC
Comment[x-test]=xxAllows managing RDP sessions through KRDCxx
Comment[zh_CN]= KRDC RDP
Comment[zh_TW]= KRDC RDP
X-KDE-PluginInfo-Author=Urs Wolfer
X-KDE-PluginInfo-Email=uwolfer@kde.org
X-KDE-PluginInfo-Version=1.0
X-KDE-PluginInfo-Category=Service
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=true
X-KDE-Library=krdc_rdpplugin
X-KDE-PluginInfo-Name=krdc_rdpplugin
X-KDE-KRDC-Sorting=60

View file

@ -0,0 +1,62 @@
[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KCModule
Name=RDP
Name[ast]=RDP
Name[bg]=RDP
Name[bs]=RDP
Name[ca]=RDP
Name[ca@valencia]=RDP
Name[cs]=RDP
Name[da]=RDP
Name[de]=RDP
Name[el]=RDP
Name[en_GB]=RDP
Name[eo]=RDP
Name[es]=RDP
Name[et]=RDP
Name[eu]=RDP
Name[fi]=RDP
Name[fr]=RDP
Name[ga]=RDP
Name[gl]=RDP
Name[hr]=RDP
Name[hu]=RDP
Name[ia]=RDP
Name[is]=RDP
Name[it]=RDP
Name[ja]=RDP
Name[kk]=RDP
Name[km]=RDP
Name[ko]=RDP
Name[lt]=RDP
Name[lv]=RDP
Name[mr]=--
Name[nb]=RDP
Name[nds]=RDP
Name[nl]=RDP
Name[nn]=RDP
Name[pa]=RDP
Name[pl]=RDP
Name[pt]=RDP
Name[pt_BR]=RDP
Name[ro]=RDP
Name[ru]=Базовая программа RDP
Name[si]=RDP
Name[sk]=RDP
Name[sl]=RDP
Name[sr]=РДП
Name[sr@ijekavian]=РДП
Name[sr@ijekavianlatin]=RDP
Name[sr@latin]=RDP
Name[sv]=RDP
Name[tr]=RDP
Name[ug]=RDP
Name[uk]=RDP
Name[wa]=RDP
Name[x-test]=xxRDPxx
Name[zh_CN]=RDP
Name[zh_TW]=RDP
X-KDE-Library=kcm_krdc_rdpplugin
X-KDE-ParentComponents=krdc_rdpplugin

12
krdc/rdp/rdp.protocol Normal file
View file

@ -0,0 +1,12 @@
[Protocol]
exec=krdc '%u'
protocol=rdp
input=none
output=none
helper=true
listing=
reading=false
writing=false
makedir=false
deleting=false
Icon=krdc

View file

@ -0,0 +1,274 @@
/****************************************************************************
**
** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "rdphostpreferences.h"
#include "settings.h"
#include <KDebug>
#include <QDesktopWidget>
static const QStringList keymaps = (QStringList()
<< "ar"
<< "cs"
<< "da"
<< "de"
<< "de-ch"
<< "en-dv"
<< "en-gb"
<< "en-us"
<< "es"
<< "et"
<< "fi"
<< "fo"
<< "fr"
<< "fr-be"
<< "fr-ca"
<< "fr-ch"
<< "he"
<< "hr"
<< "hu"
<< "is"
<< "it"
<< "ja"
<< "ko"
<< "lt"
<< "lv"
<< "mk"
<< "nl"
<< "nl-be"
<< "no"
<< "pl"
<< "pt"
<< "pt-br"
<< "ru"
<< "sl"
<< "sv"
<< "th"
<< "tr"
);
static const int defaultKeymap = 7; // en-us
inline int keymap2int(const QString &keymap)
{
const int index = keymaps.lastIndexOf(keymap);
return (index == -1) ? defaultKeymap : index;
}
inline QString int2keymap(int layout)
{
if (layout >= 0 && layout < keymaps.count())
return keymaps.at(layout);
else
return keymaps.at(defaultKeymap);
}
RdpHostPreferences::RdpHostPreferences(KConfigGroup configGroup, QObject *parent)
: HostPreferences(configGroup, parent)
{
}
RdpHostPreferences::~RdpHostPreferences()
{
}
QWidget* RdpHostPreferences::createProtocolSpecificConfigPage()
{
QWidget *rdpPage = new QWidget();
rdpUi.setupUi(rdpPage);
rdpUi.loginGroupBox->setVisible(false);
rdpUi.kcfg_Height->setValue(height());
rdpUi.kcfg_Width->setValue(width());
rdpUi.kcfg_ColorDepth->setCurrentIndex(colorDepth());
rdpUi.kcfg_KeyboardLayout->setCurrentIndex(keymap2int(keyboardLayout()));
rdpUi.kcfg_Sound->setCurrentIndex(sound());
rdpUi.kcfg_Console->setChecked(console());
rdpUi.kcfg_ExtraOptions->setText(extraOptions());
rdpUi.kcfg_RemoteFX->setChecked(remoteFX());
rdpUi.kcfg_Performance->setCurrentIndex(performance());
rdpUi.kcfg_ShareMedia->setText(shareMedia());
connect(rdpUi.resolutionComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateWidthHeight(int)));
const QString resolutionString = QString::number(width()) + 'x' + QString::number(height());
const int resolutionIndex = rdpUi.resolutionComboBox->findText(resolutionString, Qt::MatchContains);
rdpUi.resolutionComboBox->setCurrentIndex((resolutionIndex == -1) ? rdpUi.resolutionComboBox->count() - 2 : resolutionIndex); // - 2 is index of custom resolution
return rdpPage;
}
void RdpHostPreferences::updateWidthHeight(int index)
{
switch (index) {
case 0:
rdpUi.kcfg_Height->setValue(480);
rdpUi.kcfg_Width->setValue(640);
break;
case 1:
rdpUi.kcfg_Height->setValue(600);
rdpUi.kcfg_Width->setValue(800);
break;
case 2:
rdpUi.kcfg_Height->setValue(768);
rdpUi.kcfg_Width->setValue(1024);
break;
case 3:
rdpUi.kcfg_Height->setValue(1024);
rdpUi.kcfg_Width->setValue(1280);
break;
case 4:
rdpUi.kcfg_Height->setValue(1200);
rdpUi.kcfg_Width->setValue(1600);
break;
case 5: {
QDesktopWidget *desktop = QApplication::desktop();
int currentScreen = desktop->screenNumber(rdpUi.kcfg_Height);
rdpUi.kcfg_Height->setValue(desktop->screenGeometry(currentScreen).height());
rdpUi.kcfg_Width->setValue(desktop->screenGeometry(currentScreen).width());
break;
}
case 7:
rdpUi.kcfg_Height->setValue(0);
rdpUi.kcfg_Width->setValue(0);
break;
case 6:
default:
break;
}
const bool enabled = (index == 6) ? true : false;
rdpUi.kcfg_Height->setEnabled(enabled);
rdpUi.kcfg_Width->setEnabled(enabled);
rdpUi.heightLabel->setEnabled(enabled);
rdpUi.widthLabel->setEnabled(enabled);
}
void RdpHostPreferences::acceptConfig()
{
HostPreferences::acceptConfig();
setHeight(rdpUi.kcfg_Height->value());
setWidth(rdpUi.kcfg_Width->value());
setColorDepth(rdpUi.kcfg_ColorDepth->currentIndex());
setKeyboardLayout(int2keymap(rdpUi.kcfg_KeyboardLayout->currentIndex()));
setSound(rdpUi.kcfg_Sound->currentIndex());
setConsole(rdpUi.kcfg_Console->isChecked());
setExtraOptions(rdpUi.kcfg_ExtraOptions->text());
setRemoteFX(rdpUi.kcfg_RemoteFX->isChecked());
setPerformance(rdpUi.kcfg_Performance->currentIndex());
setShareMedia(rdpUi.kcfg_ShareMedia->text());
}
void RdpHostPreferences::setColorDepth(int colorDepth)
{
if (colorDepth >= 0)
m_configGroup.writeEntry("colorDepth", colorDepth);
}
int RdpHostPreferences::colorDepth() const
{
return m_configGroup.readEntry("colorDepth", Settings::colorDepth());
}
void RdpHostPreferences::setKeyboardLayout(const QString &keyboardLayout)
{
if (!keyboardLayout.isNull())
m_configGroup.writeEntry("keyboardLayout", keymap2int(keyboardLayout));
}
QString RdpHostPreferences::keyboardLayout() const
{
return int2keymap(m_configGroup.readEntry("keyboardLayout", Settings::keyboardLayout()));
}
void RdpHostPreferences::setSound(int sound)
{
if (sound >= 0)
m_configGroup.writeEntry("sound", sound);
}
int RdpHostPreferences::sound() const
{
return m_configGroup.readEntry("sound", Settings::sound());
}
void RdpHostPreferences::setConsole(bool console)
{
m_configGroup.writeEntry("console", console);
}
bool RdpHostPreferences::console() const
{
return m_configGroup.readEntry("console", Settings::console());
}
void RdpHostPreferences::setExtraOptions(const QString &extraOptions)
{
if (!extraOptions.isNull())
m_configGroup.writeEntry("extraOptions", extraOptions);
}
QString RdpHostPreferences::extraOptions() const
{
return m_configGroup.readEntry("extraOptions", Settings::extraOptions());
}
void RdpHostPreferences::setRemoteFX(bool remoteFX)
{
m_configGroup.writeEntry("remoteFX", remoteFX);
}
bool RdpHostPreferences::remoteFX() const
{
return m_configGroup.readEntry("remoteFX", Settings::remoteFX());
}
void RdpHostPreferences::setPerformance(int performance)
{
if (performance >= 0)
m_configGroup.writeEntry("performance", performance);
}
int RdpHostPreferences::performance() const
{
return m_configGroup.readEntry("performance", Settings::performance());
}
void RdpHostPreferences::setShareMedia(const QString &shareMedia)
{
if (!shareMedia.isNull())
m_configGroup.writeEntry("shareMedia", shareMedia);
}
QString RdpHostPreferences::shareMedia() const
{
return m_configGroup.readEntry("shareMedia", Settings::shareMedia());
}
#include "rdphostpreferences.moc"

View file

@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef RDPHOSTPREFERENCES_H
#define RDPHOSTPREFERENCES_H
#include "hostpreferences.h"
#include "ui_rdppreferences.h"
class RdpHostPreferences : public HostPreferences
{
Q_OBJECT
public:
explicit RdpHostPreferences(KConfigGroup configGroup, QObject *parent = 0);
~RdpHostPreferences();
void setColorDepth(int colorDepth);
int colorDepth() const;
void setKeyboardLayout(const QString &keyboardLayout);
QString keyboardLayout() const;
void setSound(int sound);
int sound() const;
void setConsole(bool console);
bool console() const;
void setExtraOptions(const QString &extraOptions);
QString extraOptions() const;
void setRemoteFX(bool remoteFX);
bool remoteFX() const;
void setPerformance(int performance);
int performance() const;
void setShareMedia(const QString &shareMedia);
QString shareMedia() const;
protected:
QWidget* createProtocolSpecificConfigPage();
void acceptConfig();
private:
Ui::RdpPreferences rdpUi;
private slots:
void updateWidthHeight(int index);
};
#endif

View file

@ -0,0 +1,66 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "rdppreferences.h"
#include "remoteviewfactory.h"
#include "settings.h"
#include "ui_rdppreferences.h"
#include <KDebug>
KRDC_PLUGIN_EXPORT(RdpPreferences)
RdpPreferences::RdpPreferences(QWidget *parent, const QVariantList &args)
: KCModule(KrdcFactory::componentData(), parent, args)
{
Ui::RdpPreferences rdpUi;
rdpUi.setupUi(this);
// would need a lot of code duplication. find a solution, bit it's not
// that important because you will not change this configuration each day...
// see rdp/rdphostpreferences.cpp
rdpUi.resolutionComboBox->hide();
rdpUi.resolutionDummyLabel->hide();
rdpUi.kcfg_Height->setEnabled(true);
rdpUi.kcfg_Width->setEnabled(true);
rdpUi.heightLabel->setEnabled(true);
rdpUi.widthLabel->setEnabled(true);
addConfig(Settings::self(), this);
}
RdpPreferences::~RdpPreferences()
{
}
void RdpPreferences::load()
{
KCModule::load();
}
void RdpPreferences::save()
{
KCModule::save();
}
#include "rdppreferences.moc"

44
krdc/rdp/rdppreferences.h Normal file
View file

@ -0,0 +1,44 @@
/****************************************************************************
**
** Copyright (C) 2008 Urs Wolfer <uwolfer @ kde.org>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef RDPPREFERENCES_H
#define RDPPREFERENCES_H
#include "rdphostpreferences.h"
#include <KCModule>
class RdpPreferences : public KCModule
{
Q_OBJECT
public:
explicit RdpPreferences(QWidget *parent = 0, const QVariantList &args = QVariantList());
~RdpPreferences();
virtual void save();
virtual void load();
};
#endif // RDPPREFERENCES_H

668
krdc/rdp/rdppreferences.ui Normal file
View file

@ -0,0 +1,668 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RdpPreferences</class>
<widget class="QWidget" name="RdpPreferences">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>484</width>
<height>452</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="connectionGroupBox">
<property name="title">
<string>Connection</string>
</property>
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="resolutionLabel">
<property name="text">
<string>Desktop &amp;resolution:</string>
</property>
<property name="buddy">
<cstring>resolutionComboBox</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="resolutionDummyLabel"/>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout">
<item>
<widget class="KComboBox" name="resolutionComboBox">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis">
<string>Here you can specify the resolution of the remote desktop. This resolution determines the size of the desktop that will be presented to you.</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>Minimal (640x480)</string>
</property>
</item>
<item>
<property name="text">
<string>Small (800x600)</string>
</property>
</item>
<item>
<property name="text">
<string>Normal (1024x768)</string>
</property>
</item>
<item>
<property name="text">
<string>Large (1280x1024)</string>
</property>
</item>
<item>
<property name="text">
<string>Very Large (1600x1200)</string>
</property>
</item>
<item>
<property name="text">
<string>Current Screen Resolution</string>
</property>
</item>
<item>
<property name="text">
<string>Custom Resolution (...)</string>
</property>
</item>
<item>
<property name="text">
<string>Current KRDC Size</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout">
<item>
<widget class="QLabel" name="widthLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>&amp;Width:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Width</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_Width">
<property name="enabled">
<bool>false</bool>
</property>
<property name="whatsThis">
<string>This is the width of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above.</string>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>800</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="heightLabel">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>H&amp;eight:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>kcfg_Height</cstring>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="kcfg_Height">
<property name="enabled">
<bool>false</bool>
</property>
<property name="whatsThis">
<string>This is the height of the remote desktop. You can only change this value manually if you select Custom as desktop resolution above.</string>
</property>
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="colorDepthLabel">
<property name="text">
<string>Color &amp;depth:</string>
</property>
<property name="buddy">
<cstring>kcfg_ColorDepth</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KComboBox" name="kcfg_ColorDepth">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>Low Color (8 Bit)</string>
</property>
</item>
<item>
<property name="text">
<string>High Color (16 Bit)</string>
</property>
</item>
<item>
<property name="text">
<string>True Color (24 Bit)</string>
</property>
</item>
<item>
<property name="text">
<string>True Color with Alpha (32 Bit)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="layoutLabel">
<property name="text">
<string>&amp;Keyboard layout:</string>
</property>
<property name="buddy">
<cstring>kcfg_KeyboardLayout</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="KComboBox" name="kcfg_KeyboardLayout">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis">
<string>Use this to specify your keyboard layout. This layout setting is used to send the correct keyboard codes to the server.</string>
</property>
<property name="currentIndex">
<number>7</number>
</property>
<item>
<property name="text">
<string>Arabic (ar)</string>
</property>
</item>
<item>
<property name="text">
<string>Czech (cs)</string>
</property>
</item>
<item>
<property name="text">
<string>Danish (da)</string>
</property>
</item>
<item>
<property name="text">
<string>German (de)</string>
</property>
</item>
<item>
<property name="text">
<string>Swiss German (de-ch)</string>
</property>
</item>
<item>
<property name="text">
<string>American Dvorak (en-dv)</string>
</property>
</item>
<item>
<property name="text">
<string>British English (en-gb)</string>
</property>
</item>
<item>
<property name="text">
<string>US English (en-us)</string>
</property>
</item>
<item>
<property name="text">
<string>Spanish (es)</string>
</property>
</item>
<item>
<property name="text">
<string>Estonian (et)</string>
</property>
</item>
<item>
<property name="text">
<string>Finnish (fi)</string>
</property>
</item>
<item>
<property name="text">
<string>Faroese (fo)</string>
</property>
</item>
<item>
<property name="text">
<string>French (fr)</string>
</property>
</item>
<item>
<property name="text">
<string>Belgian (fr-be)</string>
</property>
</item>
<item>
<property name="text">
<string>French Canadian (fr-ca)</string>
</property>
</item>
<item>
<property name="text">
<string>Swiss French (fr-ch)</string>
</property>
</item>
<item>
<property name="text">
<string>Hebrew (he)</string>
</property>
</item>
<item>
<property name="text">
<string>Croatian (hr)</string>
</property>
</item>
<item>
<property name="text">
<string>Hungarian (hu)</string>
</property>
</item>
<item>
<property name="text">
<string>Icelandic (is)</string>
</property>
</item>
<item>
<property name="text">
<string>Italian (it)</string>
</property>
</item>
<item>
<property name="text">
<string>Japanese (ja)</string>
</property>
</item>
<item>
<property name="text">
<string>Korean (ko)</string>
</property>
</item>
<item>
<property name="text">
<string>Lithuanian (lt)</string>
</property>
</item>
<item>
<property name="text">
<string>Latvian (lv)</string>
</property>
</item>
<item>
<property name="text">
<string>Macedonian (mk)</string>
</property>
</item>
<item>
<property name="text">
<string>Dutch (nl)</string>
</property>
</item>
<item>
<property name="text">
<string>Belgian Dutch (nl-be)</string>
</property>
</item>
<item>
<property name="text">
<string>Norwegian (no)</string>
</property>
</item>
<item>
<property name="text">
<string>Polish (pl)</string>
</property>
</item>
<item>
<property name="text">
<string>Portuguese (pt)</string>
</property>
</item>
<item>
<property name="text">
<string>Brazilian (pt-br)</string>
</property>
</item>
<item>
<property name="text">
<string>Russian (ru)</string>
</property>
</item>
<item>
<property name="text">
<string>Slovenian (sl)</string>
</property>
</item>
<item>
<property name="text">
<string>Swedish (sv)</string>
</property>
</item>
<item>
<property name="text">
<string>Thai (th)</string>
</property>
</item>
<item>
<property name="text">
<string>Turkish (tr)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="soundLabel">
<property name="text">
<string comment="label for soundsettings in preferences dialog">Sound:</string>
</property>
<property name="buddy">
<cstring>kcfg_Sound</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="KComboBox" name="kcfg_Sound">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>On This Computer</string>
</property>
</item>
<item>
<property name="text">
<string>On Remote Computer</string>
</property>
</item>
<item>
<property name="text">
<string>Disable Sound</string>
</property>
</item>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="performanceLabel">
<property name="text">
<string comment="label for performance settings in preferences dialog">Performance:</string>
</property>
<property name="buddy">
<cstring>kcfg_Performance</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="KComboBox" name="kcfg_Performance">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<item>
<property name="text">
<string>Modem</string>
</property>
</item>
<item>
<property name="text">
<string>Broadband</string>
</property>
</item>
<item>
<property name="text">
<string>LAN</string>
</property>
</item>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="remoteFXLabel">
<property name="text">
<string>RemoteFX:</string>
</property>
<property name="buddy">
<cstring>kcfg_RemoteFX</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QCheckBox" name="kcfg_RemoteFX">
<property name="text">
<string>Enhanced visual experience</string>
</property>
<property name="whatsThis">
<string>RemoteFX covers a set of technologies that enhance visual experience of the Remote Desktop Protocol.</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="shareMediaLabel">
<property name="text">
<string>Share Media:</string>
</property>
<property name="buddy">
<cstring>kcfg_ShareMedia</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="KLineEdit" name="kcfg_ShareMedia">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis">
<string>Share a local media directory with the remote host.</string>
</property>
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="expertGroupBox">
<property name="title">
<string>Expert Options</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="consoleLabel">
<property name="text">
<string>Console login:</string>
</property>
<property name="buddy">
<cstring>kcfg_Console</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="kcfg_Console">
<property name="text">
<string>Attach to Windows Server console</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="extraOptionsLabel">
<property name="text">
<string>Extra options:</string>
</property>
<property name="buddy">
<cstring>kcfg_ExtraOptions</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="kcfg_ExtraOptions">
<property name="minimumSize">
<size>
<width>280</width>
<height>0</height>
</size>
</property>
<property name="whatsThis">
<string>Here you can enter additional xfreerdp (FreeRDP) options.</string>
</property>
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="loginGroupBox">
<property name="title">
<string>Login</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="1" column="0">
<widget class="QLabel" name="defaultUserLabel">
<property name="text">
<string>Default user name:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="KLineEdit" name="kcfg_DefaultRdpUserName">
<property name="clickMessage">
<string>No default user name</string>
</property>
<property name="showClearButton" stdset="0">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_RecognizeLdapLogins">
<property name="text">
<string>Automatically recognize &quot;LDAP&quot;-Logins and share passwords</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>428</width>
<height>16</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>KComboBox</class>
<extends>QComboBox</extends>
<header>kcombobox.h</header>
</customwidget>
<customwidget>
<class>KLineEdit</class>
<extends>QLineEdit</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>resolutionComboBox</tabstop>
<tabstop>kcfg_Width</tabstop>
<tabstop>kcfg_Height</tabstop>
<tabstop>kcfg_ColorDepth</tabstop>
<tabstop>kcfg_KeyboardLayout</tabstop>
<tabstop>kcfg_Sound</tabstop>
<tabstop>kcfg_Performance</tabstop>
<tabstop>kcfg_RemoteFX</tabstop>
<tabstop>kcfg_ShareMedia</tabstop>
<tabstop>kcfg_Console</tabstop>
<tabstop>kcfg_ExtraOptions</tabstop>
<tabstop>kcfg_DefaultRdpUserName</tabstop>
<tabstop>kcfg_RecognizeLdapLogins</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

555
krdc/rdp/rdpview.cpp Normal file
View file

@ -0,0 +1,555 @@
/****************************************************************************
**
** Copyright (C) 2002 Arend van Beelen jr. <arend@auton.nl>
** Copyright (C) 2007 - 2012 Urs Wolfer <uwolfer @ kde.org>
** Copyright (C) 2012 AceLan Kao <acelan @ acelan.idv.tw>
**
** This file is part of KDE.
**
** 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; see the file COPYING. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#include "rdpview.h"
#include "settings.h"
#include <KInputDialog>
#include <KMessageBox>
#include <KPasswordDialog>
#include <KShell>
#include <QX11EmbedContainer>
#include <QEvent>
RdpView::RdpView(QWidget *parent,
const KUrl &url,
KConfigGroup configGroup,
const QString &user, const QString &password)
: RemoteView(parent),
m_user(user),
m_password(password),
m_quitFlag(false),
m_process(NULL)
{
m_url = url;
m_host = url.host();
m_port = url.port();
if (m_port <= 0) {
m_port = TCP_PORT_RDP;
}
m_container = new QX11EmbedContainer(this);
m_container->installEventFilter(this);
m_hostPreferences = new RdpHostPreferences(configGroup, this);
}
RdpView::~RdpView()
{
startQuitting();
}
// filter out key and mouse events to the container if we are view only
//FIXME: X11 events are passed to the app before getting caught in the Qt event processing
bool RdpView::eventFilter(QObject *obj, QEvent *event)
{
if (m_viewOnly) {
if (event->type() == QEvent::KeyPress ||
event->type() == QEvent::KeyRelease ||
event->type() == QEvent::MouseButtonDblClick ||
event->type() == QEvent::MouseButtonPress ||
event->type() == QEvent::MouseButtonRelease ||
event->type() == QEvent::MouseMove)
return true;
}
return RemoteView::eventFilter(obj, event);
}
QSize RdpView::framebufferSize()
{
return m_container->minimumSizeHint();
}
QSize RdpView::sizeHint() const
{
return maximumSize();
}
void RdpView::startQuitting()
{
kDebug(5012) << "About to quit";
m_quitFlag = true;
if (m_process) {
m_process->terminate();
m_process->waitForFinished(1000);
m_container->discardClient();
}
}
bool RdpView::isQuitting()
{
return m_quitFlag;
}
bool RdpView::start()
{
m_container->show();
if (m_url.userName().isEmpty()) {
QString userName;
bool ok = false;
userName = KInputDialog::getText(i18n("Enter Username"),
i18n("Please enter the username you would like to use for login."),
Settings::defaultRdpUserName(), &ok, this);
if (ok) {
m_url.setUserName(userName);
}
}
if (!m_url.userName().isEmpty()) {
const bool useLdapLogin = Settings::recognizeLdapLogins() && m_url.userName().contains('\\');
kDebug(5012) << "Is LDAP login:" << useLdapLogin << m_url.userName();
QString walletPassword = QString();
if (m_hostPreferences->walletSupport()) {
walletPassword = readWalletPassword(useLdapLogin);
}
if (!walletPassword.isNull()) {
m_url.setPassword(walletPassword);
} else {
KPasswordDialog dialog(this);
dialog.setPrompt(i18n("Access to the system requires a password."));
if (dialog.exec() == KPasswordDialog::Accepted) {
m_url.setPassword(dialog.password());
if (m_hostPreferences->walletSupport()) {
saveWalletPassword(dialog.password(), useLdapLogin);
}
}
}
}
m_process = new QProcess(m_container);
QStringList arguments;
int width, height;
if (m_hostPreferences->width() > 0) {
width = m_hostPreferences->width();
height = m_hostPreferences->height();
} else {
width = this->parentWidget()->size().width();
height = this->parentWidget()->size().height();
}
arguments << "-g" << QString::number(width) + 'x' + QString::number(height);
arguments << "-k" << keymapToXfreerdp(m_hostPreferences->keyboardLayout());
if (!m_url.userName().isEmpty()) {
// if username contains a domain, it needs to be set with another parameter
if (m_url.userName().contains('\\')) {
const QStringList splittedName = m_url.userName().split('\\');
arguments << "-d" << splittedName.at(0);
arguments << "-u" << splittedName.at(1);
} else {
arguments << "-u" << m_url.userName();
}
} else {
arguments << "-u" << "";
}
if (!m_url.password().isNull())
arguments << "-p" << m_url.password();
arguments << "-D"; // request the window has no decorations
arguments << "-X" << QString::number(m_container->winId());
arguments << "-a" << QString::number((m_hostPreferences->colorDepth() + 1) * 8);
switch (m_hostPreferences->sound()) {
case 1:
arguments << "-o";
break;
case 0:
arguments << "--plugin" << "rdpsnd";
break;
case 2:
default:
break;
}
if (!m_hostPreferences->shareMedia().isEmpty()) {
QStringList shareMedia;
shareMedia << "--plugin" << "rdpdr" << "--data" << "disk:media:" + m_hostPreferences->shareMedia() << "--";
arguments += shareMedia;
}
QString performance;
switch (m_hostPreferences->performance()) {
case 0:
performance = 'm';
break;
case 1:
performance = 'b';
break;
case 2:
performance = 'l';
break;
default:
break;
}
arguments << "-x" << performance;
if (m_hostPreferences->console()) {
arguments << "-0";
}
if (m_hostPreferences->remoteFX()) {
arguments << "--rfx";
}
if (!m_hostPreferences->extraOptions().isEmpty()) {
const QStringList additionalArguments = KShell::splitArgs(m_hostPreferences->extraOptions());
arguments += additionalArguments;
}
// krdc has no support for certificate management yet; it would not be possbile to connect to any host:
// "The host key for example.com has changed" ...
// "Add correct host key in ~/.freerdp/known_hosts to get rid of this message."
arguments << "--ignore-certificate";
// clipboard sharing is activated in KRDC; user can disable it at runtime
arguments << "--plugin" << "cliprdr";
arguments << "-t" << QString::number(m_port);
arguments << m_host;
kDebug(5012) << "Starting xfreerdp with arguments:" << arguments;
setStatus(Connecting);
connect(m_process, SIGNAL(error(QProcess::ProcessError)), SLOT(processError(QProcess::ProcessError)));
connect(m_process, SIGNAL(readyReadStandardError()), SLOT(receivedStandardError()));
connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(receivedStandardOutput()));
connect(m_container, SIGNAL(clientClosed()), SLOT(connectionClosed()));
connect(m_container, SIGNAL(clientIsEmbedded()), SLOT(connectionOpened()));
m_process->start("xfreerdp", arguments);
return true;
}
HostPreferences* RdpView::hostPreferences()
{
return m_hostPreferences;
}
void RdpView::switchFullscreen(bool on)
{
if (on == true) {
m_container->grabKeyboard();
}
}
void RdpView::connectionOpened()
{
kDebug(5012) << "Connection opened";
const QSize size = m_container->minimumSizeHint();
kDebug(5012) << "Size hint: " << size.width() << " " << size.height();
setStatus(Connected);
setFixedSize(size);
resize(size);
m_container->setFixedSize(size);
emit framebufferSizeChanged(size.width(), size.height());
emit connected();
setFocus();
}
QPixmap RdpView::takeScreenshot()
{
return QPixmap::grabWindow(m_container->clientWinId());
}
void RdpView::connectionClosed()
{
emit disconnected();
setStatus(Disconnected);
m_quitFlag = true;
}
void RdpView::connectionError()
{
emit disconnectedError();
connectionClosed();
}
void RdpView::processError(QProcess::ProcessError error)
{
kDebug(5012) << "processError:" << error;
if (m_quitFlag) // do not try to show error messages while quitting (prevent crashes)
return;
if (m_status == Connecting) {
if (error == QProcess::FailedToStart) {
KMessageBox::error(0, i18n("Could not start \"xfreerdp\"; make sure xfreerdp is properly installed."),
i18n("RDP Failure"));
connectionError();
return;
}
}
}
void RdpView::receivedStandardError()
{
const QString output(m_process->readAllStandardError());
kDebug(5012) << "receivedStandardError:" << output;
QString line;
int i = 0;
while (!(line = output.section('\n', i, i)).isEmpty()) {
// the following error is issued by freerdp because of a bug in freerdp 1.0.1 and below;
// see: https://github.com/FreeRDP/FreeRDP/pull/576
//"X Error of failed request: BadWindow (invalid Window parameter)
// Major opcode of failed request: 7 (X_ReparentWindow)
// Resource id in failed request: 0x71303348
// Serial number of failed request: 36
// Current serial number in output stream: 36"
if (line.contains(QLatin1String("X_ReparentWindow"))) {
KMessageBox::error(0, i18n("The version of \"xfreerdp\" you are using is too old.\n"
"xfreerdp 1.0.2 or greater is required."),
i18n("RDP Failure"));
connectionError();
return;
}
i++;
}
}
void RdpView::receivedStandardOutput()
{
const QString output(m_process->readAllStandardOutput());
kDebug(5012) << "receivedStandardOutput:" << output;
QString line;
int i = 0;
while (!(line = output.section('\n', i, i)).isEmpty()) {
// full xfreerdp message: "transport_connect: getaddrinfo (Name or service not known)"
if (line.contains(QLatin1String("Name or service not known"))) {
KMessageBox::error(0, i18n("Name or service not known."),
i18n("Connection Failure"));
connectionError();
return;
// full xfreerdp message: "unable to connect to example.com:3389"
} else if (line.contains(QLatin1String("unable to connect to"))) {
KMessageBox::error(0, i18n("Connection attempt to host failed."),
i18n("Connection Failure"));
connectionError();
return;
// looks like some generic xfreerdp error message, handle it if nothing was handled:
// "Error: protocol security negotiation failure"
} else if (line.contains(QLatin1String("Error: protocol security negotiation failure"))) {
KMessageBox::error(0, i18n("Connection attempt to host failed."),
i18n("Connection Failure"));
connectionError();
return;
}
i++;
}
}
void RdpView::setGrabAllKeys(bool grabAllKeys)
{
Q_UNUSED(grabAllKeys);
// do nothing.. grabKeyboard seems not to be supported in QX11EmbedContainer
}
QString RdpView::keymapToXfreerdp(const QString &keyboadLayout)
{
if (keymapToXfreerdpHash.isEmpty()) {
keymapToXfreerdpHash = initKeymapToXfreerdp();
}
return keymapToXfreerdpHash[keyboadLayout];
}
// list of xfreerdp --kbd-list
// this is a mapping for rdesktop comptibilty (old settings will still work)
// needs to be completed (when not in message freeze; needs new localization)
QHash<QString, QString> RdpView::initKeymapToXfreerdp()
{
QHash<QString, QString> keymapToXfreerdpHash;
// Keyboard Layouts
keymapToXfreerdpHash["ar"] = "0x00000401"; // Arabic (101)
// keymapToXfreerdpHash[""] = "0x00000402"; // Bulgarian
// keymapToXfreerdpHash[""] = "0x00000404"; // Chinese (Traditional) - US Keyboard
keymapToXfreerdpHash["cs"] = "0x00000405"; // Czech
keymapToXfreerdpHash["da"] = "0x00000406"; // Danish
keymapToXfreerdpHash["fo"] = "0x00000406"; // Danish, Faroese; legacy for rdesktop
keymapToXfreerdpHash["de"] = "0x00000407"; // German
// keymapToXfreerdpHash[""] = "0x00000408"; // Greek
keymapToXfreerdpHash["en-us"] = "0x00000409"; // US
keymapToXfreerdpHash["es"] = "0x0000040A"; // Spanish
keymapToXfreerdpHash["fi"] = "0x0000040B"; // Finnish
keymapToXfreerdpHash["fr"] = "0x0000040C"; // French
keymapToXfreerdpHash["he"] = "0x0000040D"; // Hebrew
keymapToXfreerdpHash["hu"] = "0x0000040E"; // Hungarian
keymapToXfreerdpHash["is"] = "0x0000040F"; // Icelandic
keymapToXfreerdpHash["it"] = "0x00000410"; // Italian
keymapToXfreerdpHash["ja"] = "0x00000411"; // Japanese
keymapToXfreerdpHash["ko"] = "0x00000412"; // Korean
keymapToXfreerdpHash["nl"] = "0x00000413"; // Dutch
keymapToXfreerdpHash["no"] = "0x00000414"; // Norwegian
keymapToXfreerdpHash["pl"] = "0x00000415"; // Polish (Programmers)
keymapToXfreerdpHash["pt-br"] = "0x00000416"; // Portuguese (Brazilian ABNT)
// keymapToXfreerdpHash[""] = "0x00000418"; // Romanian
keymapToXfreerdpHash["ru"] = "0x00000419"; // Russian
keymapToXfreerdpHash["hr"] = "0x0000041A"; // Croatian
// keymapToXfreerdpHash[""] = "0x0000041B"; // Slovak
// keymapToXfreerdpHash[""] = "0x0000041C"; // Albanian
keymapToXfreerdpHash["sv"] = "0x0000041D"; // Swedish
keymapToXfreerdpHash["th"] = "0x0000041E"; // Thai Kedmanee
keymapToXfreerdpHash["tr"] = "0x0000041F"; // Turkish Q
// keymapToXfreerdpHash[""] = "0x00000420"; // Urdu
// keymapToXfreerdpHash[""] = "0x00000422"; // Ukrainian
// keymapToXfreerdpHash[""] = "0x00000423"; // Belarusian
keymapToXfreerdpHash["sl"] = "0x00000424"; // Slovenian
keymapToXfreerdpHash["et"] = "0x00000425"; // Estonian
keymapToXfreerdpHash["lv"] = "0x00000426"; // Latvian
keymapToXfreerdpHash["lt"] = "0x00000427"; // Lithuanian IBM
// keymapToXfreerdpHash[""] = "0x00000429"; // Farsi
// keymapToXfreerdpHash[""] = "0x0000042A"; // Vietnamese
// keymapToXfreerdpHash[""] = "0x0000042B"; // Armenian Eastern
// keymapToXfreerdpHash[""] = "0x0000042C"; // Azeri Latin
keymapToXfreerdpHash["mk"] = "0x0000042F"; // FYRO Macedonian
// keymapToXfreerdpHash[""] = "0x00000437"; // Georgian
// keymapToXfreerdpHash[""] = "0x00000438"; // Faeroese
// keymapToXfreerdpHash[""] = "0x00000439"; // Devanagari - INSCRIPT
// keymapToXfreerdpHash[""] = "0x0000043A"; // Maltese 47-key
// keymapToXfreerdpHash[""] = "0x0000043B"; // Norwegian with Sami
// keymapToXfreerdpHash[""] = "0x0000043F"; // Kazakh
// keymapToXfreerdpHash[""] = "0x00000440"; // Kyrgyz Cyrillic
// keymapToXfreerdpHash[""] = "0x00000444"; // Tatar
// keymapToXfreerdpHash[""] = "0x00000445"; // Bengali
// keymapToXfreerdpHash[""] = "0x00000446"; // Punjabi
// keymapToXfreerdpHash[""] = "0x00000447"; // Gujarati
// keymapToXfreerdpHash[""] = "0x00000449"; // Tamil
// keymapToXfreerdpHash[""] = "0x0000044A"; // Telugu
// keymapToXfreerdpHash[""] = "0x0000044B"; // Kannada
// keymapToXfreerdpHash[""] = "0x0000044C"; // Malayalam
// keymapToXfreerdpHash[""] = "0x0000044E"; // Marathi
// keymapToXfreerdpHash[""] = "0x00000450"; // Mongolian Cyrillic
// keymapToXfreerdpHash[""] = "0x00000452"; // United Kingdom Extended
// keymapToXfreerdpHash[""] = "0x0000045A"; // Syriac
// keymapToXfreerdpHash[""] = "0x00000461"; // Nepali
// keymapToXfreerdpHash[""] = "0x00000463"; // Pashto
// keymapToXfreerdpHash[""] = "0x00000465"; // Divehi Phonetic
// keymapToXfreerdpHash[""] = "0x0000046E"; // Luxembourgish
// keymapToXfreerdpHash[""] = "0x00000481"; // Maori
// keymapToXfreerdpHash[""] = "0x00000804"; // Chinese (Simplified) - US Keyboard
keymapToXfreerdpHash["de-ch"] = "0x00000807"; // Swiss German
keymapToXfreerdpHash["en-gb"] = "0x00000809"; // United Kingdom
// keymapToXfreerdpHash[""] = "0x0000080A"; // Latin American
keymapToXfreerdpHash["fr-be"] = "0x0000080C"; // Belgian French
keymapToXfreerdpHash["nl-be"] = "0x00000813"; // Belgian (Period)
keymapToXfreerdpHash["pt"] = "0x00000816"; // Portuguese
// keymapToXfreerdpHash[""] = "0x0000081A"; // Serbian (Latin)
// keymapToXfreerdpHash[""] = "0x0000082C"; // Azeri Cyrillic
// keymapToXfreerdpHash[""] = "0x0000083B"; // Swedish with Sami
// keymapToXfreerdpHash[""] = "0x00000843"; // Uzbek Cyrillic
// keymapToXfreerdpHash[""] = "0x0000085D"; // Inuktitut Latin
// keymapToXfreerdpHash[""] = "0x00000C0C"; // Canadian French (legacy)
// keymapToXfreerdpHash[""] = "0x00000C1A"; // Serbian (Cyrillic)
keymapToXfreerdpHash["fr-ca"] = "0x00001009"; // Canadian French
keymapToXfreerdpHash["fr-ch"] = "0x0000100C"; // Swiss French
// keymapToXfreerdpHash[""] = "0x0000141A"; // Bosnian
// keymapToXfreerdpHash[""] = "0x00001809"; // Irish
// keymapToXfreerdpHash[""] = "0x0000201A"; // Bosnian Cyrillic
// Keyboard Layout Variants
// keymapToXfreerdpHash[""] = "0x00010401"; // Arabic (102)
// keymapToXfreerdpHash[""] = "0x00010402"; // Bulgarian (Latin)
// keymapToXfreerdpHash[""] = "0x00010405"; // Czech (QWERTY)
// keymapToXfreerdpHash[""] = "0x00010407"; // German (IBM)
// keymapToXfreerdpHash[""] = "0x00010408"; // Greek (220)
keymapToXfreerdpHash["en-dv"] = "0x00010409"; // United States-Dvorak
// keymapToXfreerdpHash[""] = "0x0001040A"; // Spanish Variation
// keymapToXfreerdpHash[""] = "0x0001040E"; // Hungarian 101-key
// keymapToXfreerdpHash[""] = "0x00010410"; // Italian (142)
// keymapToXfreerdpHash[""] = "0x00010415"; // Polish (214)
// keymapToXfreerdpHash[""] = "0x00010416"; // Portuguese (Brazilian ABNT2)
// keymapToXfreerdpHash[""] = "0x00010419"; // Russian (Typewriter)
// keymapToXfreerdpHash[""] = "0x0001041B"; // Slovak (QWERTY)
// keymapToXfreerdpHash[""] = "0x0001041E"; // Thai Pattachote
// keymapToXfreerdpHash[""] = "0x0001041F"; // Turkish F
// keymapToXfreerdpHash[""] = "0x00010426"; // Latvian (QWERTY)
// keymapToXfreerdpHash[""] = "0x00010427"; // Lithuanian
// keymapToXfreerdpHash[""] = "0x0001042B"; // Armenian Western
// keymapToXfreerdpHash[""] = "0x00010439"; // Hindi Traditional
// keymapToXfreerdpHash[""] = "0x0001043A"; // Maltese 48-key
// keymapToXfreerdpHash[""] = "0x0001043B"; // Sami Extended Norway
// keymapToXfreerdpHash[""] = "0x00010445"; // Bengali (Inscript)
// keymapToXfreerdpHash[""] = "0x0001045A"; // Syriac Phonetic
// keymapToXfreerdpHash[""] = "0x00010465"; // Divehi Typewriter
// keymapToXfreerdpHash[""] = "0x0001080C"; // Belgian (Comma)
// keymapToXfreerdpHash[""] = "0x0001083B"; // Finnish with Sami
// keymapToXfreerdpHash[""] = "0x00011009"; // Canadian Multilingual Standard
// keymapToXfreerdpHash[""] = "0x00011809"; // Gaelic
// keymapToXfreerdpHash[""] = "0x00020401"; // Arabic (102) AZERTY
// keymapToXfreerdpHash[""] = "0x00020405"; // Czech Programmers
// keymapToXfreerdpHash[""] = "0x00020408"; // Greek (319)
// keymapToXfreerdpHash[""] = "0x00020409"; // United States-International
// keymapToXfreerdpHash[""] = "0x0002041E"; // Thai Kedmanee (non-ShiftLock)
// keymapToXfreerdpHash[""] = "0x0002083B"; // Sami Extended Finland-Sweden
// keymapToXfreerdpHash[""] = "0x00030408"; // Greek (220) Latin
// keymapToXfreerdpHash[""] = "0x00030409"; // United States-Dvorak for left hand
// keymapToXfreerdpHash[""] = "0x0003041E"; // Thai Pattachote (non-ShiftLock)
// keymapToXfreerdpHash[""] = "0x00040408"; // Greek (319) Latin
// keymapToXfreerdpHash[""] = "0x00040409"; // United States-Dvorak for right hand
// keymapToXfreerdpHash[""] = "0x00050408"; // Greek Latin
// keymapToXfreerdpHash[""] = "0x00050409"; // US English Table for IBM Arabic 238_L
// keymapToXfreerdpHash[""] = "0x00060408"; // Greek Polytonic
// keymapToXfreerdpHash[""] = "0xB0000407"; // German Neo
// Keyboard Input Method Editors (IMEs)
// keymapToXfreerdpHash[""] = "0xE0010404"; // Chinese (Traditional) - Phonetic
// keymapToXfreerdpHash[""] = "0xE0010411"; // Japanese Input System (MS-IME2002)
// keymapToXfreerdpHash[""] = "0xE0010412"; // Korean Input System (IME 2000)
// keymapToXfreerdpHash[""] = "0xE0010804"; // Chinese (Simplified) - QuanPin
// keymapToXfreerdpHash[""] = "0xE0020404"; // Chinese (Traditional) - ChangJie
// keymapToXfreerdpHash[""] = "0xE0020804"; // Chinese (Simplified) - ShuangPin
// keymapToXfreerdpHash[""] = "0xE0030404"; // Chinese (Traditional) - Quick
// keymapToXfreerdpHash[""] = "0xE0030804"; // Chinese (Simplified) - ZhengMa
// keymapToXfreerdpHash[""] = "0xE0040404"; // Chinese (Traditional) - Big5 Code
// keymapToXfreerdpHash[""] = "0xE0050404"; // Chinese (Traditional) - Array
// keymapToXfreerdpHash[""] = "0xE0050804"; // Chinese (Simplified) - NeiMa
// keymapToXfreerdpHash[""] = "0xE0060404"; // Chinese (Traditional) - DaYi
// keymapToXfreerdpHash[""] = "0xE0070404"; // Chinese (Traditional) - Unicode
// keymapToXfreerdpHash[""] = "0xE0080404"; // Chinese (Traditional) - New Phonetic
// keymapToXfreerdpHash[""] = "0xE0090404"; // Chinese (Traditional) - New ChangJie
// keymapToXfreerdpHash[""] = "0xE00E0804"; // Chinese (Traditional) - Microsoft Pinyin IME 3.0
// keymapToXfreerdpHash[""] = "0xE00F0404"; // Chinese (Traditional) - Alphanumeric
return keymapToXfreerdpHash;
}
#include "rdpview.moc"

Some files were not shown because too many files have changed in this diff Show more