Add dead-ended knetworkmanager 0.8 source

Add copy of same for knetworkmanager 0.9 starting point


git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetworkmanager8@1259314 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
v3.5.13-sru
tpearson 13 years ago
commit 1e0dd58661

@ -0,0 +1,71 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
cmake_minimum_required( VERSION 2.6 )
##### general package setup #####################
project( knetworkmanager )
set( KNETWORKMANAGER_VERSION "0.8" )
##### include essential cmake modules ###########
include( CheckCXXSourceCompiles )
include( FindPkgConfig )
##### include our cmake modules #################
set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules" )
include( TDEMacros )
##### setup install paths #######################
include( TDESetupPaths )
tde_setup_paths( )
if( NOT DBUS_SYS_DIR )
set( DBUS_SYS_DIR ${SYSCONF_INSTALL_DIR}/dbus-1/system.d )
endif( )
##### optional stuff ############################
# option( WITH_LDAP "Enable LDAP support" OFF )
##### configure checks ##########################
include( ConfigureChecks.cmake )
###### global compiler settings #################
add_definitions(
-DHAVE_CONFIG_H
)
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TQT_CXX_FLAGS}" )
set( CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "-Wl,--no-undefined" )
##### source directories ########################
add_subdirectory( knetworkmanager-0.8 )
##### write configure files #####################
configure_file( config.h.cmake config.h @ONLY )

@ -0,0 +1,44 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
# hal
pkg_search_module( HAL hal )
if( NOT HAL_FOUND )
tde_message_fatal( "hal are required, but not found on your system" )
endif( )
# dbus-1
pkg_search_module( DBUS dbus-1 )
if( NOT DBUS_FOUND )
tde_message_fatal( "dbus-1 are required, but not found on your system" )
endif( )
# dbus-1-tqt
pkg_search_module( DBUS_TQT dbus-1-tqt )
if( DBUS_TQT_FOUND )
find_program( DBUSXML2QT3_EXECUTABLE NAMES dbusxml2qt3 )
else()
tde_message_fatal( "dbus-1-tqt are required, but not found on your system" )
endif( )
# libnm-util
pkg_search_module( NM_UTIL libnm-util )
if( NOT NM_UTIL_FOUND )
tde_message_fatal( "libnm-util are required, but not found on your system" )
endif( )
# required stuff
find_package( TQt )
find_package( TDE )

@ -0,0 +1,4 @@
AUTOMAKE_OPTIONS = foreign 1.6.1
include admin/deps.am
include admin/Doxyfile.am

@ -0,0 +1,14 @@
all:
@echo "This Makefile is only for the CVS repository"
@echo "This will be deleted before making the distribution"
@echo ""
@if test ! -d admin; then \
echo "Please recheckout this module!" ;\
echo "for cvs: use checkout once and after that update again" ;\
echo "for cvsup: checkout kde-common from cvsup and" ;\
echo " link kde-common/admin to ./admin" ;\
exit 1 ;\
fi
$(MAKE) -f admin/Makefile.common cvs
.SILENT:

@ -0,0 +1 @@
#define KNETWORKMANAGER_VERSION_STRING "@KNETWORKMANAGER_VERSION@"

@ -0,0 +1,4 @@
dnl Put here things to be done at the very end - telling users
dnl about additional packages to install. Better yet is giving
dnl each project / subdr its own configure.in.bot.

@ -0,0 +1,13 @@
#MIN_CONFIG(3.2)
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
AM_INIT_AUTOMAKE(knetworkmanager, 0.8, kb9vqf@pearsoncomputing.net)
if test "$build_arts" = "yes"; then
AC_DEFINE(USE_ARTS, 1, [If we use arts volume])
LIB_ARTS="-lartskde"
AC_SUBST(LIB_ARTS)
fi
KDE_INIT_DOXYGEN([KEG Network API Reference], [Version $VERSION])

@ -0,0 +1,5 @@
Timo Hoenig <thoenig@suse.de>
Will Stephenson <wstephenson@kde.org>
Valentine Sinitsyn <e_val@inbox.ru>
Stefan Bogner <sbogner@suse.de>
Helmut Schaa <hschaa@suse.de>

@ -0,0 +1,17 @@
#################################################
#
# (C) 2010-2011 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
add_subdirectory( pics )
add_subdirectory( src )
# add_subdirectory( vpn-plugins )
# add_subdirectory( po )
install( FILES knetworkmanager.conf DESTINATION ${DBUS_SYS_DIR} )

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

File diff suppressed because it is too large Load Diff

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

@ -0,0 +1,7 @@
SUBDIRS = pics src vpn-plugins po
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = knetworkmanager.conf
EXTRA_DIST = COPYING configure.in.in $(dbusservice_DATA)

@ -0,0 +1,10 @@
AUTOMAKE_OPTIONS = foreign 1.6.1
include admin/deps.am
include admin/Doxyfile.am
dbusservicedir = $(DBUS_SYS_DIR)
dbusservice_DATA = knetworkmanager.conf
EXTRA_DIST = COPYING configure.in.in admin $(dbusservice_DATA)

@ -0,0 +1,3 @@
22 June 2007 - KNetworkManager 0.2
23 September 2006 - KNetworkManager 0.1
28 March 2006 - KNetworkManager moves to KDE SVN

@ -0,0 +1,25 @@
KNetworkManager is a system tray application for controlling network connections on systems that use the NetworkManager daemon.
Currently the following things work:
* Show all network interfaces known to HAL and therefore to NetworkManager
* Connect to wired and wireless networks
* User interaction for encrypted (WEP, WPA Personal and WPA Enterprise) wireless networks
* User interaction to join hidden wireless networks
* Show signal strength for wireless networks in context menu
* Show tool tip with connection status on tray icon
* Show verbose tool tip with interface and network information on context
menu entries
* Store passwords of encrypted networks
* Store hidden wireless networks (per-user)
* Show connection status in system tray
* VPN support
* Notifications (new networks, new devices, NM status changes)
NetworkManager 0.6.2 is required to build this version of KNetworkManager.
If you encounter bugs, please report them using
* http://bugs.kde.org
Last update: 20-Sep-2006 - Timoe Hoenig <thoenig@suse.de>, <thoenig@nouse.net>

@ -0,0 +1,10 @@
if test -n "$MISSING_DEPS"; then
echo "**************************************************"
echo "*"
echo "* KNetworkManager will not be built due to missing dependencies!"
echo "* Missing: $MISSING_DEPS"
echo "*"
echo "**************************************************"
fi

@ -0,0 +1,147 @@
#MIN_CONFIG(3.2)
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
AM_INIT_AUTOMAKE(knetworkmanager, 0.8, kb9vqf@pearsoncomputing.net)
AC_C_BIGENDIAN
AC_CHECK_KDEMAXPATHLEN
KNETWORKMANAGER_VERSION="0.8"
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VERSION, $KNETWORKMANAGER_VERSION, [KNetworkManager Version])
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VERSION_STRING, "$KNETWORKMANAGER_VERSION", [KNetworkManager Version String])
# check for dbus, hal, libnm-util and libnl
PKG_CHECK_MODULES(HAL, [hal], [], [
AC_MSG_RESULT([no])
AC_MSG_WARN([You need Hal, knetworkmanager will not be compiled])
DO_NOT_COMPILE="$DO_NOT_COMPILE knetworkmanager"
MISSING_DEPS="$MISSING_DEPS hal"
])
PKG_CHECK_MODULES(LIBNMUTIL, [libnm-util >= 0.7], [], [
AC_MSG_RESULT([no])
AC_MSG_WARN([You need libnm-util >= 0.7, knetworkmanager will not be compiled])
DO_NOT_COMPILE="$DO_NOT_COMPILE knetworkmanager"
MISSING_DEPS="$MISSING_DEPS libnm-util"
])
PKG_CHECK_MODULES(LIBNMGLIB, [libnm_glib >= 0.7], [], [
AC_MSG_RESULT([no])
AC_MSG_WARN([You need libnm-util, knetworkmanager will not be compiled])
DO_NOT_COMPILE="$DO_NOT_COMPILE knetworkmanager"
MISSING_DEPS="$MISSING_DEPS libnm-glib"
])
PKG_CHECK_MODULES(LIBNL, [libnl-1], [], [
AC_MSG_RESULT([no])
AC_MSG_WARN([You need libnl, knetworkmanager will not be compiled])
DO_NOT_COMPILE="$DO_NOT_COMPILE knetworkmanager"
MISSING_DEPS="$MISSING_DEPS libnl-1"
])
PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([TQT dbus bindings missing])
])
AC_CHECK_PROG(DBUSXML2QT3, [dbusxml2qt3], [dbusxml2qt3], [no])
if test "$DBUSXML2QT3" = no ; then
AC_MSG_WARN([You need dbusxml2qt3, knetworkmanager will not be compiled])
DO_NOT_COMPILE="$DO_NOT_COMPILE knetworkmanager"
MISSING_DEPS="$MISSING_DEPS dbusxml2qt3"
fi
PACKAGE_CFLAGS="$HAL_CFLAGS $LIBNL_CFLAGS $DBUS_TQT_CFLAGS $LIBNMGLIB_CFLAGS"
PACKAGE_LIBS="$HAL_LIBS $LIBNL_LIBS $DBUS_TQT_LIBS"
AC_ARG_WITH(dbus-sys, AC_HELP_STRING([--with-dbus-sys=DIR], [D-BUS system.d directory]))
if ! test -z "$with_dbus_sys" ; then
DBUS_SYS_DIR="$with_dbus_sys"
else
DBUS_SYS_DIR="${sysconfdir}/dbus-1/system.d"
fi
AC_SUBST(DBUS_SYS_DIR)
AC_DEFINE_UNQUOTED(DBUS_SYSTEMD_DIR, "$DBUS_SYS_DIR", [D-BUS system.d directory])
AC_SUBST(PACKAGE_CFLAGS)
AC_SUBST(PACKAGE_LIBS)
AC_SUBST(LIB_DL)
AC_ARG_WITH(distro, AC_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: suse, gentoo, fedora]))
if test "x$with_distro" = "x"; then
AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
if test "x$with_distro" = "x"; then
with_distro=`lsb_release -is`
fi
fi
with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
# Compile dialup support
AC_ARG_WITH(dialup, AC_HELP_STRING([--with-dialup], [Build KNetworkManager with Dialup support (default)]))
if test "x$with_dialup" != "xno"; then
if test "x$with_distro" = "x"; then
echo "Linux distribution autodetection failed, you must specify the distribution to target using --with-distro=DISTRO"
else
case $with_distro in
suse)
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_DIALUP_CONFIG,
"kdesu --nonewdcop /sbin/yast2 modem",
[Command to launch dial up configuration tool])
;;
gentoo)
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_DIALUP_CONFIG,
"kdesu --nonewdcop ${KDEDIR}/bin/kppp",
[Command to launch dial up configuration tool])
;;
fedora)
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_DIALUP_CONFIG,
"kdesu --nonewdcop /usr/bin/kppp",
[Command to launch dial up configuration tool])
;;
*)
echo "Your distribution (${with_distro}) is not yet supported (e.g. you will not be able to launch a tool to configure dial-up connections.)"
;;
esac
fi
fi
# openvpn support
AC_ARG_WITH(openvpn, AC_HELP_STRING([--with-openvpn], [Build KNetworkManager with openvpn plugin]))
if test "x$with_openvpn" = "x"; then
AC_CHECK_FILE(/etc/NetworkManager/VPN/nm-openvpn-service.name,with_openvpn="yes" )
fi
AM_CONDITIONAL(WITH_OPENVPN, test x"$with_openvpn" = "xyes")
# vpnc support
AC_ARG_WITH(vpnc, AC_HELP_STRING([--with-vpnc], [Build KNetworkManager with vpnc plugin]))
if test "x$with_vpnc" = "x"; then
AC_CHECK_FILE(/etc/NetworkManager/VPN/nm-vpnc-service.name,with_vpnc="yes" )
fi
AM_CONDITIONAL(WITH_VPNC, test x"$with_vpnc" = "xyes")
# pptp support
AC_ARG_WITH(pptp, AC_HELP_STRING([--with-pptp], [Build KNetworkManager with pptp plugin]))
if test "x$with_pptp" = "x"; then
AC_CHECK_FILE(/etc/NetworkManager/VPN/nm-pptp-service.name,with_pptp="yes" )
fi
AM_CONDITIONAL(WITH_PPTP, test x"$with_pptp" = "xyes")
# strongswan support
AC_ARG_WITH(strongswan, AC_HELP_STRING([--with-strongswan], [Build KNetworkManager with strongswan plugin]))
if test "x$with_strongswan" = "x"; then
AC_CHECK_FILE(/etc/NetworkManager/VPN/nm-strongswan-service.name,with_strongswan="yes" )
fi
AM_CONDITIONAL(WITH_STRONGSWAN, test x"$with_strongswan" = "xyes")
# set include path for knetworkmanager-plugin.h and knetworkmanager-vpnplugin.h when vpn plugins are built together with knetworkmanager
KNETWORKMANAGER_CFLAGS="-I\$(top_srcdir)/knetworkmanager-0.8/src"
AC_SUBST(KNETWORKMANAGER_CFLAGS)

@ -0,0 +1,18 @@
EXTRA_DIST = \
nm-access-point.xml \
nm-active-connection.xml \
nm-device-802-11-wireless.xml \
nm-device-802-3-ethernet.xml \
nm-device-cdma.xml \
nm-device-gsm.xml \
nm-device.xml \
nm-exported-connection.xml \
nm-ip4-config.xml \
nm-manager.xml \
nm-manager-client.xml \
nm-ppp-manager.xml \
nm-settings.xml \
nm-vpn-manager.xml \
nm-vpn-plugin.xml \
nm-vpn-connection.xml

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.AccessPoint">
<property name="Flags" type="u" access="read" tp:type="NM_802_11_AP_FLAGS">
<tp:docstring>Flags describing the capabilities of the access point.</tp:docstring>
</property>
<property name="WpaFlags" type="u" access="read" tp:type="NM_802_11_AP_SEC">
<tp:docstring>Flags describing the access point's capabilities according to WPA (Wifi Protected Access).</tp:docstring>
</property>
<property name="RsnFlags" type="u" access="read" tp:type="NM_802_11_AP_SEC">
<tp:docstring>Flags describing the access point's capabilities according to the RSN (Robust Secure Network) protocol.</tp:docstring>
</property>
<property name="Ssid" type="ay" access="read">
<tp:docstring>The Service Set Identifier identifying the access point.</tp:docstring>
</property>
<property name="Frequency" type="u" access="read">
<tp:docstring>The radio channel frequency in use by the access point, in MHz.</tp:docstring>
</property>
<property name="HwAddress" type="s" access="read">
<tp:docstring>The hardware address of the access point.</tp:docstring>
</property>
<property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE">
<tp:docstring>Describes the operating mode of the access point.</tp:docstring>
</property>
<property name="MaxBitrate" type="u" access="read">
<tp:docstring>The maximum bitrate this access point is capable of, in kilobits/second (Kb/s).</tp:docstring>
</property>
<property name="Strength" type="y" access="read">
<tp:docstring>The current signal strength received from this access point.</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<tp:flags name="NM_802_11_AP_FLAGS" value-prefix="NM_802_11_AP_FLAGS" type="u">
<tp:docstring>
Flags describing the general capabilities of the access point.
</tp:docstring>
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>Null capability - says nothing about the access point.</tp:docstring>
</tp:flag>
<tp:flag suffix="PRIVACY" value="0x1">
<tp:docstring>Access point supports privacy measures.</tp:docstring>
</tp:flag>
</tp:flags>
<tp:flags name="NM_802_11_AP_SEC" value-prefix="NM_802_11_AP_SEC" type="u">
<tp:docstring>
Flags describing the security capabilities of the access point.
</tp:docstring>
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>Null flag.</tp:docstring>
</tp:flag>
<tp:flag suffix="PAIR_WEP40" value="0x1">
<tp:docstring>Access point supports pairwise 40-bit WEP encryption.</tp:docstring>
</tp:flag>
<tp:flag suffix="PAIR_WEP104" value="0x2">
<tp:docstring>Access point supports pairwise 104-bit WEP encryption.</tp:docstring>
</tp:flag>
<tp:flag suffix="PAIR_TKIP" value="0x4">
<tp:docstring>Access point supports pairwise TKIP encryption.</tp:docstring>
</tp:flag>
<tp:flag suffix="PAIR_CCMP" value="0x8">
<tp:docstring>Access point supports pairwise CCMP encryption.</tp:docstring>
</tp:flag>
<tp:flag suffix="GROUP_WEP40" value="0x10">
<tp:docstring>Access point supports a group 40-bit WEP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="GROUP_WEP104" value="0x20">
<tp:docstring>Access point supports a group 104-bit WEP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="GROUP_TKIP" value="0x40">
<tp:docstring>Access point supports a group TKIP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="GROUP_CCMP" value="0x80">
<tp:docstring>Access point supports a group CCMP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="KEY_MGMT_PSK" value="0x100">
<tp:docstring>Access point supports PSK key management.</tp:docstring>
</tp:flag>
<tp:flag suffix="KEY_MGMT_802_1X" value="0x200">
<tp:docstring>Access point supports 802.1x key management.</tp:docstring>
</tp:flag>
</tp:flags>
</interface>
</node>

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Connection.Active">
<property name="ServiceName" type="s" access="read">
<tp:docstring>The D-Bus service name providing this connection.</tp:docstring>
</property>
<property name="Connection" type="o" access="read">
<tp:docstring>The path of the connection.</tp:docstring>
</property>
<property name="SpecificObject" type="o" access="read">
<tp:docstring>A specific object associated with the active connection.</tp:docstring>
</property>
<property name="SharedServiceName" type="s" access="read">
<tp:docstring>The D-Bus service name that provides a connection with which this active connection is shared.</tp:docstring>
</property>
<property name="SharedConnection" type="o" access="read">
<tp:docstring>The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared.</tp:docstring>
</property>
<property name="Devices" type="ao" access="read">
<tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_ACTIVE_DEVICE_STATE">
<tp:docstring>The state of this active connection.</tp:docstring>
</property>
<property name="Default" type="b" access="read">
<tp:docstring>Whether this active connection is the default connection, i.e. whether it currently owns the default route.</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<tp:enum name="NM_ACTIVE_CONNECTION_STATE" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The active connection is in an unknown state.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ACTIVATING" value="1">
<tp:docstring>
The connection is activating.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ACTIVATED" value="2">
<tp:docstring>
The connection is activated.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
</interface>
</node>

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Device.Wireless">
<method name="GetAccessPoints">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_device_get_access_points"/>
<arg name="access_points" type="ao" direction="out">
<tp:docstring>
List of access point object paths
</tp:docstring>
</arg>
<tp:docstring>
Get the list of access points visible to this device.
</tp:docstring>
</method>
<property name="HwAddress" type="s" access="read">
<tp:docstring>
The hardware address of the device.
</tp:docstring>
</property>
<property name="Mode" type="u" access="read" tp:type="NM_802_11_MODE">
<tp:docstring>
The operating mode of the wireless device.
</tp:docstring>
</property>
<property name="Bitrate" type="u" access="read">
<tp:docstring>
The bit rate currently used by the wireless device, in kilobits/second (Kb/s).
</tp:docstring>
</property>
<property name="ActiveAccessPoint" type="o" access="read">
<tp:docstring>
Object path of the access point currently used by the wireless device.
</tp:docstring>
</property>
<property name="WirelessCapabilities" type="u" access="read" tp:type="NM_802_11_DEVICE_CAP">
<tp:docstring>
The capabilities of the wireless device.
</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary containing the FIXME: check changed parameters.
</tp:docstring>
</arg>
<tp:docstring>
Emitted when the wireless device's properties changed.
</tp:docstring>
</signal>
<signal name="AccessPointAdded">
<arg name="access_point" type="o">
<tp:docstring>
The object path of the newly found access point.
</tp:docstring>
</arg>
<tp:docstring>
Emitted when a new access point is found by the device.
</tp:docstring>
</signal>
<signal name="AccessPointRemoved">
<arg name="access_point" type="o">
<tp:docstring>
The object path of the access point that has disappeared.
</tp:docstring>
</arg>
<tp:docstring>
Emitted when an access point disappears from view of the device.
</tp:docstring>
</signal>
<tp:flags name="NM_802_11_DEVICE_CAP" type="u">
<tp:docstring>
Flags describing the capabilities of a wireless device.
</tp:docstring>
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>Null capability - syntactic sugar for no capabilities supported. Do not AND this with other capabilities!</tp:docstring>
</tp:flag>
<tp:flag suffix="CIPHER_WEP40" value="0x1">
<tp:docstring>The device supports the 40-bit WEP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="CIPHER_WEP104" value="0x2">
<tp:docstring>The device supports the 104-bit WEP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="CIPHER_TKIP" value="0x4">
<tp:docstring>The device supports the TKIP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="CIPHER_CCMP" value="0x8">
<tp:docstring>The device supports the CCMP cypher.</tp:docstring>
</tp:flag>
<tp:flag suffix="WPA" value="0x10">
<tp:docstring>The device supports the WPA encryption/authentication protocol.</tp:docstring>
</tp:flag>
<tp:flag suffix="RSN" value="0x20">
<tp:docstring>The device supports the RSN encryption/authentication protocol.</tp:docstring>
</tp:flag>
</tp:flags>
</interface>
</node>

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Device.Wired">
<property name="HwAddress" type="s" access="read">
<tp:docstring>
Hardware address of the device.
</tp:docstring>
</property>
<property name="Speed" type="u" access="read">
<tp:docstring>
Design speed of the device.
</tp:docstring>
</property>
<property name="Carrier" type="b" access="read">
<tp:docstring>
Indicates whether the physical carrier is found (e.g. whether a cable is plugged in or not).
</tp:docstring>
</property>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
</interface>
</node>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Device.Cdma">
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
</interface>
</node>

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Device.Gsm">
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
</interface>
</node>

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Device">
<property name="Udi" type="s" access="read">
<tp:docstring>
HAL UDI for the device.
</tp:docstring>
</property>
<property name="Interface" type="s" access="read">
<tp:docstring>
The network interface offered by the device.
</tp:docstring>
</property>
<property name="Driver" type="s" access="read">
<tp:docstring>
The driver handling the device.
</tp:docstring>
</property>
<property name="Capabilities" type="u" access="read" tp:type="NM_DEVICE_CAP">
<tp:docstring>
Flags describing the capabilities of the device.
</tp:docstring>
</property>
<property name="Ip4Address" type="i" access="read">
<tp:docstring>
The IPv4 address bound to the device. FIXME: what about devices with >1 IP address?
</tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_DEVICE_STATE">
<tp:docstring>
The current state of the device.
</tp:docstring>
</property>
<property name="Ip4Config" type="o" access="read">
<tp:docstring>
Object path of the Ip4Config object describing the configuration of the device. Only valid when the device is in the NM_DEVICE_STATE_ACTIVATED state.
</tp:docstring>
</property>
<property name="Managed" type="b" access="read">
<tp:docstring>
Whether or not this device is managed by NetworkManager.
</tp:docstring>
</property>
<!-- Ugh, but I see no other way of getting the type on the caller
based on dbus object path only -->
<property name="DeviceType" type="u" access="read">
<tp:docstring>
</tp:docstring>
</property>
<signal name="StateChanged">
<arg name="state" type="u" tp:type="NM_DEVICE_STATE">
<tp:docstring>
The new state of the device.
</tp:docstring>
</arg>
</signal>
<tp:enum name="NM_DEVICE_STATE" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The device is in an unknown state.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DOWN" value="1">
<tp:docstring>
The device is down.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DISCONNECTED" value="2">
<tp:docstring>
The device is not connected.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="PREPARE" value="3">
<tp:docstring>
The device is preparing to connect.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONFIG" value="4">
<tp:docstring>
The device is being configured.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NEED_AUTH" value="5">
<tp:docstring>
The device is awaiting authorization credentials.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="IP_CONFIG" value="6">
<tp:docstring>
The IP address of the device is being configured.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ACTIVATED" value="7">
<tp:docstring>
The device is active.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="FAILED" value="8">
<tp:docstring>
The device is in a failure state following an attempt to activate it.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CANCELLED" value="9">
<tp:docstring>
The previous activation attempt on this device was cancelled.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
<tp:flags name="NM_DEVICE_CAP" value-prefix="NM_DEVICE_CAP" type="u">
<tp:flag suffix="NONE" value="0x0">
<tp:docstring>Null capability.</tp:docstring>
</tp:flag>
<tp:flag suffix="NM_SUPPORTED" value="0x1">
<tp:docstring>The device is supported by NetworkManager.</tp:docstring>
</tp:flag>
<tp:flag suffix="CARRIER_DETECT" value="0x2">
<tp:docstring>The device supports carrier detection.</tp:docstring>
</tp:flag>
</tp:flags>
</interface>
</node>

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManagerSettings.Connection">
<tp:docstring>
Represents a single network connection configuration.
</tp:docstring>
<method name="GetID">
<tp:docstring>
Obtain the ID of this connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_id"/>
<arg name="id" type="s" direction="out">
<tp:docstring>
The ID of this connection.
</tp:docstring>
</arg>
</method>
<method name="Update">
<tp:docstring>
Update the connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_update"/>
<arg name="properties" type="a{sa{sv}}" direction="in">
<tp:docstring>
New connection properties.
</tp:docstring>
</arg>
</method>
<method name="Delete">
<tp:docstring>
Delete the connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_delete"/>
</method>
<method name="GetSettings">
<tp:docstring>
Get the settings maps describing this object.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_settings"/>
<arg name="settings" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map">
<tp:docstring>
The nested settings maps describing this object.
</tp:docstring>
</arg>
</method>
<signal name="Updated">
<tp:docstring>
Emitted when some settings changed.
</tp:docstring>
<arg name="settings" type="a{sa{sv}}" tp:type="String_String_Variant_Map_Map">
<tp:docstring>
Contains the changed settings.
</tp:docstring>
</arg>
</signal>
<signal name="Removed">
<tp:docstring>
Emitted when this settings object was removed. FIXME: Is this emitted after it was removed or when it is about to be removed? If after removed, then different semantics to Device removed. if prior to removal, should be called AboutToBeRemoved.
</tp:docstring>
</signal>
</interface>
<interface name="org.freedesktop.NetworkManagerSettings.Connection.Secrets">
<tp:docstring>
Secrets have a separate interface so that they can be locked down.
</tp:docstring>
<method name="GetSecrets">
<tp:docstring>
Get the secrets encapsulated in this object.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_exported_connection_get_secrets"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="setting_name" type="s" direction="in">
<tp:docstring>
Name of the setting to return.
</tp:docstring>
</arg>
<arg name="hints" type="as" direction="in">
<tp:docstring>
Array of strings of key names in the Setting for which NM thinks
a secrets may be required.
</tp:docstring>
</arg>
<arg name="request_new" type="b" direction="in">
<tp:docstring>
Indicates whether new secrets should be requested or if the request can be fulfilled from storage.
</tp:docstring>
</arg>
<arg name="secrets" type="a{sa{sv}}" direction="out" tp:type="String_String_Variant_Map_Map">
<tp:docstring>
Nested settings maps containing secrets. Each setting MUST contain at least the 'name' field, containing the name of the setting, and one or more secrets.
</tp:docstring>
</arg>
</method>
</interface>
</node>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.IP4Config">
<property name="Addresses" type="aau" access="read">
<tp:docstring>Tuples of IPv4 address/netmask/gateway. The gateway is optional, if not given should be 0.</tp:docstring>
</property>
<property name="Hostname" type="s" access="read">
<tp:docstring>The hostname associated with this IPv4 address. FIXME: what about multiple hostnames?</tp:docstring>
</property>
<property name="Nameservers" type="au" access="read">
<tp:docstring>The nameservers in use.</tp:docstring>
</property>
<property name="Domains" type="as" access="read">
<tp:docstring>A list of domains this address belongs to.</tp:docstring>
</property>
<property name="NisDomain" type="s" access="read">
<tp:docstring>The NIS domain this address belongs to.</tp:docstring>
</property>
<property name="NisServers" type="au" access="read">
<tp:docstring>The NIS servers associated with this address.</tp:docstring>
</property>
</interface>
</node>

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
READ ME! READ ME! READ ME! READ ME! READ ME!
This file needs to be kept in sync with nm-manager.xml with the exception of
the legacy methods at the end of nm-manager.xml.
This file is only used to ensure that a few legacy 0.6 D-DBus methods that
NM supports don't leak into libnm-glib, but are only exposed by the NMManager
object. dbus-glib generates the same bound function names for D-Bus the methods
"sleep" and "Sleep", unfortunately.
-->
<node name="/">
<interface name="org.freedesktop.NetworkManager">
<method name="GetDevices">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_devices"/>
<arg name="devices" type="ao" direction="out"/>
</method>
<method name="ActivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_activate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="service_name" type="s" direction="in"/>
<arg name="connection" type="o" direction="in"/>
<arg name="device" type="o" direction="in"/>
<arg name="specific_object" type="o" direction="in"/>
<arg name="active_connection" type="o" direction="out"/>
</method>
<method name="DeactivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/>
<arg name="active_connection" type="o" direction="in"/>
</method>
<method name="Sleep">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/>
<arg name="sleep" type="b" direction="in"/>
</method>
<property name="WirelessEnabled" type="b" access="readwrite"/>
<property name="WirelessHardwareEnabled" type="b" access="read"/>
<property name="ActiveConnections" type="ao" access="read"/>
<property name="State" type="u" access="read"/>
<signal name="StateChanged">
<arg name="state" type="u"/>
</signal>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}"/>
</signal>
<signal name="DeviceAdded">
<arg name="state" type="o"/>
</signal>
<signal name="DeviceRemoved">
<arg name="state" type="o"/>
</signal>
</interface>
</node>

@ -0,0 +1,227 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!--
READ ME! READ ME! READ ME! READ ME! READ ME!
This file needs to be kept in sync with nm-manager-client.xml with the exception of
the legacy methods at the end of this file.
-->
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager">
<method name="GetDevices">
<tp:docstring>
Get the list of network devices.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_get_devices"/>
<arg name="devices" type="ao" direction="out">
<tp:docstring>
List of object paths of network devices known to the system.
</tp:docstring>
</arg>
</method>
<method name="ActivateConnection">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_activate_connection"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<tp:docstring>
Activate a connection using the supplied device.
</tp:docstring>
<arg name="service_name" type="s" direction="in">
<tp:docstring>
The D-Bus service name of the settings service that provides this connection.
</tp:docstring>
</arg>
<arg name="connection" type="o" direction="in">
<tp:docstring>
The connection to activate the devices with.
</tp:docstring>
</arg>
<arg name="device" type="o" direction="in">
<tp:docstring>
The device to be activated.
</tp:docstring>
</arg>
<arg name="specific_object" type="o" direction="in">
<tp:docstring>
The path of a device-type-specific object this activation should use, for example a WiFi access point.
</tp:docstring>
</arg>
<arg name="active_connection" type="o" direction="out">
<tp:docstring>
The path of the active connection object representing this active connection.
</tp:docstring>
</arg>
<tp:possible-errors>
<tp:error name="org.freedesktop.NetworkManager.Error.UnknownConnection"/>
<tp:error name="org.freedesktop.NetworkManager.Error.UnknownDevice"/>
<tp:error name="org.freedesktop.NetworkManager.Error.InvalidService"/>
<tp:error name="org.freedesktop.NetworkManager.Error.ConnectionActivating">
<tp:docstring>Another connection is already activating or the same connection is already active. FIXME: check if the error name is correct. FIXME: split into 2 errors?</tp:docstring>
</tp:error>
<tp:error name="org.freedesktop.NetworkManager.Error.ConnectionInvalid">
<tp:docstring>The connection is invalid for this device.</tp:docstring>
</tp:error>
</tp:possible-errors>
</method>
<method name="DeactivateConnection">
<tp:docstring>
Deactivate an active connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_deactivate_connection"/>
<arg name="active_connection" type="o" direction="in">
<tp:docstring>
The currently active connection to deactivate.
</tp:docstring>
</arg>
</method>
<method name="Sleep">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_sleep"/>
<tp:docstring>
Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated. When awake, devices are available to be activated.
</tp:docstring>
<arg name="sleep" type="b" direction="in">
<tp:docstring>
Indicates whether the NetworkManager daemon should sleep or wake.
</tp:docstring>
</arg>
</method>
<property name="WirelessEnabled" type="b" access="readwrite">
<tp:docstring>
Indicates if wireless is currently enabled or not.
</tp:docstring>
</property>
<property name="WirelessHardwareEnabled" type="b" access="read">
<tp:docstring>
Indicates if the wireless hardware is currently enabled, i.e. the state of the RF kill switch.
</tp:docstring>
</property>
<property name="ActiveConnections" type="ao" access="read">
<tp:docstring>
List of active connection object paths.
</tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_STATE">
<tp:docstring>
The overall state of the NetworkManager daemon.
</tp:docstring>
</property>
<signal name="StateChanged">
<tp:docstring>
NetworkManager's state changed.
</tp:docstring>
<arg name="state" type="u" tp:type="NM_STATE">
<tp:docstring>
The new state of NetworkManager.
</tp:docstring>
</arg>
</signal>
<signal name="PropertiesChanged">
<tp:docstring>
NetworkManager's properties changed.
</tp:docstring>
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
The changed properties.
</tp:docstring>
</arg>
</signal>
<signal name="DeviceAdded">
<tp:docstring>
A device was added to the system
</tp:docstring>
<arg name="device_path" type="o">
<tp:docstring>
The object path of the newly added device.
</tp:docstring>
</arg>
</signal>
<signal name="DeviceRemoved">
<tp:docstring>
A device was removed from the system, and is no longer available.
</tp:docstring>
<arg name="device_path" type="o">
<tp:docstring>
The object path of the device that was just removed.
</tp:docstring>
</arg>
</signal>
<tp:enum name="NM_STATE" type="u">
<tp:docstring>
Describes the overall state of the daemon.
</tp:docstring>
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The NetworkManager daemon is in an unknown state.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ASLEEP" value="1">
<tp:docstring>
The NetworkManager daemon is asleep and all interfaces managed by it are inactive.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECTING" value="2">
<tp:docstring>
The NetworkManager daemon is connecting a device. FIXME: What does this mean when one device is active and another is connecting?
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECTED" value="3">
<tp:docstring>
The NetworkManager daemon is connected.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DISCONNECTED" value="4">
<tp:docstring>
The NetworkManager daemon is disconnected.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
<!-- Legacy methods to maintain backwards compatibility for 0.6 branch. -->
<signal name="StateChange">
<tp:docstring>
DEPRECATED. NetworkManager's state changed. Use the 'StateChanged' signal instead.
</tp:docstring>
<arg name="state" type="u" tp:type="NM_STATE">
<tp:docstring>
The new state of NetworkManager.
</tp:docstring>
</arg>
</signal>
<method name="sleep">
<tp:docstring>
DEPRECATED. Control the NetworkManager daemon's sleep state. When asleep, all interfaces that it manages are deactivated.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_sleep"/>
</method>
<method name="wake">
<tp:docstring>
DEPRECATED. Control the NetworkManager daemon's sleep state. When awake, all known interfaces are available to be activated.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_wake"/>
</method>
<method name="state">
<tp:docstring>
DEPRECATED. The overall state of the NetworkManager daemon.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_manager_legacy_state"/>
<arg name="state" type="u" direction="out" tp:type="NM_STATE"/>
</method>
</interface>
</node>

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/">
<interface name="org.freedesktop.NetworkManager.PPP">
<method name="NeedSecrets">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_need_secrets"/>
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<arg name="username" type="s" direction="out"/>
<arg name="password" type="s" direction="out"/>
</method>
<method name="SetIp4Config">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_set_ip4_config"/>
<arg name="config" type="a{sv}" direction="in"/>
</method>
<method name="SetState">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_ppp_manager_set_state"/>
<arg name="state" type="u" direction="in"/>
</method>
</interface>
</node>

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManagerSettings">
<tp:docstring>
The NetworkManagerSettings interface is provided by the service which provides connections to NetworkManager.
</tp:docstring>
<method name="ListConnections">
<tp:docstring>
List the connections stored by this Settings object.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_settings_list_connections"/>
<arg name="connections" type="ao" direction="out">
<tp:docstring>
List of connections.
</tp:docstring>
</arg>
</method>
<signal name="NewConnection">
<tp:docstring>
Emitted when a new connection has been configured.
</tp:docstring>
<arg name="connection" type="o">
<tp:docstring>
Object path of the new connection.
</tp:docstring>
</arg>
</signal>
</interface>
</node>

@ -0,0 +1,136 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.VPN.Connection">
<tp:docstring>
Represents an active connection to a Virtual Private Network.
</tp:docstring>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<property name="VpnState" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>The VPN-specific state of the connection.</tp:docstring>
</property>
<property name="Banner" type="s" access="read">
<tp:docstring>The banner string of the VPN connection.</tp:docstring>
</property>
<signal name="VpnStateChanged">
<tp:docstring>
Emitted when the state of the VPN connection has changed.
</tp:docstring>
<arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>
The new state of the VPN connection.
</tp:docstring>
</arg>
<arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON">
<tp:docstring>
Reason code describing the change to the new state.
</tp:docstring>
</arg>
</signal>
<tp:enum name="NM_VPN_CONNECTION_STATE" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The state of the VPN connection is unknown.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="PREPARE" value="1">
<tp:docstring>
The VPN connection is preparing to connect.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NEED_AUTH" value="2">
<tp:docstring>
The VPN connection needs authorization credentials.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECT" value="3">
<tp:docstring>
The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="IP_CONFIG_GET" value="4">
<tp:docstring>
The VPN connection is getting an IP address. FIXME: Should be an -ING
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ACTIVATED" value="5">
<tp:docstring>
The VPN connection is active.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="FAILED" value="6">
<tp:docstring>
The VPN connection failed.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DISCONNECTED" value="7">
<tp:docstring>
The VPN connection is disconnected.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
<tp:enum name="NM_VPN_CONNECTION_STATE_REASON" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The reason for the VPN connection state change is unknown.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NONE" value="1">
<tp:docstring>
No reason was given for the VPN connection state change.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="USER_DISCONNECTED" value="2">
<tp:docstring>
The VPN connection changed state because the user disconnected it.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DEVICE_DISCONNECTED" value="3">
<tp:docstring>
The VPN connection changed state because the device it was using was disconnected.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_STOPPED" value="4">
<tp:docstring>
The service providing the VPN connection was stopped.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="IP_CONFIG_INVALID" value="5">
<tp:docstring>
The IP config of the VPN connection was invalid.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECT_TIMEOUT" value="6">
<tp:docstring>
The connection attempt to the VPN service timed out.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_START_TIMEOUT" value="7">
<tp:docstring>
A timeout occurred while starting the service providing the VPN connection.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_START_FAILED" value="8">
<tp:docstring>
Starting the service starting the service providing the VPN connection failed.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NO_SECRETS" value="9">
<tp:docstring>
Necessary secrets for the VPN connection were not provided.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
</interface>
</node>

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.Connection.Active">
<property name="ServiceName" type="s" access="read">
<tp:docstring>The D-Bus service name providing this connection.</tp:docstring>
</property>
<property name="Connection" type="o" access="read">
<tp:docstring>The path of the connection.</tp:docstring>
</property>
<property name="SpecificObject" type="o" access="read">
<tp:docstring>A specific object associated with the active connection.</tp:docstring>
</property>
<property name="SharedServiceName" type="s" access="read">
<tp:docstring>The D-Bus service name that provides a connection with which this active connection is shared.</tp:docstring>
</property>
<property name="SharedConnection" type="o" access="read">
<tp:docstring>The path of a connection provided by the D-Bus service SharedServiceName which which this connection is shared.</tp:docstring>
</property>
<property name="Devices" type="ao" access="read">
<tp:docstring>Array of object paths representing devices which are part of this active connection.</tp:docstring>
</property>
<property name="State" type="u" access="read" tp:type="NM_ACTIVE_DEVICE_STATE">
<tp:docstring>The state of this active connection.</tp:docstring>
</property>
<property name="Default" type="b" access="read">
<tp:docstring>Whether this active connection is the default connection, i.e. whether it currently owns the default route.</tp:docstring>
</property>
</interface>
<interface name="org.freedesktop.NetworkManager.VPN.Connection">
<tp:docstring>
Represents an active connection to a Virtual Private Network.
</tp:docstring>
<signal name="PropertiesChanged">
<arg name="properties" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
A dictionary mapping property names to variant boxed values
</tp:docstring>
</arg>
</signal>
<property name="VpnState" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>The VPN-specific state of the connection.</tp:docstring>
</property>
<property name="Banner" type="s" access="read">
<tp:docstring>The banner string of the VPN connection.</tp:docstring>
</property>
<signal name="VpnStateChanged">
<tp:docstring>
Emitted when the state of the VPN connection has changed.
</tp:docstring>
<arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>
The new state of the VPN connection.
</tp:docstring>
</arg>
<arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON">
<tp:docstring>
Reason code describing the change to the new state.
</tp:docstring>
</arg>
</signal>
<tp:enum name="NM_VPN_CONNECTION_STATE" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The state of the VPN connection is unknown.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="PREPARE" value="1">
<tp:docstring>
The VPN connection is preparing to connect.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NEED_AUTH" value="2">
<tp:docstring>
The VPN connection needs authorization credentials.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECT" value="3">
<tp:docstring>
The VPN connection is being established. FIXME: Should be CONNECTING or CONNECTED.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="IP_CONFIG_GET" value="4">
<tp:docstring>
The VPN connection is getting an IP address. FIXME: Should be an -ING
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="ACTIVATED" value="5">
<tp:docstring>
The VPN connection is active.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="FAILED" value="6">
<tp:docstring>
The VPN connection failed.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DISCONNECTED" value="7">
<tp:docstring>
The VPN connection is disconnected.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
<tp:enum name="NM_VPN_CONNECTION_STATE_REASON" type="u">
<tp:enumvalue suffix="UNKNOWN" value="0">
<tp:docstring>
The reason for the VPN connection state change is unknown.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NONE" value="1">
<tp:docstring>
No reason was given for the VPN connection state change.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="USER_DISCONNECTED" value="2">
<tp:docstring>
The VPN connection changed state because the user disconnected it.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="DEVICE_DISCONNECTED" value="3">
<tp:docstring>
The VPN connection changed state because the device it was using was disconnected.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_STOPPED" value="4">
<tp:docstring>
The service providing the VPN connection was stopped.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="IP_CONFIG_INVALID" value="5">
<tp:docstring>
The IP config of the VPN connection was invalid.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="CONNECT_TIMEOUT" value="6">
<tp:docstring>
The connection attempt to the VPN service timed out.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_START_TIMEOUT" value="7">
<tp:docstring>
A timeout occurred while starting the service providing the VPN connection.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="SERVICE_START_FAILED" value="8">
<tp:docstring>
Starting the service starting the service providing the VPN connection failed.
</tp:docstring>
</tp:enumvalue>
<tp:enumvalue suffix="NO_SECRETS" value="9">
<tp:docstring>
Necessary secrets for the VPN connection were not provided.
</tp:docstring>
</tp:enumvalue>
</tp:enum>
</interface>
</node>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.VPN.Manager">
<method name="Connect">
<tp:docstring>
Establish a VPN connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_manager_connect"/>
<arg name="connection_type" type="s" direction="in">
<tp:docstring>
String describing the connection type.
</tp:docstring>
</arg>
<arg name="connection" type="o" direction="in">
<tp:docstring>
Object path of the network connection to establish the VPN connection on.
</tp:docstring>
</arg>
<arg name="device" type="o" direction="in">
<tp:docstring>
Object path of the device to establish the VPN connection on.
</tp:docstring>
</arg>
<arg name="vpn_connection" type="o" direction="out">
<tp:docstring>
Object path of the newly created VPN connection.
</tp:docstring>
</arg>
</method>
<method name="ListConnections">
<tp:docstring>
Get the list of active VPN connections.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_manager_get_connections"/>
<arg name="connections" type="ao" direction="out">
<tp:docstring>
List of object paths of active VPN connections.
</tp:docstring>
</arg>
</method>
</interface>
</node>

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8" ?>
<node name="/" xmlns:tp="http://telepathy.freedesktop.org/wiki/DbusSpec#extensions-v0">
<interface name="org.freedesktop.NetworkManager.VPN.Plugin">
<tp:docstring>
This interface is provided by plugins providing VPN services to the NetworkManager daemon.
</tp:docstring>
<method name="Connect">
<tp:docstring>
Tells the plugin to connect.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_connect"/>
<arg name="connection" type="a{sa{sv}}" direction="in" tp:type="String_String_Variant_Map_Map">
<tp:docstring>
Describes the connection to be established.
</tp:docstring>
</arg>
<tp:possible-errors>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.StartingInProgress"/>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.AlreadyStarted"/>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.StoppingInProgress"/>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.BadArguments"/>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.LaunchFailed"/>
</tp:possible-errors>
</method>
<method name="NeedSecrets">
<tp:docstring>
Asks the plugin whether the provided connection will require secrets to connect successfully.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_need_secrets"/>
<arg name="settings" type="a{sa{sv}}" direction="in" tp:type="String_String_Variant_Map_Map">
<tp:docstring>
Describes the connection that may need secrets.
</tp:docstring>
</arg>
<arg name="setting_name" type="s" direction="out">
<tp:docstring>
The setting name within the provided connection that requires secrets, if any.
</tp:docstring>
</arg>
<tp:possible-errors>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.ConnectionInvalid"/>
</tp:possible-errors>
</method>
<method name="Disconnect">
<tp:docstring>
Disconnect the plugin.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_disconnect"/>
<tp:possible-errors>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.StoppingInProgress"/>
<tp:error name="org.freedesktop.NetworkManager.VPN.Error.AlreadyStopped"/>
</tp:possible-errors>
</method>
<method name="SetIp4Config">
<tp:docstring>
Set IPv4 details on the connection.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_set_ip4_config"/>
<arg name="config" type="a{sv}" direction="in" tp:type="String_Variant_Map">
<tp:docstring>
Ip4Config details for the conneciton.
</tp:docstring>
</arg>
</method>
<method name="SetFailure">
<tp:docstring>
Indicate a failure to the plugin.
</tp:docstring>
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="impl_vpn_plugin_set_failure"/>
<arg name="reason" type="s" direction="in">
<tp:docstring>
The reason for the failure.
</tp:docstring>
</arg>
</method>
<property name="State" type="u" access="read" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>
The state of the plugin.
</tp:docstring>
</property>
<signal name="StateChanged">
<tp:docstring>
Emitted when the plugin state changes.
</tp:docstring>
<arg name="state" type="u" tp:type="NM_VPN_CONNECTION_STATE">
<tp:docstring>
The new state of the plugin.
</tp:docstring>
</arg>
</signal>
<signal name="Ip4Config">
<tp:docstring>
The plugin obtained an IPv4 configuration.
</tp:docstring>
<arg name="ip4config" type="a{sv}" tp:type="String_Variant_Map">
<tp:docstring>
The IPv4 configuration.
</tp:docstring>
</arg>
</signal>
<signal name="LoginBanner">
<tp:docstring>
Emitted when the plugin receives a login banner from the VPN service.
</tp:docstring>
<arg name="banner" type="s">
<tp:docstring>
The login banner string.
</tp:docstring>
</arg>
</signal>
<signal name="Failure">
<tp:docstring>
Emitted when a failure in the VPN plugin occurs.
</tp:docstring>
<arg name="reason" type="u" tp:type="NM_VPN_CONNECTION_STATE_REASON">
<tp:docstring>
Reason code for the failure.
</tp:docstring>
</arg>
</signal>
</interface>
</node>

@ -0,0 +1,63 @@
<!DOCTYPE busconfig PUBLIC
"-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<policy user="root">
<allow own="org.freedesktop.NetworkManagerUserSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection"/>
<!-- Only root can get secrets -->
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection.Secrets"/>
</policy>
<policy at_console="true">
<allow own="org.freedesktop.NetworkManagerUserSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection"/>
<!-- Only root can get secrets -->
<deny send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection.Secrets"/>
</policy>
<policy group="netdev">
<allow own="org.freedesktop.NetworkManagerUserSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection"/>
<!-- Only root can get secrets -->
<deny send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings.Connection.Secrets"/>
</policy>
<policy group="users">
<allow own="org.freedesktop.NetworkManagerInfo"/>
<allow send_destination="org.freedesktop.NetworkManagerInfo"/>
<allow send_interface="org.freedesktop.NetworkManagerInfo"/>
<allow own="org.freedesktop.NetworkManagerUserSettings"/>
<allow send_destination="org.freedesktop.NetworkManagerSettings"/>
<allow send_interface="org.freedesktop.NetworkManagerSettings"/>
</policy>
<policy context="default">
<deny own="org.freedesktop.NetworkManagerUserSettings"/>
<deny send_destination="org.freedesktop.NetworkManagerUserSettings"
send_interface="org.freedesktop.NetworkManagerSettings"/>
</policy>
</busconfig>

@ -0,0 +1,13 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
tde_install_icons( DESTINATION ${DATA_INSTALL_DIR}/knetworkmanager/icons )
tde_install_icons( knetworkmanager knetworkmanager_disabled )

@ -0,0 +1,5 @@
knmicondir = $(kde_datadir)/knetworkmanager/icons
knmicon_ICON = AUTO
KDE_ICON = knetworkmanager knetworkmanager_disabled

Binary file not shown.

After

Width:  |  Height:  |  Size: 954 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 629 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 927 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 672 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 699 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 717 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 734 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 719 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 698 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 712 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 693 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 701 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 661 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 727 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 708 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 650 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 893 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,93 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
add_subdirectory( dbus )
add_definitions( -UQT_NO_ASCII_CAST )
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_BINARY_DIR}
${TDE_INCLUDE_DIR}
${TQT_INCLUDE_DIRS}
${DBUS_TQT_INCLUDE_DIRS}
${NM_UTIL_INCLUDE_DIRS}
)
link_directories(
${TQT_LIBRARY_DIRS}
)
##### headers ###################################
install( FILES
knetworkmanager-plugin.h knetworkmanager-vpnplugin.h
DESTINATION ${INCLUDE_INSTALL_DIR} )
##### other data ################################
install( FILES knetworkmanager.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( FILES eventsrc DESTINATION ${DATA_INSTALL_DIR}/knetworkmanager )
install( FILES knetworkmanager_plugin.desktop knetworkmanager_vpnplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR} )
##### knetworkmanager (kdeinit) #################
tde_add_kdeinit_executable( knetworkmanager AUTOMOC
SOURCES
connection_setting_info.ui connection_setting_wireless_security_wep.ui connection_setting_gsm.ui
connection_setting_cdma.ui connection_setting_ipv4.ui connection_setting_ppp.ui
connection_setting_serial.ui connection_setting_wireless_security_wpacipher.ui
connection_setting_wireless_security_eap.ui connection_setting_wireless_security_wpapsk.ui
connection_setting_wireless_security_phase2.ui connection_setting_wireless_security_wpaversion.ui
connection_setting_wireless_security.ui connection_setting_wireless.ui
connection_setting_wireless_security_wepencryption.ui connection_settings.ui
connection_setting_wireless_security_auth.ui connection_setting_vpn.ui connection_editor.ui
vpnauthentication.ui main.cpp knetworkmanager.cpp knetworkmanager-tray.cpp
knetworkmanager-hal_device_proxy.cpp knetworkmanager-nm_proxy.cpp knetworkmanager-device.cpp
knetworkmanager-cdma_device.cpp knetworkmanager-cellular_device.cpp knetworkmanager-gsm_device.cpp
knetworkmanager-wired_device.cpp knetworkmanager-vpn_device.cpp knetworkmanager-vpn_plugin.cpp
knetworkmanager-wireless_device.cpp knetworkmanager-devicestore.cpp
knetworkmanager-cellular_device_tray.cpp knetworkmanager-device_tray.cpp
knetworkmanager-wired_device_tray.cpp knetworkmanager-wireless_device_tray.cpp
knetworkmanager-accesspoint.cpp knetworkmanager-wireless_menuitem.cpp knetworkmanager-menuitem.cpp
knetworkmanager-menu_subhead.cpp knetworkmanager-connection_setting.cpp
knetworkmanager-connection_setting_info.cpp knetworkmanager-connection_setting_ipv4.cpp
knetworkmanager-connection_setting_wired.cpp knetworkmanager-connection_setting_wireless.cpp
knetworkmanager-connection_setting_wireless_security.cpp
knetworkmanager-connection_setting_8021x.cpp knetworkmanager-connection_setting_vpn.cpp
knetworkmanager-connection_setting_serial.cpp knetworkmanager-connection_setting_cdma.cpp
knetworkmanager-connection_setting_gsm.cpp knetworkmanager-connection_setting_ppp.cpp
knetworkmanager-connection_dbus.cpp knetworkmanager-connection_secrets_dbus.cpp
knetworkmanager-connection.cpp knetworkmanager-generic_connection.cpp
knetworkmanager-cdma_connection.cpp knetworkmanager-gsm_connection.cpp
knetworkmanager-ppp_connection.cpp knetworkmanager-wireless_connection.cpp
knetworkmanager-wired_connection.cpp knetworkmanager-vpn_connection.cpp
knetworkmanager-connection_store.cpp knetworkmanager-connection_setting_cdma_widget.cpp
knetworkmanager-connection_setting_gsm_widget.cpp
knetworkmanager-connection_setting_info_widget.cpp
knetworkmanager-connection_setting_ipv4_widget.cpp
knetworkmanager-connection_setting_ppp_widget.cpp
knetworkmanager-connection_setting_serial_widget.cpp
knetworkmanager-connection_setting_wireless_security_widget.cpp
knetworkmanager-connection_setting_wireless_widget.cpp
knetworkmanager-connection_setting_vpn_widget.cpp knetworkmanager-connection_settings_dialog.cpp
knetworkmanager-connection_setting_widget_interface.cpp knetworkmanager-nmsettings.cpp
sha1.cpp md5.cpp xmlmarshaller.cpp knetworkmanager-storage.cpp
knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp
knetworkmanager-connection_editor.cpp knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp
knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp
knetworkmanager-vpnauthenticationdialog.cpp devicetraycomponent.cpp traycomponent.cpp
vpn_tray_component.cpp secret_storage_plugin.cpp
LINK knm_dbus-static kdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES}
)

@ -0,0 +1,220 @@
SUBDIRS = dbus
# set the include path for X, qt and KDE
INCLUDES = $(PACKAGE_CFLAGS) $(all_includes)
# headers to install
include_HEADERS = knetworkmanager-plugin.h \
knetworkmanager-vpnplugin.h
# these are the headers for your project
noinst_HEADERS = knetworkmanager.h \
knetworkmanager-tray.h \
knetworkmanager-hal_device_proxy.h \
knetworkmanager-nm_proxy.h \
knetworkmanager-device.h \
knetworkmanager-wired_device.h \
knetworkmanager-vpn_device.h \
knetworkmanager-vpn_plugin.h \
knetworkmanager-gsm_device.h \
knetworkmanager-cdma_device.h \
knetworkmanager-cellular_device.h \
knetworkmanager-wireless_device.h \
knetworkmanager-devicestore.h \
knetworkmanager-cellular_device_tray.h \
knetworkmanager-device_tray.h \
knetworkmanager-wired_device_tray.h \
knetworkmanager-wireless_device_tray.h \
knetworkmanager-accesspoint.h \
knetworkmanager-wireless_menuitem.h \
knetworkmanager-menuitem.h \
knetworkmanager-menu_subhead.h \
knetworkmanager-connection_setting.h \
knetworkmanager-connection_setting_info.h \
knetworkmanager-connection_setting_ipv4.h \
knetworkmanager-connection_setting_wired.h \
knetworkmanager-connection_setting_wireless.h \
knetworkmanager-connection_setting_wireless_security.h \
knetworkmanager-connection_setting_8021x.h \
knetworkmanager-connection_setting_vpn.h \
knetworkmanager-connection_setting_serial.h \
knetworkmanager-connection_setting_cdma.h \
knetworkmanager-connection_setting_gsm.h \
knetworkmanager-connection_setting_ppp.h \
knetworkmanager-ppp_connection.h \
knetworkmanager-cdma_connection.h \
knetworkmanager-gsm_connection.h \
knetworkmanager-wired_connection.h \
knetworkmanager-vpn_connection.h \
knetworkmanager-wireless_connection.h \
knetworkmanager-generic_connection.h \
knetworkmanager-connection.h \
knetworkmanager-connection_dbus.h \
knetworkmanager-connection_secrets_dbus.h \
knetworkmanager-connection_store.h \
knetworkmanager-connection_setting_gsm_widget.h \
knetworkmanager-connection_setting_cdma_widget.h \
knetworkmanager-connection_setting_info_widget.h \
knetworkmanager-connection_setting_ipv4_widget.h \
knetworkmanager-connection_setting_ppp_widget.h \
knetworkmanager-connection_setting_serial_widget.h \
knetworkmanager-connection_setting_widget_interface.h \
knetworkmanager-connection_setting_wireless_security_widget.h \
knetworkmanager-connection_setting_wireless_widget.h \
knetworkmanager-connection_setting_vpn_widget.h \
knetworkmanager-connection_setting_widget_interface.h \
knetworkmanager-nmsettings.h \
sha1.h \
md5.h \
xmlmarshaller.h \
knetworkmanager-storage.h \
knetworkmanager-wireless_network.h \
knetworkmanager-wireless_manager.h \
knetworkmanager-connection_editor.h \
knetworkmanager-plugin.h \
knetworkmanager-vpnplugin.h \
knetworkmanager-pluginmanager.h \
knetworkmanager-vpnservice.h \
knetworkmanager-vpnmanager.h \
knetworkmanager-vpnauthenticationdialog.h \
devicetraycomponent.h \
traycomponent.h \
vpn_tray_component.h \
secret_storage_plugin.h
# let automoc handle all of the meta source files (moc)
METASOURCES = AUTO
messages: rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/knetworkmanager.pot
#########################################################################
# APPLICATION SECTION
#########################################################################
# this is the program that gets installed. it's name is used for all
# of the other Makefile.am variables
bin_PROGRAMS =
lib_LTLIBRARIES =
kdeinit_LTLIBRARIES = knetworkmanager.la
KDE_CXXFLAGS = -UQT_NO_ASCII_CAST ${LIBNMUTIL_CFLAGS}
# the application source, library search path, and link libraries
knetworkmanager_la_SOURCES = connection_setting_info.ui \
connection_setting_wireless_security_wep.ui \
connection_setting_gsm.ui \
connection_setting_cdma.ui \
connection_setting_ipv4.ui \
connection_setting_ppp.ui \
connection_setting_serial.ui \
connection_setting_wireless_security_wpacipher.ui \
connection_setting_wireless_security_eap.ui \
connection_setting_wireless_security_wpapsk.ui \
connection_setting_wireless_security_phase2.ui \
connection_setting_wireless_security_wpaversion.ui \
connection_setting_wireless_security.ui \
connection_setting_wireless.ui \
connection_setting_wireless_security_wepencryption.ui \
connection_settings.ui \
connection_setting_wireless_security_auth.ui \
connection_setting_vpn.ui \
connection_editor.ui \
vpnauthentication.ui \
main.cpp \
knetworkmanager.cpp \
knetworkmanager-tray.cpp \
knetworkmanager-hal_device_proxy.cpp \
knetworkmanager-nm_proxy.cpp \
knetworkmanager-device.cpp \
knetworkmanager-cdma_device.cpp \
knetworkmanager-cellular_device.cpp \
knetworkmanager-gsm_device.cpp \
knetworkmanager-wired_device.cpp \
knetworkmanager-vpn_device.cpp \
knetworkmanager-vpn_plugin.cpp \
knetworkmanager-wireless_device.cpp \
knetworkmanager-devicestore.cpp \
knetworkmanager-cellular_device_tray.cpp \
knetworkmanager-device_tray.cpp \
knetworkmanager-wired_device_tray.cpp \
knetworkmanager-wireless_device_tray.cpp \
knetworkmanager-accesspoint.cpp \
knetworkmanager-wireless_menuitem.cpp \
knetworkmanager-menuitem.cpp \
knetworkmanager-menu_subhead.cpp \
knetworkmanager-connection_setting.cpp \
knetworkmanager-connection_setting_info.cpp \
knetworkmanager-connection_setting_ipv4.cpp \
knetworkmanager-connection_setting_wired.cpp \
knetworkmanager-connection_setting_wireless.cpp \
knetworkmanager-connection_setting_wireless_security.cpp \
knetworkmanager-connection_setting_8021x.cpp \
knetworkmanager-connection_setting_vpn.cpp \
knetworkmanager-connection_setting_serial.cpp \
knetworkmanager-connection_setting_cdma.cpp \
knetworkmanager-connection_setting_gsm.cpp \
knetworkmanager-connection_setting_ppp.cpp \
knetworkmanager-connection_dbus.cpp \
knetworkmanager-connection_secrets_dbus.cpp \
knetworkmanager-connection.cpp \
knetworkmanager-generic_connection.cpp \
knetworkmanager-cdma_connection.cpp \
knetworkmanager-gsm_connection.cpp \
knetworkmanager-ppp_connection.cpp \
knetworkmanager-wireless_connection.cpp \
knetworkmanager-wired_connection.cpp \
knetworkmanager-vpn_connection.cpp \
knetworkmanager-connection_store.cpp \
knetworkmanager-connection_setting_cdma_widget.cpp \
knetworkmanager-connection_setting_gsm_widget.cpp \
knetworkmanager-connection_setting_info_widget.cpp \
knetworkmanager-connection_setting_ipv4_widget.cpp \
knetworkmanager-connection_setting_ppp_widget.cpp \
knetworkmanager-connection_setting_serial_widget.cpp \
knetworkmanager-connection_setting_wireless_security_widget.cpp \
knetworkmanager-connection_setting_wireless_widget.cpp \
knetworkmanager-connection_setting_vpn_widget.cpp \
knetworkmanager-connection_settings_dialog.cpp \
knetworkmanager-connection_setting_widget_interface.cpp \
knetworkmanager-nmsettings.cpp \
sha1.cpp \
md5.cpp \
xmlmarshaller.cpp \
knetworkmanager-storage.cpp \
knetworkmanager-wireless_network.cpp \
knetworkmanager-wireless_manager.cpp \
knetworkmanager-connection_editor.cpp \
knetworkmanager-plugin.cpp \
knetworkmanager-vpnplugin.cpp \
knetworkmanager-pluginmanager.cpp \
knetworkmanager-vpnservice.cpp \
knetworkmanager-vpnmanager.cpp \
knetworkmanager-vpnauthenticationdialog.cpp \
devicetraycomponent.cpp \
traycomponent.cpp \
vpn_tray_component.cpp \
secret_storage_plugin.cpp
knetworkmanager_la_LDFLAGS = -module \
$(KDE_RPATH) \
$(all_libraries) \
$(KDE_PLUGIN)
knetworkmanager_la_LIBADD = dbus/libknm_dbus.la \
$(PACKAGE_LIBS) \
$(LIB_KDEUI) \
$(LIB_KUTILS) \
$(LIB_KWALLETCLIENT) \
$(LIB_KDEUI)
# this is where the desktop file will go
xdg_apps_DATA = knetworkmanager.desktop
mydatadir = $(kde_datadir)/knetworkmanager
mydata_DATA = eventsrc
servicetype_DATA = knetworkmanager_plugin.desktop knetworkmanager_vpnplugin.desktop
servicetypedir = $(kde_servicetypesdir)
EXTRA_DIST = $(xdg_apps_DATA) $(mydata_DATA) $(servicetype_DATA)

@ -0,0 +1,123 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionEditor</class>
<widget class="TQDialog">
<property name="name">
<cstring>ConnectionEditor</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>480</height>
</rect>
</property>
<property name="caption">
<string>Edit Connections ...</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KListView" row="1" column="0" rowspan="5" colspan="1">
<column>
<property name="text">
<string>Connection</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Type</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<property name="name">
<cstring>lvConnections</cstring>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="showSortIndicator">
<bool>true</bool>
</property>
<property name="resizeMode">
<enum>AllColumns</enum>
</property>
</widget>
<widget class="KComboBox" row="0" column="0">
<property name="name">
<cstring>cboConnectionType</cstring>
</property>
</widget>
<widget class="KPushButton" row="5" column="1">
<property name="name">
<cstring>pbClose</cstring>
</property>
<property name="text">
<string>Close</string>
</property>
</widget>
<spacer row="4" column="1">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>240</height>
</size>
</property>
</spacer>
<widget class="KPushButton" row="1" column="1">
<property name="name">
<cstring>pbNew</cstring>
</property>
<property name="text">
<string>New Connection</string>
</property>
</widget>
<widget class="KPushButton" row="3" column="1">
<property name="name">
<cstring>pbDelete</cstring>
</property>
<property name="text">
<string>Delete Connection</string>
</property>
</widget>
<widget class="KPushButton" row="2" column="1">
<property name="name">
<cstring>pbEdit</cstring>
</property>
<property name="text">
<string>Edit Connection</string>
</property>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,131 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingCdmaWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingCdmaWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>102</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLayoutWidget">
<property name="name">
<cstring>tqlayout10</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>mPassword</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Password needed to access the service</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>&amp;Number:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mNumber</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>mUsername</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Username needed to access the service</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>&amp;Username:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
<string>&amp;Password:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>mNumber</cstring>
</property>
</widget>
<spacer row="0" column="2" rowspan="2" colspan="1">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>146</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>mNumber</tabstop>
<tabstop>mUsername</tabstop>
<tabstop>mPassword</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,294 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingGsmWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingGsmWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>381</width>
<height>245</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLayoutWidget">
<property name="name">
<cstring>tqlayout9</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="2" column="2">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>Network &amp;ID:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mNetworkId</cstring>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel2_2_2</cstring>
</property>
<property name="text">
<string>PU&amp;K:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>&amp;Number:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mNumber</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>mPassword</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Password needed to access the service</string>
</property>
</widget>
<widget class="TQComboBox" row="3" column="3">
<item>
<property name="text">
<string>Any</string>
</property>
</item>
<item>
<property name="text">
<string>GPRS</string>
</property>
</item>
<item>
<property name="text">
<string>GSM</string>
</property>
</item>
<item>
<property name="text">
<string>Prefer GPRS</string>
</property>
</item>
<item>
<property name="text">
<string>Prefer GSM</string>
</property>
</item>
<property name="name">
<cstring>mNetworkType</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Select the type of cellular data network the connection should use</string>
</property>
<property name="whatsThis" stdset="0">
<string>Any chooses the best available; GSM/GPRS locks the connection to the specified network type; Prefer options prefer one type but will use the other if necessary</string>
</property>
</widget>
<widget class="TQLabel" row="3" column="2">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Network &amp;Type:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mNetworkType</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>&amp;Username:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="3">
<property name="name">
<cstring>mApn</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Access Point Name</string>
</property>
<property name="whatsThis" stdset="0">
<string>The hostname of the machine providing network access</string>
</property>
</widget>
<widget class="TQLabel" row="4" column="2">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>&amp;Band:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mBand</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="3" column="1">
<property name="name">
<cstring>mPuk</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Personal Unblocking Code</string>
</property>
<property name="whatsThis" stdset="0">
<string> A code used to unblock a blocked SIM card</string>
</property>
</widget>
<widget class="TQSpinBox" row="4" column="3">
<property name="name">
<cstring>mBand</cstring>
</property>
<property name="maxValue">
<number>5</number>
</property>
<property name="minValue">
<number>-1</number>
</property>
<property name="value">
<number>-1</number>
</property>
</widget>
<spacer row="4" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>171</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>mPin</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Personal Identification Number</string>
</property>
<property name="whatsThis" stdset="0">
<string>A code used for all GSM-based phones to establish authorisation for access to certain functions or information</string>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>mUsername</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Username needed to access the service</string>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="3">
<property name="name">
<cstring>mNumber</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="2" column="3">
<property name="name">
<cstring>mNetworkId</cstring>
</property>
<property name="toolTip" stdset="0">
<string>The GSM network to connect to</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel2_3</cstring>
</property>
<property name="text">
<string>&amp;PIN:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
<string>Pass&amp;word:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="2">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>&amp;APN:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mApn</cstring>
</property>
</widget>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer5</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>51</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>mUsername</tabstop>
<tabstop>mPassword</tabstop>
<tabstop>mPin</tabstop>
<tabstop>mPuk</tabstop>
<tabstop>mNumber</tabstop>
<tabstop>mApn</tabstop>
<tabstop>mNetworkId</tabstop>
<tabstop>mNetworkType</tabstop>
<tabstop>mBand</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,71 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingInfoWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingInfoWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>591</width>
<height>151</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Connection Name:</string>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>txtConnectionName</cstring>
</property>
</widget>
<spacer row="2" column="0">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Autoconnect:</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>chkAutoConnect</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,116 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingIPv4Widget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingIPv4Widget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>534</width>
<height>330</height>
</rect>
</property>
<property name="caption">
<string>Form3</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupIPConfig</cstring>
</property>
<property name="title">
<string>Use manual IP configuration</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>DNS Addresses:</string>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
<string>DNS Search:</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>IP Address:</string>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>txtIP</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="3" column="1">
<property name="name">
<cstring>txtDNSAddresses</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="4" column="1">
<property name="name">
<cstring>txtDNSSearch</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2_3</cstring>
</property>
<property name="text">
<string>Netmask:</string>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>txtNetmask</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Gateway:</string>
</property>
</widget>
<widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>txtGateway</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<tabstops>
<tabstop>txtIP</tabstop>
<tabstop>txtNetmask</tabstop>
<tabstop>txtGateway</tabstop>
<tabstop>txtDNSAddresses</tabstop>
<tabstop>txtDNSSearch</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,320 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingPppWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingPppWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<height>284</height>
</rect>
</property>
<property name="caption">
<string>Form2</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLayoutWidget">
<property name="name">
<cstring>tqlayout9</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="3" column="1">
<property name="name">
<cstring>mRequireMppe128</cstring>
</property>
<property name="text">
<string>Require MPPE128</string>
</property>
</widget>
<spacer row="5" column="2" rowspan="2" colspan="1">
<property name="name">
<cstring>spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
<widget class="TQLayoutWidget" row="4" column="2">
<property name="name">
<cstring>tqlayout11</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox">
<property name="name">
<cstring>mLcpEchoInterval</cstring>
</property>
</widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel11</cstring>
</property>
<property name="text">
<string>LCP Echo Interval</string>
</property>
</widget>
</hbox>
</widget>
<widget class="TQLayoutWidget" row="3" column="2">
<property name="name">
<cstring>tqlayout12</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox">
<property name="name">
<cstring>mLcpEchoFailure</cstring>
</property>
</widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel10</cstring>
</property>
<property name="text">
<string>LCP Echo Failure</string>
</property>
</widget>
</hbox>
</widget>
<widget class="TQLayoutWidget" row="0" column="2">
<property name="name">
<cstring>tqlayout15</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox">
<property name="name">
<cstring>mBaudRate</cstring>
</property>
</widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="text">
<string>Baud rate</string>
</property>
</widget>
</hbox>
</widget>
<widget class="TQLayoutWidget" row="2" column="2">
<property name="name">
<cstring>tqlayout13</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox">
<property name="name">
<cstring>mMtu</cstring>
</property>
</widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel9</cstring>
</property>
<property name="text">
<string>MTU</string>
</property>
</widget>
</hbox>
</widget>
<widget class="TQCheckBox" row="2" column="0">
<property name="name">
<cstring>mRefusePap</cstring>
</property>
<property name="text">
<string>Refuse PAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>mNoAuth</cstring>
</property>
<property name="text">
<string>No Authorization</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>mNoVjComp</cstring>
</property>
<property name="text">
<string>No VJ Compression</string>
</property>
</widget>
<widget class="TQCheckBox" row="4" column="0">
<property name="name">
<cstring>mRefuseMschap</cstring>
</property>
<property name="text">
<string>Refuse MSCHAP</string>
</property>
</widget>
<widget class="TQLayoutWidget" row="1" column="2">
<property name="name">
<cstring>tqlayout14</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox">
<property name="name">
<cstring>mMru</cstring>
</property>
</widget>
<widget class="TQLabel">
<property name="name">
<cstring>textLabel8</cstring>
</property>
<property name="text">
<string>MRU</string>
</property>
</widget>
</hbox>
</widget>
<widget class="TQCheckBox" row="2" column="1">
<property name="name">
<cstring>mRequireMppe</cstring>
</property>
<property name="text">
<string>Require MPPE</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="1">
<property name="name">
<cstring>mRequireMppc</cstring>
</property>
<property name="text">
<string>Require MPPC</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="0">
<property name="name">
<cstring>mRefuseMschapV2</cstring>
</property>
<property name="text">
<string>Refuse MSCHAPv2</string>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="0">
<property name="name">
<cstring>mNoBsd</cstring>
</property>
<property name="text">
<string>No BSD</string>
</property>
</widget>
<widget class="TQCheckBox" row="4" column="1">
<property name="name">
<cstring>mStatefulMppe</cstring>
</property>
<property name="text">
<string>Stateful MPPE</string>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="1">
<property name="name">
<cstring>mCrtscts</cstring>
</property>
<property name="text">
<string>CRTSCTS</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="1">
<property name="name">
<cstring>mNoDeflate</cstring>
</property>
<property name="text">
<string>No Deflate</string>
</property>
</widget>
<widget class="TQCheckBox" row="3" column="0">
<property name="name">
<cstring>mRefuseChap</cstring>
</property>
<property name="text">
<string>Refuse CHAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>mRefuseEap</cstring>
</property>
<property name="text">
<string>Refuse EAP</string>
</property>
</widget>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>41</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>mNoAuth</tabstop>
<tabstop>mRefuseEap</tabstop>
<tabstop>mRefusePap</tabstop>
<tabstop>mRefuseChap</tabstop>
<tabstop>mRefuseMschap</tabstop>
<tabstop>mRefuseMschapV2</tabstop>
<tabstop>mNoBsd</tabstop>
<tabstop>mNoDeflate</tabstop>
<tabstop>mNoVjComp</tabstop>
<tabstop>mRequireMppe</tabstop>
<tabstop>mRequireMppe128</tabstop>
<tabstop>mStatefulMppe</tabstop>
<tabstop>mRequireMppc</tabstop>
<tabstop>mCrtscts</tabstop>
<tabstop>mBaudRate</tabstop>
<tabstop>mMru</tabstop>
<tabstop>mMtu</tabstop>
<tabstop>mLcpEchoFailure</tabstop>
<tabstop>mLcpEchoInterval</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,185 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingSerialWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingSerialWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>170</width>
<height>187</height>
</rect>
</property>
<property name="caption">
<string>Form2</string>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLayoutWidget">
<property name="name">
<cstring>tqlayout23</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQSpinBox" row="4" column="1">
<property name="name">
<cstring>mSendDelay</cstring>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>textLabel11</cstring>
</property>
<property name="text">
<string>&amp;Send delay</string>
</property>
<property name="buddy" stdset="0">
<cstring>mSendDelay</cstring>
</property>
</widget>
<widget class="TQComboBox" row="2" column="1">
<item>
<property name="text">
<string>None</string>
</property>
</item>
<item>
<property name="text">
<string>Even</string>
</property>
</item>
<item>
<property name="text">
<string>Odd</string>
</property>
</item>
<property name="name">
<cstring>mParity</cstring>
</property>
</widget>
<widget class="TQComboBox" row="3" column="1">
<item>
<property name="text">
<string>0</string>
</property>
</item>
<item>
<property name="text">
<string>1</string>
</property>
</item>
<property name="name">
<cstring>mStopBits</cstring>
</property>
<property name="currentItem">
<number>1</number>
</property>
</widget>
<widget class="TQComboBox" row="1" column="1">
<item>
<property name="text">
<string>7</string>
</property>
</item>
<item>
<property name="text">
<string>8</string>
</property>
</item>
<item>
<property name="text">
<string>9</string>
</property>
</item>
<property name="name">
<cstring>mDataBits</cstring>
</property>
<property name="currentItem">
<number>1</number>
</property>
</widget>
<widget class="TQSpinBox" row="0" column="1">
<property name="name">
<cstring>mBaudRate</cstring>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel12_3</cstring>
</property>
<property name="text">
<string>&amp;Stop bits:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mStopBits</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="text">
<string>Baud rate</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel12_2</cstring>
</property>
<property name="text">
<string>&amp;Parity:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mParity</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel12</cstring>
</property>
<property name="text">
<string>&amp;Data bits:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mDataBits</cstring>
</property>
</widget>
</grid>
</widget>
<spacer>
<property name="name">
<cstring>spacer6</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>141</height>
</size>
</property>
</spacer>
</vbox>
</widget>
<tabstops>
<tabstop>mBaudRate</tabstop>
<tabstop>mDataBits</tabstop>
<tabstop>mParity</tabstop>
<tabstop>mStopBits</tabstop>
<tabstop>mSendDelay</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,51 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingVPNWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>VPN</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>331</width>
<height>155</height>
</rect>
</property>
<property name="caption">
<string>VPN</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboServices</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Service</string>
</property>
</widget>
<widget class="TQWidgetStack" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>widgetStack</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>0</number>
</attribute>
</widget>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,140 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>506</width>
<height>418</height>
</rect>
</property>
<property name="caption">
<string>Form6</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Essid:</string>
</property>
</widget>
<widget class="KLineEdit" row="2" column="1" rowspan="1" colspan="3">
<property name="name">
<cstring>txtEssid</cstring>
</property>
</widget>
<widget class="KPushButton" row="3" column="2" rowspan="1" colspan="2">
<property name="name">
<cstring>pbExpert</cstring>
</property>
<property name="text">
<string>Expert options</string>
</property>
</widget>
<spacer row="3" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>282</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="KListView" row="1" column="0" rowspan="1" colspan="4">
<column>
<property name="text">
<string>Essid</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Quality</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<column>
<property name="text">
<string>Security</string>
</property>
<property name="clickable">
<bool>true</bool>
</property>
<property name="resizable">
<bool>true</bool>
</property>
</column>
<property name="name">
<cstring>lvEssids</cstring>
</property>
<property name="frameShape">
<enum>StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="allColumnsShowFocus">
<bool>true</bool>
</property>
<property name="fullWidth">
<bool>true</bool>
</property>
</widget>
<widget class="TQFrame" row="0" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>framePlaceholder</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="frameShadow">
<enum>Raised</enum>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="3">
<property name="name">
<cstring>chkAutoRefresh</cstring>
</property>
<property name="text">
<string>Refresh automatically</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>klineedit.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>klistview.h</includehint>
</includehints>
</UI>

@ -0,0 +1,87 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>Form1</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>522</width>
<height>158</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupUseEncryption</cstring>
</property>
<property name="title">
<string>Use Wireless Security</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboSecurity</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Security:</string>
</property>
</widget>
<widget class="TQButtonGroup" row="1" column="1">
<property name="name">
<cstring>buttonGroup5</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="title">
<string></string>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
</hbox>
</widget>
<widget class="TQPushButton" row="0" column="2">
<property name="name">
<cstring>pbExtra</cstring>
</property>
<property name="text">
<string>Expert settings</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,51 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>Form1</class>
<widget class="TQWidget">
<property name="name">
<cstring>Form1</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>342</width>
<height>97</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupBox1</cstring>
</property>
<property name="title">
<string>Authentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Method:</string>
</property>
</widget>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboAuthAlg</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,163 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityEAP</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityEAP</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>583</width>
<height>174</height>
</rect>
</property>
<property name="caption">
<string>Form2</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupBox2</cstring>
</property>
<property name="title">
<string>EAP</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel8</cstring>
</property>
<property name="text">
<string>Method:</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel9</cstring>
</property>
<property name="text">
<string>Identity:</string>
</property>
</widget>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboMethod</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>txtIdentity</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>txtAnonIdentity</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel10</cstring>
</property>
<property name="text">
<string>Anonymous Identity:</string>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel11</cstring>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
<widget class="KPasswordEdit" row="3" column="1">
<property name="name">
<cstring>txtPassword</cstring>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>textLabel16</cstring>
</property>
<property name="text">
<string>Private Secret Key:</string>
</property>
</widget>
<widget class="KPasswordEdit" row="4" column="1">
<property name="name">
<cstring>txtPrivateSecretKey</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>textLabel12</cstring>
</property>
<property name="text">
<string>Client Certificate:</string>
</property>
</widget>
<widget class="KURLRequester" row="0" column="3">
<property name="name">
<cstring>kURLClientCert</cstring>
</property>
</widget>
<widget class="KURLRequester" row="1" column="3">
<property name="name">
<cstring>kURLPrivateKey</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="2">
<property name="name">
<cstring>textLabel15</cstring>
</property>
<property name="text">
<string>Private Keyfile:</string>
</property>
</widget>
<widget class="TQLabel" row="3" column="2">
<property name="name">
<cstring>textLabel14</cstring>
</property>
<property name="text">
<string>CA Certificate:</string>
</property>
</widget>
<widget class="KURLRequester" row="3" column="3">
<property name="name">
<cstring>kURLCACert</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="2">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Use System CA Certificates</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="3">
<property name="name">
<cstring>chkCAStore</cstring>
</property>
<property name="text">
<string></string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,54 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityPhase2</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityPhase2</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>225</width>
<height>135</height>
</rect>
</property>
<property name="caption">
<string>Form4</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupBox4</cstring>
</property>
<property name="title">
<string>Phase 2</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel17</cstring>
</property>
<property name="text">
<string>Method:</string>
</property>
</widget>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboPhase2Method</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,146 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWEP</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityWEP</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>333</width>
<height>238</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>WEP</cstring>
</property>
<property name="title">
<string>WEP</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQButtonGroup" row="0" column="0">
<property name="name">
<cstring>buttonGroup1</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<property name="title">
<string></string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLineEdit" row="4" column="1">
<property name="name">
<cstring>txtWEPKey2</cstring>
</property>
</widget>
<widget class="TQRadioButton" row="3" column="0">
<property name="name">
<cstring>rbKeyIdx1</cstring>
</property>
<property name="text">
<string>Key 2:</string>
</property>
</widget>
<widget class="TQRadioButton" row="5" column="0">
<property name="name">
<cstring>rbKeyIdx3</cstring>
</property>
<property name="text">
<string>Key 4:</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Type:</string>
</property>
</widget>
<widget class="TQRadioButton" row="2" column="0">
<property name="name">
<cstring>rbKeyIdx0</cstring>
</property>
<property name="text">
<string>Key 1:</string>
</property>
</widget>
<widget class="TQLineEdit" row="5" column="1">
<property name="name">
<cstring>txtWEPKey3</cstring>
</property>
</widget>
<widget class="TQRadioButton" row="4" column="0">
<property name="name">
<cstring>rbKeyIdx2</cstring>
</property>
<property name="text">
<string>Key 3:</string>
</property>
</widget>
<widget class="TQLineEdit" row="3" column="1">
<property name="name">
<cstring>txtWEPKey1</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="2" column="1">
<property name="name">
<cstring>txtWEPKey0</cstring>
</property>
</widget>
<widget class="TQComboBox" row="1" column="1">
<property name="name">
<cstring>cbKeyType</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Authentication:</string>
</property>
</widget>
<widget class="TQComboBox" row="0" column="1">
<property name="name">
<cstring>cboAuthentication</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,46 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWEPEncryption</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityWEPEncryption</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>64</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupBox2</cstring>
</property>
<property name="title">
<string>Encryption</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQComboBox" row="0" column="0">
<property name="name">
<cstring>cboEncryption</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,128 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWPACipher</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityWPACipher</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>99</height>
</rect>
</property>
<property name="caption">
<string>Form1</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>grpUseCipher</cstring>
</property>
<property name="title">
<string>Use specific cipher</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel18</cstring>
</property>
<property name="text">
<string>Group Cipher:</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Pairwise Cipher:</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="2">
<property name="name">
<cstring>chkGroupCipherCCMP</cstring>
</property>
<property name="text">
<string>CCMP</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="1">
<property name="name">
<cstring>chkGroupCipherTKIP</cstring>
</property>
<property name="text">
<string>TKIP</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="1">
<property name="name">
<cstring>chkPairwiseCipherTKIP</cstring>
</property>
<property name="text">
<string>TKIP</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="2">
<property name="name">
<cstring>chkPairwiseCipherCCMP</cstring>
</property>
<property name="text">
<string>CCMP</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="3">
<property name="name">
<cstring>chkGroupCipherWEP40</cstring>
</property>
<property name="text">
<string>WEP 40</string>
</property>
</widget>
<spacer row="0" column="5">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>60</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQCheckBox" row="0" column="4">
<property name="name">
<cstring>chkGroupCipherWEP104</cstring>
</property>
<property name="text">
<string>WEP 104</string>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,46 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWPAPSK</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityWPAPSK</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>600</width>
<height>480</height>
</rect>
</property>
<property name="caption">
<string>Form2</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>groupBox3</cstring>
</property>
<property name="title">
<string>Shared Key</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLineEdit" row="0" column="0">
<property name="name">
<cstring>txtPSK</cstring>
</property>
</widget>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,80 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingWirelessSecurityWPAVersion</class>
<widget class="TQWidget">
<property name="name">
<cstring>ConnectionSettingWirelessSecurityWPAVersion</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>308</width>
<height>64</height>
</rect>
</property>
<property name="caption">
<string>Form3</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQButtonGroup" row="0" column="0">
<property name="name">
<cstring>grpUseWPAVersion</cstring>
</property>
<property name="title">
<string>Use specific WPA Version</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="1">
<property name="name">
<cstring>cbRSN</cstring>
</property>
<property name="text">
<string>WPA 2/RSN</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>cbWPA</cstring>
</property>
<property name="text">
<string>WPA 1</string>
</property>
</widget>
<spacer row="0" column="2">
<property name="name">
<cstring>spacer7</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>50</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,137 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>ConnectionSettingsDialog</class>
<widget class="TQDialog">
<property name="name">
<cstring>ConnectionSettingsDialog</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>644</width>
<height>318</height>
</rect>
</property>
<property name="caption">
<string>Connections</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KPushButton" row="2" column="0">
<property name="name">
<cstring>pbBack</cstring>
</property>
<property name="text">
<string>Back</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="0" rowspan="1" colspan="6">
<property name="name">
<cstring>lblInfo</cstring>
</property>
<property name="font">
<font>
<bold>1</bold>
</font>
</property>
<property name="text">
<string>New Connection</string>
</property>
</widget>
<widget class="TQWidgetStack" row="1" column="0" rowspan="1" colspan="6">
<property name="name">
<cstring>wstackSettings</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>5</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>TabWidgetPanel</enum>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>0</number>
</attribute>
</widget>
</widget>
<widget class="KPushButton" row="2" column="5">
<property name="name">
<cstring>pbCancel</cstring>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<spacer row="2" column="1">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>180</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="KPushButton" row="2" column="2">
<property name="name">
<cstring>pbNext</cstring>
</property>
<property name="text">
<string>Next</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="TQPushButton" row="2" column="4">
<property name="name">
<cstring>pbSave</cstring>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
<widget class="KPushButton" row="2" column="3">
<property name="name">
<cstring>btnConnect</cstring>
</property>
<property name="text">
<string>Connect &amp;&amp; Save</string>
</property>
<property name="accel">
<string></string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
</includehints>
</UI>

@ -0,0 +1,88 @@
#################################################
#
# (C) 2010 Serghei Amelian
# serghei (DOT) amelian (AT) gmail.com
#
# Improvements and feedback are welcome
#
# This file is released under GPL >= 2
#
#################################################
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${TQT_INCLUDE_DIRS}
${DBUS_TQT_INCLUDE_DIRS}
)
##### knm_dbus (static) #########################
set( INTROSPECTIONPATH "${CMAKE_SOURCE_DIR}/knetworkmanager-0.8/introspection" )
# options:
# p - generate proxy files
# i - generate interface files
# n - generate node files
function( add_dbus_xml option basename classname namespace xmlfile )
if( classname )
set( classname -c ${classname} )
endif( )
add_custom_command( OUTPUT ${basename}.cpp ${basename}.h
COMMAND ${DBUSXML2QT3_EXECUTABLE} -${option} ${basename} ${classname} -N ${namespace} ${INTROSPECTIONPATH}/${xmlfile} 2>/dev/null
DEPENDS ${INTROSPECTIONPATH}/${xmlfile} )
endfunction( )
add_dbus_xml( p networkmanagerproxy NetworkManagerProxy DBus nm-manager.xml )
add_dbus_xml( p networkmanagervpnproxy NetworkManagerVPNProxy DBus nm-vpn-manager.xml )
add_dbus_xml( p deviceproxy DeviceProxy DBus nm-device.xml )
add_dbus_xml( p wirelessproxy WirelessDeviceProxy DBus nm-device-802-11-wireless.xml )
add_dbus_xml( p wiredproxy WiredDeviceProxy DBus nm-device-802-3-ethernet.xml )
add_dbus_xml( p gsmproxy GSMDeviceProxy DBus nm-device-gsm.xml )
add_dbus_xml( p cdmaproxy CDMADeviceProxy DBus nm-device-cdma.xml )
add_dbus_xml( p accesspointproxy AccessPointProxy DBus nm-access-point.xml )
add_dbus_xml( p activeconnectionproxy ActiveConnectionProxy DBus nm-active-connection.xml )
add_dbus_xml( p vpnconnectionproxy VPNConnectionProxy DBus nm-vpn-connection-only.xml )
add_dbus_xml( p vpnpluginproxy VPNPluginProxy DBus nm-vpn-plugin.xml )
add_dbus_xml( i networkmanagersettings SettingsInterface DBus nm-settings.xml )
add_dbus_xml( i connection "" DBus nm-exported-connection.xml )
add_custom_command( OUTPUT connectionnode.cpp connectionnode.h introspectableinterface.cpp introspectableinterface.h
COMMAND ${DBUSXML2QT3_EXECUTABLE} -n connectionnode -c ConnectionNode -N DBus ${INTROSPECTIONPATH}/nm-exported-connection.xml 2>/dev/null
COMMAND sed s/\#include\\ \\"secrets.h\\"// connectionnode.cpp > connectionnode.cpp_tmp
COMMAND sed s/\#include\\ \\"introspectable.h\\"/\#include\\ \\"introspectableinterface.h\\"/ connectionnode.cpp_tmp > connectionnode.cpp
COMMAND rm -f connectionnode.cpp_tmp
DEPENDS ${INTROSPECTIONPATH}/nm-exported-connection.xml )
# generate moc files
set( MOCHEADERS accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagervpnproxy.h wiredproxy.h
wirelessproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h gsmproxy.h cdmaproxy.h )
foreach( _header_file ${MOCHEADERS} )
get_filename_component( _basename "${_header_file}" NAME_WE )
set( _moc_file ${_basename}.moc )
list( APPEND _moc_files ${_moc_file} )
add_custom_command( OUTPUT ${_moc_file}
COMMAND ${TMOC_EXECUTABLE} ${_header_file} -o ${_moc_file}
DEPENDS ${_header_file} )
endforeach( )
add_custom_command( OUTPUT mocfiles.cpp
COMMAND cat ${_moc_files} > mocfiles.cpp
DEPENDS ${_moc_files} )
# build the library
tde_add_library( knm_dbus STATIC_PIC
SOURCES
networkmanagerproxy.cpp networkmanagervpnproxy.cpp
deviceproxy.cpp wiredproxy.cpp wirelessproxy.cpp
accesspointproxy.cpp networkmanagersettings.cpp
connection.cpp connectionnode.cpp introspectableinterface.cpp
mocfiles.cpp activeconnectionproxy.cpp vpnconnectionproxy.cpp
vpnpluginproxy.cpp gsmproxy.cpp cdmaproxy.cpp
)

@ -0,0 +1,129 @@
INCLUDES = $(DBUS_TQT_CFLAGS) $(QT_INCLUDES)
INTROSPECTIONPATH = $(srcdir)/../../introspection/
MOCHEADERS = accesspointproxy.h deviceproxy.h networkmanagerproxy.h networkmanagervpnproxy.h \
wiredproxy.h wirelessproxy.h activeconnectionproxy.h vpnconnectionproxy.h vpnpluginproxy.h gsmproxy.h cdmaproxy.h
#ip4configproxy.h
MOCSUBS = accesspointproxy.moc deviceproxy.moc networkmanagerproxy.moc networkmanagervpnproxy.moc \
wiredproxy.moc wirelessproxy.moc activeconnectionproxy.moc vpnconnectionproxy.moc vpnpluginproxy.moc gsmproxy.moc cdmaproxy.moc
#ip4configproxy.moc
DBUSPROXY = networkmanagerproxy.cpp \
networkmanagervpnproxy.cpp \
deviceproxy.cpp \
wiredproxy.cpp \
wirelessproxy.cpp \
accesspointproxy.cpp \
networkmanagersettings.cpp \
connection.cpp \
connectionnode.cpp \
introspectableinterface.cpp \
mocfiles.cpp \
activeconnectionproxy.cpp \
vpnconnectionproxy.cpp \
vpnpluginproxy.cpp \
gsmproxy.cpp \
cdmaproxy.cpp
# ip4configproxy.cpp
DBUSPROXYHEADERS = networkmanagerproxy.h \
networkmanagervpnproxy.h \
deviceproxy.h \
wiredproxy.h \
wirelessproxy.h \
accesspointproxy.h \
networkmanagersettings.h \
connection.h \
connectionnode.h \
introspectableinterface.h \
activeconnectionproxy.h \
vpnconnectionproxy.h \
vpnpluginproxy.h \
gsmproxy.h \
cdmaproxy.h
# ip4configproxy.h
noinst_HEADERS = accesspointproxy.h \
connection.h \
connectionnode.h \
deviceproxy.h \
introspectableinterface.h \
networkmanagerproxy.h \
networkmanagervpnproxy.h \
networkmanagersettings.h \
wiredproxy.h \
wirelessproxy.h \
activeconnectionproxy.h \
vpnconnectionproxy.h \
vpnpluginproxy.h \
gsmproxy.h \
cdmaproxy.h
#ip4configproxy.h
noinst_LTLIBRARIES = libknm_dbus.la
libknm_dbus_la_SOURCES = $(DBUSPROXY)
CLEANFILES = $(DBUSPROXY) $(DBUSPROXYHEADERS) $(MOCSUBS)
.h.moc:
$(TQTMOC) $< -o $@
mocfiles.cpp: $(MOCSUBS)
cat $(MOCSUBS) > mocfiles.cpp
networkmanagerproxy.cpp networkmanagerproxy.h:
$(DBUSXML2QT3) -p networkmanagerproxy -c NetworkManagerProxy -N DBus $(INTROSPECTIONPATH)nm-manager.xml
networkmanagervpnproxy.cpp networkmanagervpnproxy.h:
$(DBUSXML2QT3) -p networkmanagervpnproxy -c NetworkManagerVPNProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-manager.xml
deviceproxy.cpp deviceproxy.h:
$(DBUSXML2QT3) -p deviceproxy -c DeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device.xml
wirelessproxy.cpp wirelessproxy.h:
$(DBUSXML2QT3) -p wirelessproxy -c WirelessDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-802-11-wireless.xml
wiredproxy.cpp wiredproxy.h:
$(DBUSXML2QT3) -p wiredproxy -c WiredDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-802-3-ethernet.xml
gsmproxy.cpp gsmproxy.h:
$(DBUSXML2QT3) -p gsmproxy -c GSMDeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-gsm.xml
cdmaproxy.cpp cdmaproxy.h:
$(DBUSXML2QT3) -p cdmaproxy -c CDMADeviceProxy -N DBus $(INTROSPECTIONPATH)nm-device-cdma.xml
#ip4configproxy.cpp ip4configproxy.h:
# $(DBUSXML2QT3) -p ip4configproxy -c IP4ConfigProxy -N DBus $(INTROSPECTIONPATH)nm-ip4-config.xml
accesspointproxy.cpp accesspointproxy.h:
$(DBUSXML2QT3) -p accesspointproxy -c AccessPointProxy -N DBus $(INTROSPECTIONPATH)nm-access-point.xml
activeconnectionproxy.cpp activeconnectionproxy.h:
$(DBUSXML2QT3) -p activeconnectionproxy -c ActiveConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-active-connection.xml
#vpnconnectionproxy.cpp vpnconnectionproxy.h:
# $(DBUSXML2QT3) -p vpnconnectionproxy -c VPNConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection.xml
#vpnconnectionproxy.cpp vpnconnectionproxy.h:
# $(DBUSXML2QT3) -p vpnconnectionproxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection.xml
vpnconnectionproxy.cpp vpnconnectionproxy.h:
$(DBUSXML2QT3) -p vpnconnectionproxy -c VPNConnectionProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-connection-only.xml
vpnpluginproxy.cpp vpnpluginproxy.h:
$(DBUSXML2QT3) -p vpnpluginproxy -c VPNPluginProxy -N DBus $(INTROSPECTIONPATH)nm-vpn-plugin.xml
networkmanagersettings.cpp networkmanagersettings.h:
$(DBUSXML2QT3) -i networkmanagersettings -c SettingsInterface -N DBus $(INTROSPECTIONPATH)nm-settings.xml
connection.cpp connection.h:
$(DBUSXML2QT3) -i connection -N DBus $(INTROSPECTIONPATH)nm-exported-connection.xml
connectionnode.cpp connectionnode.h introspectableinterface.cpp introspectableinterface.h:
$(DBUSXML2QT3) -n connectionnode -c ConnectionNode -N DBus $(INTROSPECTIONPATH)nm-exported-connection.xml
sed s/#include\ \"secrets.h\"// connectionnode.cpp > connectionnode.cpp_tmp
sed s/#include\ \"introspectable.h\"/#include\ \"introspectableinterface.h\"/ connectionnode.cpp_tmp > connectionnode.cpp
rm -f connectionnode.cpp_tmp

@ -0,0 +1,133 @@
/*
Copyright 2008 Will Stephenson <wstephenson@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#include "devicetraycomponent.h"
#include <kiconloader.h>
#include <klocale.h>
#include <ksystemtray.h>
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name )
: TrayComponent(parent, name), m_device(device)
{
connect( m_device, TQT_SIGNAL(StateChanged(NMDeviceState)), TQT_SLOT(deviceStateChanged(NMDeviceState)));
m_pixmaps[NM_DEVICE_STATE_UNKNOWN] = "nm_no_connection";
m_pixmaps[NM_DEVICE_STATE_UNMANAGED] = "nm_no_connection";
m_pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = "nm_no_connection";
m_pixmaps[NM_DEVICE_STATE_DISCONNECTED] = "nm_no_connection";
m_pixmaps[NM_DEVICE_STATE_ACTIVATED] = "ok";
m_pixmaps[NM_DEVICE_STATE_FAILED] = "nm_no_connection";
m_movies[NM_DEVICE_STATE_PREPARE] = "nm_stage01_connecting";
m_movies[NM_DEVICE_STATE_CONFIG] = "nm_stage02_connecting";
m_movies[NM_DEVICE_STATE_IP_CONFIG] = "nm_stage03_connecting";
m_movies[NM_DEVICE_STATE_NEED_AUTH] = m_movies[NM_DEVICE_STATE_CONFIG];
m_tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown");
m_tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down");
m_tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged");
m_tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected");
m_tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing");
m_tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration");
m_tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication");
m_tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration");
m_tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated");
m_tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed");
}
DeviceTrayComponent::~DeviceTrayComponent()
{
}
Device* DeviceTrayComponent::device() const
{
return m_device;
}
TQStringList DeviceTrayComponent::getToolTipText()
{
TQStringList list;
NMDeviceState state = m_device->getState();
if (m_tooltips.contains(state)) {
list.append(i18n("Device: %1").tqarg(m_device->getInterface()));
list.append(i18n("State: %1").tqarg(m_tooltips[state]));
}
return list;
}
TQPixmap DeviceTrayComponent::pixmapForState(NMDeviceState state)
{
if (m_pixmaps.contains(state)) {
return KSystemTray::loadIcon(m_pixmaps[state]);
} else {
return TQPixmap();
}
}
TQMovie DeviceTrayComponent::movieForState(NMDeviceState state)
{
if (m_movies.contains(state)) {
return TQMovie( KGlobal::iconLoader()->moviePath(m_movies[state], KIcon::Panel));
} else {
return TQMovie();
}
}
void DeviceTrayComponent::setMovieForState(NMDeviceState state, TQString movie)
{
m_movies[state] = movie;
}
void DeviceTrayComponent::setPixmapForState(NMDeviceState state, TQString pixmap)
{
m_pixmaps[state] = pixmap;
}
void DeviceTrayComponent::deviceStateChanged(NMDeviceState state)
{
//check if our device now holds the default active connection
// if it is the default active connection
// or if it is activating. what if 2 devices are activating simultaneously?
NMProxy * nm = 0;
switch (state) {
case NM_DEVICE_STATE_PREPARE:
emit needsCenterStage(this, true);
break;
case NM_DEVICE_STATE_ACTIVATED:
nm = NMProxy::getInstance();
if ( m_device == nm->getDefaultDevice() ) {
emit needsCenterStage(this, true);
}
break;
case NM_DEVICE_STATE_UNAVAILABLE:
case NM_DEVICE_STATE_DISCONNECTED:
case NM_DEVICE_STATE_FAILED:
emit needsCenterStage(this, false);
break;
default:
break;
}
}
#include "devicetraycomponent.moc"

@ -0,0 +1,63 @@
/*
Copyright 2008 Will Stephenson <wstephenson@kde.org>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License or (at your option) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef DEVICE_TRAY_COMPONENT_H
#define DEVICE_TRAY_COMPONENT_H
#include <NetworkManager.h>
#include <tqmap.h>
#include <tqmovie.h>
#include <tqobject.h>
#include <tqpixmap.h>
#include "traycomponent.h"
class Device;
class KPopupMenu;
class KSystemTray;
class DeviceTrayComponent : public TrayComponent
{
Q_OBJECT
TQ_OBJECT
public:
DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name );
virtual ~DeviceTrayComponent();
TQPixmap pixmapForState(NMDeviceState state);
TQMovie movieForState(NMDeviceState state);
virtual TQStringList getToolTipText();
Device* device() const;
signals:
void needsCenterStage(TrayComponent *, bool);
public slots:
virtual void newConnection() = 0;
protected slots:
void deviceStateChanged(NMDeviceState);
protected:
void setMovieForState(NMDeviceState, TQString);
void setPixmapForState(NMDeviceState, TQString);
private:
Device * m_device;
TQMap<NMDeviceState, TQString> m_movies;
TQMap<NMDeviceState, TQString> m_pixmaps;
TQMap<NMDeviceState, TQString> m_tooltips;
};
#endif // DEVICE_TRAY_COMPONENT_H

@ -0,0 +1,315 @@
[!Global!]
IconName=network
Comment=KNetworkManager
Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার
Comment[da]=Netværkshåndtering
Comment[sv]=Nätverkshantering
[knm-nm-vpn-banner]
Comment=VPN Banner Notification Received
default_presentation=0
[knm-nm-sleeping]
Name=KNetworkManager Offline
Name[bg]=KNetworkManager - изключен от Интернет
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার অফলাইন
Name[br]=Ezlinenn eo KNetworkManager
Name[ca]=El KNetworkManager està desconnectat
Name[cs]=KNetworkManager offline
Name[da]=Netværkshåndtering offline
Name[el]=Ο KNetworkManager χωρίς σύνδεση
Name[es]=KNetworkManager desconectado
Name[et]=KNetworkManager võrguta režiimis
Name[it]=KNetworkManager Non in linea
Name[ja]=KNetworkManager オフライン
Name[pt]=KNetworkManager Desligado
Name[sr]=KNetworkManager ван везе
Name[sr@Latn]=KNetworkManager van veze
Name[sv]=Nätverkshantering nerkopplad
Name[tr]=KNetworkManager Çevrimdışı
Comment=Switched to offline mode
Comment[bg]=Преминаване в режим "Изключен от Интернет"
Comment[bn]=অফলাইন মোড চালু করা হয়েছে
Comment[ca]=S'ha canviat al mode 'desconnectat'
Comment[cs]=Přepnutý do offline režimu
Comment[da]=Skiftede til offline tilstand
Comment[de]=In Offline-Modus gewechselt
Comment[el]=Άλλαξε σε λειτουργία χωρίς σύνδεση
Comment[es]=Se ha pasado al modo desconectado
Comment[et]=Lülituti võrguta režiimi
Comment[it]=Passato in modalità non in linea
Comment[ja]=オフラインモードに切り替わりました
Comment[nl]=Offline-modus geactiveerd
Comment[pt]=Mudou-se para o modo desligado
Comment[sr]=Пребачен у режим ван везе
Comment[sr@Latn]=Prebačen u režim van veze
Comment[sv]=Bytte till nerkopplat läge
Comment[tr]=Çevrimdışı kipe geçildi
default_presentation=0
[knm-nm-connected]
Name=KNetworkManager Connected
Name[bg]=KNetworkManager - свързан
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযুক্ত
Name[br]=Kevreet eo KNetworkManager
Name[ca]=El KNetworkManager està connectat
Name[cs]=KNetworkManager připojen
Name[da]=Netværkshåndtering forbundet
Name[de]=KNetworkManager Verbunden
Name[el]=Ο KNetworkManager συνδέθηκε
Name[es]=KNetworkManager conectado
Name[et]=KNetworkManager ühendatud
Name[it]=KNetworkManager Connesso
Name[ja]=KNetworkManager 接続しました
Name[nl]=KNetworkManager Verbonden
Name[pt]=KNetworkManager Ligado
Name[sr]=KNetworkManager је повезан
Name[sr@Latn]=KNetworkManager je povezan
Name[sv]=Nätverkshantering ansluten
Name[tr]=KNetworkManager Bağlandı
Comment=NetworkManager is now connected
Comment[bg]=NetworkManager е свързан
Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযুক্ত
Comment[ca]=Ara el NetworkManager està connectat
Comment[cs]=NetworkManager je nyní připojen
Comment[da]=Networkmanager er nu forbundet
Comment[de]=NetworkManager ist jetzt verbunden
Comment[el]=Ο NetworkManager είναι τώρα συνδεδεμένος
Comment[es]=NetworkManager está ahora conectado
Comment[et]=Võrguhaldur on nüüd ühendatud
Comment[it]=NetworkManager è ora connesso
Comment[ja]=NetworkManager は接続しました
Comment[nl]=NetworkManager is nu verbonden
Comment[pt]=O NetworkManager está agora ligado
Comment[sr]=NetworkManager је сада повезан
Comment[sr@Latn]=NetworkManager je sada povezan
Comment[sv]=Networkmanager är nu ansluten
Comment[tr]=NetworkManager şimdi bağlı
default_presentation=0
[knm-nm-connecting]
Name=KNetworkManager Connecting
Name[bg]=KNetworkManager се свързва
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে
Name[ca]=El KNetworkManager s'està connectant
Name[da]=Netværkshåndtering forbinder
Name[de]=KNetworkManager Verbinden
Name[el]=Ο KNetworkManager συνδέεται
Name[es]=KNetworkManager conectando
Name[et]=KNetworkManager ühendub
Name[it]=KNetworkManager Connessione in corso
Name[ja]=KNetworkManager 接続中
Name[nl]=KNetworkManager Verbinden
Name[pt]=KNetworkManager a Ligar
Name[sr]=KNetworkManager се повезује
Name[sr@Latn]=KNetworkManager se povezuje
Name[sv]=Nätverkshantering kopplar upp
Name[tr]=KNetworkManager Bağlanıyor
Comment=NetworkManager is connecting
Comment[bg]=NetworkManager се свързва
Comment[bn]=নেটওয়ার্ক-ম্যানেজার সংযোগ স্থাপন করছে
Comment[ca]=El NetworkManager s'està connectant
Comment[da]=Networkmanager forbinder
Comment[de]=NetworkManager stellt eine Verbindung her
Comment[el]=Ο KNetworkManager συνδέεται
Comment[es]=NetworkManager se está conectando
Comment[et]=Võrguhaldur ühendub
Comment[it]=NetworkManager si sta connettendo
Comment[ja]=NetworkManager は接続中です
Comment[nl]=NetworkManager is bezig met verbinden
Comment[pt]=O NetworkManager está a estabelecer a ligação
Comment[sr]=NetworkManager се повезује
Comment[sr@Latn]=NetworkManager se povezuje
Comment[sv]=Networkmanager kopplar upp
Comment[tr]=NetworkManager bağlanıyor
default_presentation=0
[knm-nm-disconnected]
Name=KNetworkManager Disconnected
Name[bg]=KNetworkManager - изключен от Интернет
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন
Name[br]=Digevreet eo KNetworkManager
Name[ca]=El KNetworkManager està desconnectat
Name[da]=Netværkshåndtering afbrudt
Name[de]=KNetworkManager Getrennt
Name[el]=Ο KNetworkManager αποσυνδέθηκε
Name[es]=KNetworkManager desconectado
Name[et]=KNetworkManager lahutatud
Name[it]=KNetworkManager Disconnesso
Name[ja]=KNetworkManager 切断しました
Name[nl]=KNetworkManager Niet verbonden
Name[pt]=KNetworkManager Desligado
Name[sr]=KNetworkManager је развезан
Name[sr@Latn]=KNetworkManager je razvezan
Name[sv]=Nätverkshantering nerkopplad
Name[tr]=KNetworkManager Bağlı Değil
Comment=NetworkManager is now disconnected
Comment[bg]=NetworkManager е изключен от Интернет
Comment[bn]=এখন নেটওয়ার্ক-ম্যানেজার সংযোগ বিহীন
Comment[ca]=Ara el NetworkManager està desconnectat
Comment[da]=Networkmanager er nu afbrudt
Comment[de]=NetworkManager ist jetzt getrennt
Comment[el]=Ο NetworkManager είναι τώρα αποσυνδεδεμένος
Comment[es]=NetworkManager está ahora desconectado
Comment[et]=Võrguhaldur on nüüd lahutatud
Comment[it]=NetworkManager è ora disconnesso
Comment[ja]=NetworkManager は切断しました
Comment[nl]=NetworkManager is niet verbonden met het netwerk
Comment[pt]=O NetworkManager está agora desligado
Comment[sr]=NetworkManager је сада развезан
Comment[sr@Latn]=NetworkManager je sada razvezan
Comment[sv]=Networkmanager är nu nerkopplad
Comment[tr]=NetworkManager artık bağlı değil
default_presentation=0
[knm-nm-device-added]
Name=KNetworkManager Device Added
Name[bg]=KNetworkManager - добавено е устройство
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস যোগ করা হয়েছে
Name[ca]=S'ha afegit un dispositiu del KNetworkManager
Name[da]=Netværkshåndtering enhed tilføjet
Name[de]=KNetworkManager Gerät hinzugefügt
Name[el]=Προστέθηκε συσκευή στον KNetworkManager
Name[es]=Añadido dispositivo a KNetworkManager
Name[et]=KNetworkManager lisas seadme
Name[it]=KNetworkManager Dispositivo aggiunto
Name[ja]=KNetworkManager デバイスが追加されました
Name[nl]=KNetworkManager Apparaat toegevoegd
Name[pt]=KNetworkManager com Dispositivo Adicionado
Name[sr]=KNetworkManager уређај додат
Name[sr@Latn]=KNetworkManager uređaj dodat
Name[sv]=Nätverkshantering enhet tillagd
Name[tr]=KNetworkManager Aygıt Eklendi
Comment=New network device found
Comment[bg]=Открито е ново мрежово устройство
Comment[bn]=নতুন নেটওয়ার্ক ডিভাইস খুঁজে পেয়েছে
Comment[br]=Kavet eo an drobarzhell rouedad nevez
Comment[ca]=S'ha trobat un nou dispositiu de xarxa
Comment[da]=Ny netværksenhed fundet
Comment[de]=Neues Netzwerkgerät gefunden
Comment[el]=Βρέθηκε νέα συσκευή δικτύου
Comment[es]=Se ha encontrado un nuevo dispositivo de red
Comment[et]=Leiti uus võrguseade
Comment[it]=Trovato nuovo dispositivo di rete
Comment[ja]=新しいネットワークデバイスが見つかりました
Comment[nl]=Nieuw netwerkapparaat gevonden
Comment[pt]=Foi detectado um novo dispositivo de rede
Comment[sr]=Нађен је нови мрежни уређај
Comment[sr@Latn]=Nađen je novi mrežni uređaj
Comment[sv]=Ny nätverksenhet hittades
Comment[tr]=Yeni ağ aygıtı bulundu
default_presentation=0
[knm-nm-device-removed]
Name=KNetworkManager Device Removed
Name[bg]=KNetworkManager - устройството е премахнато
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ডিভাইস অপসারিত করা হয়েছে
Name[ca]=S'ha eliminat un dispositiu del KNetworkManager
Name[da]=Netværkshåndtering enhed fjernet
Name[de]=KNetworkManager Gerät entfernt
Name[el]=Αφαιρέθηκε συσκευή από τον KNetworkManager
Name[es]=Eliminado dispositivo de KNetworkManager
Name[et]=KNetworkManager eemaldas seadme
Name[it]=KNetworkManager Dispositivo rimosso
Name[ja]=KNetworkManager デバイスが削除されました
Name[nl]=KNetworkManager Apparaat verwijderd
Name[pt]=KNetworkManager com Dispositivo Removido
Name[sr]=KNetworkManager уређај уклоњен
Name[sr@Latn]=KNetworkManager uređaj uklonjen
Name[sv]=Nätverkshantering enhet borttagen
Name[tr]=KNetworkManager Aygıt Kaldırıldı
Comment=Network device removed
Comment[bg]=Мрежовото устройство е премахнато
Comment[bn]=নেটওয়ার্ক ডিভাইস অপসারিত করা হয়েছে
Comment[br]=Lemet eo an drobarzhell rouedad
Comment[ca]=S'ha eliminat un dispositiu de xarxa
Comment[da]=Netværksenhed fjernet
Comment[de]=Netzwerkgerät entfernt
Comment[el]=Μια συσκευή δικτύου αφαιρέθηκε
Comment[es]=Se ha eliminado un dispositivo de red
Comment[et]=Võrguseade eemaldatud
Comment[it]=Dispositivo di rete rimosso
Comment[ja]=ネットワークデバイスが削除されました
Comment[nl]=Netwerkapparaat verwijderd
Comment[pt]=O dispositivo de rede foi removido
Comment[sr]=Мрежни уређај је уклоњен
Comment[sr@Latn]=Mrežni uređaj je uklonjen
Comment[sv]=Nätverksenhet borttagen
Comment[tr]=Ağ aygıtı kaldırıldı
default_presentation=0
[knm-nm-network-found]
Name=KNetworkManager New Wireless Network Found
Name[bg]=KNetworkManager - намерена е нова безжична мрежа
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে
Name[ca]=S'ha trobat una nova xarxa sense fils del KNetworkManager
Name[da]=Netværkshåndtering fandt nyt trådløst netværk
Name[de]=KNetworkManager Neues drahtloses Netzwerk gefunden
Name[el]=Βρέθηκε νέο ασύρματο δίκτυο στον KNetworkManager
Name[es]=Encontrada nueva red inalámbrica en KNetworkManager
Name[et]=KNetworkManager leidis uue traadita võrgu
Name[it]=KNetworkManager Trovata nuova rete senza fili
Name[ja]=KNetworkManager ワイヤレスネットワークを検出
Name[nl]=KNetworkManager Nieuw draadloos netwerk gevonden
Name[pt]=KNetworkManager com Nova Rede Sem-Fios Encontrada
Name[sr]=KNetworkManager нова бежична мрежа је нађена
Name[sr@Latn]=KNetworkManager nova bežična mreža je nađena
Name[sv]=Nätverkshantering ny trådlös enhet hittades
Name[tr]=KNetworkManager Yeni Kablosuz Ağ Bulundu
Comment=New wireless network found
Comment[bg]=Намерена е нова безжична мрежа
Comment[bn]=নতুন ওয়্যারলেস নেটওয়ার্ক খুঁজে পেয়েছে
Comment[ca]=S'ha trobat una nova xarxa sense fils
Comment[da]=Nyt trådløst netværk fundet
Comment[de]=Neues drahtloses Netzwerk gefunden
Comment[el]=Βρέθηκε νέο ασύρματο δίκτυο
Comment[es]=Se ha encontrado una nueva red inalámbrica
Comment[et]=Leiti uus traadita võrk
Comment[it]=Trovata nuova rete senza fili
Comment[ja]=新しいワイヤレスネットワークが見つかりました
Comment[nl]=Nieuw draadloos netwerk gevonden
Comment[pt]=Foi encontrada uma nova rede sem-fios
Comment[sr]=Нова бежична мрежа је нађена
Comment[sr@Latn]=Nova bežična mreža je nađena
Comment[sv]=Nytt trådlöst nätverk hittades
Comment[tr]=Yeni kablosuz ağ bulundu
default_presentation=0
[knm-nm-network-gone]
Name=KNetworkManager Wireless Network Disappeared
Name[bg]=KNetworkManager - безжичната мрежа се изгуби
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে
Name[ca]=Ha desaparegut la xarxa sense fils del KNetworkManager
Name[da]=Netværkshåndtering trådløst netværk forsvandt
Name[de]=KNetworkManager Drahtloses Netzwerk nicht mehr vorhanden
Name[el]=Ένα ασύρματο δίκτυο αφαιρέθηκε από τον KNetworkManager
Name[es]=Desaparecida red inalámbrica en KNetworkManager
Name[et]=KNetworkManager kaotas traadita võrgu
Name[it]=KNetworkManager È scomparsa la rete senza fili
Name[ja]=KNetworkManager ワイヤレスネットワークが消失
Name[nl]=KNetworkManager Draadloos netwerk verdwenen
Name[pt]=KNetworkManager Rede Sem-Fios Desaparecida
Name[sr]=KNetworkManager бежична мрежа је нестала
Name[sr@Latn]=KNetworkManager bežična mreža je nestala
Name[sv]=Nätverkshantering trådlöst nätverk försvann
Name[tr]=KNetworkManager Kablosuz Ağ Yok Oldu
Comment=Wireless network disappeared
Comment[bg]=Безжичната мрежа се изгуби
Comment[bn]=ওয়্যারলেস নেটওয়ার্ক অন্তর্ধান করেছে
Comment[ca]=Ha desaparegut la xarxa sense fils
Comment[da]=Trådløst netværk forsvandt
Comment[de]=Drahtloses Netzwerk nicht mehr vorhanden
Comment[el]=Ένα ασύρματο δίκτυο αφαιρέθηκε
Comment[es]=Ha desaparecido una red inalámbrica
Comment[et]=Traadita võrk kadus
Comment[it]=La rete senza fili è scomparsa
Comment[ja]=ワイヤレスネットワークが消失しました
Comment[nl]=Draadloos netwerk is verdwenen
Comment[pt]=Desapareceu uma rede sem-fios
Comment[sr]=Бежична мрежа је нестала
Comment[sr@Latn]=Bežična mreža je nestala
Comment[sv]=Trådlöst nätverk försvann
Comment[tr]=Kablosuz ağ kaybedildi
default_presentation=0

@ -0,0 +1,222 @@
/***************************************************************************
*
* knetworkmanager-accesspoint.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// TQt
#include <tqguardedptr.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
#include <tqdbuserror.h>
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-accesspoint.h"
#include "dbus/accesspointproxy.h"
class AccessPointPrivate
{
public:
AccessPointPrivate(TQString objpath = TQString(), const DBus::AccessPointProxy* proxy = NULL)
: nmAccessPoint(proxy)
, objPath(objpath)
{
}
~AccessPointPrivate() { }
// pointer to the shared DBus proxy
TQGuardedPtr<const DBus::AccessPointProxy> nmAccessPoint;
// DBus object path
TQString objPath;
// Properties
TQ_UINT32 flags;
TQ_UINT32 wpaFlags;
TQ_UINT32 rsnFlags;
TQValueList<TQ_UINT8> ssid;
TQ_UINT32 freq;
TQString hwAddress;
TQ_INT32 mode;
TQ_UINT32 rate;
TQ_UINT8 strength;
};
TQ_UINT32 AccessPoint::getFlags() const
{
return d->flags;
}
TQ_UINT32 AccessPoint::getWpaFlags() const
{
return d->wpaFlags;
}
TQ_UINT32 AccessPoint::getRsnFlags() const
{
return d->rsnFlags;
}
TQValueList<TQ_UINT8> AccessPoint::getSsid() const
{
return d->ssid;
}
TQ_UINT32 AccessPoint::getFrequency() const
{
return d->freq;
}
TQString AccessPoint::getHwAddress() const
{
return d->hwAddress;
}
TQ_INT32 AccessPoint::getMode() const
{
return d->mode;
}
TQ_UINT32 AccessPoint::getRate() const
{
return d->rate;
}
TQ_UINT8 AccessPoint::getStrength() const
{
return d->strength;
}
const TQByteArray AccessPoint::getSsidByteArray() const
{
// FIXME: Wow, thats ugly
TQValueList<TQ_UINT8> ssid = d->ssid;
TQByteArray ret_ssid(ssid.count());
TQByteArray::Iterator byteit = ret_ssid.begin();
for (TQValueList<TQ_UINT8>::iterator it = ssid.begin(); it != ssid.end(); ++it)
{
(*byteit) = (*it);
++byteit;
}
return ret_ssid;
}
TQString AccessPoint::getDisplaySsid() const
{
return TQString(getSsidByteArray());
}
bool AccessPoint::isEncrypted() const
{
return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY);
}
void AccessPoint::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties)
{
updateProperties();
}
void AccessPoint::updateProperties()
{
//TODO do this proper-like
TQT_DBusError err;
if (d->nmAccessPoint.isNull())
return;
d->flags = d->nmAccessPoint->getFlags(err);
d->wpaFlags = d->nmAccessPoint->getWpaFlags(err);
d->rsnFlags = d->nmAccessPoint->getRsnFlags(err);
d->ssid = d->nmAccessPoint->getSsid(err);
d->freq = d->nmAccessPoint->getFrequency(err);
d->hwAddress = d->nmAccessPoint->getHwAddress(err);
d->mode = d->nmAccessPoint->getMode(err);
d->rate = d->nmAccessPoint->getMaxBitrate(err);
d->strength = d->nmAccessPoint->getStrength(err);
emit strengthChanged(d->strength);
}
TQString AccessPoint::getObjectPath() const
{
return d->objPath;
}
bool AccessPoint::isValid() const
{
return !(d->objPath.isEmpty());
}
bool AccessPoint::operator== (const AccessPoint& other) const
{
return (other.getObjectPath() == getObjectPath());
}
#if 0
AccessPoint& AccessPoint::operator= (const AccessPoint& other)
{
kdDebug() << "AccessPoint::operator=\n" << endl;
d->objPath = other.d->objPath;
d->nmAccessPoint = other.d->nmAccessPoint;
connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
updateProperties();
return *this;
}
#endif
AccessPoint::AccessPoint(TQString obj_path, TQObject * parent, const char * name)
: TQObject(parent, name)
{
DBus::AccessPointProxy * proxy = new DBus::AccessPointProxy(NM_DBUS_SERVICE, obj_path);
proxy->setConnection(TQT_DBusConnection::systemBus());
d = new AccessPointPrivate(obj_path, proxy);
if (!d->nmAccessPoint.isNull())
connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
updateProperties();
}
#if 0
// copy constructor
AccessPoint::AccessPoint(const AccessPoint& other)
: TQObject()
{
// just copy the private data from other
d = new AccessPointPrivate(*other.d);
if (!d->nmAccessPoint.isNull())
connect(d->nmAccessPoint, TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
updateProperties();
}
#endif
AccessPoint::~AccessPoint()
{
delete d->nmAccessPoint;
delete d;
}
#include "knetworkmanager-accesspoint.moc"

@ -0,0 +1,75 @@
/***************************************************************************
*
* knetworkmanager-device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_ACCESSPOINT_H
#define KNETWORKMANAGER_ACCESSPOINT_H
#include "knetworkmanager.h"
#include <tqdbusvariant.h>
class AccessPointPrivate;
namespace DBus
{
class AccessPointProxy;
};
class AccessPoint : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
AccessPoint (const AccessPoint&);
AccessPoint (TQString objpath = TQString(), TQObject * parent = 0, const char * name = 0);
~AccessPoint ();
AccessPoint& operator= (const AccessPoint& other);
bool operator== (const AccessPoint& other) const;
TQ_UINT32 getFlags() const;
TQ_UINT32 getWpaFlags() const;
TQ_UINT32 getRsnFlags() const;
TQValueList<TQ_UINT8> getSsid() const;
TQ_UINT32 getFrequency() const;
TQString getHwAddress() const;
TQ_INT32 getMode() const;
TQ_UINT32 getRate() const;
TQ_UINT8 getStrength() const;
TQString getDisplaySsid() const;
const TQByteArray getSsidByteArray() const;
bool isEncrypted() const;
TQString getObjectPath() const;
bool isValid() const;
signals:
void strengthChanged(TQ_UINT8);
private slots:
void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties);
void updateProperties();
private:
AccessPointPrivate * d;
};
#endif /* KNETWORKMANAGER_DEVICE_H */

@ -0,0 +1,61 @@
/***************************************************************************
*
* knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager-cdma_connection.h"
#include <nm-setting-cdma.h>
#include "knetworkmanager-connection_setting_serial.h"
ConnectionSettings::CDMAConnection::CDMAConnection()
: PPPConnection(NM_SETTING_CDMA_SETTING_NAME)
{
appendSetting(new CDMA(this));
appendSetting(new Serial(this));
}
ConnectionSettings::CDMAConnection::~CDMAConnection()
{
}
ConnectionSettings::CDMA* ConnectionSettings::CDMAConnection::getCDMASetting() const
{
return dynamic_cast<CDMA*>(getSetting(NM_SETTING_CDMA_SETTING_NAME));
}
ConnectionSettings::Serial* ConnectionSettings::CDMAConnection::getSerialSetting() const
{
return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME));
}
ConnectionSettings::Connection* ConnectionSettings::CDMAConnection::duplicate()
{
CDMAConnection* conn = new CDMAConnection();
conn->updateSettings(this);
return conn;
}
#include "knetworkmanager-cdma_connection.moc"
// vim: sw=4 sts=4 noet tw=100

@ -0,0 +1,50 @@
/***************************************************************************
*
* knetworkmanager-cdma_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CDMA_CONNECTION_H
#define KNETWORKMANAGER_CDMA_CONNECTION_H
#include "knetworkmanager-ppp_connection.h"
#include "knetworkmanager-connection_setting_cdma.h"
namespace ConnectionSettings
{
class CDMA;
class Serial;
class CDMAConnection : public PPPConnection
{
Q_OBJECT
TQ_OBJECT
public:
CDMAConnection();
~CDMAConnection();
CDMA* getCDMASetting() const;
Serial* getSerialSetting() const;
Connection* duplicate();
};
} // namespace ConnectionSettings
#endif

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-cdma_device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-cdma_device.h"
#include "dbus/cdmaproxy.h"
class CDMADevicePrivate
{
public:
CDMADevicePrivate(TQString service, TQString obj_path)
: nmCDMA(service, obj_path)
{}
~CDMADevicePrivate() {}
DBus::CDMADeviceProxy nmCDMA;
};
CDMADevice::CDMADevice (const TQString & obj_path)
: CellularDevice(obj_path)
{
d = new CDMADevicePrivate(NM_DBUS_SERVICE, obj_path);
d->nmCDMA.setConnection(TQT_DBusConnection::systemBus());
}
CDMADevice::~CDMADevice ()
{
delete d;
}
#include "knetworkmanager-cdma_device.moc"

@ -0,0 +1,51 @@
/***************************************************************************
*
* knetworkmanager-cdma_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CDMADEVICE_H
#define KNETWORKMANAGER_CDMADEVICE_H
// std includes
#include <stdint.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-cellular_device.h"
class KNetworkManager;
class CDMADevicePrivate;
class CDMADevice : public CellularDevice
{
Q_OBJECT
TQ_OBJECT
public:
CDMADevice (const TQString & obj_path );
~CDMADevice ();
private:
CDMADevicePrivate * d;
};
#endif /* KNETWORKMANAGER_CDMADEVICE_H */

@ -0,0 +1,37 @@
/***************************************************************************
*
* knetworkmanager-cellular_device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KNM includes
#include "knetworkmanager-cellular_device.h"
CellularDevice::CellularDevice (const TQString & obj_path)
: Device(obj_path)
{
}
CellularDevice::~CellularDevice()
{
}
#include "knetworkmanager-cellular_device.moc"

@ -0,0 +1,40 @@
/***************************************************************************
*
* knetworkmanager-cellular_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CELLULARDEVICE_H
#define KNETWORKMANAGER_CELLULARDEVICE_H
// KNM includes
#include "knetworkmanager-device.h"
class CellularDevice : public Device
{
Q_OBJECT
TQ_OBJECT
public:
CellularDevice (const TQString & obj_path );
~CellularDevice ();
};
#endif /* KNETWORKMANAGER_CELLULARDEVICE_H */

@ -0,0 +1,184 @@
/***************************************************************************
*
* knetworkmanager-cellular_device_tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/// TQt includes
#include <tqwidget.h> // for TQt::WidgetFlags
// KDE includes
#include <kdebug.h>
#include <klocale.h>
#include <kiconloader.h>
// TQt DBus
#include <tqdbusobjectpath.h>
// KNM includes
#include "knetworkmanager-cellular_device_tray.h"
#include "knetworkmanager-cellular_device.h"
#include "knetworkmanager-menuitem.h"
#include "knetworkmanager-menu_subhead.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-cdma_connection.h"
#include "knetworkmanager-gsm_connection.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_cdma.h"
#include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_settings_dialog.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
using namespace ConnectionSettings;
class CellularDeviceTrayPrivate
{
public:
CellularDeviceTrayPrivate() {}
~CellularDeviceTrayPrivate() {}
CellularDevice* dev;
};
void CellularDeviceTray::newConnection()
{
// create an appropriate connection
Connection* conn = 0;
switch (d->dev->getDeviceType()) {
#if NM_CHECK_VERSION(0,8,992)
case NM_DEVICE_TYPE_MODEM:
#else
case DEVICE_TYPE_GSM:
#endif
conn = new GSMConnection();
break;
#if NM_CHECK_VERSION(0,8,992)
#else
case DEVICE_TYPE_CDMA:
conn = new CDMAConnection();
break;
#endif
default:
break;
}
// edit the new connection
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
dlg->show();
}
void CellularDeviceTray::addMenuItems(KPopupMenu* menu)
{
ConnectionStore* connectionStore = ConnectionStore::getInstance();
// device title
Subhead* subhead = new Subhead (menu, "subhead", d->dev->getInterface(), SmallIcon("nm_device_wwan", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
//menu->insertSeparator();
NMProxy* nm = NMProxy::getInstance();
Connection* active_conn = nm->getActiveConnection(d->dev);
if (active_conn)
kdDebug() << active_conn->getObjectPath().data() << endl;
// get all available Connections for cellular devices
// WILLTODO : repeat for GSM
TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_CDMA_SETTING_NAME);
for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
{
CDMAConnection* cellularconn = dynamic_cast<CDMAConnection*>(*it);
if (cellularconn)
{
// cellular connection found :)
Info* info = cellularconn->getInfoSetting();
IPv4* ip = cellularconn->getIPv4Setting();
// lets create a nice name for this connection
if (info)
{
TQString title = info->getName();
if (ip)
title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
NetworkMenuItem* item = new NetworkMenuItem(d->dev, cellularconn, TQT_TQOBJECT(menu));
int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
menu->setItemChecked(id, ((*it) == active_conn));
}
}
}
connections = connectionStore->getConnections(NM_SETTING_GSM_SETTING_NAME);
for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
{
GSMConnection* cellularconn = dynamic_cast<GSMConnection*>(*it);
if (cellularconn)
{
// cellular connection found :)
Info* info = cellularconn->getInfoSetting();
IPv4* ip = cellularconn->getIPv4Setting();
// lets create a nice name for this connection
if (info)
{
TQString title = info->getName();
if (ip)
title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
NetworkMenuItem* item = new NetworkMenuItem(d->dev, cellularconn, TQT_TQOBJECT(menu));
int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
menu->setItemChecked(id, ((*it) == active_conn));
}
}
}
// bring the device down
KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
if (deactivate)
deactivate->plug(menu);
menu->insertSeparator();
}
CellularDeviceTray::CellularDeviceTray (CellularDevice* dev, KSystemTray * parent, const char * name)
: DeviceTrayComponent (dev, parent, name)
{
d = new CellularDeviceTrayPrivate();
d->dev = dev;
setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wwan");
}
CellularDeviceTray::~CellularDeviceTray ()
{
delete d;
}
#include "knetworkmanager-cellular_device_tray.moc"

@ -0,0 +1,55 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H
#define KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H
// KNM includes
#include "knetworkmanager.h"
#include "devicetraycomponent.h"
// predefs
class CellularDevice;
class CellularDeviceTrayPrivate;
class CellularDeviceTray : public DeviceTrayComponent
{
Q_OBJECT
TQ_OBJECT
public:
CellularDeviceTray (CellularDevice*, KSystemTray * parent = 0, const char * name = 0);
~CellularDeviceTray ();
void addMenuItems(KPopupMenu* menu);
public slots:
void newConnection();
private:
CellularDeviceTrayPrivate* d;
};
#endif /* KNETWORKMANAGER_CELLULAR_DEVICE_TRAY_H */

@ -0,0 +1,299 @@
/***************************************************************************
*
* knetworkmanager-connection.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_dbus.h"
#include "knetworkmanager-connection_secrets_dbus.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-nmsettings.h"
#include <stdio.h>
extern unsigned char vpn_new_credentials_needed;
using namespace ConnectionSettings;
namespace ConnectionSettings
{
class ConnectionPrivate
{
public:
ConnectionPrivate(Connection* parent)
{
conn_dbus = new ConnectionDBus(parent);
conn_secrets_dbus = new ConnectionSecretsDBus(parent);
secrets_requested = false;
}
~ConnectionPrivate() {}
TQT_DBusObjectPath obj_path;
ConnectionDBus* conn_dbus;
ConnectionSecretsDBus* conn_secrets_dbus;
TQValueList<ConnectionSetting*> settings;
TQString specific_object;
bool secrets_requested;
};
}
/*
class Connection
*/
Connection::Connection()
{
d = new ConnectionPrivate(this);
NMSettings* nmSettings = NMSettings::getInstance();
d->obj_path = nmSettings->getObjPathForConnection();
TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
if (!registerObject(conn, objectPath()))
kdError() << "registerobjectpath failed" << endl;
// get notified whenever NM needs a secret
connect(d->conn_secrets_dbus, TQT_SIGNAL(SecretsNeeded(const TQString&, const TQStringList&, bool)), this, TQT_SLOT(slotSecretsNeeded(const TQString&, const TQStringList&, bool)));
}
Connection::~Connection()
{
for (TQValueList<ConnectionSetting*>::Iterator it= d->settings.begin(); it != d->settings.end(); ++it)
{
delete (*it);
*it = NULL;
}
delete d;
}
ConnectionSetting*
Connection::getSetting(const TQString& type) const
{
// find a setting by its type
for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it)
{
if ((*it)->getType() == type)
return (*it);
}
return NULL;
}
TQValueList<ConnectionSetting*>
Connection::getSettings() const
{
return d->settings;
}
void
Connection::appendSetting(ConnectionSetting* setting)
{
// that's our setting now :)
d->settings.append(setting);
connect(setting, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotSettingValidityChanged()));
}
void
Connection::setSpecificObject(const TQString& obj_path)
{
d->specific_object = obj_path;
}
TQString
Connection::getSpecificObject() const
{
return d->specific_object;
}
TQT_DBusObjectPath
Connection::getObjectPath() const
{
return d->obj_path;
}
TQString
Connection::objectPath() const
{
return d->obj_path;
}
bool
Connection::isValid() const
{
bool retval = true;
// check if every enabled setting is valid
for (TQValueList<ConnectionSetting*>::ConstIterator it = d->settings.begin(); it != d->settings.end(); ++it)
{
if ((*it)->getEnabled())
retval &= (*it)->isValid();
}
return retval;
}
void
Connection::slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new)
{
printf("Connection::slotSecretsNeeded %s, new: %s\n\r", setting_name.ascii(), (request_new ? "yes" : "no"));
kdDebug() << "Connection::slotSecretsNeeded " << setting_name.ascii() << ", new: " << (request_new ? "yes" : "no") << endl;
ConnectionSetting* setting = getSetting(setting_name);
// If needed, request new VPN credentials
if (strcmp("vpn", setting_name.ascii()) == 0) {
if (vpn_new_credentials_needed == 1) {
vpn_new_credentials_needed = 0;
request_new = 1;
}
}
if (!setting)
{
// send an error to NM
d->conn_secrets_dbus->SendGetSecretsReply(NULL);
}
else
{
if (!request_new && setting->hasSecrets())
{
// if the setting has secrets just send them
d->conn_secrets_dbus->SendGetSecretsReply(setting);
}
else
{
// NetworkManager asks for new secrets, ask user for new secrets/retry
d->secrets_requested = true;
emit SecretsNeeded(this, setting, hints, request_new);
}
}
}
void
Connection::slotSecretsProvided(ConnectionSetting* setting)
{
if (!d->secrets_requested)
return;
if (!setting)
{
// send all settings to NM
d->conn_secrets_dbus->SendGetSecretsReply(NULL);
}
else
{
// if we have the secrets already send them to NM
d->conn_secrets_dbus->SendGetSecretsReply(setting);
}
d->secrets_requested = false;
}
void
Connection::slotSecretsError()
{
if (!d->secrets_requested)
return;
d->conn_secrets_dbus->SendGetSecretsError();
d->secrets_requested = false;
}
TQT_DBusObjectBase*
Connection::createInterface(const TQString& interfaceName)
{
// the interfaces are already created, just return the right one
if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION)
return d->conn_dbus;
if (interfaceName == NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS)
return d->conn_secrets_dbus;
return NULL;
}
TQString
Connection::getType()
{
return TQString();
}
void
Connection::slotSettingValidityChanged()
{
emit validityChanged();
}
void
Connection::slotAboutToBeRemoved()
{
d->conn_dbus->slotAboutToBeRemoved();
}
void
Connection::slotUpdated()
{
d->conn_dbus->slotUpdated();
}
void
Connection::updateSettings(Connection* conn)
{
TQValueList<ConnectionSetting*> settings = conn->getSettings();
// copy all settings over to the new connection
for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
{
ConnectionSetting* other_setting = *it;
ConnectionSetting* my_setting = getSetting(other_setting->getType());
if (my_setting)
{
my_setting->fromMap(other_setting->toMap());
my_setting->fromSecretsMap(other_setting->toSecretsMap(false));
}
else
{
// should not happen
}
}
}
bool
Connection::awaitingSecrets()
{
return d->secrets_requested;
}
#include "knetworkmanager-connection.moc"

@ -0,0 +1,133 @@
/***************************************************************************
*
* knetworkmanager-connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_H
#define KNETWORKMANAGER_CONNECTION_H
#include <tqmap.h>
#include <tqobject.h>
#include "knetworkmanager-connection_setting.h"
#include "dbus/connection.h"
#include "dbus/connectionnode.h"
class AccessPoint;
class TQT_DBusObjectPath;
namespace ConnectionSettings
{
class WirelessSecurity;
class Connection;
class ConnectionSetting;
class ConnectionPrivate;
class Info;
class Wired;
class Wireless;
class WirelessSecurity;
class IPv4;
typedef TQMap<TQString, SettingsMap> ConnectionMap;
// a connection wraps multiple settings
class Connection : public TQObject, DBus::ConnectionNode
{
Q_OBJECT
TQ_OBJECT
public:
Connection();
virtual ~Connection();
virtual TQString getID() const = 0;
virtual void setID(const TQString& id) = 0;
// get a specific setting
ConnectionSetting* getSetting(const TQString&) const;
// get all settings of this connection
TQValueList<ConnectionSetting*> getSettings() const;
// attach a new setting
virtual void appendSetting(ConnectionSetting* setting);
// ugly stuff introduced by NM
void setSpecificObject(const TQString&);
TQString getSpecificObject() const;
// sometimes its usefull to have the object_path
TQT_DBusObjectPath getObjectPath() const;
// is the connection valid?
virtual bool isValid() const;
// the connections type (only for KNM use)
virtual TQString getType();
// duplicate
virtual Connection* duplicate() = 0;
// update the settings from another connection
void updateSettings(Connection*);
// true if the NM requested new secrets for this connection
bool awaitingSecrets();
public slots:
// gets called from NM when it needs the secrets
void slotSecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new);
// gets called when the GUI provided new secrets
void slotSecretsProvided(ConnectionSetting* setting);
// signal a failure in getting new secrets
void slotSecretsError();
// gets called when a settings validity changes
void slotSettingValidityChanged();
// gets called when the connection is about to be removed
void slotAboutToBeRemoved();
// gets called when the connections settings changed
void slotUpdated();
protected:
// implementations for ConnectionNode
TQT_DBusObjectBase* createInterface(const TQString& interfaceName);
TQString objectPath() const;
signals:
// signal when we need new secrets
void SecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new);
// signal gets emitted when connections validity changes
void validityChanged();
private:
ConnectionPrivate* d;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_H */

@ -0,0 +1,200 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
#include <tqdbuserror.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_dbus.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-nmsettings.h"
#include "xmlmarshaller.h"
using namespace ConnectionSettings;
namespace ConnectionSettings
{
class ConnectionDBusPrivate
{
public:
ConnectionDBusPrivate() {}
~ConnectionDBusPrivate() {}
ConnectionSettings::Connection* parent;
};
}
/*
class Connection
*/
ConnectionDBus::ConnectionDBus(ConnectionSettings::Connection* parent)
: TQObject(parent)
{
d = new ConnectionDBusPrivate();
d->parent = parent;
}
ConnectionDBus::~ConnectionDBus()
{
delete d;
}
bool
ConnectionDBus::GetID(TQString& id, TQT_DBusError& /*error*/)
{
kdDebug() << "Connection::GetID" << endl;
id = d->parent->getID();
return true;
}
bool
ConnectionDBus::GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& /*error*/)
{
kdDebug() << "Connection::GetSettings, obj: " << objectPath().ascii() << endl;
TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings();
// FIXME: ugly conversions, ask Kevin on how to make it better
for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it)
{
kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl;
// only append this setting if it is really used
if (!(*it)->getEnabled())
{
kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not enabled, discarding" << endl;
continue;
}
if (!(*it)->isValid())
{
kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl;
continue;
}
// copy the settingsmap over to a variantmap
TQMap<TQString, TQT_DBusData> map = (*it)->toMap();
// only take used settings
if (map.size() == 0)
{
kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl;
continue;
}
kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl;
TQMap<TQString, TQT_DBusVariant> variant_map;
for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
{
TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data());
kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl;
TQT_DBusVariant var;
var.value = it2.data();
var.signature = var.value.buildDBusSignature();
variant_map.insert(it2.key(), var);
}
// convert the variantma
TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map);
TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2);
// insert this setting
settings.insert((*it)->getType(), data);
}
return true;
}
bool
ConnectionDBus::Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error)
{
// FIXME
return true;
}
bool
ConnectionDBus::Delete(TQT_DBusError& error)
{
// FIXME
return true;
}
void
ConnectionDBus::handleMethodReply(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
}
bool
ConnectionDBus::handleSignalSend(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
return true;
}
TQString
ConnectionDBus::objectPath() const
{
return TQString(d->parent->getObjectPath());
}
void
ConnectionDBus::slotAboutToBeRemoved()
{
// tell NM about us being removed
emitRemoved();
}
void
ConnectionDBus::slotUpdated()
{
TQT_DBusDataMap<TQString> settings;
TQT_DBusError error;
if (GetSettings(settings, error))
emitUpdated(settings);
}
#include "knetworkmanager-connection_dbus.moc"

@ -0,0 +1,77 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_DBUS_H
#define KNETWORKMANAGER_CONNECTION_DBUS_H
#include <hal/libhal.h>
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include "knetworkmanager-connection_setting.h"
#include "dbus/connection.h"
#include "dbus/connectionnode.h"
class TQT_DBusObjectPath;
namespace ConnectionSettings
{
class Connection;
class ConnectionSetting;
class ConnectionDBusPrivate;
// DBUS abstraction for a connection
class ConnectionDBus : public TQObject, public DBus::Connection
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionDBus(ConnectionSettings::Connection* parent);
~ConnectionDBus();
public slots:
void slotAboutToBeRemoved();
void slotUpdated();
protected:
// implementations of the Setting DBus-interface
bool GetID(TQString& id, TQT_DBusError& error);
bool GetSettings(TQT_DBusDataMap<TQString>& settings, TQT_DBusError& error);
bool Update(const TQT_DBusDataMap<TQString>& properties, TQT_DBusError& error);
bool Delete(TQT_DBusError& error);
// used from both interfaces
void handleMethodReply(const TQT_DBusMessage& reply);
bool handleSignalSend(const TQT_DBusMessage& reply);
TQString objectPath() const;
private:
ConnectionDBusPrivate* d;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_DBUS_H */

@ -0,0 +1,250 @@
/***************************************************************************
*
* knetworkmanager-connection_editor.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqcombobox.h>
#include <tqtabwidget.h>
#include <tqpushbutton.h>
#include <tqwidgetstack.h>
#include <tqapplication.h>
#include <tqlabel.h>
#include <tqpopupmenu.h>
// kde headers
#include <kiconloader.h>
#include <kdebug.h>
#include <kpushbutton.h>
#include <klistview.h>
#include <klocale.h>
#include <kcombobox.h>
// knm headers
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection_editor.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include "knetworkmanager-storage.h"
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnmanager.h"
using namespace ConnectionSettings;
/*
* ConnectionListViewItem
*/
class ConnectionListViewItem : public KListViewItem
{
public:
ConnectionListViewItem(TQListView* parent, GenericConnection* connection)
: KListViewItem(parent)
, _conn(connection)
{
Info* info = _conn->getInfoSetting();
if (info)
{
setText(0, info->getName());
setText(1, info->getDevType());
// TODO: Move to a Factory
if (info->getDevType() == NM_SETTING_WIRED_SETTING_NAME)
setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small));
else if (info->getDevType() == NM_SETTING_WIRELESS_SETTING_NAME)
setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
else if (info->getDevType() == NM_SETTING_VPN_SETTING_NAME)
setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
else
setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small));
}
}
GenericConnection* _conn;
};
/*
* Constructor
*/
ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, bool modal, WFlags fl)
: ConnectionEditor(parent, name, modal, fl)
{
// TODO: enable combobox if implemented
cboConnectionType->hide();
// TODO: Editmode is not ready yet, hide the button
// pbEdit->hide();
pbNew->setIconSet(KGlobal::iconLoader()->loadIcon("add", KIcon::Small));
pbDelete->setIconSet(KGlobal::iconLoader()->loadIcon("remove", KIcon::Small));
pbEdit->setIconSet(KGlobal::iconLoader()->loadIcon("edit", KIcon::Small));
TQPopupMenu* popup = new TQPopupMenu(pbNew);
// TODO: move to a factory class
popup->insertItem(KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small), i18n("Wireless"), this, TQT_SLOT(slotNewWirelessConnection()));
popup->insertItem(KGlobal::iconLoader()->loadIcon("wired", KIcon::Small), i18n("Wired"), this, TQT_SLOT(slotNewWiredConnection()));
if (!VPNManager::getVPNServices().isEmpty())
popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
pbNew->setPopup(popup);
connect(pbClose, TQT_SIGNAL(clicked()), this, TQT_SLOT(close()));
connect(pbDelete, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotRemoveCurrentConnection()));
connect(pbEdit, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotEditCurrentConnection()));
// show all connections
fillConnectionList();
}
/*
* Destructor
*/
ConnectionEditorImpl::~ConnectionEditorImpl()
{
// remove the popupmenu
if (pbNew->popup())
delete pbNew->popup();
}
/*
* New Wireless connection
*/
void ConnectionEditorImpl::slotNewWirelessConnection()
{
// create a new wireless connection
slotEditNewConnection(new WirelessConnection());
}
/*
* New Wired connection
*/
void ConnectionEditorImpl::slotNewWiredConnection()
{
slotEditNewConnection(new WiredConnection());
}
/*
* New VPN connection
*/
void ConnectionEditorImpl::slotNewVPNConnection()
{
slotEditNewConnection(new VPNConnection());
}
/*
*
*/
void ConnectionEditorImpl::slotEditNewConnection(Connection* conn)
{
// open a dialog for editing the connection
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, this, "connect_something", false, TQt::WDestructiveClose);
connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList()));
dlg->show();
}
void ConnectionEditorImpl::slotRefershConnectionList()
{
fillConnectionList();
}
/*
* Edit the selected connection
*/
void ConnectionEditorImpl::slotEditCurrentConnection()
{
ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
if (!item)
return;
Connection* conn = item->_conn;
Storage* storage = Storage::getInstance();
bool hasSecretsStored = storage->hasSecretsStored(conn);
// we need the secrets for editing
if (hasSecretsStored)
storage->restoreAllSecrets(conn);
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, NULL, this, "connect_something", false, TQt::WDestructiveClose);
dlg->show();
// save all connections (if not done already)
storage->saveConnections();
}
/*
* Delete the selected connection
*/
void ConnectionEditorImpl::slotRemoveCurrentConnection()
{
ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
if (!item)
return;
ConnectionStore* cstore = ConnectionStore::getInstance();
Connection* conn = item->_conn;
lvConnections->takeItem(item);
delete item;
cstore->removeConnection(conn);
}
/*
* Fill the connection list
*/
void ConnectionEditorImpl::fillConnectionList()
{
ConnectionStore* cstore = ConnectionStore::getInstance();
TQValueList<Connection*> conns = cstore->getConnections();
TQValueList<Connection*>::Iterator it = conns.begin();
lvConnections->clear();
for (; it != conns.end(); ++it)
{
GenericConnection* conn = dynamic_cast<GenericConnection*>(*it);
if (conn)
{
Info* info = conn->getInfoSetting();
if (info)
{
new ConnectionListViewItem(lvConnections, conn);
}
else
kdWarning() << k_funcinfo << "Connection without Info setting, drop it." << endl;
}
else
kdWarning() << k_funcinfo << "non-generic connection, dropping it." << endl;
}
}
#include "knetworkmanager-connection_editor.moc"

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-connection_editor.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_EDITOR_H
#define KNETWORKMANAGER_CONNECTION_EDITOR_H
// qt headers
#include <tqvaluelist.h>
// qt autogenerated headers
#include "connection_editor.h"
// knm headers
#include "knetworkmanager-connection_setting.h"
class TQWidget;
class Device;
namespace ConnectionSettings
{
class WidgetInterface;
class ConnectionSetting;
}
class ConnectionEditorImpl : public ConnectionEditor
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionEditorImpl(TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~ConnectionEditorImpl();
protected slots:
void slotRemoveCurrentConnection();
void slotEditCurrentConnection();
void slotNewWirelessConnection();
void slotNewWiredConnection();
void slotEditNewConnection(Connection* conn);
void slotRefershConnectionList();
void slotNewVPNConnection();
private:
void fillConnectionList();
};
#endif /* KNETWORKMANAGER_CONNECTION_EDITOR_H*/

@ -0,0 +1,230 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatalist.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
#include <tqdbuserror.h>
#include <tqdbusmessage.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_secrets_dbus.h"
#include "knetworkmanager-connection_dbus.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-nmsettings.h"
#include "xmlmarshaller.h"
#include "stdio.h"
using namespace ConnectionSettings;
namespace ConnectionSettings
{
class ConnectionSecretsDBusPrivate
{
public:
ConnectionSecretsDBusPrivate(Connection* par)
: parent(par)
, currentRequest(-1)
{}
~ConnectionSecretsDBusPrivate() {}
Connection* parent;
int currentRequest;
};
}
/*
class Connection
*/
ConnectionSecretsDBus::ConnectionSecretsDBus(Connection* parent)
: TQObject(parent)
{
d = new ConnectionSecretsDBusPrivate(parent);
}
ConnectionSecretsDBus::~ConnectionSecretsDBus()
{
delete d;
}
void
ConnectionSecretsDBus::SendGetSecretsError()
{
GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty"));
}
void
ConnectionSecretsDBus::SendGetSecretsReply(ConnectionSettings::ConnectionSetting* setting)
{
TQT_DBusMessage reply;
kdDebug() << "SendGetSecretsReply1 id " << d->currentRequest << endl;
// if no secret is needed we should not send one, right?
if (d->currentRequest < 0)
return;
kdDebug() << "SendGetSecretsReply2" << endl;
/*
// no such setting
if (!setting)
{
GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is unknown"));
}
else
{
kdDebud() << "SendGetSecretsReply3" << endl;
// copy the settingsmap over to a variantmap
TQMap<TQString, TQT_DBusData> map = setting->toSecretsMap();
// only take used settings
if (map.size() == 0)
{
kdDebug() << "SendGetSecretsReply4" << endl;
GetSecretsAsyncError(d->currentRequest, TQT_DBusError::stdFailed("Requested setting is empty"));
}
else
{
kdDebug() << "SendGetSecretsReply5" << endl;
TQT_DBusDataMap<TQString> secrets(map);
TQMap<TQString, TQT_DBusVariant> secrets;
for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
{
TQT_DBusVariant var;
var.value = it2.data();
var.signature = var.value.buildDBusSignature();
secrets.insert(it2.key(), var);
}
kdDebug() << "SendGetSecretsReply6" << endl;
GetSecretsAsyncReply(d->currentRequest, secrets);
}
}*/
TQT_DBusDataMap<TQString> settings;
TQValueList<ConnectionSetting*> all_settings = d->parent->getSettings();
// FIXME: ugly conversions, ask Kevin on how to make it better
for (TQValueList<ConnectionSetting*>::Iterator it = all_settings.begin(); it != all_settings.end(); ++it)
{
kdDebug() << " Processing Setting '" << (*it)->getType().ascii() << "'" << endl;
if (!(*it)->isValid())
{
kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is not valid, discarding" << endl;
continue;
}
// copy the settingsmap over to a variantmap
TQMap<TQString, TQT_DBusData> map = (*it)->toSecretsMap();
// only take used settings
if (map.size() == 0)
{
kdDebug() << " Setting '" << (*it)->getType().ascii() << "' is empty, discarding" << endl;
continue;
}
kdDebug() << " Attach setting '" << (*it)->getType().ascii() << "'" << endl;
TQMap<TQString, TQT_DBusVariant> variant_map;
for (TQMap<TQString, TQT_DBusData>::Iterator it2 = map.begin(); it2 != map.end(); ++it2)
{
TQString dataxml = XMLMarshaller::fromTQT_DBusData(it2.data());
kdDebug() << " " << it2.key().ascii() << ": " << dataxml.replace('\n', ' ').ascii() << endl;
TQT_DBusVariant var;
var.value = it2.data();
var.signature = var.value.buildDBusSignature();
variant_map.insert(it2.key(), var);
}
// convert the variantma
TQT_DBusDataMap<TQString> map2 = TQT_DBusDataMap<TQString>(variant_map);
TQT_DBusData data = TQT_DBusData::fromStringKeyMap(map2);
// insert this setting
settings.insert((*it)->getType(), data);
}
GetSecretsAsyncReply(d->currentRequest, settings);
d->currentRequest = -1;
}
void
ConnectionSecretsDBus::GetSecretsAsync(int id, const TQString& setting_name, const TQStringList& hints, bool request_new)
{
printf("Connection::GetSecretsAsync for setting %s, %s\n\r", setting_name.ascii(), id);
kdDebug() << "Connection::GetSecretsAsync for setting " << setting_name.ascii() << ", " << id << endl;
d->currentRequest = id;
emit SecretsNeeded(setting_name, hints, request_new);
}
void
ConnectionSecretsDBus::handleMethodReply(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
}
bool
ConnectionSecretsDBus::handleSignalSend(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
return true;
}
TQString
ConnectionSecretsDBus::objectPath() const
{
return TQString(d->parent->getObjectPath());
}
#include "knetworkmanager-connection_secrets_dbus.moc"

@ -0,0 +1,76 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H
#define KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H
#include <hal/libhal.h>
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include "knetworkmanager-connection_setting.h"
#include "dbus/connection.h"
#include "dbus/connectionnode.h"
class AccessPoint;
class TQT_DBusObjectPath;
namespace ConnectionSettings
{
class WirelessSecurity;
class Connection;
class ConnectionSetting;
class ConnectionSecretsDBusPrivate;
// a connection wraps multiple settings
class ConnectionSecretsDBus : public TQObject, public DBus::Secrets
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionSecretsDBus(ConnectionSettings::Connection* parent);
virtual ~ConnectionSecretsDBus();
void SendGetSecretsReply(ConnectionSettings::ConnectionSetting* setting);
void SendGetSecretsError();
protected:
// implementation of the Secrets DBus-interface
void GetSecretsAsync(int, const TQString&, const TQStringList&, bool);
void handleMethodReply(const TQT_DBusMessage& reply);
bool handleSignalSend(const TQT_DBusMessage& reply);
TQString objectPath() const;
signals:
void SecretsNeeded(const TQString& setting_name, const TQStringList& hints, bool request_new);
private:
ConnectionSecretsDBusPrivate* d;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SECRETS_DBUS_H */

@ -0,0 +1,106 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection.h"
using namespace ConnectionSettings;
/*
class ConnectionSetting
*/
ConnectionSetting::ConnectionSetting(Connection* conn, TQString type, const char* name, bool enabled)
: TQObject(conn, name)
{
_type = type;
_enabled = enabled;
_conn = conn;
}
ConnectionSetting::ConnectionSetting(const ConnectionSetting& setting)
: TQObject()
{
_type = setting.getType();
_enabled = setting.getEnabled();
_conn = setting.getConnection();
}
SettingsMap
ConnectionSetting::toSecretsMap(bool with_settings) const
{
kdDebug() << "ConnectionSetting::toSecretsMap" << endl;
return SettingsMap();
}
bool
ConnectionSetting::fromSecretsMap(const SettingsMap& /*map*/)
{
return true;
}
bool
ConnectionSetting::getEnabled(void) const
{
return true;
}
TQString
ConnectionSetting::getType(void) const
{
return _type;
}
Connection*
ConnectionSetting::getConnection(void) const
{
return _conn;
}
bool
ConnectionSetting::hasSecrets(void) const
{
return !(toSecretsMap(false).isEmpty());
}
void
ConnectionSetting::emitValidityChanged()
{
emit validityChanged();
}
#include "knetworkmanager-connection_setting.moc"

@ -0,0 +1,94 @@
/***************************************************************************
*
* knetworkmanager-connection_setting.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_H
#define KNETWORKMANAGER_CONNECTION_SETTING_H
#include <tqmap.h>
#include <tqobject.h>
#include <tqdbusdata.h>
namespace ConnectionSettings
{
/*
Annotation: hopefully we can convert these to
TQMap<TQString, TQVariant> when switching to TQt4
*/
typedef TQMap<TQString, TQT_DBusData> SettingsMap;
class Connection;
// the base class for all settings
class ConnectionSetting : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionSetting(Connection* conn, TQString type, const char* name = 0, bool enabled = true);
ConnectionSetting(const ConnectionSetting&);
// serialize the setting to a map
virtual SettingsMap toMap() const = 0;
// serialize the secrets to a map
virtual SettingsMap toSecretsMap(bool withSettings = true) const;
// initialize setting from a settingsmap
virtual void fromMap(const SettingsMap&) = 0;
// set secrtes from a secretsmap
virtual bool fromSecretsMap(const SettingsMap&);
// return whether this setting should be used or not
virtual bool getEnabled(void) const;
// return whether this setting is valid or not
virtual bool isValid() const = 0;
// return the settings type
TQString getType(void) const;
// return the connection this setting belongs to
Connection* getConnection(void) const;
// return whether the setting has secrets or not
virtual bool hasSecrets(void) const;
signals:
void validityChanged();
protected:
void emitValidityChanged();
// parent-connection
Connection* _conn;
private:
TQString _type;
bool _enabled;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_H */

@ -0,0 +1,380 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_8021x.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection.h"
#include "sha1.h"
#include "md5.h"
#define WPA_PMK_LEN 32
using namespace ConnectionSettings;
/*
class IEEE8021x
*/
IEEE8021x::IEEE8021x(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_802_1X_SETTING_NAME)
, _eap(EAP_PHASE1_NONE)
, _identity(TQString())
, _anonIdentity(TQString())
, _caPath(TQString())
, _phase1PeapVer(TQString())
, _phase1PeapLabel(TQString())
, _phase1FastProvisioning(TQString())
, _eapPhase2(EAP_PHASE2_AUTH_NONE)
, _phase2AuthEAP(TQString())
, _phase2CaPath(TQString())
, _useSystemCaCert(false)
{
// init eap map
_eapMap[EAP_NONE] = TQString();
_eapMap[EAP_LEAP] = "leap";
_eapMap[EAP_MD5] = "md5";
_eapMap[EAP_PAP] = "pap";
_eapMap[EAP_CHAP] = "chap";
_eapMap[EAP_MSCHAP] = "mschap";
_eapMap[EAP_MSCHAPV2] = "mschapv2";
_eapMap[EAP_FAST] = "fast";
_eapMap[EAP_PSK] = "psk";
_eapMap[EAP_PAX] = "pax";
_eapMap[EAP_SAKE] = "sake";
_eapMap[EAP_GPSK] = "gpsk";
_eapMap[EAP_TLS] = "tls";
_eapMap[EAP_PEAP] = "peap";
_eapMap[EAP_TTLS] = "ttls";
_eapMap[EAP_SIM] = "sim";
_eapMap[EAP_GTC] = "gtc";
_eapMap[EAP_OTP] = "otp";
}
TQString
IEEE8021x::getIdentity(void) const
{
return _identity;
}
void
IEEE8021x::setIdentity(const TQString & identity)
{
_identity = identity;
}
TQString
IEEE8021x::getAnonIdentity(void) const
{
return _anonIdentity;
}
void
IEEE8021x::setAnonIdentity(const TQString & identity)
{
_anonIdentity = identity;
}
void
IEEE8021x::setPassword(const TQString& pwd)
{
_password = pwd;
}
TQString
IEEE8021x::getPassword(void) const
{
return _password;
}
bool
IEEE8021x::getUseSystemCaCert(void) const
{
return _useSystemCaCert;
}
void
IEEE8021x::setUseSystemCaCert(bool use)
{
_useSystemCaCert = use;
}
IEEE8021x::EAP_PHASE1
IEEE8021x::getEAP(void) const
{
return _eap;
}
void
IEEE8021x::setEAP(EAP_PHASE1 eap)
{
_eap = eap;
}
IEEE8021x::EAP_PHASE2
IEEE8021x::getPhase2EAP(void) const
{
return _eapPhase2;
}
void
IEEE8021x::setPhase2EAP(EAP_PHASE2 eap)
{
_eapPhase2 = eap;
}
SettingsMap
IEEE8021x::toMap() const
{
SettingsMap map;
// EAP
TQString eap = _eapMap[(EAP)_eap];
if (!eap.isEmpty())
{
TQValueList<TQT_DBusData> eap_methods;
eap_methods.append(TQT_DBusData::fromString(eap));
map.insert(NM_SETTING_802_1X_EAP, TQT_DBusData::fromTQValueList(eap_methods));
}
// Phase2 EAP
if (_eapPhase2 != EAP_PHASE2_AUTH_NONE)
{
map.insert(NM_SETTING_802_1X_PHASE2_AUTH, TQT_DBusData::fromString(_eapMap[(EAP)_eapPhase2]));
}
if (!_identity.isEmpty())
map.insert(NM_SETTING_802_1X_IDENTITY, TQT_DBusData::fromString(_identity));
if (!_anonIdentity.isEmpty())
map.insert(NM_SETTING_802_1X_ANONYMOUS_IDENTITY, TQT_DBusData::fromString(_anonIdentity));
// FIXME
/*
if (!_caCert.isNull())
map.insert("ca-cert", TQT_DBusData::fromString(_caCert));
*/
if (!_caPath.isEmpty())
map.insert(NM_SETTING_802_1X_CA_PATH, TQT_DBusData::fromString(_caPath));
if (!eap.isEmpty())
map.insert(NM_SETTING_802_1X_SYSTEM_CA_CERTS, TQT_DBusData::fromBool(_useSystemCaCert));
//FIXME
/*
if (!_clientCert.isNull())
map.insert("client-cert", TQT_DBusData::fromString(_clientCert));
if (!_privateKey.isNull())
map.insert("private-key", TQT_DBusData::fromString(_privateKey));
*/
if (!_phase1PeapVer.isNull())
map.insert(NM_SETTING_802_1X_PHASE1_PEAPVER, TQT_DBusData::fromString(_phase1PeapVer));
if (!_phase1PeapLabel.isNull())
map.insert(NM_SETTING_802_1X_PHASE1_PEAPLABEL, TQT_DBusData::fromString(_phase1PeapLabel));
if (!_phase1FastProvisioning.isNull())
map.insert(NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING, TQT_DBusData::fromString(_phase1FastProvisioning));
if (!_phase2AuthEAP.isNull())
map.insert(NM_SETTING_802_1X_PHASE2_AUTHEAP, TQT_DBusData::fromString(_phase2AuthEAP));
// FIXME
/*
if (!_phase2CaCert.isNull())
map.insert("phase2-ca-cert", TQVariant(_phase2CaCert));
*/
if (!_phase2CaPath.isNull())
map.insert(NM_SETTING_802_1X_PHASE2_CA_PATH, TQT_DBusData::fromString(_phase2CaPath));
// FIXME
/*
if (!_phase2ClientCert.isNull())
map.insert("phase2-client-cert", TQVariant(_phase2ClientCert));
if (!_phase2PrivateKey.isNull())
map.insert("phase2-private-key", TQVariant(_phase2PrivateKey));
*/
if(!_password.isNull())
map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(""));
/*
899 g_hash_table_insert (hash, "password", string_to_gvalue (self->password));
900 if (self->pin)
901 g_hash_table_insert (hash, "pin", string_to_gvalue (self->pin));
902 if (self->eappsk)
903 g_hash_table_insert (hash, "eappsk", string_to_gvalue (self->eappsk));
904 if (self->private_key_passwd)
905 g_hash_table_insert (hash, "private-key-passwd", string_to_gvalue (self->private_key_passwd));
906 if (self->phase2_private_key_passwd)
907 g_hash_table_insert (hash, "phase2-private-key-passwd", string_to_gvalue (self->phase2_private_key_passwd));
*/
return map;
}
void
IEEE8021x::fromMap(const SettingsMap& map)
{
kdDebug() << "IEEE8021x::fromMap" << endl;
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if(it.key() == NM_SETTING_802_1X_EAP)
{
TQValueList<TQT_DBusData> eap_methods = it.data().toTQValueList();
if (!eap_methods.isEmpty())
{
TQString eap = eap_methods.first().toString();
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
setEAP((EAP_PHASE1)it2.key());
}
else
{
// older version of NM used TQString instead of TQValueList<TQString>
TQString eap = it.data().toString();
if (!eap.isEmpty())
{
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
if (_eapMap.end() != (it2 = _eapMap.findData(eap)))
setEAP((EAP_PHASE1)it2.key());
}
}
}
else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTH)
{
TQString eapPhase2 = it.data().toString();
TQBiDirectionalMap<EAP, TQString>::Iterator it2;
if (_eapMap.end() != (it2 = _eapMap.findData(eapPhase2)))
setPhase2EAP((EAP_PHASE2)it2.key());
}
else if (it.key() == NM_SETTING_802_1X_IDENTITY)
_identity = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_ANONYMOUS_IDENTITY)
_anonIdentity = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_CA_PATH)
_caPath = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPVER)
_phase1PeapVer = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE1_PEAPLABEL)
_phase1PeapLabel = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE1_FAST_PROVISIONING)
_phase1FastProvisioning = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE2_AUTHEAP)
_phase2AuthEAP = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE2_CA_PATH)
_phase2CaPath = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_SYSTEM_CA_CERTS)
_useSystemCaCert = it.data().toBool();
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
}
SettingsMap
IEEE8021x::toSecretsMap(bool with_settings) const
{
SettingsMap map;
kdDebug() << "IEEE8021x::toSecretsMap" << endl;
// first serialize the settings if needed
if (with_settings)
map = toMap();
// add password
if (!_password.isNull())
map.insert(NM_SETTING_802_1X_PASSWORD, TQT_DBusData::fromString(_password));
if (!_privateKeyPasswd.isNull())
map.insert(NM_SETTING_802_1X_PRIVATE_KEY, TQT_DBusData::fromString(_privateKeyPasswd));
if (!_phase2PrivateKeyPasswd.isNull())
map.insert(NM_SETTING_802_1X_PHASE2_PRIVATE_KEY, TQT_DBusData::fromString(_phase2PrivateKeyPasswd));
return map;
}
bool
IEEE8021x::fromSecretsMap(const SettingsMap& map)
{
kdDebug() << "IEEE8021x::fromMap" << endl;
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_802_1X_PASSWORD)
_password = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PRIVATE_KEY)
_privateKeyPasswd = it.data().toString();
else if (it.key() == NM_SETTING_802_1X_PHASE2_PRIVATE_KEY)
_phase2PrivateKeyPasswd = it.data().toString();
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
return true;
}
bool
IEEE8021x::isValid() const
{
return true;
}
TQValueList<IEEE8021x::EAP_PHASE2>
IEEE8021x::getAllowedPhase2Methods() const
{
TQValueList<EAP_PHASE2> phase2;
// TODO : not sure if this is correct, jsut copied from nm-applet
switch(_eap)
{
case EAP_PHASE1_TTLS:
phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
phase2.append(EAP_PHASE2_AUTH_MSCHAP);
phase2.append(EAP_PHASE2_AUTH_CHAP);
phase2.append(EAP_PHASE2_AUTH_PAP);
break;
case EAP_PHASE1_PEAP:
phase2.append(EAP_PHASE2_AUTH_MSCHAPV2);
phase2.append(EAP_PHASE2_AUTH_MD5);
break;
default:
phase2.append(EAP_PHASE2_AUTH_NONE);
}
return phase2;
}

@ -0,0 +1,195 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_8021x.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
#define KNETWORKMANAGER_CONNECTION_SETTING_8021X_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
#include "qbidirectionalmap.h"
/* NM */
#include <nm-setting-8021x.h>
#include <nm-setting-wireless.h>
class AccessPoint;
namespace ConnectionSettings
{
// setting for 802.1x parameters
class IEEE8021x : public ConnectionSetting
{
public:
enum EAP
{
EAP_NONE = 0
, EAP_LEAP
, EAP_MD5
, EAP_PAP
, EAP_CHAP
, EAP_MSCHAP
, EAP_MSCHAPV2
, EAP_FAST
, EAP_PSK
, EAP_PAX
, EAP_SAKE
, EAP_GPSK
, EAP_TLS
, EAP_PEAP
, EAP_TTLS
, EAP_SIM
, EAP_GTC
, EAP_OTP
};
enum EAP_PHASE1
{
EAP_PHASE1_NONE = EAP_NONE
, EAP_PHASE1_LEAP = EAP_LEAP
, EAP_PHASE1_MD5 = EAP_MD5
, EAP_PHASE1_TLS = EAP_TLS
, EAP_PHASE1_PEAP = EAP_PEAP
, EAP_PHASE1_TTLS = EAP_TTLS
, EAP_PHASE1_SIM = EAP_SIM
, EAP_PHASE1_FAST = EAP_FAST
};
enum EAP_PHASE2
{
EAP_PHASE2_AUTH_NONE = EAP_NONE
, EAP_PHASE2_AUTH_PAP = EAP_PAP
, EAP_PHASE2_AUTH_CHAP = EAP_CHAP
, EAP_PHASE2_AUTH_MSCHAP = EAP_MSCHAP
, EAP_PHASE2_AUTH_MSCHAPV2 = EAP_MSCHAPV2
, EAP_PHASE2_AUTH_GTC = EAP_GTC
, EAP_PHASE2_AUTH_OTP = EAP_OTP
, EAP_PHASE2_AUTH_MD5 = EAP_MD5
, EAP_PHASE2_AUTH_TLS = EAP_TLS
};
enum EAP_PHASE2_AUTH_EAP
{
EAP_PHASE2_AUTH_EAP_NONE = EAP_NONE
, EAP_PHASE2_AUTH_EAP_MD5 = EAP_MD5
, EAP_PHASE2_AUTH_EAP_MSCHAPV2 = EAP_MSCHAPV2
, EAP_PHASE2_AUTH_EAP_OTP = EAP_OTP
, EAP_PHASE2_AUTH_EAP_GTC = EAP_GTC
, EAP_PHASE2_AUTH_EAP_TLS = EAP_TLS
};
enum PEAPVER
{
PEAPVER_0 = 0
, PEAPVER_1
};
IEEE8021x(Connection* conn);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
SettingsMap toSecretsMap(bool with_settings = true) const;
bool fromSecretsMap(const SettingsMap&);
// FIXME
// multiple EAP methods are allowed
EAP_PHASE1 getEAP(void) const;
void setEAP(EAP_PHASE1);
EAP_PHASE2 getPhase2EAP(void) const;
void setPhase2EAP(EAP_PHASE2);
TQString getIdentity(void) const;
void setIdentity(const TQString&);
TQString getAnonIdentity(void) const;
void setAnonIdentity(const TQString&);
TQString getPassword(void) const;
void setPassword(const TQString&);
// FIXME
// ca cert
TQString getCaPath(void) const;
void setCaPath(TQString);
bool getUseSystemCaCert(void) const;
void setUseSystemCaCert(bool);
//FIXME
// client cert
// FIXME
// private key
PEAPVER getPhase1PeapVer(void) const;
void setPhase1PeapVer(PEAPVER);
// get a list of allowed phase2 methods
TQValueList<EAP_PHASE2> getAllowedPhase2Methods() const;
bool isValid() const;
private:
// settigs
EAP_PHASE1 _eap;
EAP_PHASE2 _eapPhase2;
TQString _identity;
TQString _anonIdentity;
TQByteArray _caCert;
bool _useSystemCaCert;
TQString _caPath;
TQByteArray _clientCert;
TQByteArray _privateKey;
TQString _phase1PeapVer;
TQString _phase1PeapLabel;
TQString _phase1FastProvisioning;
TQString _phase2AuthEAP;
TQByteArray _phase2CaCert;
TQString _phase2CaPath;
TQByteArray _phase2ClientCert;
TQByteArray _phase2PrivateKey;
// secrets
TQString _password;
TQString _privateKeyPasswd;
TQString _phase2PrivateKeyPasswd;
// map the different eap types (enum EAP) to their string representation
TQBiDirectionalMap<EAP, TQString> _eapMap;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_8021X_H */

@ -0,0 +1,138 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_cdma.h"
using namespace ConnectionSettings;
/*
class CDMA
*/
CDMA::CDMA(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_CDMA_SETTING_NAME), _number("#777")
{
}
void CDMA::setNumber(const TQString& number)
{
_number = number;
}
TQString CDMA::getNumber() const
{
return _number;
}
void CDMA::setUsername(const TQString& username)
{
_username = username;
}
TQString CDMA::getUsername() const
{
return _username;
}
void CDMA::setPassword(const TQString& password)
{
_password = password;
}
TQString CDMA::getPassword() const
{
return _password;
}
bool
CDMA::isValid() const
{
return true;
}
SettingsMap
CDMA::toMap() const
{
SettingsMap map;
map.insert(NM_SETTING_CDMA_NUMBER, TQT_DBusData::fromString(_number));
map.insert(NM_SETTING_CDMA_USERNAME, TQT_DBusData::fromString(_username));
return map;
}
SettingsMap
CDMA::toSecretsMap(bool with_settings) const
{
SettingsMap map;
// first serialize the settings if needed
if (with_settings)
map = toMap();
map.insert(NM_SETTING_CDMA_PASSWORD, TQT_DBusData::fromString(_password));
return map;
}
bool
CDMA::fromSecretsMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_CDMA_PASSWORD)
setPassword(it.data().toString());
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
return true;
}
void
CDMA::fromMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_CDMA_NUMBER)
setNumber(it.data().toString());
else if (it.key() == NM_SETTING_CDMA_USERNAME)
setUsername(it.data().toString());
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
}

@ -0,0 +1,75 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_cdma.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H
#define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-cdma.h>
namespace ConnectionSettings
{
class Connection;
// serial setting
class CDMA : public ConnectionSetting
{
public:
CDMA(Connection* conn);
SettingsMap toMap() const;
SettingsMap toSecretsMap(bool with_settings = true) const;
void fromMap(const SettingsMap&);
bool fromSecretsMap(const SettingsMap&);
bool isValid() const;
bool useSetting();
void setNumber(const TQString&);
TQString getNumber() const;
void setUsername(const TQString&);
TQString getUsername() const;
void setPassword(const TQString&);
TQString getPassword() const;
private:
TQString _number;
TQString _username;
TQString _password;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */

@ -0,0 +1,89 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqcombobox.h>
#include <tqiconset.h>
#include <kiconloader.h>
#include <tqwidgetstack.h>
#include <kuser.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_cdma.h"
#include "knetworkmanager-connection_setting_cdma_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_cdma.h"
using namespace ConnectionSettings;
CDMAWidgetImpl::CDMAWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_cdmasetting = dynamic_cast<ConnectionSettings::CDMA*> (conn->getSetting(NM_SETTING_CDMA_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingCdmaWidget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
CDMAWidgetImpl::Init()
{
_mainWid->mUsername->setText( _cdmasetting->getUsername() );
_mainWid->mPassword->setText( _cdmasetting->getPassword( ) );
_mainWid->mNumber->setText( _cdmasetting->getNumber() );
connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
}
void
CDMAWidgetImpl::Deactivate()
{
}
void
CDMAWidgetImpl::Activate()
{
}
void
CDMAWidgetImpl::dirty()
{
_cdmasetting->setUsername( _mainWid->mUsername->text() );
_cdmasetting->setPassword( _mainWid->mPassword->text() );
_cdmasetting->setNumber( _mainWid->mNumber->text() );
}
#include "knetworkmanager-connection_setting_cdma_widget.moc"

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_cdma_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "knetworkmanager-connection_setting_cdma.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService;
class ConnectionSettingCdmaWidget;
namespace ConnectionSettings
{
class Connection;
class CDMAWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
CDMAWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
void Deactivate();
public slots:
void dirty();
private:
void Init();
//VPNConfigWidget* getVPNConfigWidget(VPNService* service);
CDMA* _cdmasetting;
ConnectionSettingCdmaWidget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_WIDGET_H*/

@ -0,0 +1,251 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_gsm.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_gsm.h"
/* network-manager headers */
#include <NetworkManager.h>
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
using namespace ConnectionSettings;
/*
class GSM
*/
GSM::GSM(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_GSM_SETTING_NAME), _number("*99#"), _network_type(-1), _band(-1)
{
}
void GSM::setNumber(const TQString& number)
{
_number = number;
}
TQString GSM::getNumber() const
{
return _number;
}
void GSM::setUsername(const TQString& username)
{
_username = username;
}
TQString GSM::getUsername() const
{
return _username;
}
void GSM::setPassword(const TQString& password)
{
_password = password;
}
TQString GSM::getPassword() const
{
return _password;
}
void GSM::setPin(const TQString& pin)
{
_pin = pin;
}
TQString GSM::getPin() const
{
return _pin;
}
void GSM::setPuk(const TQString& puk)
{
_puk = puk;
}
TQString GSM::getPuk() const
{
return _puk;
}
void GSM::setAPN(const TQString& apn)
{
_apn = apn;
}
TQString GSM::getAPN() const
{
return _apn;
}
void GSM::setNetworkID(const TQString& id)
{
_network_id = id;
}
TQString GSM::getNetworkID() const
{
return _network_id;
}
void GSM::setNetworkType(int type)
{
_network_type = type;
}
int GSM::getNetworkType() const
{
return _network_type;
}
void GSM::setBand(int band)
{
_band = band;
}
int GSM::getBand() const
{
return _band;
}
bool
GSM::isValid() const
{
return true;
}
SettingsMap
GSM::toMap() const
{
SettingsMap map;
if (!_number.isEmpty()) {
map.insert(NM_SETTING_GSM_NUMBER, TQT_DBusData::fromString(_number));
}
if (!_username.isEmpty()) {
map.insert(NM_SETTING_GSM_USERNAME, TQT_DBusData::fromString(_username));
}
if (!_apn.isEmpty()) {
map.insert(NM_SETTING_GSM_APN, TQT_DBusData::fromString(_apn));
}
if (!_network_id.isEmpty()) {
map.insert(NM_SETTING_GSM_NETWORK_ID, TQT_DBusData::fromString(_network_id));
}
map.insert(NM_SETTING_GSM_NETWORK_TYPE, TQT_DBusData::fromInt32(_network_type));
#if NM_CHECK_VERSION(0,8,992)
#else
map.insert(NM_SETTING_GSM_BAND, TQT_DBusData::fromInt32(_band));
#endif
return map;
}
SettingsMap
GSM::toSecretsMap(bool with_settings) const
{
SettingsMap map;
// first serialize the settings if needed
if (with_settings)
map = toMap();
if (!_password.isEmpty()) {
map.insert(NM_SETTING_GSM_PASSWORD, TQT_DBusData::fromString(_password));
}
if (!_pin.isEmpty()) {
map.insert(NM_SETTING_GSM_PIN, TQT_DBusData::fromString(_pin));
}
#if NM_CHECK_VERSION(0,8,992)
#else
if (!_puk.isEmpty()) {
map.insert(NM_SETTING_GSM_PUK, TQT_DBusData::fromString(_puk));
}
#endif
return map;
}
bool
GSM::fromSecretsMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
// TODO: add all secrets
if (it.key() == NM_SETTING_GSM_PASSWORD)
setPassword(it.data().toString());
else if (it.key() == NM_SETTING_GSM_PIN)
setPin(it.data().toString());
#if NM_CHECK_VERSION(0,8,992)
#else
else if (it.key() == NM_SETTING_GSM_PUK)
setPuk(it.data().toString());
#endif
else
kdWarning() << k_funcinfo << " Unknown secret: " << it.key() << endl;
}
return true;
}
void
GSM::fromMap(const SettingsMap& map)
{
// TODO: add all attributes
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_GSM_NUMBER)
setNumber(it.data().toString());
else if (it.key() == NM_SETTING_GSM_USERNAME)
setUsername(it.data().toString());
else if (it.key() == NM_SETTING_GSM_APN)
setAPN(it.data().toString());
else if (it.key() == NM_SETTING_GSM_NETWORK_ID)
setNetworkID(it.data().toString());
else if (it.key() == NM_SETTING_GSM_NETWORK_TYPE)
setNetworkType(it.data().toUInt32());
#if NM_CHECK_VERSION(0,8,992)
#else
else if (it.key() == NM_SETTING_GSM_BAND)
setBand(it.data().toUInt32());
#endif
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
}

@ -0,0 +1,99 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_gsm.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_GSM_H
#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-gsm.h>
namespace ConnectionSettings
{
class Connection;
// serial setting
class GSM : public ConnectionSetting
{
public:
GSM(Connection* conn);
SettingsMap toMap() const;
SettingsMap toSecretsMap(bool with_settings = true) const;
void fromMap(const SettingsMap&);
bool fromSecretsMap(const SettingsMap&);
bool isValid() const;
bool useSetting();
void setNumber(const TQString&);
TQString getNumber() const;
void setUsername(const TQString&);
TQString getUsername() const;
void setPassword(const TQString&);
TQString getPassword() const;
void setAPN(const TQString&);
TQString getAPN() const;
void setNetworkID(const TQString&);
TQString getNetworkID() const;
void setNetworkType(int);
int getNetworkType() const;
void setBand(int);
int getBand() const;
void setPin(const TQString&);
TQString getPin() const;
void setPuk(const TQString&);
TQString getPuk() const;
private:
TQString _number;
TQString _username;
TQString _password;
TQString _apn;
TQString _network_id;
int _network_type;
int _band;
TQString _pin;
TQString _puk;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_CDMA_H */

@ -0,0 +1,108 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqcombobox.h>
#include <tqspinbox.h>
#include <tqiconset.h>
#include <kiconloader.h>
#include <tqwidgetstack.h>
#include <kuser.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_setting_gsm_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_gsm.h"
using namespace ConnectionSettings;
GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_gsmsetting = dynamic_cast<ConnectionSettings::GSM*> (conn->getSetting(NM_SETTING_GSM_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingGsmWidget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
GSMWidgetImpl::Init()
{
_mainWid->mUsername->setText( _gsmsetting->getUsername() );
_mainWid->mPassword->setText( _gsmsetting->getPassword( ) );
_mainWid->mPin->setText( _gsmsetting->getPin() );
_mainWid->mPuk->setText( _gsmsetting->getPuk() );
_mainWid->mNumber->setText( _gsmsetting->getNumber() );
_mainWid->mApn->setText( _gsmsetting->getAPN() );
_mainWid->mNetworkId->setText( _gsmsetting->getNetworkID( ));
_mainWid->mNetworkType->setCurrentItem( _gsmsetting->getNetworkType( ) +1);
_mainWid->mBand->setValue( _gsmsetting->getBand() );
connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPin, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPuk, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNetworkId, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNetworkType, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mBand, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
}
void
GSMWidgetImpl::Deactivate()
{
}
void
GSMWidgetImpl::Activate()
{
}
void
GSMWidgetImpl::dirty()
{
_gsmsetting->setUsername( _mainWid->mUsername->text() );
_gsmsetting->setPassword( _mainWid->mPassword->text() );
_gsmsetting->setPin( _mainWid->mPin->text() );
_gsmsetting->setPuk( _mainWid->mPuk->text() );
_gsmsetting->setNumber( _mainWid->mNumber->text() );
_gsmsetting->setAPN( _mainWid->mApn->text() );
_gsmsetting->setNetworkID( _mainWid->mNetworkId->text() );
_gsmsetting->setNetworkType( _mainWid->mNetworkType->currentItem() - 1 );
_gsmsetting->setBand( _mainWid->mBand->value() );
}
#include "knetworkmanager-connection_setting_gsm_widget.moc"

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_gsm_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService;
class ConnectionSettingGsmWidget;
namespace ConnectionSettings
{
class Connection;
class GSMWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
GSMWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
void Deactivate();
public slots:
void dirty();
private:
void Init();
//VPNConfigWidget* getVPNConfigWidget(VPNService* service);
GSM* _gsmsetting;
ConnectionSettingGsmWidget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H*/

@ -0,0 +1,163 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-accesspoint.h"
using namespace ConnectionSettings;
/*
class Info
*/
Info::Info(Connection* conn, TQString devtype, const TQString& name, bool autoconnect)
: ConnectionSetting(conn, NM_SETTING_CONNECTION_SETTING_NAME)
{
_name = name;
_devtype = devtype;
_autoconnect = autoconnect;
}
TQString
Info::getDevType() const
{
return _devtype;
}
void
Info::setDevType(const TQString& devtype)
{
_devtype = devtype;
emitValidityChanged();
}
TQString
Info::getName() const
{
return _name;
}
void
Info::setName(const TQString& name)
{
_name = name;
emitValidityChanged();
}
bool
Info::getAutoconnect() const
{
return _autoconnect;
}
void
Info::setAutoconnect(bool autoconnect)
{
_autoconnect = autoconnect;
emitValidityChanged();
}
TQDateTime
Info::getTimestamp() const
{
return _timestamp;
}
void
Info::setTimestamp(const TQDateTime& dt)
{
_timestamp = dt;
}
TQString
Info::getUUID() const
{
return _uuid;
}
void
Info::setUUID(const TQString& uuid)
{
_uuid = uuid;
}
SettingsMap
Info::toMap() const
{
SettingsMap map;
map.insert(NM_SETTING_CONNECTION_ID, TQT_DBusData::fromString(_name));
map.insert(NM_SETTING_CONNECTION_TYPE, TQT_DBusData::fromString(_devtype));
map.insert(NM_SETTING_CONNECTION_AUTOCONNECT, TQT_DBusData::fromBool(_autoconnect));
map.insert(NM_SETTING_CONNECTION_UUID, TQT_DBusData::fromString(_uuid));
if (!_timestamp.isNull())
map.insert(NM_SETTING_CONNECTION_TIMESTAMP, TQT_DBusData::fromUInt32(_timestamp.toTime_t()));
return map;
}
void
Info::fromMap(const SettingsMap& map)
{
SettingsMap::ConstIterator it;
if ((it = map.find(NM_SETTING_CONNECTION_ID)) != map.end())
_name = it.data().toString();
if ((it = map.find(NM_SETTING_CONNECTION_TYPE)) != map.end())
_devtype = it.data().toString();
if ((it = map.find(NM_SETTING_CONNECTION_AUTOCONNECT)) != map.end())
_autoconnect = it.data().toBool();
if ((it = map.find(NM_SETTING_CONNECTION_TIMESTAMP)) != map.end())
_timestamp.setTime_t(it.data().toUInt32());
if ((it = map.find(NM_SETTING_CONNECTION_UUID)) != map.end())
_uuid = it.data().toString();
}
bool
Info::isValid() const
{
// name is essential
if (_name.isEmpty())
return false;
return true;
}

@ -0,0 +1,79 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_INFO_H
#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdatetime.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-connection.h>
namespace ConnectionSettings
{
// info setting
class Info : public ConnectionSetting
{
public:
Info(Connection* conn, TQString devtype = TQString(), const TQString& name = TQString(), bool autoconnect = false);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
TQString getDevType() const;
void setDevType(const TQString&);
TQString getName() const;
void setName(const TQString&);
bool getAutoconnect() const;
void setAutoconnect(bool);
TQDateTime getTimestamp() const;
void setTimestamp(const TQDateTime&);
TQString getUUID() const;
void setUUID(const TQString&);
bool isValid() const;
private:
TQString _name;
TQString _devtype;
bool _autoconnect;
TQDateTime _timestamp;
TQString _uuid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_H */

@ -0,0 +1,79 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_info_widget.h"
#include "knetworkmanager-device.h"
using namespace ConnectionSettings;
InfoWidgetImpl::InfoWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_infosetting = dynamic_cast<ConnectionSettings::Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingInfoWidget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
InfoWidgetImpl::Init()
{
connect(_mainWid->txtConnectionName, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotNameChanged(const TQString&)));
connect(_mainWid->chkAutoConnect, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotAutoconnectChanged(bool)));
}
void
InfoWidgetImpl::Activate()
{
_mainWid->txtConnectionName->setText(_infosetting->getName());
_mainWid->chkAutoConnect->setChecked(_infosetting->getAutoconnect());
}
void
InfoWidgetImpl::slotNameChanged(const TQString& name)
{
_infosetting->setName(name);
}
void
InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect)
{
_infosetting->setAutoconnect(autoconnect);
}
#include "knetworkmanager-connection_setting_info_widget.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "connection_setting_info.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
namespace ConnectionSettings
{
class Info;
class Connection;
class InfoWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
InfoWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
public slots:
void slotNameChanged(const TQString&);
void slotAutoconnectChanged(bool);
private:
void Init();
Info* _infosetting;
ConnectionSettingInfoWidget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H*/

@ -0,0 +1,318 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_ipv4.h"
using namespace ConnectionSettings;
// reverse order the bytes
TQ_UINT32 swap32(TQ_UINT32 x)
{
TQ_UINT32 ret = 0;
TQ_UINT8* from = (TQ_UINT8*) &x;
TQ_UINT8* to = (TQ_UINT8*) &ret;
for (int i = 0; i < 4; ++i)
to[3-i] = from[i];
return ret;
}
/*
class IPv4
*/
IPv4::IPv4(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_IP4_CONFIG_SETTING_NAME)
{
_method = METHOD_DHCP;
_ignore_auto_dns = false;
_ignore_auto_routes = false;
}
TQValueList<IPv4Address> IPv4::getAddresses() const
{
return _addresses;
}
void IPv4::setAddresses(const TQValueList<IPv4Address> & adr)
{
_addresses = adr;
emitValidityChanged();
}
TQValueList<TQHostAddress> IPv4::getDNS() const
{
return _dns;
}
void IPv4::setDNS(const TQValueList<TQHostAddress>& dns)
{
_dns = dns;
emitValidityChanged();
}
TQStringList IPv4::getDNSSearch() const
{
return _dns_search;
}
void IPv4::setDNSSearch(const TQStringList & dnsSearch)
{
_dns_search = dnsSearch;
emitValidityChanged();
}
void
IPv4::setMethod(IPV4METHOD method)
{
_method = method;
emitValidityChanged();
}
IPv4::IPV4METHOD
IPv4::getMethod() const
{
return _method;
}
void
IPv4::setIgnoreAutoDNS(bool ignore)
{
_ignore_auto_dns = ignore;
emitValidityChanged();
}
bool
IPv4::getIgnoreAutoDNS() const
{
return _ignore_auto_dns;
}
void
IPv4::setIgnoreAutoRoutes(bool ignore)
{
_ignore_auto_routes = ignore;
emitValidityChanged();
}
bool
IPv4::getIgnoreAutoRoutes() const
{
return _ignore_auto_routes;
}
bool
IPv4::isValid() const
{
if (_method == METHOD_MANUAL)
{
// only check the manual settings
// at least one address has to be specified
if (_addresses.empty())
return false;
// check every address
for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
{
if ((*it).address.isNull())
return false;
if ((*it).netmask.isNull())
return false;
// no need to check gateway as it is optional
}
// check DNS addresses but may be empty
for (TQValueList<TQHostAddress>::ConstIterator it = _dns.begin(); it != _dns.end(); ++it)
{
if ((*it).isNull())
return false;
}
// don't check DNS Search because it is optional ...
}
return true;
}
SettingsMap
IPv4::toMap() const
{
SettingsMap map;
if (_method == METHOD_DHCP)
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_AUTO));
else if (_method == METHOD_AUTOIP)
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL));
else if (_method == METHOD_SHARED)
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_SHARED));
else if (_method == METHOD_MANUAL)
{
map.insert(NM_SETTING_IP4_CONFIG_METHOD, TQT_DBusData::fromString(NM_SETTING_IP4_CONFIG_METHOD_MANUAL));
// DNS search
if (_dns_search.size() > 0)
{
TQValueList<TQT_DBusData> dns_search;
TQStringList::ConstIterator it = _dns_search.begin();
for(;it != _dns_search.end(); ++it)
dns_search.append(TQT_DBusData::fromString(*it));
map.insert(NM_SETTING_IP4_CONFIG_DNS_SEARCH, TQT_DBusData::fromTQValueList(dns_search));
}
// DNS addresses
if (_dns.size() > 0)
{
TQValueList<TQT_DBusData> dns;
TQValueList<TQHostAddress>::ConstIterator it_dns = _dns.begin();
// the strange swap32 is needed as NM reads the address exactly the other way round as TQt
for(;it_dns != _dns.end(); ++it_dns)
dns.append(TQT_DBusData::fromUInt32(swap32((*it_dns).toIPv4Address())));
map.insert(NM_SETTING_IP4_CONFIG_DNS, TQT_DBusData::fromTQValueList(dns));
}
// IP's
if (_addresses.size() > 0)
{
TQValueList<TQT_DBusData> ips;
for (TQValueList<IPv4Address>::ConstIterator it = _addresses.begin(); it != _addresses.end(); ++it)
{
TQValueList<TQT_DBusData> cur_ip;
cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).address.toIPv4Address())));
cur_ip.append(TQT_DBusData::fromUInt32(toCIDRSuffix((*it).netmask)));
if (!(*it).gateway.isNull())
cur_ip.append(TQT_DBusData::fromUInt32(swap32((*it).gateway.toIPv4Address())));
ips.append(TQT_DBusData::fromTQValueList(cur_ip));
}
map.insert(NM_SETTING_IP4_CONFIG_ADDRESSES, TQT_DBusData::fromTQValueList(ips));
}
}
map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES, TQT_DBusData::fromBool(_ignore_auto_routes));
map.insert(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS, TQT_DBusData::fromBool(_ignore_auto_dns));
return map;
}
void
IPv4::fromMap(const SettingsMap& map)
{
SettingsMap::ConstIterator it;
if ((it = map.find(NM_SETTING_IP4_CONFIG_METHOD)) != map.end())
{
if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_AUTO || it.data().toString() == "dhcp")
_method = METHOD_DHCP;
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL || it.data().toString() == "autoip")
_method = METHOD_AUTOIP;
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_SHARED)
_method = METHOD_SHARED;
else if (it.data().toString() == NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
_method = METHOD_MANUAL;
}
// DNS search
if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS_SEARCH)) != map.end())
{
TQValueList<TQT_DBusData> dns_search = it.data().toTQValueList();
for (TQValueList<TQT_DBusData>::Iterator it = dns_search.begin(); it != dns_search.end(); ++it)
{
_dns_search.append( (*it).toString());
}
}
// DNS addresses
if ((it = map.find(NM_SETTING_IP4_CONFIG_DNS)) != map.end())
{
TQValueList<TQT_DBusData> dns = it.data().toTQValueList();
for (TQValueList<TQT_DBusData>::Iterator it = dns.begin(); it != dns.end(); ++it)
{
_dns.append( TQHostAddress(swap32((*it).toUInt32())) );
}
}
// IP's
if ((it = map.find(NM_SETTING_IP4_CONFIG_ADDRESSES)) != map.end())
{
TQValueList<TQT_DBusData> ips = it.data().toTQValueList();
for (TQValueList<TQT_DBusData>::Iterator it2 = ips.begin(); it2 != ips.end(); ++it2)
{
TQValueList<TQT_DBusData> cur_ip = (*it2).toTQValueList();
IPv4Address address;
address.address = swap32(cur_ip[0].toUInt32());
if (cur_ip[1].toUInt32() >= 0 && cur_ip[1].toUInt32() <= 32)
address.netmask = fromCIDRSuffix(cur_ip[1].toUInt32());
else
address.netmask = swap32(cur_ip[1].toUInt32());
if (cur_ip.size() > 2)
address.gateway = swap32(cur_ip[2].toUInt32());
_addresses.append(address);
}
}
if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES)) != map.end())
_ignore_auto_routes = it.data().toBool();
if ((it = map.find(NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS)) != map.end())
_ignore_auto_dns = it.data().toBool();
}
TQ_UINT32 IPv4::toCIDRSuffix(const TQHostAddress& adr) const
{
TQ_UINT32 netmask = adr.toIPv4Address();
TQ_UINT32 suffix = 0;
while (netmask > 0)
{
suffix++;
netmask = netmask << 1;
}
return suffix;
}
TQHostAddress IPv4::fromCIDRSuffix(TQ_UINT32 suffix)
{
TQ_UINT32 netmask = 0xFFFFFFFF;
netmask = netmask << (32 - suffix);
return TQHostAddress(netmask);
}

@ -0,0 +1,112 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H
#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-ip4-config.h>
namespace ConnectionSettings
{
class Connection;
class IPv4Address
{
public:
TQHostAddress address;
TQHostAddress netmask;
TQHostAddress gateway;
};
// ipv4 setting
class IPv4 : public ConnectionSetting
{
public:
enum IPV4METHOD
{
METHOD_DHCP = 1
, METHOD_AUTO = METHOD_DHCP // DHCP is obsolete now
, METHOD_AUTOIP
, METHOD_LINK_LOCAL = METHOD_AUTOIP // AUTOIP is obsolete now
, METHOD_MANUAL
, METHOD_SHARED
};
IPv4(Connection* conn);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
void addAddress(const IPv4Address&);
void removeAddress(const IPv4Address&);
TQValueList<IPv4Address> getAddresses() const;
void setAddresses(const TQValueList<IPv4Address>&);
TQValueList<TQHostAddress> getDNS() const;
void setDNS(const TQValueList<TQHostAddress>&);
TQStringList getDNSSearch() const;
void setDNSSearch(const TQStringList&);
void setMethod(IPV4METHOD);
IPV4METHOD getMethod() const;
void setIgnoreAutoDNS(bool);
bool getIgnoreAutoDNS() const;
void setIgnoreAutoRoutes(bool);
bool getIgnoreAutoRoutes() const;
bool isValid() const;
bool useSetting();
TQ_UINT32 toCIDRSuffix(const TQHostAddress&) const;
TQHostAddress fromCIDRSuffix(TQ_UINT32 suffix);
private:
TQValueList<TQHostAddress> _dns;
TQStringList _dns_search;
TQValueList<IPv4Address> _addresses;
IPV4METHOD _method;
bool _ignore_auto_dns;
bool _ignore_auto_routes;
// TODO routes, dhcp-client-id, dhcp-hostname
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPV4_H */

@ -0,0 +1,175 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqgroupbox.h>
#include <tqlayout.h>
#include <tqhostaddress.h>
#include "knetworkmanager-connection_setting_ipv4_widget.h"
#include "knetworkmanager-connection_setting_ipv4.h"
using namespace ConnectionSettings;
#define IP_INPUT_MASK "900.900.900.900"
IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_ipv4_setting = dynamic_cast<ConnectionSettings::IPv4*> (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingIPv4Widget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
IPv4WidgetImpl::Init()
{
_mainWid->groupIPConfig->setChecked(_ipv4_setting->getMethod() == IPv4::METHOD_MANUAL);
connect(_mainWid->groupIPConfig, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotIPConfigEnabled(bool)));
_mainWid->txtIP->setInputMask(IP_INPUT_MASK);
_mainWid->txtNetmask->setInputMask(IP_INPUT_MASK);
_mainWid->txtGateway->setInputMask(IP_INPUT_MASK);
if (!_ipv4_setting->getAddresses().isEmpty())
{
_mainWid->txtIP->setText(_ipv4_setting->getAddresses()[0].address.toString());
_mainWid->txtNetmask->setText(_ipv4_setting->getAddresses()[0].netmask.toString());
_mainWid->txtGateway->setText(_ipv4_setting->getAddresses()[0].gateway.toString());
}
if (!_ipv4_setting->getDNS().isEmpty())
{
TQValueList<TQHostAddress> hosts = _ipv4_setting->getDNS();
TQStringList list;
for (TQValueList<TQHostAddress>::Iterator it = hosts.begin(); it != hosts.end(); ++it)
{
list.append((*it).toString());
}
_mainWid->txtDNSAddresses->setText(list.join(" "));
}
if (!_ipv4_setting->getDNSSearch().isEmpty())
_mainWid->txtDNSSearch->setText(_ipv4_setting->getDNSSearch().join(" "));
// connect the signals after setting up the values
connect(_mainWid->txtIP, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIPAddressChanged(const TQString&)));
connect(_mainWid->txtNetmask, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotNetmaskChanged(const TQString&)));
connect(_mainWid->txtGateway, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotGatewayChanged(const TQString&)));
connect(_mainWid->txtDNSAddresses, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotDNSAddressesChanged(const TQString&)));
connect(_mainWid->txtDNSSearch, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotDNSSearchChanged(const TQString&)));
}
void
IPv4WidgetImpl::Activate()
{
}
void
IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr)
{
// TODO: use , and ; for splitting too
TQStringList list = TQStringList::split(" ", adr);
TQValueList<TQHostAddress> hosts;
for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it)
{
TQHostAddress host(*it);
if (!host.isNull())
hosts.append(host);
}
_ipv4_setting->setDNS(hosts);
}
void
IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search)
{
// TODO: use , and ; for splitting too
_ipv4_setting->setDNSSearch(TQStringList::split(" ", search));
}
void
IPv4WidgetImpl::slotIPConfigEnabled(bool enabled)
{
_ipv4_setting->setMethod(enabled ? IPv4::METHOD_MANUAL : IPv4::METHOD_DHCP );
}
void
IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip)
{
TQHostAddress ipadr(ip);
if (!ipadr.isNull())
{
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
if (addrs.size() > 0)
addrs[0].address = ipadr;
else
{
IPv4Address adr;
adr.address = ipadr;
addrs.append(adr);
}
_ipv4_setting->setAddresses(addrs);
// if netmask is not set yet we preset it to a default value depending on the network class
if (_mainWid->txtNetmask->text() == "...")
{
if ( (ipadr.toIPv4Address() & 0xFF000000) < 0xDF000000)
{
if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000)
_mainWid->txtNetmask->setText("255.255.255.0"); // class C
else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000)
_mainWid->txtNetmask->setText("255.255.0.0"); // class B
else
_mainWid->txtNetmask->setText("255.0.0.0"); // class A
}
}
}
}
void
IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip)
{
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
addrs[0].netmask = TQHostAddress(ip);
_ipv4_setting->setAddresses(addrs);
}
void
IPv4WidgetImpl::slotGatewayChanged(const TQString& ip)
{
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses();
addrs[0].gateway = TQHostAddress(ip);
_ipv4_setting->setAddresses(addrs);
}
#include "knetworkmanager-connection_setting_ipv4_widget.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
// qt autogenerated headers
#include "connection_setting_ipv4.h"
// knetworkmanager headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-connection_setting_ipv4.h"
namespace ConnectionSettings
{
class IPv4;
class IPv4WidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
IPv4WidgetImpl(Connection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate();
public slots:
void slotIPConfigEnabled(bool);
void slotIPAddressChanged(const TQString&);
void slotNetmaskChanged(const TQString&);
void slotGatewayChanged(const TQString&);
void slotDNSSearchChanged(const TQString&);
void slotDNSAddressesChanged(const TQString&);
private:
void Init();
IPv4* _ipv4_setting;
ConnectionSettingIPv4Widget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_IPv4_WIDGET_H*/

@ -0,0 +1,376 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_ppp.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* NM headers */
#include <nm-setting-ppp.h>
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_ppp.h"
using namespace ConnectionSettings;
/*
class PPP
*/
PPP::PPP(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_PPP_SETTING_NAME),
_noauth(false),
_refuse_eap(false),
_refuse_pap(false),
_refuse_chap(false),
_refuse_mschap(false),
_refuse_mschapv2(false),
_nobsdcomp(false),
_nodeflate(false),
_novjcomp(false),
_require_mppe(false),
_require_mppe_128(false),
_mppe_stateful(false),
_require_mppc(false),
_crtscts(false),
_baud(0),
_mru(0),
_mtu(0),
_lcp_echo_failure(0),
_lcp_echo_interval(0)
{
// set defaults
}
bool
PPP::getNoAuth() const
{
return _noauth;
}
void
PPP::setNoAuth(bool noauth)
{
_noauth = noauth;
}
bool
PPP::getRefuseEAP() const
{
return _refuse_eap;
}
void
PPP::setRefuseEAP(bool refuse_eap)
{
_refuse_eap = refuse_eap;
}
bool
PPP::getRefusePAP() const
{
return _refuse_pap;
}
void
PPP::setRefusePAP(bool refuse_pap)
{
_refuse_pap = refuse_pap;
}
bool
PPP::getRefuseChap() const
{
return _refuse_chap;
}
void
PPP::setRefuseChap(bool refuse_chap)
{
_refuse_chap = refuse_chap;
}
bool
PPP::getRefuseMSChap() const
{
return _refuse_mschap;
}
void
PPP::setRefuseMSChap(bool refuse_mschap)
{
_refuse_mschap = refuse_mschap;
}
bool
PPP::getRefuseMSChapV2() const
{
return _refuse_mschapv2;
}
void
PPP::setRefuseMSChapV2(bool refuse_mschapv2)
{
_refuse_mschapv2 = refuse_mschapv2;
}
bool
PPP::getNoBSDComp() const
{
return _nobsdcomp;
}
void
PPP::setNoBSDComp(bool nobsdcomp)
{
_nobsdcomp = nobsdcomp;
}
bool
PPP::getNoDeflate() const
{
return _nodeflate;
}
void
PPP::setNoDeflate(bool nodeflate)
{
_nodeflate = nodeflate;
}
bool
PPP::getNoVJComp() const
{
return _novjcomp;
}
void
PPP::setNoVJComp(bool novjcomp)
{
_novjcomp = novjcomp;
}
bool
PPP::getRequireMPPE() const
{
return _require_mppe;
}
void
PPP::setRequireMPPE(bool require_mppe)
{
_require_mppe = require_mppe;
}
bool
PPP::getRequireMPPE128() const
{
return _require_mppe_128;
}
void
PPP::setRequireMPPE128(bool require_mppe_128)
{
_require_mppe_128 = require_mppe_128;
}
bool
PPP::getMPPEStateful() const
{
return _mppe_stateful;
}
void
PPP::setMPPEStateful(bool b)
{
_mppe_stateful = b;
}
bool
PPP::getRequireMPPC() const
{
return _require_mppc;
}
void
PPP::setRequireMPPC(bool b)
{
_require_mppc = b;
}
bool
PPP::getCRTSCTS() const
{
return _crtscts;
}
void
PPP::setCRTSCTS(bool b)
{
_crtscts = b;
}
TQ_INT32
PPP::getBaud() const
{
return _baud;
}
void
PPP::setBaud(TQ_INT32 i)
{
_baud = i;
}
TQ_INT32
PPP::getMRU() const
{
return _mru;
}
void
PPP::setMRU(TQ_INT32 i)
{
_mru = i;
}
TQ_INT32
PPP::getMTU() const
{
return _mtu;
}
void
PPP::setMTU(TQ_INT32 i)
{
_mtu = i;
}
TQ_INT32
PPP::getLCPEchoFailure() const
{
return _lcp_echo_failure;
}
void
PPP::setLCPEchoFailure(TQ_INT32 i)
{
_lcp_echo_failure = i;
}
TQ_INT32
PPP::getLCPEchoInterval() const
{
return _lcp_echo_interval;
}
void
PPP::setLCPEchoInterval(TQ_INT32 i)
{
_lcp_echo_interval = i;
}
bool
PPP::isValid() const
{
return true;
}
SettingsMap
PPP::toMap() const
{
SettingsMap map;
// TODO
map.insert(NM_SETTING_PPP_NOAUTH, TQT_DBusData::fromBool(_noauth));
map.insert(NM_SETTING_PPP_REFUSE_EAP, TQT_DBusData::fromBool(_refuse_eap));
map.insert(NM_SETTING_PPP_REFUSE_PAP, TQT_DBusData::fromBool(_refuse_pap));
map.insert(NM_SETTING_PPP_REFUSE_CHAP, TQT_DBusData::fromBool(_refuse_chap));
map.insert(NM_SETTING_PPP_REFUSE_MSCHAP, TQT_DBusData::fromBool(_refuse_mschap));
map.insert(NM_SETTING_PPP_NOBSDCOMP, TQT_DBusData::fromBool(_nobsdcomp));
map.insert(NM_SETTING_PPP_NODEFLATE, TQT_DBusData::fromBool(_nodeflate));
map.insert(NM_SETTING_PPP_NO_VJ_COMP, TQT_DBusData::fromBool(_novjcomp));
map.insert(NM_SETTING_PPP_REQUIRE_MPPE, TQT_DBusData::fromBool(_require_mppe));
map.insert(NM_SETTING_PPP_REQUIRE_MPPE_128, TQT_DBusData::fromBool(_require_mppe_128));
map.insert(NM_SETTING_PPP_MPPE_STATEFUL, TQT_DBusData::fromBool(_mppe_stateful));
map.insert(NM_SETTING_PPP_CRTSCTS, TQT_DBusData::fromBool(_crtscts));
map.insert(NM_SETTING_PPP_BAUD, TQT_DBusData::fromUInt32(_baud));
map.insert(NM_SETTING_PPP_MRU, TQT_DBusData::fromUInt32(_mru));
map.insert(NM_SETTING_PPP_MTU, TQT_DBusData::fromUInt32(_mtu));
map.insert(NM_SETTING_PPP_LCP_ECHO_FAILURE, TQT_DBusData::fromUInt32(_lcp_echo_failure));
map.insert(NM_SETTING_PPP_LCP_ECHO_INTERVAL, TQT_DBusData::fromUInt32(_lcp_echo_interval));
return map;
}
SettingsMap
PPP::toSecretsMap(bool with_settings) const
{
SettingsMap map;
// first serialize the settings if needed
if (with_settings)
map = toMap();
return map;
}
bool
PPP::fromSecretsMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
// TODO
/*if (it.key() == NM_SETTING_PPP_PASSWORD)
setPassword(it.data().toString());
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
*/
}
return true;
}
void
PPP::fromMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
// TODO
/*
if (it.key() == NM_SETTING_PPP_NUMBER)
setNumber(it.data().toString());
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
*/
}
}

@ -0,0 +1,136 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_ppp.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_PPP_H
#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
namespace ConnectionSettings
{
class Connection;
// serial setting
class PPP : public ConnectionSetting
{
public:
PPP(Connection* conn);
SettingsMap toMap() const;
SettingsMap toSecretsMap(bool with_settings = true) const;
void fromMap(const SettingsMap&);
bool fromSecretsMap(const SettingsMap&);
bool isValid() const;
bool useSetting();
bool getNoAuth() const;
void setNoAuth(bool);
bool getRefuseEAP() const;
void setRefuseEAP(bool);
bool getRefusePAP() const;
void setRefusePAP(bool);
bool getRefuseChap() const;
void setRefuseChap(bool);
bool getRefuseMSChap() const;
void setRefuseMSChap(bool);
bool getRefuseMSChapV2() const;
void setRefuseMSChapV2(bool);
bool getNoBSDComp() const;
void setNoBSDComp(bool);
bool getNoDeflate() const;
void setNoDeflate(bool);
bool getNoVJComp() const;
void setNoVJComp(bool);
bool getRequireMPPE() const;
void setRequireMPPE(bool);
bool getRequireMPPE128() const;
void setRequireMPPE128(bool);
bool getMPPEStateful() const;
void setMPPEStateful(bool);
bool getRequireMPPC() const;
void setRequireMPPC(bool);
bool getCRTSCTS() const;
void setCRTSCTS(bool);
TQ_INT32 getBaud() const;
void setBaud(TQ_INT32);
TQ_INT32 getMRU() const;
void setMRU(TQ_INT32);
TQ_INT32 getMTU() const;
void setMTU(TQ_INT32);
TQ_INT32 getLCPEchoFailure() const;
void setLCPEchoFailure(TQ_INT32);
TQ_INT32 getLCPEchoInterval() const;
void setLCPEchoInterval(TQ_INT32);
private:
bool _noauth;
bool _refuse_eap;
bool _refuse_pap;
bool _refuse_chap;
bool _refuse_mschap;
bool _refuse_mschapv2;
bool _nobsdcomp;
bool _nodeflate;
bool _novjcomp;
bool _require_mppe;
bool _require_mppe_128;
bool _mppe_stateful;
bool _require_mppc;
bool _crtscts;
TQ_UINT32 _baud;
TQ_UINT32 _mru;
TQ_UINT32 _mtu;
TQ_UINT32 _lcp_echo_failure;
TQ_UINT32 _lcp_echo_interval;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_H */

@ -0,0 +1,130 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <nm-setting-ppp.h>
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqcombobox.h>
#include <tqspinbox.h>
#include <tqiconset.h>
#include <kiconloader.h>
#include <tqwidgetstack.h>
#include <kuser.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_ppp.h"
#include "knetworkmanager-connection_setting_ppp_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_ppp.h"
using namespace ConnectionSettings;
PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_pppsetting = dynamic_cast<ConnectionSettings::PPP*> (conn->getSetting(NM_SETTING_PPP_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingPppWidget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
PPPWidgetImpl::Init()
{
_mainWid->mNoAuth->setChecked( _pppsetting->getNoAuth() );
_mainWid->mRefuseEap->setChecked( _pppsetting->getRefuseEAP( ) );
_mainWid->mRefusePap->setChecked( _pppsetting->getRefusePAP( ) );
_mainWid->mRefuseChap->setChecked( _pppsetting->getRefuseChap() );
_mainWid->mRefuseMschap->setChecked( _pppsetting->getRefuseMSChap() );
_mainWid->mRefuseMschapV2->setChecked( _pppsetting->getRefuseMSChapV2() );
_mainWid->mNoBsd->setChecked( _pppsetting->getNoBSDComp() );
_mainWid->mNoDeflate->setChecked( _pppsetting->getNoDeflate() );
_mainWid->mNoVjComp->setChecked( _pppsetting->getNoVJComp() );
_mainWid->mRequireMppe->setChecked( _pppsetting->getRequireMPPE( ));
_mainWid->mRequireMppe128->setChecked( _pppsetting->getRequireMPPE128( ));
_mainWid->mStatefulMppe->setChecked( _pppsetting->getMPPEStateful() );
_mainWid->mRequireMppc->setChecked( _pppsetting->getRequireMPPC() );
_mainWid->mCrtscts->setChecked( _pppsetting->getCRTSCTS() );
_mainWid->mBaudRate->setValue(_pppsetting->getBaud());
_mainWid->mMru->setValue(_pppsetting->getMRU());
_mainWid->mMtu->setValue(_pppsetting->getMTU());
_mainWid->mLcpEchoFailure->setValue(_pppsetting->getLCPEchoFailure());
_mainWid->mLcpEchoInterval->setValue(_pppsetting->getLCPEchoInterval());
connect( _mainWid->mNoAuth, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseEap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefusePap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppe128, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mStatefulMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppc, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
}
void
PPPWidgetImpl::Deactivate()
{
}
void
PPPWidgetImpl::Activate()
{
}
void
PPPWidgetImpl::dirty()
{
_pppsetting->setNoAuth( _mainWid->mNoAuth->isChecked() );
_pppsetting->setRefuseEAP( _mainWid->mRefuseEap->isChecked() );
_pppsetting->setRefuseChap( _mainWid->mRefuseChap->isChecked() );
_pppsetting->setRefuseMSChap( _mainWid->mRefuseMschap->isChecked() );
_pppsetting->setNoBSDComp( _mainWid->mNoBsd->isChecked() );
_pppsetting->setNoDeflate( _mainWid->mNoDeflate->isChecked() );
_pppsetting->setRequireMPPE( _mainWid->mRequireMppe->isChecked() );
_pppsetting->setRequireMPPE( _mainWid->mRequireMppe128->isChecked() );
_pppsetting->setMPPEStateful( _mainWid->mStatefulMppe->isChecked() );
_pppsetting->setBaud(_mainWid->mBaudRate->value());
_pppsetting->setMRU(_mainWid->mMru->value());
_pppsetting->setMTU(_mainWid->mMtu->value());
_pppsetting->setLCPEchoFailure(_mainWid->mLcpEchoFailure->value());
_pppsetting->setLCPEchoInterval(_mainWid->mLcpEchoInterval->value());
}
#include "knetworkmanager-connection_setting_ppp_widget.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_ppp_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "knetworkmanager-connection_setting_ppp.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService;
class ConnectionSettingPppWidget;
namespace ConnectionSettings
{
class Connection;
class PPPWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
PPPWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
void Deactivate();
public slots:
void dirty();
private:
void Init();
PPP* _pppsetting;
ConnectionSettingPppWidget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H*/

@ -0,0 +1,168 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_serial.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_serial.h"
using namespace ConnectionSettings;
/*
class Serial
*/
Serial::Serial(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_SERIAL_SETTING_NAME),
_baud( 115200 ),
_bits( 8 ),
_parity( PARITY_NONE ),
_stopBits( 1 ),
_sendDelay( 0 )
{
}
void Serial::setBaud(TQ_UINT32 baud)
{
_baud = baud;
}
TQ_UINT32 Serial::getBaud() const
{
return _baud;
}
void Serial::setBits(TQ_UINT32 bits)
{
if (bits >= 5 && bits <= 8)
_bits = bits;
else
kdWarning() << k_funcinfo << "bits property not accepted" << endl;
}
TQ_UINT32 Serial::getBits() const
{
return _bits;
}
void Serial::setParity(PARITY_MODE parity)
{
_parity = parity;
}
Serial::PARITY_MODE Serial::getParity() const
{
return _parity;
}
void Serial::setStopBits(TQ_UINT32 stopBits)
{
if (stopBits >= 1 && stopBits <= 2)
_stopBits = stopBits;
else
kdWarning() << k_funcinfo << "stopbits property: wrong value" << endl;
}
TQ_UINT32 Serial::getStopBits() const
{
return _stopBits;
}
void Serial::setSendDelay(TQ_UINT64 delay)
{
_sendDelay = delay;
}
TQ_UINT64 Serial::getSendDelay() const
{
return _sendDelay;
}
bool
Serial::isValid() const
{
// serial setting without ppp setting is not valid
if (!(getConnection()->getSetting(NM_SETTING_PPP_SETTING_NAME)))
return false;
return true;
}
SettingsMap
Serial::toMap() const
{
SettingsMap map;
map.insert(NM_SETTING_SERIAL_BAUD, TQT_DBusData::fromUInt32(_baud));
map.insert(NM_SETTING_SERIAL_BITS, TQT_DBusData::fromUInt32(_bits));
if (_parity == PARITY_NONE)
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('n'));
else if (_parity == PARITY_EVEN)
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('e'));
else if (_parity == PARITY_ODD)
map.insert(NM_SETTING_SERIAL_PARITY, TQT_DBusData::fromByte('o'));
map.insert(NM_SETTING_SERIAL_STOPBITS, TQT_DBusData::fromUInt32(_stopBits));
map.insert(NM_SETTING_SERIAL_SEND_DELAY, TQT_DBusData::fromUInt64(_sendDelay));
return map;
}
void
Serial::fromMap(const SettingsMap& map)
{
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_SERIAL_BAUD)
setBaud(it.data().toUInt32());
else if (it.key() == NM_SETTING_SERIAL_BITS)
setBits(it.data().toUInt32());
else if (it.key() == NM_SETTING_SERIAL_PARITY)
{
if (it.data().toByte() == 'n')
_parity = PARITY_NONE;
else if (it.data().toByte() == 'e')
_parity = PARITY_EVEN;
else if (it.data().toByte() == 'o')
_parity = PARITY_ODD;
}
else if (it.key() == NM_SETTING_SERIAL_STOPBITS)
setStopBits(it.data().toUInt32());
else if (it.key() == NM_SETTING_SERIAL_SEND_DELAY)
setSendDelay(it.data().toUInt64());
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
}

@ -0,0 +1,89 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_serial.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H
#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-ppp.h>
#include <nm-setting-serial.h>
namespace ConnectionSettings
{
class Connection;
// serial setting
class Serial : public ConnectionSetting
{
public:
enum PARITY_MODE
{
PARITY_NONE = 0
, PARITY_EVEN
, PARITY_ODD
};
Serial(Connection* conn);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
bool isValid() const;
bool useSetting();
void setBaud(TQ_UINT32);
TQ_UINT32 getBaud() const;
void setBits(TQ_UINT32);
TQ_UINT32 getBits() const;
void setParity(PARITY_MODE);
PARITY_MODE getParity() const;
void setStopBits(TQ_UINT32);
TQ_UINT32 getStopBits() const;
void setSendDelay(TQ_UINT64);
TQ_UINT64 getSendDelay() const;
private:
TQ_UINT32 _baud;
TQ_UINT32 _bits;
PARITY_MODE _parity;
TQ_UINT32 _stopBits;
TQ_UINT64 _sendDelay;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_H */

@ -0,0 +1,97 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <limits.h>
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqcombobox.h>
#include <tqspinbox.h>
#include <tqiconset.h>
#include <kiconloader.h>
#include <tqwidgetstack.h>
#include <kuser.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_serial.h"
#include "knetworkmanager-connection_setting_serial_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_serial.h"
using namespace ConnectionSettings;
SerialWidgetImpl::SerialWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_serialsetting = dynamic_cast<ConnectionSettings::Serial*> (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingSerialWidget(this);
tqlayout->addWidget(_mainWid);
_mainWid->mBaudRate->setMaxValue(INT_MAX);
Init();
}
void
SerialWidgetImpl::Init()
{
_mainWid->mBaudRate->setValue(_serialsetting->getBaud());
_mainWid->mDataBits->setCurrentItem(_serialsetting->getBits() - 7);
_mainWid->mParity->setCurrentItem(_serialsetting->getParity());
_mainWid->mStopBits->setCurrentItem(_serialsetting->getStopBits());
_mainWid->mSendDelay->setValue(_serialsetting->getSendDelay());
connect( _mainWid->mBaudRate, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
connect( _mainWid->mDataBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mParity, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
}
void
SerialWidgetImpl::Deactivate()
{
}
void
SerialWidgetImpl::Activate()
{
}
void
SerialWidgetImpl::dirty()
{
_serialsetting->setBaud( _mainWid->mBaudRate->value() );
_serialsetting->setBits( _mainWid->mDataBits->currentItem() + 7 );
_serialsetting->setParity( (ConnectionSettings::Serial::PARITY_MODE)_mainWid->mParity->currentItem() );
_serialsetting->setStopBits( _mainWid->mStopBits->currentItem() );
_serialsetting->setSendDelay( _mainWid->mSendDelay->value() );
}
#include "knetworkmanager-connection_setting_serial_widget.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_serial_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "knetworkmanager-connection_setting_serial.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService;
class ConnectionSettingSerialWidget;
namespace ConnectionSettings
{
class Connection;
class SerialWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
SerialWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
void Deactivate();
public slots:
void dirty();
private:
void Init();
Serial* _serialsetting;
ConnectionSettingSerialWidget* _mainWid;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H*/

@ -0,0 +1,206 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_vpn.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_vpn.h"
using namespace ConnectionSettings;
/*
class VPN
*/
VPN::VPN(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_VPN_SETTING_NAME)
{
}
TQString VPN::getUserName() const
{
return _userName;
}
void VPN::setUserName(const TQString& u)
{
_userName = u;
emitValidityChanged();
}
TQString VPN::getServiceType() const
{
return _serviceType;
}
void VPN::setServiceType(const TQString& s)
{
_serviceType = s;
emitValidityChanged();
}
TQValueList<TQString> VPN::getRoutes() const
{
return _routes;
}
void VPN::setRoutes(const TQValueList<TQString>& r)
{
_routes = r;
emitValidityChanged();
}
void VPN::setData(TQMap<TQString, TQString> data)
{
_data = data;
emitValidityChanged();
}
TQMap<TQString, TQString> VPN::getData() const
{
return _data;
}
void VPN::setSecrets(const TQMap<TQString, TQString>& data)
{
_secrets = data;
emitValidityChanged();
}
TQMap<TQString, TQString> VPN::getSecrets() const
{
return _secrets;
}
SettingsMap
VPN::toMap() const
{
SettingsMap map;
map.insert(NM_SETTING_VPN_SERVICE_TYPE, TQT_DBusData::fromString(_serviceType));
map.insert(NM_SETTING_VPN_USER_NAME, TQT_DBusData::fromString(_userName));
if (!_routes.isEmpty())
{
TQValueList<TQT_DBusData> list;
for (TQValueList<TQString>::ConstIterator it = _routes.begin(); it != _routes.end(); ++it)
{
list.append(TQT_DBusData::fromString(*it));
}
}
// NM expects a String/String map -> convert
TQT_DBusDataMap<TQString> data;
for (TQMap<TQString, TQString>::ConstIterator it = _data.begin(); it != _data.end(); ++it)
{
data.insert(it.key(), TQT_DBusData::fromString(it.data()));
}
map.insert(NM_SETTING_VPN_DATA, TQT_DBusData::fromStringKeyMap(data));
return map;
}
void
VPN::fromMap(const SettingsMap& map)
{
SettingsMap::ConstIterator it;
if ((it = map.find(NM_SETTING_VPN_SERVICE_TYPE)) != map.end())
_serviceType = it.data().toString();
if ((it = map.find(NM_SETTING_VPN_USER_NAME)) != map.end())
_userName = it.data().toString();
TQT_DBusDataMap<TQString> data;
_data.clear();
if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
{
data = it.data().toStringKeyMap();
for (TQMap<TQString, TQT_DBusData>::ConstIterator it = data.begin(); it != data.end(); ++it)
{
_data.insert(it.key(), it.data().toString());
}
}
}
SettingsMap
VPN::toSecretsMap(bool with_settings) const
{
SettingsMap map;
// NM does not want the settings too
/* if (with_settings)
map = toMap();*/
// copy all secrets into the map
for (TQMap<TQString, TQString>::ConstIterator it = _secrets.begin(); it != _secrets.end(); ++it)
map.insert(it.key(), TQT_DBusData::fromString(it.data()));
return map;
}
bool
VPN::fromSecretsMap(const SettingsMap& map)
{
/* SettingsMap::ConstIterator it;
TQT_DBusDataMap<TQString> data;
if ((it = map.find(NM_SETTING_VPN_DATA)) != map.end())
{
data = it.data().toStringKeyMap();
_data = data.toTQMap();
}*/
// FIXME
return false;
}
bool
VPN::isValid() const
{
// name is essential
if (_userName.isEmpty() || _serviceType.isEmpty())
return false;
// data is essential
if (_data.isEmpty())
return false;
return true;
}

@ -0,0 +1,83 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_vpn.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_VPN_H
#define KNETWORKMANAGER_CONNECTION_SETTING_VPN_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdatetime.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
/* NM headers */
#include <nm-setting-vpn.h>
namespace ConnectionSettings
{
// info setting
class VPN : public ConnectionSetting
{
public:
VPN(Connection* conn);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
SettingsMap toSecretsMap(bool with_settings = true) const;
bool fromSecretsMap(const SettingsMap&);
TQString getUserName() const;
void setUserName(const TQString&);
TQString getServiceType() const;
void setServiceType(const TQString&);
TQValueList<TQString> getRoutes() const;
void setRoutes(const TQValueList<TQString>&);
TQMap<TQString, TQString> getData() const;
void setData(TQMap<TQString, TQString> data);
// Ugh, that is ugly
TQMap<TQString, TQString> getSecrets() const;
void setSecrets(const TQMap<TQString, TQString>& secrets);
bool isValid() const;
private:
TQString _userName;
TQString _serviceType;
TQValueList<TQString> _routes;
TQMap<TQString, TQString> _data;
TQMap<TQString, TQString> _secrets;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_H */

@ -0,0 +1,206 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tqcombobox.h>
#include <tqiconset.h>
#include <kiconloader.h>
#include <tqwidgetstack.h>
#include <kuser.h>
// knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_vpn.h"
#include "knetworkmanager-connection_setting_vpn_widget.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-vpnmanager.h"
#include "knetworkmanager-vpnservice.h"
using namespace ConnectionSettings;
VPNWidgetImpl::VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
, _new_conn(new_conn)
{
_vpnsetting = dynamic_cast<ConnectionSettings::VPN*> (conn->getSetting(NM_SETTING_VPN_SETTING_NAME));
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingVPNWidget(this);
tqlayout->addWidget(_mainWid);
Init();
}
void
VPNWidgetImpl::Init()
{
// fill in all possible VPN services
VPNServiceList list = VPNManager::getVPNServices();
if (list.isEmpty())
{
// FIXME Do something useful here
}
else
{
int index = 0;
for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it)
{
TQString icon;
TQString disp_name;
// get service icon and display name
VPNService* service = *it;
if (service)
{
icon = service->getIcon();
disp_name = service->getDisplayName();
}
if (strcmp(disp_name, "vpnc") == 0) {
disp_name = "Cisco VPN";
}
else if (strcmp(disp_name, "pptp") == 0) {
disp_name = "Microsoft PPTP VPN";
}
else if (strcmp(disp_name, "openvpn") == 0) {
disp_name = "Open VPN";
}
else if (strcmp(disp_name, "strongswan") == 0) {
disp_name = "StrongSwan VPN";
}
// the service should not get changed when editing a connection
if (service->getService() != _vpnsetting->getServiceType() && !_new_conn)
continue;
// no special icon for this service, use default
if (icon.isEmpty())
icon = "encrypted";
_mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index);
_mapServiceCombo.insert(index++, *it);
if (service->getService() == _vpnsetting->getServiceType())
{
// preselect the correct service
_mainWid->cboServices->setCurrentItem(index - 1);
slotServiceComboActivated(index - 1);
}
}
}
// lock the combo when editing an already existing connection
if (!_new_conn)
_mainWid->cboServices->setEnabled(false);
else
{
// preselect the correct service
_mainWid->cboServices->setCurrentItem(0);
slotServiceComboActivated(0);
}
// update the username to the current one
KUser user;
_vpnsetting->setUserName(user.loginName());
// notification if VPN service is selected
connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int)));
}
VPNConfigWidget*
VPNWidgetImpl::getVPNConfigWidget(VPNService* service)
{
if (_mapServiceWidget.find(service) != _mapServiceWidget.end())
{
// return the already available config widget
return *_mapServiceWidget.find(service);
}
else
{
// we have to create a new one
VPNPlugin* plugin = service->getVPNPlugin();
if (plugin)
{
VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack);
_mapServiceWidget.insert(service, config);
return config;
}
}
return NULL;
}
void
VPNWidgetImpl::slotServiceComboActivated(int index)
{
VPNService* service;
if (_mapServiceCombo.find(index) != _mapServiceCombo.end())
{
service = *_mapServiceCombo.find(index);
if (service)
{
VPNConfigWidget* config = getVPNConfigWidget(service);
_mainWid->widgetStack->raiseWidget(config);
config->setVPNData(_vpnsetting->getRoutes(), _vpnsetting->getData());
}
}
else
{
//FIXME - do something useful here
}
}
void
VPNWidgetImpl::Deactivate()
{
// update the setting from the currently selected vpn service
VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem());
if (service)
{
// set the correct service type
_vpnsetting->setServiceType(service->getService());
VPNConfigWidget* config = *_mapServiceWidget.find(service);
if (config)
{
// update the vpn properties
_vpnsetting->setData(config->getVPNProperties());
}
}
}
void
VPNWidgetImpl::Activate()
{
}
#include "knetworkmanager-connection_setting_vpn_widget.moc"

@ -0,0 +1,69 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_vpn_widget.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H
// qt headers
#include <tqwidget.h>
#include <tqlineedit.h>
// knm headers
#include "connection_setting_vpn.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
class VPNService;
class VPNConfigWidget;
namespace ConnectionSettings
{
class Connection;
class VPNWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate();
void Deactivate();
public slots:
void slotServiceComboActivated(int);
private:
void Init();
VPNConfigWidget* getVPNConfigWidget(VPNService* service);
bool _new_conn;
VPN* _vpnsetting;
ConnectionSettingVPNWidget* _mainWid;
TQMap<int, VPNService*> _mapServiceCombo;
TQMap<VPNService*, VPNConfigWidget*> _mapServiceWidget;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_VPN_WIDGET_H*/

@ -0,0 +1,37 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_widget_interface.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include "knetworkmanager-connection_setting_widget_interface.h"
using namespace ConnectionSettings;
WidgetInterface::WidgetInterface(TQWidget* parent, const char* name, WFlags fl)
: TQWidget(parent, name, fl)
{
}
#include "knetworkmanager-connection_setting_widget_interface.moc"

@ -0,0 +1,47 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_widget_interface.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H
// qt headers
#include <tqwidget.h>
namespace ConnectionSettings
{
class WidgetInterface : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
WidgetInterface(TQWidget* parent = NULL, const char* name = 0, WFlags fl = 0);
virtual void Activate() = 0;
virtual void Deactivate() {};
signals:
void next();
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIDGET_INTERFACE_H */

@ -0,0 +1,99 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* NM headers */
#include <nm-setting-wired.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-accesspoint.h"
using namespace ConnectionSettings;
/*
class Wired
*/
Wired::Wired(Connection* conn, TQString port, uint32_t speed, TQString duplex, bool autoNegotiate, TQByteArray macAddress, uint32_t mtu)
: ConnectionSetting(conn, NM_SETTING_WIRED_SETTING_NAME)
{
_port = port;
_speed = speed;
_duplex = duplex;
_autoNegotiate = autoNegotiate;
_macAddress = macAddress;
_mtu = mtu;
}
SettingsMap
Wired::toMap() const
{
SettingsMap map;
if (!_port.isNull())
map.insert(NM_SETTING_WIRED_PORT, TQT_DBusData::fromString(_port));
map.insert(NM_SETTING_WIRED_SPEED, TQT_DBusData::fromUInt32(_speed));
if (!_duplex.isNull())
map.insert(NM_SETTING_WIRED_DUPLEX, TQT_DBusData::fromString(_duplex));
map.insert(NM_SETTING_WIRED_AUTO_NEGOTIATE, TQT_DBusData::fromBool(_autoNegotiate));
//FIXME
/*
if (!_macAddress.isNull())
map.insert(NM_SETTING_WIRED_MAC_ADDRESS, TQT_DBusData::from(_macAddress));
*/
map.insert(NM_SETTING_WIRED_MTU, TQT_DBusData::fromUInt32(_mtu));
return map;
}
void
Wired::fromMap(const SettingsMap& map)
{
SettingsMap::ConstIterator it;
// TODO
}
bool
Wired::isValid() const
{
return true;
}

@ -0,0 +1,62 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
#include <nm-setting-wired.h>
namespace ConnectionSettings
{
// setting for wired interfaces
class Wired: public ConnectionSetting
{
public:
Wired(Connection* conn, TQString port = TQString(), uint32_t speed = 0, TQString duplex = TQString(), bool autoNegotiate = true, TQByteArray macAddress = TQByteArray(), uint32_t mtu = 0);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
bool isValid() const;
private:
TQString _port;
uint32_t _speed;
TQString _duplex;
bool _autoNegotiate;
TQByteArray _macAddress;
uint32_t _mtu;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRED_H */

@ -0,0 +1,220 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqregexp.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-accesspoint.h"
// the bssid should look like XX:XX:XX:XX:XX:XX where X is a hexadecimal digit
#define MAC_ADDRESS_PATTERN "[0-9A-Fa-f]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}:[0-9A-F]{2}"
using namespace ConnectionSettings;
/*
class Wireless
*/
Wireless::Wireless(Connection* conn, ::AccessPoint* ap, WirelessSecurity* security)
: ConnectionSetting(conn, NM_SETTING_WIRELESS_SETTING_NAME)
{
_security = TQString();
if (ap)
{
_essid = ap->getSsidByteArray();
_mode = ap->getMode() == 0 ? MODE_ADHOC : MODE_INFRASTRUCTURE;
}
else
{
_essid = TQByteArray();
_mode = MODE_INFRASTRUCTURE;
}
_modeMap[MODE_INFRASTRUCTURE] = "infrastructure";
_modeMap[MODE_ADHOC] = "adhoc";
}
SettingsMap
Wireless::toMap() const
{
SettingsMap map;
map.insert(NM_SETTING_WIRELESS_MODE, TQT_DBusData::fromString(_modeMap[_mode]));
TQValueList<TQT_DBusData> essid;
for (TQByteArray::ConstIterator it = _essid.begin(); it != _essid.end(); ++it)
essid.append(TQT_DBusData::fromByte(*it));
if (essid.size() > 0)
map.insert(NM_SETTING_WIRELESS_SSID, TQT_DBusData::fromTQValueList(essid));
else
kdWarning() << k_funcinfo << " SSID undefined" << endl;
if (!_security.isEmpty())
map.insert(NM_SETTING_WIRELESS_SEC, TQT_DBusData::fromString(_security));
if (!_seenBssids.empty())
{
TQValueList<TQT_DBusData> bssids;
for (TQValueList<TQString>::ConstIterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
bssids.append(TQT_DBusData::fromString(*it));
map.insert(NM_SETTING_WIRELESS_SEEN_BSSIDS, TQT_DBusData::fromTQValueList(bssids));
}
return map;
}
void
Wireless::fromMap(const SettingsMap& map)
{
SettingsMap::ConstIterator it;
// Mode
if ((it = map.find(NM_SETTING_WIRELESS_MODE)) != map.end())
{
TQBiDirectionalMap<MODES, TQString>::Iterator mode_it = _modeMap.findData(it.data().toString());
if (mode_it != _modeMap.end())
_mode = mode_it.key();
else
_mode = MODE_INFRASTRUCTURE;
}
// Essid
if ((it = map.find(NM_SETTING_WIRELESS_SSID)) != map.end())
{
TQValueList<TQT_DBusData> dbus_essid = (*it).toTQValueList();
TQByteArray essid(dbus_essid.size());
int index = 0;
for (TQValueList<TQT_DBusData>::ConstIterator byte_it = dbus_essid.begin(); byte_it != dbus_essid.end(); ++byte_it)
{
essid[index] = (*byte_it).toByte();
index++;
}
_essid = essid;
}
if ((it = map.find(NM_SETTING_WIRELESS_SEC)) != map.end())
{
_security = (*it).toString();
}
// Seen BSSIDS
if ((it = map.find(NM_SETTING_WIRELESS_SEEN_BSSIDS)) != map.end())
{
TQRegExp exp(MAC_ADDRESS_PATTERN);
TQValueList<TQT_DBusData> bssids = (*it).toTQValueList();
_seenBssids.clear();
for(TQValueList<TQT_DBusData>::Iterator it = bssids.begin(); it != bssids.end(); ++it)
{
TQString bssid = (*it).toString();
if (exp.exactMatch(bssid))
_seenBssids.append(bssid);
}
}
}
void
Wireless::setEssid(const TQByteArray& essid)
{
_essid = essid;
emitValidityChanged();
}
TQByteArray
Wireless::getEssid(void) const
{
return _essid;
}
void
Wireless::setMode(MODES mode)
{
_mode = mode;
emitValidityChanged();
}
Wireless::MODES
Wireless::getMode(void) const
{
return _mode;
}
void
Wireless::setSecurity(const TQString& security)
{
_security = security;
emitValidityChanged();
}
TQString
Wireless::getSecurity(void) const
{
return _security;
}
bool
Wireless::isValid() const
{
// ESSID is essential
if (_essid.isEmpty())
return false;
return true;
}
void
Wireless::addSeenBssid(const TQString& bssid)
{
TQRegExp exp(MAC_ADDRESS_PATTERN);
if (!exp.exactMatch(bssid))
return;
// no duplicates please
for(TQValueList<TQString>::Iterator it = _seenBssids.begin(); it != _seenBssids.end(); ++it)
{
if ((*it) == bssid)
return;
}
// insert this bssid
_seenBssids.append(bssid);
emitValidityChanged();
}

@ -0,0 +1,97 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
#include "qbidirectionalmap.h"
/* NM headers */
#include <nm-setting-wireless.h>
class AccessPoint;
namespace ConnectionSettings
{
class WirelessSecurity;
class Connection;
// setting for wireless interfaces
class Wireless : public ConnectionSetting
{
public:
enum MODES
{
MODE_INFRASTRUCTURE = 0
, MODE_ADHOC
};
Wireless(Connection* conn, ::AccessPoint* ap = NULL, WirelessSecurity* security = NULL);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
void setEssid(const TQByteArray&);
TQByteArray getEssid(void) const;
void setMode(MODES);
MODES getMode(void) const;
void setSecurity(const TQString&);
TQString getSecurity(void) const;
bool isValid() const;
void addSeenBssid(const TQString&);
private:
TQByteArray _essid;
MODES _mode;
TQString _band;
uint32_t _channel;
TQByteArray _bssid;
uint32_t _rate;
uint32_t _txPower;
TQByteArray _macAddress;
uint32_t _mtu;
TQValueList<TQString> _seenBssids;
TQString _security;
TQBiDirectionalMap<MODES, TQString> _modeMap;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_H */

@ -0,0 +1,451 @@
/**************************************************************************
*
* knetworkmanager-connection_setting_wireless_security.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQT_DBus headers*/
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection.h"
#include "sha1.h"
#include "md5.h"
using namespace ConnectionSettings;
/*
class WirelessSecurity
*/
WirelessSecurity::WirelessSecurity(Connection* conn)
: ConnectionSetting(conn, NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)
, _keyMgmt(KEY_MGMT_NONE)
, _wepTxKeyidx(0)
, _authAlg(AUTH_ALG_NONE)
, _proto(PROTO_NONE)
, _pairwise(CIPHER_TKIP | CIPHER_CCMP)
, _group(CIPHER_TKIP | CIPHER_CCMP)
{
// init key_mgmt map
_keyMgmtMap[KEY_MGMT_NONE] = "none";
_keyMgmtMap[KEY_MGMT_WPA_PSK] = "wpa-psk";
_keyMgmtMap[KEY_MGMT_WPA_EAP] = "wpa-eap";
_keyMgmtMap[KEY_MGMT_IEEE8021X] = "ieee8021x";
// init auth_alg map
_authAlgMap[AUTH_ALG_NONE] = TQString(); // do not include auth alg if none is needed
_authAlgMap[AUTH_ALG_OPEN] = "open";
_authAlgMap[AUTH_ALG_SHARED] = "shared";
_authAlgMap[AUTH_ALG_LEAP] = "leap";
// proto map
_protoMap[PROTO_WPA] = "wpa";
_protoMap[PROTO_RSN] = "rsn"; // Info: rsn is wpa2
// cipher map
_cipherMap[CIPHER_TKIP] = "tkip";
_cipherMap[CIPHER_CCMP] = "ccmp";
_cipherMap[CIPHER_WEP40] = "wep40";
_cipherMap[CIPHER_WEP104] = "wep104";
}
bool WirelessSecurity::getEnabled() const
{
Connection* conn = getConnection();
if (conn)
{
Wireless* wireless = dynamic_cast<Wireless*>(conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
if (wireless && wireless->getSecurity() != getType())
{
kdDebug() << "WirelessSecurity::getEnabled false " << wireless->getSecurity().ascii() << endl;
return false;
}
}
return true;
}
int
WirelessSecurity::getWepTxidx(void) const
{
return _wepTxKeyidx;
}
void
WirelessSecurity::setWepTxidx(int idx)
{
if (idx >= 0 && idx < 4)
_wepTxKeyidx = idx;
}
void
WirelessSecurity::setWepKey(int idx, TQString key)
{
kdDebug() << "WirelessSecurity::setWepKey " << idx << " " << key.ascii() << endl;
if (idx >= 0 && idx < 4)
_wepKey[idx] = key;
}
TQString
WirelessSecurity::getWepKey(int idx) const
{
if (idx >= 0 && idx < 4)
return _wepKey[idx];
return TQString();
}
uint32_t
WirelessSecurity::getGroupCiphers(void) const
{
return _group;
}
void
WirelessSecurity::setGroupCiphers(uint32_t ciphers)
{
_group= ciphers & (CIPHER_TKIP | CIPHER_CCMP | CIPHER_WEP40 | CIPHER_WEP104);
}
uint32_t
WirelessSecurity::getPairwiseCiphers(void) const
{
return _pairwise;
}
void
WirelessSecurity::setPairwiseCiphers(uint32_t ciphers)
{
// only tkip and ccmp allowed
_pairwise = ciphers & (CIPHER_TKIP | CIPHER_CCMP);
}
uint32_t
WirelessSecurity::getProto(void) const
{
return _proto;
}
void
WirelessSecurity::setProto(uint32_t proto)
{
_proto = proto & (PROTO_WPA | PROTO_RSN);
}
void
WirelessSecurity::addProto(uint32_t proto)
{
setProto(_proto | proto);
}
void
WirelessSecurity::delProto(uint32_t proto)
{
setProto(_proto & ~proto);
}
TQString
WirelessSecurity::getPSK(void) const
{
return _psk;
}
void
WirelessSecurity::setPSK(const TQString& psk)
{
_psk = psk;
}
TQString
WirelessSecurity::getLeapPassword(void) const
{
return _leapPassword;
}
void
WirelessSecurity::setLeapPassword(const TQString& p)
{
_leapPassword = p;
}
TQString
WirelessSecurity::getLeapUsername(void) const
{
return _leapUsername;
}
void
WirelessSecurity::setLeapUsername(const TQString& u)
{
_leapUsername = u;
}
WirelessSecurity::KEY_MGMT
WirelessSecurity::getKeyMgmt(void) const
{
return _keyMgmt;
}
void
WirelessSecurity::setKeyMgmt(KEY_MGMT keyMgmt)
{
_keyMgmt = keyMgmt;
}
WirelessSecurity::AUTH_ALG
WirelessSecurity::getAuthAlg(void) const
{
return _authAlg;
}
void
WirelessSecurity::setAuthAlg(AUTH_ALG authAlg)
{
_authAlg = authAlg;
}
SettingsMap
WirelessSecurity::toMap() const
{
SettingsMap map;
// KEY MGMT
map.insert(NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, TQT_DBusData::fromString(_keyMgmtMap[_keyMgmt]));
// WEP TX KEYIDX is only needed if WEP is used
if (_keyMgmt == KEY_MGMT_NONE && _wepTxKeyidx >= 0 && _wepTxKeyidx <= 3)
{
// WEP TX KEYIDX
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX, TQT_DBusData::fromInt32(_wepTxKeyidx));
}
// AUTH ALG
if (_authAlg != AUTH_ALG_NONE)
map.insert(NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, TQT_DBusData::fromString(_authAlgMap[_authAlg]));
// PROTO is only needed for WPA connections
if (_proto != PROTO_NONE && (_keyMgmt == KEY_MGMT_WPA_NONE || _keyMgmt == KEY_MGMT_WPA_PSK || _keyMgmt == KEY_MGMT_WPA_EAP))
{
TQValueList<TQT_DBusData> protos;
for (TQMap<PROTO, TQString>::ConstIterator it = _protoMap.begin(); it != _protoMap.end(); ++it)
if (_proto & it.key())
protos.append(TQT_DBusData::fromString(it.data()));
if (protos.size() > 0)
map.insert(NM_SETTING_WIRELESS_SECURITY_PROTO, TQT_DBusData::fromTQValueList(protos));
}
// groupcipher
if (_group != CIPHER_NONE)
{
TQValueList<TQT_DBusData> ciphers;
for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
if (_group & it.key())
ciphers.append(TQT_DBusData::fromString(it.data()));
if (ciphers.size() > 0)
map.insert(NM_SETTING_WIRELESS_SECURITY_GROUP, TQT_DBusData::fromTQValueList(ciphers));
}
// pairwise cipher
if (_pairwise != CIPHER_NONE)
{
TQValueList<TQT_DBusData> ciphers;
for (TQMap<CIPHERS, TQString>::ConstIterator it = _cipherMap.begin(); it != _cipherMap.end(); ++it)
if (_pairwise & it.key())
ciphers.append(TQT_DBusData::fromString(it.data()));
if (ciphers.size() > 0)
map.insert(NM_SETTING_WIRELESS_SECURITY_PAIRWISE, TQT_DBusData::fromTQValueList(ciphers));
}
if (!_leapUsername.isEmpty())
map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME, TQT_DBusData::fromString(_leapUsername));
return map;
}
void
WirelessSecurity::fromMap(const SettingsMap& map)
{
kdDebug() << "WirelessSecurity::fromMap" << endl;
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_WIRELESS_SECURITY_KEY_MGMT)
{
TQBiDirectionalMap<KEY_MGMT, TQString>::Iterator it2;
if (_keyMgmtMap.end() != (it2 = _keyMgmtMap.findData(it.data().toString())))
setKeyMgmt(it2.key());
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_TX_KEYIDX)
{
_wepTxKeyidx = it.data().toInt32();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_AUTH_ALG)
{
TQBiDirectionalMap<AUTH_ALG, TQString>::Iterator it2;
if (_authAlgMap.end() != (it2 = _authAlgMap.findData(it.data().toString())))
setAuthAlg(it2.key());
}
else if(it.key() == NM_SETTING_WIRELESS_SECURITY_PROTO)
{
TQValueList<TQT_DBusData> proto_list = it.data().toTQValueList();
uint32_t protos = PROTO_NONE;
for (TQValueList<TQT_DBusData>::Iterator proto_it = proto_list.begin(); proto_it != proto_list.end(); ++proto_it)
{
TQBiDirectionalMap<PROTO, TQString>::Iterator it2;
if (_protoMap.end() != (it2 = _protoMap.findData( (*proto_it).toString() )))
protos |= it2.key();
}
setProto(protos);
}
else if(it.key() == NM_SETTING_WIRELESS_SECURITY_GROUP)
{
TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
uint32_t ciphers = CIPHER_NONE;
for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
{
TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
ciphers |= it2.key();
}
setGroupCiphers(ciphers);
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_PAIRWISE)
{
TQValueList<TQT_DBusData> cipher_list = it.data().toTQValueList();
uint32_t ciphers = CIPHER_NONE;
for (TQValueList<TQT_DBusData>::Iterator cipher_it = cipher_list.begin(); cipher_it != cipher_list.end(); ++cipher_it)
{
TQBiDirectionalMap<CIPHERS, TQString>::Iterator it2;
if (_cipherMap.end() != (it2 = _cipherMap.findData( (*cipher_it).toString() )))
ciphers |= it2.key();
}
setPairwiseCiphers(ciphers);
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_USERNAME)
{
_leapUsername = it.data().toString();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD)
{
_leapPassword = it.data().toString();
}
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
}
SettingsMap
WirelessSecurity::toSecretsMap(bool with_settings) const
{
SettingsMap map;
kdDebug() << "WirelessSecurity::toSecretsMap" << endl;
// first serialize the settings if needed
if (with_settings)
map = toMap();
// add the hashed psk
if (!_psk.isNull())
{
map.insert(NM_SETTING_WIRELESS_SECURITY_PSK, TQT_DBusData::fromString(_psk), TRUE);
}
// wep keys
if (!_wepKey[0].isNull())
{
kdDebug() << "insert wep key0: " << _wepKey[0].ascii() << endl;
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY0, TQT_DBusData::fromString(_wepKey[0]));
}
if (!_wepKey[1].isNull())
{
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY1, TQT_DBusData::fromString(_wepKey[1]));
}
if (!_wepKey[2].isNull())
{
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY2, TQT_DBusData::fromString(_wepKey[2]));
}
if (!_wepKey[3].isNull())
{
map.insert(NM_SETTING_WIRELESS_SECURITY_WEP_KEY3, TQT_DBusData::fromString(_wepKey[3]));
}
if (!_leapPassword.isEmpty())
map.insert(NM_SETTING_WIRELESS_SECURITY_LEAP_PASSWORD, TQT_DBusData::fromString(_leapPassword));
return map;
}
bool
WirelessSecurity::fromSecretsMap(const SettingsMap& map)
{
kdDebug() << "WirelessSecurity::fromMap" << endl;
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
if (it.key() == NM_SETTING_WIRELESS_SECURITY_PSK)
{
_psk = it.data().toString();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY0)
{
_wepKey[0] = it.data().toString();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY1)
{
_wepKey[1] = it.data().toString();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY2)
{
_wepKey[2] = it.data().toString();
}
else if (it.key() == NM_SETTING_WIRELESS_SECURITY_WEP_KEY3)
{
_wepKey[3] = it.data().toString();
}
else
kdWarning() << k_funcinfo << " Unknown setting: " << it.key() << endl;
}
return true;
}
bool
WirelessSecurity::isValid() const
{
return true;
}

@ -0,0 +1,156 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H
#include <stdint.h>
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvariant.h>
#include <tqobject.h>
#include <tqdbusdata.h>
#include "knetworkmanager-connection_setting.h"
#include "qbidirectionalmap.h"
/* NM */
#include <nm-setting-wireless-security.h>
#include <nm-setting-wireless.h>
class AccessPoint;
namespace ConnectionSettings
{
class WirelessSecurity;
// setting for wireless security parameters
class WirelessSecurity : public ConnectionSetting
{
public:
// bitwise or-able ciphers
enum CIPHERS
{
CIPHER_NONE = 0
, CIPHER_TKIP = 1
, CIPHER_CCMP = 2
, CIPHER_WEP40 = 4
, CIPHER_WEP104 = 8
, CIPHER_AUTO = CIPHER_TKIP | CIPHER_CCMP
};
enum KEY_MGMT
{
KEY_MGMT_NONE = 0
, KEY_MGMT_IEEE8021X
, KEY_MGMT_WPA_NONE
, KEY_MGMT_WPA_PSK
, KEY_MGMT_WPA_EAP
};
enum AUTH_ALG
{
AUTH_ALG_NONE = 0
, AUTH_ALG_OPEN
, AUTH_ALG_SHARED
, AUTH_ALG_LEAP
};
// bitwise or-able protos
enum PROTO
{
PROTO_NONE = 0
, PROTO_AUTO = PROTO_NONE
, PROTO_WPA
, PROTO_RSN
};
WirelessSecurity(Connection* conn);
SettingsMap toMap() const;
void fromMap(const SettingsMap&);
SettingsMap toSecretsMap(bool with_settings = true) const;
bool fromSecretsMap(const SettingsMap&);
uint32_t getGroupCiphers(void) const;
void setGroupCiphers(uint32_t);
uint32_t getPairwiseCiphers(void) const;
void setPairwiseCiphers(uint32_t);
KEY_MGMT getKeyMgmt(void) const;
void setKeyMgmt(KEY_MGMT);
AUTH_ALG getAuthAlg(void) const;
void setAuthAlg(AUTH_ALG);
uint32_t getProto(void) const;
void setProto(uint32_t);
void addProto(uint32_t);
void delProto(uint32_t);
TQString getPSK(void) const;
void setPSK(const TQString&);
TQString getLeapUsername(void) const;
void setLeapUsername(const TQString&);
TQString getLeapPassword(void) const;
void setLeapPassword(const TQString&);
TQString getWepKey(int) const;
void setWepKey(int, TQString);
int getWepTxidx() const;
void setWepTxidx(int);
bool isValid() const;
bool getEnabled() const;
private:
// settigs
KEY_MGMT _keyMgmt;
int _wepTxKeyidx;
AUTH_ALG _authAlg;
uint32_t _proto;
uint32_t _pairwise;
uint32_t _group;
TQString _leapUsername;
// secrets
TQString _wepKey[4];
TQString _psk;
TQString _leapPassword;
TQBiDirectionalMap<KEY_MGMT, TQString> _keyMgmtMap;
TQBiDirectionalMap<AUTH_ALG, TQString> _authAlgMap;
TQBiDirectionalMap<PROTO, TQString> _protoMap;
TQBiDirectionalMap<CIPHERS, TQString> _cipherMap;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_H */

@ -0,0 +1,999 @@
/***************************************************************************
*
* knetworkmanager-connection_setting_wireless_security_widget.cpp
* - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqgroupbox.h>
#include <tqbuttongroup.h>
#include <tqwidgetstack.h>
#include <tqcombobox.h>
#include <tqradiobutton.h>
#include <tqlayout.h>
#include <tqcheckbox.h>
/* kde headers */
#include <kurlrequester.h>
#include <klocale.h>
#include <kdebug.h>
#include <kpassdlg.h>
/* knetworkmanager headers */
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_wireless_security_widget.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "sha1.h"
#include "md5.h"
#include "knetworkmanager-wireless_manager.h"
#define WPA_PMK_LEN 32
using namespace ConnectionSettings;
/*
class WirelessSecurityWEPImpl
*/
WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWEP(parent, name, fl)
, _security_setting(sec)
, _wepKeyType( WEPKEY_TYPE_HEX )
{
cboAuthentication->insertItem(i18n("Open System"), 0);
cboAuthentication->insertItem(i18n("Shared Key"), 1);
if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_OPEN)
cboAuthentication->setCurrentItem(0);
else if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED)
cboAuthentication->setCurrentItem(1);
cbKeyType->insertItem(i18n("WEP 40/128-bit ASCII"), WEPKEY_TYPE_ASCII);
cbKeyType->insertItem(i18n("WEP 40/128-bit Hexadecimal"), WEPKEY_TYPE_HEX);
cbKeyType->insertItem(i18n("WEP 128-bit passphrase"), WEPKEY_TYPE_PASSPHRASE);
cbKeyType->setCurrentItem(_wepKeyType );
txtWEPKey0->setText(_security_setting->getWepKey(0));
txtWEPKey1->setText(_security_setting->getWepKey(1));
txtWEPKey2->setText(_security_setting->getWepKey(2));
txtWEPKey3->setText(_security_setting->getWepKey(3));
switch(_security_setting->getWepTxidx())
{
case 0:
rbKeyIdx0->setChecked(true);
break;
case 1:
rbKeyIdx1->setChecked(true);
break;
case 2:
rbKeyIdx2->setChecked(true);
break;
case 3:
rbKeyIdx3->setChecked(true);
break;
default:
rbKeyIdx0->setChecked(true);
break;
}
connect(cboAuthentication, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotAuthAlgChanged(int)));
connect(cbKeyType, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotKeyTypeChanged(int)));
connect(txtWEPKey0, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey0Changed(const TQString&)));
connect(txtWEPKey1, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey1Changed(const TQString&)));
connect(txtWEPKey2, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey2Changed(const TQString&)));
connect(txtWEPKey3, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotWepKey3Changed(const TQString&)));
connect(rbKeyIdx0, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx0Checked(bool)));
connect(rbKeyIdx1, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx1Checked(bool)));
connect(rbKeyIdx2, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx2Checked(bool)));
connect(rbKeyIdx3, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWepIdx3Checked(bool)));
}
void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index)
{
if (index == 0)
_security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_OPEN);
else if (index == 1)
_security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_SHARED);
}
void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index)
{
_wepKeyType = (WEPKEY_TYPE)index;
// update all WEP-Keys here due to the new key_type
}
void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key)
{
TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(0, hashed);
}
void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key)
{
TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(1, hashed);
}
void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key)
{
TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(2, hashed);
}
void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key)
{
TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(3, hashed);
}
void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check)
{
if (check)
_security_setting->setWepTxidx(0);
}
void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check)
{
if (check)
_security_setting->setWepTxidx(1);
}
void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check)
{
if (check)
_security_setting->setWepTxidx(2);
}
void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check)
{
if (check)
_security_setting->setWepTxidx(3);
}
TQCString
WirelessSecurityWEPImpl::getHashedWEPKey(TQString key, WEPKEY_TYPE type) const
{
TQCString hashed;
switch(type)
{
case WEPKEY_TYPE_HEX:
return TQCString(key);
break;
case WEPKEY_TYPE_ASCII:
hashed = String2Hex(TQCString(key), key.length() * 2);
return hashed;
break;
case WEPKEY_TYPE_PASSPHRASE:
return getWEP128PassphraseHash(TQCString(key));
break;
}
return hashed;
}
TQCString
WirelessSecurityWEPImpl::getWEP128PassphraseHash(TQCString input) const
{
char md5_data[65];
TQCString digest(16);
int input_len;
int i;
if (input.isNull()) return input;
input_len = input.length();
if (input_len < 1)
return TQCString();
/* Get at least 64 bytes */
for (i = 0; i < 64; i++)
md5_data [i] = input [i % input_len];
/* Null terminate md5 seed data and hash it */
md5_data[64] = 0;
gnome_keyring_md5_string (md5_data, (unsigned char*)digest.data());
return (String2Hex(TQByteArray(digest), 26));
}
TQCString
WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const
{
TQCString result(final_len+1);
static char hex_digits[] = "0123456789abcdef";
result.resize(bytes.size() * 2 + 1);
for (uint i = 0; i < bytes.size(); i++)
{
result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf];
result[2*i+1] = hex_digits[bytes[i] & 0xf];
}
/* Cut converted key off at the correct length for this cipher type */
if (final_len > -1)
result[final_len] = '\0';
return result;
}
/*
class WirelessSecurityWEPEncryptionImpl
*/
WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl)
, _security_setting(security_setting)
{
cboEncryption->insertItem(i18n("None"));
cboEncryption->insertItem(i18n("Dynamic WEP"));
}
/*
class WirelessSecurityWPAVersionImpl
*/
WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl)
, _security_setting(security_setting)
{
cbWPA->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_WPA);
cbRSN->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_RSN);
connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool)));
connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool)));
connect(grpUseWPAVersion, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotAuto(bool)));
}
void
WirelessSecurityWPAVersionImpl::slotAuto(bool on)
{
if (!on)
{
// auto-select proto
_security_setting->setProto(WirelessSecurity::PROTO_AUTO);
}
else
{
// use selected wpa-version
TQ_UINT32 proto = WirelessSecurity::PROTO_NONE;
if (cbWPA->isChecked())
proto |= WirelessSecurity::PROTO_WPA;
if (cbRSN->isChecked())
proto |= WirelessSecurity::PROTO_RSN;
_security_setting->setProto(proto);
}
}
void
WirelessSecurityWPAVersionImpl::slotWPA1(bool on)
{
if (on)
_security_setting->addProto(WirelessSecurity::PROTO_WPA);
else
_security_setting->delProto(WirelessSecurity::PROTO_WPA);
}
void
WirelessSecurityWPAVersionImpl::slotWPA2(bool on)
{
if (on)
_security_setting->addProto(WirelessSecurity::PROTO_RSN);
else
_security_setting->delProto(WirelessSecurity::PROTO_RSN);
}
/*
class WirelessSecurityWPACipherImpl
*/
WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPACipher(parent, name, fl)
, _security_setting(security_setting)
{
connect(grpUseCipher, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotCipherChangedAuto(bool)));
connect(chkGroupCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedTKIP(bool)));
connect(chkGroupCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedCCMP(bool)));
connect(chkGroupCipherWEP40, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedWEP40(bool)));
connect(chkGroupCipherWEP104, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotGroupCipherChangedWEP104(bool)));
connect(chkPairwiseCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedTKIP(bool)));
connect(chkPairwiseCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedCCMP(bool)));
chkPairwiseCipherCCMP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_CCMP);
chkPairwiseCipherTKIP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_TKIP);
chkGroupCipherCCMP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_CCMP);
chkGroupCipherTKIP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_TKIP);
chkGroupCipherWEP40->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP40);
chkGroupCipherWEP104->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP104);
}
void
WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked)
{
if (!checked)
{
// select auto for both ciphers
_security_setting->setGroupCiphers(WirelessSecurity::CIPHER_AUTO);
_security_setting->setPairwiseCiphers(WirelessSecurity::CIPHER_AUTO);
}
else
{
// use the already selected ciphers
// group cipher
TQ_UINT32 cipher = WirelessSecurity::CIPHER_NONE;
if (chkGroupCipherTKIP->isChecked())
cipher |= WirelessSecurity::CIPHER_TKIP;
if (chkGroupCipherCCMP->isChecked())
cipher |= WirelessSecurity::CIPHER_CCMP;
if (chkGroupCipherWEP40->isChecked())
cipher |= WirelessSecurity::CIPHER_WEP40;
if (chkGroupCipherWEP104->isChecked())
cipher |= WirelessSecurity::CIPHER_WEP104;
_security_setting->setGroupCiphers(cipher);
// pairwise cipher
cipher = WirelessSecurity::CIPHER_NONE;
if (chkPairwiseCipherTKIP->isChecked())
cipher |= WirelessSecurity::CIPHER_TKIP;
if (chkPairwiseCipherCCMP->isChecked())
cipher |= WirelessSecurity::CIPHER_CCMP;
_security_setting->setPairwiseCiphers(cipher);
}
}
void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked)
{
if (checked)
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_TKIP);
else
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_TKIP));
}
void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked)
{
if (checked)
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_CCMP);
else
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_CCMP));
}
void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked)
{
if (checked)
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP40);
else
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP40));
}
void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked)
{
if (checked)
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP104);
else
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP104));
}
void
WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked)
{
if (checked)
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_TKIP);
else
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_TKIP));
}
void
WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked)
{
if (checked)
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_CCMP);
else
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_CCMP));
}
/*
class WirelessSecurityWPAPSK
*/
WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl)
, _security_setting(security_setting)
, _wireless_setting(wireless_setting)
{
txtPSK->setText(_security_setting->getPSK());
connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&)));
}
void
WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk)
{
if (_wireless_setting)
{
_security_setting->setPSK(psk);
}
}
TQCString
WirelessSecurityWPAPSKImpl::String2Hex(TQByteArray bytes, int final_len) const
{
TQCString result(final_len+1);
static char hex_digits[] = "0123456789abcdef";
result.resize(bytes.size() * 2 + 1);
for (uint i = 0; i < bytes.size(); i++)
{
result[2*i] = hex_digits[(bytes[i] >> 4) & 0xf];
result[2*i+1] = hex_digits[bytes[i] & 0xf];
}
/* Cut converted key off at the correct length for this cipher type */
if (final_len > -1)
result[final_len] = '\0';
return result;
}
/*
class WirelessSecurityEAPImpl
*/
WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityEAP(parent, name, fl)
, _security_setting(security_setting)
, _phase2_widget(phase2_widget)
{
// insert all EAP-Methods
int index = 0;
cboMethod->insertItem(i18n("None"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_NONE;
cboMethod->insertItem(i18n("TTLS"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TTLS;
cboMethod->insertItem(i18n("PEAP"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_PEAP;
cboMethod->insertItem(i18n("TLS"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TLS;
cboMethod->insertItem(i18n("Leap"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_LEAP;
cboMethod->insertItem(i18n("MD5"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_MD5;
cboMethod->insertItem(i18n("FAST"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_FAST;
cboMethod->insertItem(i18n("SIM"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_SIM;
// preselect the correct method
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1>::Iterator it = _eapIndexMap.findData(_security_setting->getEAP());
cboMethod->setCurrentItem(it.key());
// update phase2 combobox
_phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods());
txtIdentity->setText(_security_setting->getIdentity());
txtAnonIdentity->setText(_security_setting->getAnonIdentity());
txtPassword->setText(_security_setting->getPassword());
chkCAStore->setChecked(_security_setting->getUseSystemCaCert());
kURLCACert->setEnabled(!_security_setting->getUseSystemCaCert());
// get notified if the method changes
connect(cboMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMethodChanged(int)));
connect(txtIdentity, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIdentityChanged(const TQString&)));
connect(txtAnonIdentity, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotAnonIdentityChanged(const TQString&)));
connect(txtPassword, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPasswordChanged(const TQString&)));
connect(chkCAStore, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUseSystemCaCertChanged(bool)));
}
void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on)
{
_security_setting->setUseSystemCaCert(on);
kURLCACert->setEnabled(!on);
}
void WirelessSecurityEAPImpl::slotMethodChanged(int index)
{
// new method choosen
IEEE8021x::EAP_PHASE1 eap = _eapIndexMap[index];
_security_setting->setEAP(eap);
_phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods());
}
void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity)
{
_security_setting->setIdentity(identity);
}
void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity)
{
_security_setting->setAnonIdentity(identity);
}
void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd)
{
_security_setting->setPassword(TQString(txtPassword->password()));
}
/*
class WirelessSecurityPhase2Impl
*/
WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityPhase2(parent, name, fl)
, _security_setting(security_setting)
{
_allowed_methods.append(IEEE8021x::EAP_PHASE2_AUTH_NONE);
updateMethodComboBox();
connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int)));
}
void WirelessSecurityPhase2Impl::updateMethodComboBox()
{
// insert all phase2 EAP-Methods
int index = 0;
cboPhase2Method->clear();
_eapIndexMap.clear();
for (TQValueList<IEEE8021x::EAP_PHASE2>::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it)
{
if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_NONE)
{
cboPhase2Method->insertItem(i18n("None"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_NONE;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2)
{
cboPhase2Method->insertItem(i18n("MSCHAPv2"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_PAP)
{
cboPhase2Method->insertItem(i18n("PAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_PAP;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_CHAP)
{
cboPhase2Method->insertItem(i18n("CHAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_CHAP;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAP)
{
cboPhase2Method->insertItem(i18n("MSCHAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAP;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_GTC)
{
cboPhase2Method->insertItem(i18n("GTC"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_GTC;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_OTP)
{
cboPhase2Method->insertItem(i18n("OTP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_OTP;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MD5)
{
cboPhase2Method->insertItem(i18n("MD5"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MD5;
index++;
}
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_TLS)
{
cboPhase2Method->insertItem(i18n("TLS"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_TLS;
index++;
}
}
// preselect the correct method
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2>::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP());
if (it != _eapIndexMap.end())
{
cboPhase2Method->setCurrentItem(it.key());
_security_setting->setPhase2EAP(it.data());
}
else
{
cboPhase2Method->setCurrentItem(0);
_security_setting->setPhase2EAP(_eapIndexMap[0]);
}
}
void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>& list)
{
_allowed_methods = list;
updateMethodComboBox();
}
void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index)
{
// new method choosen
IEEE8021x::EAP_PHASE2 eap = _eapIndexMap[index];
_security_setting->setPhase2EAP(eap);
}
/*
class WirelessSecurityWidgetImpl
*/
WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
_wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
_ieee8021x_setting = dynamic_cast<IEEE8021x*> (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME));
_new_conn = new_conn;
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingWirelessSecurityWidget(this);
tqlayout->addWidget(_mainWid);
TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
}
void
WirelessSecurityWidgetImpl::slotInit()
{
// create all security widgets...
TQWidget* wep = new WirelessSecurityWEPImpl(_security_setting, _mainWid->groupUseEncryption);
TQWidget* phase2 = new WirelessSecurityPhase2Impl(_ieee8021x_setting, _mainWid->groupUseEncryption);
TQWidget* eap = new WirelessSecurityEAPImpl(_ieee8021x_setting, (WirelessSecurityPhase2Impl*)phase2, _mainWid->groupUseEncryption);
TQWidget* wpaversion = new WirelessSecurityWPAVersionImpl(_security_setting, _mainWid->groupUseEncryption);
TQWidget* wpacipher = new WirelessSecurityWPACipherImpl(_security_setting, _mainWid->groupUseEncryption);
TQWidget* wpapsk = new WirelessSecurityWPAPSKImpl(_security_setting, _wireless_setting, _mainWid->groupUseEncryption);
TQWidget* wepencryption = new WirelessSecurityWEPEncryptionImpl(_security_setting, _mainWid->groupUseEncryption);
wep->setHidden(true);
eap->setHidden(true);
wpaversion->setHidden(true);
wpacipher->setHidden(true);
phase2->setHidden(true);
wpapsk->setHidden(true);
wepencryption->setHidden(true);
_widgets[SECURITY_WEP].clear();
_widgets[SECURITY_WPA_PSK].clear();
_widgets[SECURITY_WPA_EAP].clear();
_widgets[SECURITY_IEEE8021X].clear();
// create WEP widget list
_widgets[SECURITY_WEP].append(wep);
// create WPA PSK widget list
_extra_widgets[SECURITY_WPA_PSK].append(wpaversion);
_extra_widgets[SECURITY_WPA_PSK].append(wpacipher);
_widgets[SECURITY_WPA_PSK].append(wpapsk);
// create WPA EAP widget list
_extra_widgets[SECURITY_WPA_EAP].append(wpaversion);
_extra_widgets[SECURITY_WPA_EAP].append(wpacipher);
_widgets[SECURITY_WPA_EAP].append(eap);
_widgets[SECURITY_WPA_EAP].append(phase2);
// create IEEE8021X widget list
_widgets[SECURITY_IEEE8021X].append(wepencryption);
_widgets[SECURITY_IEEE8021X].append(eap);
connect(_mainWid->cboSecurity, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotComboSecurityActivated(int)));
connect(_mainWid->groupUseEncryption, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotUseEncryptionToggled(bool)));
connect(_mainWid->pbExtra, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotExtraSettingsToggled(bool)));
}
void
WirelessSecurityWidgetImpl::Activate()
{
kdDebug() << "Activate " << (_new_conn ? "New" : "Edit") << endl;
comboSecurityInit();
}
void
WirelessSecurityWidgetImpl::comboSecurityInit()
{
int index = 0;
TQValueList<SecurityMethods> allowed_methods;
_mainWid->cboSecurity->clear();
// TODO: Preselect the right security method
// We should have an Essid already, fetch all possible APs
TQValueList<AccessPoint *> aps;
if (_new_conn && !_wireless_setting->getEssid().isEmpty())
{
aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid());
#if 0
kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl;
#endif
}
if (!aps.isEmpty())
{
// if at least one AP has this security setting show the entry in the combobox
for (TQValueList<AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it)
{
if((*it)->isEncrypted())
{
kdDebug() << "AP " << (*it)->getDisplaySsid().ascii() << " is encrypted" << endl;
if ((*it)->getRsnFlags() != NM_802_11_AP_SEC_NONE || (*it)->getWpaFlags() != NM_802_11_AP_SEC_NONE)
{
// WPA or RSN
if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK)
if (!allowed_methods.contains(SECURITY_WPA_PSK))
allowed_methods.append(SECURITY_WPA_PSK);
if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X)
if (!allowed_methods.contains(SECURITY_WPA_EAP))
allowed_methods.append(SECURITY_WPA_EAP);
}
// No WPA & RSN => WEP or dynamic WEP with 802.1x authentication
// TODO: an AP can provide WEP in addition to WPA
if (!allowed_methods.contains(SECURITY_WEP))
allowed_methods.append(SECURITY_WEP);
if (!allowed_methods.contains(SECURITY_IEEE8021X))
allowed_methods.append(SECURITY_IEEE8021X);
}
}
// insert only allowed security methods
if (allowed_methods.contains(SECURITY_WPA_PSK))
{
_securityComboMap.insert(index, SECURITY_WPA_PSK);
_mainWid->cboSecurity->insertItem(i18n("WPA Personal"), index++);
}
if (allowed_methods.contains(SECURITY_WPA_EAP))
{
_securityComboMap.insert(index, SECURITY_WPA_EAP);
_mainWid->cboSecurity->insertItem(i18n("WPA Enterprise"), index++);
}
if (allowed_methods.contains(SECURITY_WEP))
{
_securityComboMap.insert(index, SECURITY_WEP);
_mainWid->cboSecurity->insertItem(i18n("WEP"), index++);
}
if (allowed_methods.contains(SECURITY_IEEE8021X))
{
_securityComboMap.insert(index, SECURITY_IEEE8021X);
_mainWid->cboSecurity->insertItem(i18n("IEEE 802.1X"), index++);
}
}
else
{
// insert all possible authentication methods
_mainWid->cboSecurity->insertItem(i18n("WEP"),SECURITY_WEP );
_mainWid->cboSecurity->insertItem(i18n("WPA Personal"), SECURITY_WPA_PSK);
_mainWid->cboSecurity->insertItem(i18n("WPA Enterprise"), SECURITY_WPA_EAP);
_mainWid->cboSecurity->insertItem(i18n("IEEE 802.1X"), SECURITY_IEEE8021X);
_securityComboMap.insert(SECURITY_WEP, SECURITY_WEP);
_securityComboMap.insert(SECURITY_WPA_PSK, SECURITY_WPA_PSK);
_securityComboMap.insert(SECURITY_WPA_EAP, SECURITY_WPA_EAP);
_securityComboMap.insert(SECURITY_IEEE8021X, SECURITY_IEEE8021X);
}
if (!_new_conn)
{
switch(_security_setting->getKeyMgmt())
{
case WirelessSecurity::KEY_MGMT_NONE:
if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED ||
!_security_setting->getWepKey(0).isEmpty() ||
!_security_setting->getWepKey(1).isEmpty() ||
!_security_setting->getWepKey(2).isEmpty() ||
!_security_setting->getWepKey(3).isEmpty() )
{
_mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WEP);
slotComboSecurityActivated(_securityComboMap[SECURITY_WEP]);
}
else
_mainWid->groupUseEncryption->setChecked(false);
break;
case WirelessSecurity::KEY_MGMT_WPA_PSK:
_mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK);
slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]);
break;
case WirelessSecurity::KEY_MGMT_WPA_EAP:
_mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP);
slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]);
break;
case WirelessSecurity::KEY_MGMT_IEEE8021X:
_mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X);
slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]);
break;
default:
break;
}
}
else
{
// select first possible security method
if (_mainWid->cboSecurity->count() > 0)
{
_mainWid->groupUseEncryption->setChecked(true);
_mainWid->groupUseEncryption->setEnabled(true);
_mainWid->cboSecurity->setCurrentItem(0);
slotComboSecurityActivated(0);
}
else
{
_mainWid->groupUseEncryption->setChecked(false);
_mainWid->groupUseEncryption->setEnabled(false);
}
}
}
void
WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on)
{
_wireless_setting->setSecurity(on ? _security_setting->getType() : NULL);
}
void
WirelessSecurityWidgetImpl::slotComboSecurityActivated(int index)
{
int i = _securityComboMap[index];
// authentication switched, we have to show the appropriate widgets and hide some others
switch(i)
{
case SECURITY_WEP:
configureForWEP();
break;
case SECURITY_WPA_PSK:
configureForWPAPSK();
break;
case SECURITY_WPA_EAP:
configureForWPAEAP();
break;
case SECURITY_IEEE8021X:
configureForIEEE8021X();
break;
default:
// should not happen, something is broken...
break;
}
}
void
WirelessSecurityWidgetImpl::configureWidgets(SecurityMethods method)
{
// store selected method
_currentMethod = method;
for (int i = 0; i < SECURITY_COUNT; ++i)
{
// remove all current widgets that do not belong to the selected method
if (i != method)
{
for (TQValueList<TQWidget*>::iterator it = _widgets[i].begin(); it != _widgets[i].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->remove(*it);
(*it)->hide();
}
// remove extra widgets too
for (TQValueList<TQWidget*>::iterator it = _extra_widgets[i].begin(); it != _extra_widgets[i].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->remove(*it);
(*it)->hide();
}
}
}
// show all widgets widgets for the selected security method
for (TQValueList<TQWidget*>::iterator it = _widgets[method].begin(); it != _widgets[method].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->add(*it);
(*it)->show();
}
if (_mainWid->pbExtra->isOn())
for (TQValueList<TQWidget*>::iterator it = _extra_widgets[method].begin(); it != _extra_widgets[method].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->add(*it);
(*it)->show();
}
// deactivate button if no extra settings are available
_mainWid->pbExtra->setEnabled(!(_extra_widgets[method].begin() == _extra_widgets[method].end()));
}
void
WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on)
{
if (on)
for (TQValueList<TQWidget*>::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->add(*it);
(*it)->show();
}
else
for (TQValueList<TQWidget*>::iterator it = _extra_widgets[_currentMethod].begin(); it != _extra_widgets[_currentMethod].end(); ++it)
{
_mainWid->groupUseEncryption->tqlayout()->remove(*it);
(*it)->hide();
}
}
void
WirelessSecurityWidgetImpl::configureForWEP()
{
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_NONE);
configureWidgets(SECURITY_WEP);
}
void
WirelessSecurityWidgetImpl::configureForWPAPSK()
{
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_PSK);
configureWidgets(SECURITY_WPA_PSK);
}
void
WirelessSecurityWidgetImpl::configureForWPAEAP()
{
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_EAP);
configureWidgets(SECURITY_WPA_EAP);
}
void
WirelessSecurityWidgetImpl::configureForIEEE8021X()
{
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_IEEE8021X);
configureWidgets(SECURITY_IEEE8021X);
}
#include "knetworkmanager-connection_setting_wireless_security_widget.moc"

@ -0,0 +1,238 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
/* qt autogenerated headers */
#include "connection_setting_wireless_security.h"
#include "connection_setting_wireless_security_eap.h"
#include "connection_setting_wireless_security_phase2.h"
#include "connection_setting_wireless_security_wep.h"
#include "connection_setting_wireless_security_wpaversion.h"
#include "connection_setting_wireless_security_wpacipher.h"
#include "connection_setting_wireless_security_wpapsk.h"
#include "connection_setting_wireless_security_wepencryption.h"
/* knetworkmanager headers */
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
namespace ConnectionSettings
{
/* class declarations */
class WirelessSecurity;
class Wireless;
class IEEE8021x;
class WirelessSecurityPhase2Impl;
class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP
{
Q_OBJECT
TQ_OBJECT
public:
enum WEPKEY_TYPE
{
WEPKEY_TYPE_ASCII = 0
, WEPKEY_TYPE_HEX
, WEPKEY_TYPE_PASSPHRASE
};
WirelessSecurityWEPImpl(WirelessSecurity* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
TQCString getHashedWEPKey(TQString key, WEPKEY_TYPE type) const;
TQCString getWEP128PassphraseHash(TQCString input) const;
TQCString String2Hex(TQByteArray bytes, int final_len) const;
public slots:
void slotAuthAlgChanged(int);
void slotKeyTypeChanged(int);
void slotWepKey0Changed(const TQString&);
void slotWepKey1Changed(const TQString&);
void slotWepKey2Changed(const TQString&);
void slotWepKey3Changed(const TQString&);
void slotWepIdx0Checked(bool);
void slotWepIdx1Checked(bool);
void slotWepIdx2Checked(bool);
void slotWepIdx3Checked(bool);
private:
WirelessSecurity* _security_setting;
WEPKEY_TYPE _wepKeyType;
};
class WirelessSecurityWEPEncryptionImpl : public ConnectionSettingWirelessSecurityWEPEncryption
{
Q_OBJECT
TQ_OBJECT
public:
WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
private:
WirelessSecurity* _security_setting;
};
class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion
{
Q_OBJECT
TQ_OBJECT
public:
WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots:
void slotAuto(bool);
void slotWPA1(bool);
void slotWPA2(bool);
private:
WirelessSecurity* _security_setting;
};
class WirelessSecurityWPACipherImpl : public ConnectionSettingWirelessSecurityWPACipher
{
Q_OBJECT
TQ_OBJECT
private:
enum WPA_CIPHERS
{
WPA_CIPHER_AUTO = 0
, WPA_CIPHER_TKIP
, WPA_CIPHER_CCMP
, WPA_CIPHER_LAST
};
public:
WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots:
void slotCipherChangedAuto(bool);
void slotGroupCipherChangedTKIP(bool);
void slotGroupCipherChangedCCMP(bool);
void slotGroupCipherChangedWEP40(bool);
void slotGroupCipherChangedWEP104(bool);
void slotPairwiseCipherChangedTKIP(bool);
void slotPairwiseCipherChangedCCMP(bool);
private:
WirelessSecurity* _security_setting;
};
class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK
{
Q_OBJECT
TQ_OBJECT
public:
WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
TQCString String2Hex(TQByteArray bytes, int final_len) const;
public slots:
void slotPSKChanged(const TQString&);
private:
WirelessSecurity* _security_setting;
Wireless* _wireless_setting;
};
class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP
{
Q_OBJECT
TQ_OBJECT
public:
WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots:
void slotMethodChanged(int index);
void slotIdentityChanged(const TQString&);
void slotAnonIdentityChanged(const TQString&);
void slotPasswordChanged(const TQString&);
void slotUseSystemCaCertChanged(bool on);
private:
IEEE8021x* _security_setting;
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1> _eapIndexMap;
WirelessSecurityPhase2Impl* _phase2_widget;
};
class WirelessSecurityPhase2Impl : public ConnectionSettingWirelessSecurityPhase2
{
Q_OBJECT
TQ_OBJECT
public:
WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots:
void setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>&);
void slotPhase2MethodChanged(int index);
private:
void updateMethodComboBox();
IEEE8021x* _security_setting;
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2> _eapIndexMap;
TQValueList<IEEE8021x::EAP_PHASE2> _allowed_methods;
};
class WirelessSecurityWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
private:
enum SecurityMethods
{
SECURITY_WEP = 0
, SECURITY_WPA_PSK
, SECURITY_WPA_EAP
, SECURITY_IEEE8021X
, SECURITY_COUNT
};
public:
WirelessSecurityWidgetImpl(Connection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate();
public slots:
void slotComboSecurityActivated(int);
void slotUseEncryptionToggled(bool);
void slotExtraSettingsToggled(bool);
private slots:
void slotInit();
private:
void comboSecurityInit();
void configureWidgets(SecurityMethods);
void configureForWEP();
void configureForWPAPSK();
void configureForWPAEAP();
void configureForIEEE8021X();
SecurityMethods _currentMethod;
TQValueList<TQWidget*> _widgets[SECURITY_COUNT];
TQValueList<TQWidget*> _extra_widgets[SECURITY_COUNT];
WirelessSecurity* _security_setting;
Wireless* _wireless_setting;
IEEE8021x* _ieee8021x_setting;
ConnectionSettingWirelessSecurityWidget* _mainWid;
bool _new_conn;
TQMap<int, SecurityMethods> _securityComboMap;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H*/

@ -0,0 +1,231 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqwidget.h>
#include <tqlineedit.h>
#include <tqlayout.h>
#include <tqlistview.h>
#include <klistview.h>
#include <klineedit.h>
#include <klistviewsearchline.h>
#include <kiconloader.h>
#include <kglobal.h>
#include <kpushbutton.h>
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-connection_setting_wireless_widget.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-wireless_manager.h"
using namespace ConnectionSettings;
class NetworkListViewItem : public KListViewItem
{
public:
NetworkListViewItem(TQListView* parent, WirelessNetwork& net)
: KListViewItem(parent, TQString::fromUtf8(net.getDisplaySsid()), TQString("%1\%").tqarg(net.getStrength()))
, _net(net)
{
TQ_UINT8 strength = net.getStrength();
if (strength > 80)
setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_100", KIcon::Small));
else if (strength > 55)
setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_75", KIcon::Small));
else if (strength > 30)
setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_50", KIcon::Small));
else if (strength > 5)
setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_25", KIcon::Small));
else
setPixmap(1, KGlobal::iconLoader()->loadIcon("nm_signal_00", KIcon::Small));
if (net.isEncrypted())
setPixmap(2, KGlobal::iconLoader()->loadIcon("lock", KIcon::Small));
}
WirelessNetwork _net;
};
WirelessWidgetImpl::WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl)
{
_wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
_info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
_security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
_hasName = !_info_setting->getName().isEmpty();
_new_conn = new_conn;
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingWirelessWidget(this);
tqlayout->addWidget(_mainWid);
// FIXME hide this button until it is implemented
_mainWid->pbExpert->hide();
Init();
}
void
WirelessWidgetImpl::Init()
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(_mainWid->framePlaceholder, 1, 1);
_searchLine = new KListViewSearchLineWidget(_mainWid->lvEssids, _mainWid->framePlaceholder);
tqlayout->addWidget(_searchLine);
connect(_mainWid->txtEssid, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotEssidChanged(const TQString&)));
connect(_mainWid->lvEssids, TQT_SIGNAL(doubleClicked(TQListViewItem*, const TQPoint&, int)), this, TQT_SLOT(slotEssidDoubleClicked(TQListViewItem*, const TQPoint&, int)) );
connect(_mainWid->lvEssids, TQT_SIGNAL(selectionChanged(TQListViewItem*)), this, TQT_SLOT(slotEssidChanged(TQListViewItem*)));
if (!_new_conn)
{
_mainWid->chkAutoRefresh->hide();
_mainWid->lvEssids->hide();
_searchLine->hide();
}
}
void
WirelessWidgetImpl::Activate()
{
// Fill in all available networks from all devices
// get all aps from all devices grouped together using the ssid
TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID);
_mainWid->lvEssids->clear();
for (TQValueList<WirelessNetwork>::Iterator it = nets.begin(); it != nets.end(); ++it)
{
KListViewItem* item = new NetworkListViewItem(_mainWid->lvEssids, (*it));
_mainWid->lvEssids->insertItem(item);
}
// FIXME, if essid contains unprintable characters show the essid in hex
_mainWid->txtEssid->setText(_wireless_setting->getEssid());
}
void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item)
{
NetworkListViewItem* net_item = dynamic_cast<NetworkListViewItem*>(item);
if (net_item)
{
// update the settingsobject
updateEssid(net_item->_net.getSsid());
// update the textbox to match the selected essid
_mainWid->txtEssid->setText(net_item->_net.getDisplaySsid());
}
}
void
WirelessWidgetImpl::slotEssidDoubleClicked(TQListViewItem* item, const TQPoint& /*p*/, int /*i*/)
{
NetworkListViewItem* net_item = dynamic_cast<NetworkListViewItem*>(item);
if (net_item)
{
updateEssid(net_item->_net.getSsid());
// essid selected with double click -> goto the next setting
emit next();
}
}
void
WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid)
{
/* set the newly entered essid */
/* FIXME perhaps local8Bit is better? */
/* FIXME allow entering essid in hex */
/* FIXME select the appropriate essid in the list too */
TQByteArray essid(new_essid.utf8());
// remove trailing \0
essid.resize(essid.size() - 1);
updateEssid(essid);
}
void
WirelessWidgetImpl::updateEssid(const TQByteArray& essid)
{
_wireless_setting->setEssid(essid);
if (!_hasName)
{
// the connection has no name yet -> just take the essid for it
_info_setting->setName(essid);
}
}
TQByteArray WirelessWidgetImpl::byteArrayFromHexString(const TQCString& str)
{
char c[2];
TQByteArray arr(str.length() - 1);
TQTextStream stream(str, IO_ReadOnly);
stream.setf(TQTextStream::hex);
stream.setf(TQTextStream::left);
stream.width(2);
stream.fill('0');
// 0x
stream.readRawBytes(c, 2);
for (uint i = 0; i < (str.length()-1)/2; ++i)
{
stream.readRawBytes(c, 2);
TQString hex;
hex += "0x";
hex += c[0];
hex += c[1];
arr[i] = (unsigned char)hex.toShort();
}
return arr;
}
TQString WirelessWidgetImpl::hexStringFromByteArray(const TQByteArray& bytes)
{
TQString tmp;
TQTextStream stream(&tmp, IO_ReadWrite);
stream.setf(TQTextStream::hex);
stream.setf(TQTextStream::left);
stream.width(2);
stream.fill('0');
stream << "0x" ;
for (uint i = 0; i < bytes.size(); ++i)
{
stream << static_cast<unsigned char>(bytes[i]);
}
return tmp;
}
#include "knetworkmanager-connection_setting_wireless_widget.moc"

@ -0,0 +1,71 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "connection_setting_wireless.h"
#include "knetworkmanager-connection_setting.h"
class KListViewSearchLineWidget;
namespace ConnectionSettings
{
class Wireless;
class WirelessSecurity;
class Info;
class WirelessWidgetImpl : public WidgetInterface
{
Q_OBJECT
TQ_OBJECT
public:
WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate();
public slots:
void slotEssidChanged(const TQString& new_essid);
void slotEssidChanged(TQListViewItem*);
void slotEssidDoubleClicked(TQListViewItem*, const TQPoint&, int);
private:
void Init();
void updateEssid(const TQByteArray&);
TQByteArray byteArrayFromHexString(const TQCString&);
TQString hexStringFromByteArray(const TQByteArray& );
bool _hasName;
Wireless* _wireless_setting;
Info* _info_setting;
WirelessSecurity* _security_setting;
ConnectionSettingWirelessWidget* _mainWid;
KListViewSearchLineWidget* _searchLine;
bool _new_conn;
};
}
#endif /* KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H*/

@ -0,0 +1,530 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// qt headers
#include <tqwidget.h>
#include <tqcombobox.h>
#include <tqtabwidget.h>
#include <tqpushbutton.h>
#include <tqwidgetstack.h>
#include <tqapplication.h>
#include <tqlabel.h>
// kde headers
#include <kiconloader.h>
#include <kdebug.h>
#include <kpushbutton.h>
// TQt DBus headers
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
// NM headers
#include <NetworkManager.h>
// knm headers
#include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_setting_cdma.h"
#include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-devicestore.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include "knetworkmanager-connection_setting_cdma_widget.h"
#include "knetworkmanager-connection_setting_gsm_widget.h"
#include "knetworkmanager-connection_setting_ppp_widget.h"
#include "knetworkmanager-connection_setting_serial_widget.h"
#include "knetworkmanager-connection_setting_wireless_widget.h"
#include "knetworkmanager-connection_setting_wireless_security_widget.h"
#include "knetworkmanager-connection_setting_ipv4_widget.h"
#include "knetworkmanager-connection_setting_info_widget.h"
#include "knetworkmanager-connection_setting_vpn_widget.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-storage.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-wireless_manager.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
char use_new_wireless_essid = 0;
TQByteArray new_wireless_essid;
ConnectionSettingsDialogImpl::ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, TQWidget* parent, const char* name, bool modal, WFlags fl)
: ConnectionSettingsDialog(parent, name, modal, fl)
, _conn(conn)
, _setting(setting)
, _new_conn(new_conn)
{
updateDialogForDeviceType();
// get notified if device combo changes
connect(btnConnect, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotConnect()) );
connect(pbNext, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotNext()) );
connect(pbBack, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotBack()) );
connect(pbCancel, TQT_SIGNAL(clicked()), this, TQT_SLOT( slotCancel()) );
connect(pbSave, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotSave()) );
// nice images for the buttons
btnConnect->setIconSet(SmallIcon ("connect_creating", TQIconSet::Automatic));
pbNext->setIconSet(SmallIcon ("1rightarrow", TQIconSet::Automatic));
pbBack->setIconSet(SmallIcon ("1leftarrow", TQIconSet::Automatic));
pbCancel->setIconSet(SmallIcon("cancel", TQIconSet::Automatic));
pbSave->setIconSet(SmallIcon("ok", TQIconSet::Automatic));
// enable or disable buttons accroding to the current state
slotEnableButtons();
}
ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl()
{
kdDebug() << "ConnectionSettingsDialogImpl::~ConnectionSettingsDialogImpl" << endl;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
TQValueList<WidgetInterface*> ret;
// widgetlist for wireless connection
ret.append(new ConnectionSettings::WirelessWidgetImpl(conn, new_conn));
ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn));
ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
if (ret.isEmpty())
{
// we have a problem here, NetworkManager asked for a setting we do not have
kdError() << k_funcinfo << "Unexpected setting requested" << endl;
}
return ret;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid)
{
TQValueList<WidgetInterface*> ret;
// Set ESSID
// _wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
// _info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
// _wireless_setting->setEssid(essid);
// if (!_hasName)
// {
// // the connection has no name yet -> just take the essid for it
// _info_setting->setName(essid);
// }
// widgetlist for wireless connection
ret.append(new ConnectionSettings::WirelessSecurityWidgetImpl(conn, new_conn));
ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
if (ret.isEmpty())
{
// we have a problem here, NetworkManager asked for a setting we do not have
kdError() << k_funcinfo << "Unexpected setting requested" << endl;
}
return ret;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
TQValueList<WidgetInterface*> ret;
// widgetlist for wired connection
ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
return ret;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
TQValueList<WidgetInterface*> ret;
// widgetlist for wired connection
ret.append(new ConnectionSettings::VPNWidgetImpl(conn, new_conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
return ret;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
TQValueList<WidgetInterface*> ret;
// widgetlist for wired connection
ret.append(new ConnectionSettings::CDMAWidgetImpl(conn));
ret.append(new ConnectionSettings::SerialWidgetImpl(conn));
ret.append(new ConnectionSettings::PPPWidgetImpl(conn));
ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
return ret;
}
TQValueList<WidgetInterface*>
ConnectionSettingsDialogImpl::createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
TQValueList<WidgetInterface*> ret;
// widgetlist for wired connection
ret.append(new ConnectionSettings::GSMWidgetImpl(conn));
ret.append(new ConnectionSettings::PPPWidgetImpl(conn));
ret.append(new ConnectionSettings::SerialWidgetImpl(conn));
ret.append(new ConnectionSettings::IPv4WidgetImpl(conn));
ret.append(new ConnectionSettings::InfoWidgetImpl(conn));
return ret;
}
void
ConnectionSettingsDialogImpl::createWidgetsForConnection(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting)
{
/*
Currently two modes:
* dev == NULL -> Connection should be edited without the wish to start a connection
* dev != NULL -> A connection should be edited for connection on this device
*/
if (!conn)
{
// TODO: create an empty widget and show an error
kdWarning() << k_funcinfo << "Not handled yet" << endl;
}
else
{
TQValueList<WidgetInterface*> widgets;
// TODO: move to a factory class
if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME) {
if (use_new_wireless_essid == 0) {
widgets = createWidgetsForWireless(conn, new_conn, setting);
}
else {
createWidgetsForWirelessKnownESSID(conn, new_conn, setting, new_wireless_essid);
new_wireless_essid = NULL;
}
}
else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME)
widgets = createWidgetsForWired(conn, new_conn, setting);
else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME)
widgets = createWidgetsForCDMA(conn, new_conn, setting);
else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME)
widgets = createWidgetsForGSM(conn, new_conn, setting);
else if (conn->getType() == NM_SETTING_VPN_SETTING_NAME)
widgets = createWidgetsForVPN(conn, new_conn, setting);
else
{
kdWarning() << k_funcinfo << "Not handled yet" << endl;
}
int id;
for (TQValueList<WidgetInterface*>::Iterator it = widgets.begin(); it != widgets.end(); ++it)
{
id = wstackSettings->addWidget(*it);
_widgetIds.append(id);
}
if (widgets.begin() != widgets.end())
activateWidget(*widgets.begin());
}
}
void
ConnectionSettingsDialogImpl::updateDialogForDeviceType()
{
// clear our tabview first
TQWidget *page = NULL;
while ( (page = wstackSettings->visibleWidget()) != NULL)
{
wstackSettings->removeWidget(page);
delete page;
}
if (_conn)
{
connect(_conn, TQT_SIGNAL(validityChanged()), this, TQT_SLOT(slotEnableButtons()));
createWidgetsForConnection(_conn, _new_conn, _setting);
}
else
{
// this should never happen
TQLabel* lbl = new TQLabel(wstackSettings, "Unknown Device Type");
wstackSettings->addWidget(lbl);
wstackSettings->raiseWidget(lbl);
}
}
int
ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(Connection* conn)
{
if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_WIFI;
#else
return DEVICE_TYPE_802_11_WIRELESS;
#endif
else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_ETHERNET;
#else
return DEVICE_TYPE_802_3_ETHERNET;
#endif
else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_MODEM;
#else
return DEVICE_TYPE_GSM;
#endif
else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_MODEM;
#else
return DEVICE_TYPE_CDMA;
#endif
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_UNKNOWN;
#else
return DEVICE_TYPE_UNKNOWN;
#endif
}
void
ConnectionSettingsDialogImpl::slotConnect()
{
DeviceStore* dstore = DeviceStore::getInstance();
Device* dev = dstore->getDevices(getDeviceTypeFromConnection(_conn)).first();
ConnectionStore* cstore = ConnectionStore::getInstance();
NMProxy* nm = NMProxy::getInstance();
TQT_DBusError err;
// add the connection to the store
cstore->addConnection(_conn);
// activate device
if (dev && _conn && nm)
{
int id;
if (_conn->awaitingSecrets())
{
_conn->Connection::slotSecretsProvided(NULL);
}
else
{
// VPN connection needs a special specific object
if (_conn->getType() == NM_SETTING_VPN_SETTING_NAME)
{
TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
#else
nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), device, act_conn, err);
#endif
}
else
{
// we need to call ActivateDevice async
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(dev->getObjectPath())), _conn->getObjectPath(), err);
#else
nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(dev->getObjectPath())), _conn->getObjectPath(), err);
#endif
}
}
}
emit connectionSaved();
this->close(true);
}
void
ConnectionSettingsDialogImpl::slotSave()
{
// Make sure settings are committed
TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
if (current != _widgetIds.fromLast())
{
WidgetInterface* widget = NULL;
// let the widget know about it being the active one
widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
if (widget)
deactivateWidget(widget);
}
// Now save
ConnectionStore* cstore = ConnectionStore::getInstance();
NMProxy* nm = NMProxy::getInstance();
TQT_DBusError err;
// add the connection to the store
cstore->addConnection(_conn);
// if the connection waits for new secrets
// signal an error to NM, the user only wants to save
// the connection
if (_conn->awaitingSecrets())
_conn->slotSecretsError();
emit connectionSaved();
this->close(true);
}
void
ConnectionSettingsDialogImpl::slotCancel()
{
_conn->slotSecretsError();
close();
}
void
ConnectionSettingsDialogImpl::slotNext()
{
TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
if (current != _widgetIds.fromLast())
{
WidgetInterface* widget = NULL;
// let the widget know about it being the active one
widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
if (widget)
deactivateWidget(widget);
// next widget
current++;
// let the widget know about it being the active one
widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
if (widget)
activateWidget(widget);
}
slotEnableButtons();
}
void
ConnectionSettingsDialogImpl::slotBack()
{
TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
if (current != _widgetIds.begin())
{
WidgetInterface* widget = NULL;
// let the widget know about it being the active one
widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
if (widget)
deactivateWidget(widget);
// one back
current--;
// let the widget know about it being the active one
widget = dynamic_cast<WidgetInterface*>(wstackSettings->widget(*current));
if (widget)
activateWidget(widget);
}
slotEnableButtons();
}
void
ConnectionSettingsDialogImpl::activateWidget(WidgetInterface* widget)
{
// allow the widget to press next
connect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext()));
// allow the widget to do some initialization
widget->Activate();
// show the widget
wstackSettings->raiseWidget(widget);
}
void
ConnectionSettingsDialogImpl::deactivateWidget(WidgetInterface* widget)
{
// allow the widget to press next
disconnect(widget, TQT_SIGNAL(next()), this, TQT_SLOT(slotNext()));
// allow the widget to do some initialization
widget->Deactivate();
}
void
ConnectionSettingsDialogImpl::slotEnableButtons()
{
// enable the buttons according to the current state
TQValueList<int>::Iterator current = _widgetIds.find(wstackSettings->id(wstackSettings->visibleWidget()));
bool enabled;
/*
Next: enabled if another widget is available
*/
enabled = true;
if (current == _widgetIds.fromLast())
enabled = false;
pbNext->setEnabled(enabled);
/*
Back: enabled if the current widget has a predecessor
*/
enabled = true;
if (current == _widgetIds.begin())
enabled = false;
pbBack->setEnabled(enabled);
/*
Connect: only show connect if the connection is valid
*/
if (_conn)
{
btnConnect->setEnabled(_conn->isValid());
pbSave->setEnabled(_conn->isValid());
}
}
#include "knetworkmanager-connection_settings_dialog.moc"

@ -0,0 +1,86 @@
/***************************************************************************
*
* knetworkmanager-devicestore_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H
#define KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H
// qt headers
#include <tqvaluelist.h>
// qt autogenerated headers
#include "connection_settings.h"
// knm headers
#include "knetworkmanager-connection_setting.h"
class TQWidget;
class Device;
namespace ConnectionSettings
{
class WidgetInterface;
class ConnectionSetting;
}
class ConnectionSettingsDialogImpl : public ConnectionSettingsDialog
{
Q_OBJECT
TQ_OBJECT
public:
ConnectionSettingsDialogImpl(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~ConnectionSettingsDialogImpl();
public slots:
void slotConnect();
void slotCancel();
void slotSave();
void slotNext();
void slotBack();
void slotEnableButtons();
signals:
void connectionSaved();
private:
void updateDialogForDeviceType();
void createWidgetsForConnection(ConnectionSettings::Connection*, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
void activateWidget(ConnectionSettings::WidgetInterface* widget);
void deactivateWidget(ConnectionSettings::WidgetInterface* widget);
int getDeviceTypeFromConnection(ConnectionSettings::Connection* conn);
// TODO: To be moved to a factory class
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWired(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWireless(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForWirelessKnownESSID(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting, const TQByteArray& essid);
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForVPN(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForCDMA(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
TQValueList<ConnectionSettings::WidgetInterface*> createWidgetsForGSM(ConnectionSettings::Connection* conn, bool new_conn, ConnectionSettings::ConnectionSetting* setting);
ConnectionSettings::Connection* _conn;
ConnectionSettings::ConnectionSetting* _setting;
TQValueList<int> _widgetIds;
bool _new_conn;
};
#endif /* KNETWORKMANAGER_CONNECTION_SETTINGS_DIALOG_H*/

@ -0,0 +1,191 @@
/***************************************************************************
*
* knetworkmanager-connection_store.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqtimer.h>
#include <tquuid.h>
#include <tqdbusobjectpath.h>
#include <kstaticdeleter.h>
#include <kapplication.h>
#include <kdebug.h>
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
using namespace ConnectionSettings;
static KStaticDeleter<ConnectionStore> sd;
ConnectionStore* ConnectionStore::_instance = NULL;
ConnectionStore*
ConnectionStore::getInstance()
{
if (_instance)
return _instance;
return sd.setObject(_instance, new ConnectionStore());
}
ConnectionStore::ConnectionStore()
: _connectionList()
{
// defer the connection init a bit
TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
}
ConnectionStore::~ConnectionStore()
{
for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it)
{
delete (*it);
*it = NULL;
}
}
void
ConnectionStore::slotInit()
{
}
void
ConnectionStore::slotSecretsNeeded(Connection* conn, ConnectionSetting* setting, const TQStringList& hints, bool request_new)
{
kdDebug() << "ConnectionStore::slotSecretsNeeded" << endl;
emit SecretsNeeded(conn, setting, hints, request_new);
}
void
ConnectionStore::addConnection(Connection* con)
{
if (_connectionList.find(con) != _connectionList.end())
{
con->slotUpdated();
emit signalConnectionUpdated(con);
return;
}
// check if the connection has an ID already
if (con->getID().isEmpty())
{
// set unique id for this connection
con->setID(createNewConnectionID());
}
// we own the connection now
_connectionList.append(con);
// let's get notified if the connection asks for new secrets
connect(con, TQT_SIGNAL(SecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool)),
this, TQT_SLOT(slotSecretsNeeded(Connection*, ConnectionSetting*, const TQStringList&, bool)));
// new connection, ring ring
emit signalConnectionAdded(con);
}
void
ConnectionStore::removeConnection(Connection* con)
{
// check if the connection is != NULL
if (!con)
return;
// remove the object from our list
if (_connectionList.remove(con) == 0)
return;
// notify everybody about the removed connection
emit signalConnectionRemoved(con);
// delete the connection, it will deregister itself from NM
con->slotAboutToBeRemoved();
delete con;
}
Connection*
ConnectionStore::getConnection(const TQString& obj_path)
{
// find a connection by obj_path
TQValueList<Connection*>::Iterator it = _connectionList.begin();
for (; it != _connectionList.end(); ++it)
if (TQString((*it)->getObjectPath()) == obj_path)
return (*it);
return NULL;
}
TQValueList<Connection*>
ConnectionStore::getConnections(const TQString& type)
{
// return a list of connection
if (type.isEmpty())
return _connectionList;
else
{
TQValueList<Connection*> ret;
for (TQValueList<Connection*>::Iterator it = _connectionList.begin(); it != _connectionList.end(); ++it)
{
if ( (*it)->getType() == type)
ret.append(*it);
}
return ret;
}
}
TQString
ConnectionStore::createNewConnectionID()
{
bool unique;
TQString id;
do
{
unique = true;
// 16 bytes of randomness should be enougth for getting a unique ID
id = TQUuid::createUuid().toString();
id = id.replace("{","");
id = id.replace("}","");
// nevertheless check if the id is used already
TQValueList<Connection*>::Iterator it = _connectionList.begin();
for (; it != _connectionList.end(); ++it)
{
if ((*it)->getID() == id)
{
unique = false;
break;
}
}
} while (unique == false);
return id;
}
#include "knetworkmanager-connection_store.moc"

@ -0,0 +1,88 @@
/***************************************************************************
*
* knetworkmanager-connection_store.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_CONNECTION_STORE_H
#define KNETWORKMANAGER_CONNECTION_STORE_H
#include <tqvaluelist.h>
#include <tqobject.h>
namespace ConnectionSettings
{
class Connection;
class ConnectionSetting;
}
using namespace ConnectionSettings;
class ConnectionStore : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
static ConnectionStore* getInstance();
~ConnectionStore();
// add a new connection to the store
void addConnection(ConnectionSettings::Connection*);
// get all connections
TQValueList<ConnectionSettings::Connection*> getConnections(const TQString& type = TQString());
// get a connection by ID
ConnectionSettings::Connection* getConnection(const TQString&);
// delete the specified connection from the store and delete it
void removeConnection(ConnectionSettings::Connection*);
public slots:
// has to be called as response to the signal SecretsNeeded
void slotSecretsNeeded(Connection* connection, ConnectionSetting* setting, const TQStringList& hints, bool request_new);
signals:
// emitted when a new connection is added to the store
void signalConnectionAdded(ConnectionSettings::Connection*);
// emitted when a connection was updated
void signalConnectionUpdated(ConnectionSettings::Connection*);
// emitted when a connection is removed from the store
void signalConnectionRemoved(ConnectionSettings::Connection*);
// emitted when a connection needs new secrets
void SecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
private slots:
void slotInit();
private:
ConnectionStore();
TQString createNewConnectionID();
TQValueList<ConnectionSettings::Connection*> _connectionList;
static ConnectionStore* _instance;
};
#endif /* KNETWORKMANAGER_CONNECTION_STORE_H */

@ -0,0 +1,166 @@
/***************************************************************************
*
* knetworkmanager-device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <NetworkManager.h>
#include "knetworkmanager.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-device.h"
#include "dbus/deviceproxy.h"
#include "knetworkmanager-hal_device_proxy.h"
#include <kdebug.h>
#include <tqhostaddress.h>
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
#include <tqdbusproxy.h>
class NMDeviceProxy : public DBus::DeviceProxy
{
public:
NMDeviceProxy(const TQString& service, const TQString& path, TQObject* parent = 0, const char* name = 0)
: DeviceProxy(service, path, parent, name)
{
}
TQString getObjectPath() const
{
return m_baseProxy->path();
}
};
class DevicePrivate
{
public:
DevicePrivate(TQString service, TQString obj_path)
: nmDevice(service, obj_path)
, halDevice(NULL)
{}
~DevicePrivate() {}
NMDeviceProxy nmDevice;
HalDeviceProxy* halDevice;
};
TQ_UINT32 Device::getDeviceType() const
{
TQT_DBusError err;
TQ_UINT32 type = d->nmDevice.getDeviceType(err);
kdWarning() << k_funcinfo << err.name() << err.message() << endl;
return type;
}
TQString Device::getInterface() const
{
TQT_DBusError err;
return d->nmDevice.getInterface(err);
}
TQString Device::getUdi() const
{
TQT_DBusError err;
return d->nmDevice.getUdi(err);
}
TQString Device::getDriver() const
{
TQT_DBusError err;
return d->nmDevice.getDriver(err);
}
TQ_UINT32 Device::getCapabilities() const
{
TQT_DBusError err;
return d->nmDevice.getCapabilities(err);
}
TQ_INT32 Device::getIp4Address() const
{
TQT_DBusError err;
return d->nmDevice.getIp4Address(err);
}
NMDeviceState Device::getState() const
{
TQT_DBusError err;
return (NMDeviceState)d->nmDevice.getState(err);
}
TQString Device::getVendor() const
{
// FIXME: ask hal
return "";
}
TQString Device::getProduct() const
{
// FIXME: ask hal
return "";
}
TQString Device::getObjectPath() const
{
return d->nmDevice.getObjectPath();
}
void Device::slotStateChanged(TQ_UINT32 state)
{
emit StateChanged((NMDeviceState)state);
}
void Device::slotDeactivate()
{
// FIXME: the method was removed from NM API, use nm_proxy instead
NMProxy* nm = NMProxy::getInstance();
nm->deactivateDevice(this);
// TQT_DBusError err;
// d->nmDevice.Deactivate(err);
}
Device::Device (const TQString & obj_path)
{
d = new DevicePrivate(NM_DBUS_SERVICE, obj_path);
// create the NM Device Proxy
d->nmDevice.setConnection(TQT_DBusConnection::systemBus());
connect(&(d->nmDevice), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
// d->halDevice = new HalDeviceProxy();
}
Device::~Device ()
{
// delete d->halDevice;
delete d;
}
#include "knetworkmanager-device.moc"

@ -0,0 +1,74 @@
/***************************************************************************
*
* knetworkmanager-device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_DEVICE_H
#define KNETWORKMANAGER_DEVICE_H
#include <NetworkManager.h>
#include "knetworkmanager.h"
#include <stdint.h>
class KNetworkManager;
class Network;
class IP4Config;
class DevicePrivate;
class Device : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Device (const TQString & obj_path );
~Device ();
TQ_UINT32 getDeviceType() const;
TQString getInterface() const;
TQString getUdi() const;
TQString getDriver() const;
TQ_UINT32 getCapabilities() const;
TQ_INT32 getIp4Address() const;
NMDeviceState getState() const;
// FIXME: should return IPv4-objects
// TQDBusObjectPath getIp4Config() const;
TQString getVendor() const;
TQString getProduct() const;
TQString getObjectPath() const;
signals:
void StateChanged(NMDeviceState);
public slots:
void slotStateChanged(TQ_UINT32);
void slotDeactivate();
private:
DevicePrivate * d;
};
#endif /* KNETWORKMANAGER_DEVICE_H */

@ -0,0 +1,337 @@
/***************************************************************************
*
* knetworkmanager-device_tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
class WirelessDialog;
// TQt includes
#include <tqevent.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqbitmap.h>
#include <tqimage.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqtimer.h>
// KDE includes
#include <dcopclient.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <knotifyclient.h>
#include <knotifydialog.h>
#include <kiconeffect.h>
#include <klocale.h>
#include <kstdguiitem.h>
#include <khelpmenu.h>
#include <kprocess.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include <kglobalsettings.h>
// KNM includes
#include "knetworkmanager-device_tray.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-menu_subhead.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-connection.h"
using namespace ConnectionSettings;
class DeviceTrayPrivate
{
public:
DeviceTrayPrivate()
: dev(NULL)
{
tooltips[NM_DEVICE_STATE_UNKNOWN] = i18n("Unknown");
tooltips[NM_DEVICE_STATE_UNAVAILABLE] = i18n("Down");
tooltips[NM_DEVICE_STATE_UNMANAGED] = i18n("Unmanaged");
tooltips[NM_DEVICE_STATE_DISCONNECTED] = i18n("Disconnected");
tooltips[NM_DEVICE_STATE_PREPARE] = i18n("Preparing");
tooltips[NM_DEVICE_STATE_CONFIG] = i18n("Configuration");
tooltips[NM_DEVICE_STATE_NEED_AUTH] = i18n("Awaiting authentication");
tooltips[NM_DEVICE_STATE_IP_CONFIG] = i18n("IP configuration");
tooltips[NM_DEVICE_STATE_ACTIVATED] = i18n("Activated");
tooltips[NM_DEVICE_STATE_FAILED] = i18n("Failed");
}
~DeviceTrayPrivate() {}
Device* dev;
TQMap<NMDeviceState, TQMovie> movies;
TQMap<NMDeviceState, TQPixmap> pixmaps;
TQMap<NMDeviceState, TQString> tooltips;
};
Device* DeviceTray::getDevice() const
{
return d->dev;
}
TQString DeviceTray::getTooltipText()
{
NMDeviceState state = d->dev->getState();
TQString tooltip = TQString();
if (!d->tooltips[state].isEmpty())
tooltip += i18n("State: %1").tqarg(d->tooltips[state]);
return tooltip;
}
void DeviceTray::enterEvent (TQEvent* /*e*/)
{
// show tooltip
TQToolTip::remove (this);
TQString tooltip = getTooltipText();
if (!tooltip.isEmpty())
TQToolTip::add (this, tooltip);
}
void DeviceTray::setPixmap(const TQPixmap& pixmap)
{
/*
int oldPixmapWidth = pixmap.size().width();
int oldPixmapHeight = pixmap.size().height();
// we want to show the interface name
TQString iface = d->dev->getInterface();
// grab a font
TQFont iface_font = KGlobalSettings::generalFont();
// iface_font.setBold(true);
// resize the font to fit the icon's size
float fontSize = iface_font.pointSizeFloat();
TQFontMetrics qfm(iface_font);
int height = qfm.height();
int width = qfm.width(iface);
float factor = 1.0f;
float factor2 = 1.0f;
if (height > (oldPixmapHeight / 2.0f))
factor = float(oldPixmapHeight / 2.0f) / float(height);
if (width > (oldPixmapWidth / 1.1f))
factor2 = float(oldPixmapWidth / 1.1f) / float(width);
fontSize *= (factor2 < factor) ? factor2 : factor;
iface_font.setPointSizeFloat( fontSize);
// draw the text to a bitmap and put is as an overlay on top of the pixmap
TQPixmap iface_pixmap(oldPixmapWidth, oldPixmapHeight);
iface_pixmap.fill(TQt::white);
TQPainter p(&iface_pixmap);
p.setFont(iface_font);
p.setPen(TQt::blue);
p.drawText(iface_pixmap.rect(), TQt::AlignHCenter | TQt::AlignBottom, iface);
iface_pixmap.setMask(iface_pixmap.createHeuristicMask());
TQImage iface_image = iface_pixmap.convertToImage();
TQImage pixmap_with_overlay = pixmap.convertToImage();
KIconEffect::overlay(pixmap_with_overlay, iface_image);
TQPixmap new_pixmap;
new_pixmap.convertFromImage(pixmap_with_overlay);
// call base-class setPixmap
KSystemTray::setPixmap(new_pixmap);
*/
KSystemTray::setPixmap(pixmap);
}
void DeviceTray::contextMenuAboutToShow (KPopupMenu* menu)
{
menu->clear();
// insert title
menu->insertTitle (SmallIcon ("knetworkmanager", TQIconSet::Automatic), "KNetworkManager", -1, -1);
// let the specific device_tray add its items
addMenuItems(menu);
// quit
menu->insertSeparator ();
KAction* quitAction = actionCollection ()->action (KStdAction::name (KStdAction::Quit));
if (quitAction)
quitAction->plug (menu);
}
void DeviceTray::resizeEvent ( TQResizeEvent * )
{
// Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
loadIcons();
updateTrayIcon(m_currentIconState);
}
void DeviceTray::setPixmapForState(NMDeviceState state, TQMovie movie)
{
d->movies[state] = movie;
slotUpdateDeviceState();
}
void DeviceTray::setPixmapForState(NMDeviceState state, TQPixmap pixmap)
{
d->pixmaps[state] = pixmap;
slotUpdateDeviceState();
}
void DeviceTray::updateTrayIcon(NMDeviceState state)
{
// stop the old movie to avoid unnecessary wakups
if (movie())
movie()->pause();
if (d->movies.find(state) != d->movies.end() && !d->movies[state].isNull())
{
if (m_currentIconState != state) {
// Clear the icon pixmap as the movie may be a different size
TQPixmap nullPixmap;
setPixmap(nullPixmap);
}
// animation desired
int frame = -1;
if (movie())
frame = movie()->frameNumber();
// set the movie
setMovie(d->movies[state]);
// start at the same frame as the movie before
if (frame > 0)
movie()->step(frame);
// start the animation
movie()->unpause();
}
else if (d->pixmaps.find(state) != d->pixmaps.end() && !d->pixmaps[state].isNull())
setPixmap(d->pixmaps[state]);
else
setPixmap(loadSizedIcon("KNetworkManager", width()));
m_currentIconState = state;
}
void DeviceTray::updateActions(NMDeviceState state)
{
// allow device deactivation only when device is activated
KAction* deactivate = actionCollection()->action("deactivate_device");
if (deactivate)
deactivate->setEnabled( (state == NM_DEVICE_STATE_ACTIVATED ||
state == NM_DEVICE_STATE_IP_CONFIG ||
state == NM_DEVICE_STATE_PREPARE ||
state == NM_DEVICE_STATE_CONFIG ||
state == NM_DEVICE_STATE_NEED_AUTH) );
}
void DeviceTray::updateActiveConnection(NMDeviceState state)
{
if (state != NM_DEVICE_STATE_ACTIVATED)
return;
NMProxy* nm = NMProxy::getInstance();
Connection* active_conn = nm->getActiveConnection(d->dev);
if (active_conn)
{
Info* info = dynamic_cast<Info*>(active_conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME));
if (info)
info->setTimestamp(TQDateTime::tqcurrentDateTime());
}
}
void DeviceTray::slotUpdateDeviceState(NMDeviceState state)
{
updateTrayIcon(state);
updateActions(state);
updateActiveConnection(state);
}
void DeviceTray::slotUpdateDeviceState()
{
slotUpdateDeviceState(d->dev->getState());
}
void DeviceTray::loadIcons() {
d->pixmaps[NM_DEVICE_STATE_UNKNOWN] = loadSizedIcon("nm_no_connection", width());
d->pixmaps[NM_DEVICE_STATE_UNMANAGED] = loadSizedIcon("nm_no_connection", width());
d->pixmaps[NM_DEVICE_STATE_UNAVAILABLE] = loadSizedIcon("nm_no_connection", width());
d->pixmaps[NM_DEVICE_STATE_DISCONNECTED] = loadSizedIcon("nm_no_connection", width());
d->movies[NM_DEVICE_STATE_PREPARE] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage01_connecting", KIcon::Panel));
d->movies[NM_DEVICE_STATE_PREPARE].pause();
d->movies[NM_DEVICE_STATE_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage02_connecting", KIcon::Panel));
d->movies[NM_DEVICE_STATE_CONFIG].pause();
d->movies[NM_DEVICE_STATE_IP_CONFIG] = TQMovie( KGlobal::iconLoader()->moviePath("nm_stage03_connecting", KIcon::Panel));
d->movies[NM_DEVICE_STATE_IP_CONFIG].pause();
d->movies[NM_DEVICE_STATE_NEED_AUTH] = d->movies[NM_DEVICE_STATE_CONFIG];
d->movies[NM_DEVICE_STATE_NEED_AUTH].pause();
d->pixmaps[NM_DEVICE_STATE_ACTIVATED] = loadSizedIcon("ok", width());
d->pixmaps[NM_DEVICE_STATE_FAILED] = loadSizedIcon("nm_no_connection", width());
}
DeviceTray::DeviceTray (Device* dev) : KSystemTray ()
{
d = new DeviceTrayPrivate();
d->dev = dev;
m_currentIconState = NM_DEVICE_STATE_UNKNOWN;
loadIcons();
// get notified when the device state changes
connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
setMouseTracking (true);
// defer the initial call to slotUpdateDeviceState as it will crash knm when called directly from here
// virtual method calls are not allowed in constructor
TQTimer::singleShot(0, this, TQT_SLOT(slotUpdateDeviceState()));
// Actions used for plugging into the menu
new KAction (i18n ("Deactivate connection..."),
SmallIcon ("no", TQIconSet::Automatic), 0,
dev, TQT_SLOT (slotDeactivate()), actionCollection (), "deactivate_device");
}
DeviceTray::~DeviceTray ()
{
delete d;
}
#include "knetworkmanager-device_tray.moc"

@ -0,0 +1,90 @@
/***************************************************************************
*
* knetworkmanager-device_tray.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_DEVICE_TRAY_H
#define KNETWORKMANAGER_DEVICE_TRAY_H
#include <tqmap.h>
#include <tqtimer.h>
#include <tqtooltip.h>
#include <ksystemtray.h>
#include <kuniqueapplication.h>
#include <kpopupmenu.h>
#include <kactionclasses.h>
#include <kstdaction.h>
#include <kstdguiitem.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqprogressbar.h>
#include <tqguardedptr.h>
#include <NetworkManager.h>
#include "knetworkmanager.h"
#define NM_DEVICE_STATE_VPN_PREPARE 100
#define NM_DEVICE_STATE_VPN_ACTIVATED 101
class Device;
class DeviceTrayPrivate;
class DeviceTray : public KSystemTray
{
Q_OBJECT
TQ_OBJECT
public:
DeviceTray (Device*);
~DeviceTray ();
void contextMenuAboutToShow (KPopupMenu* menu);
virtual void addMenuItems(KPopupMenu* menu) = 0;
Device* getDevice() const;
protected:
void setPixmapForState(NMDeviceState, TQMovie);
void setPixmapForState(NMDeviceState, TQPixmap);
void resizeEvent ( TQResizeEvent * );
virtual TQString getTooltipText();
public slots:
void setPixmap(const TQPixmap &);
void slotUpdateDeviceState(NMDeviceState);
void slotUpdateDeviceState();
private:
void updateTrayIcon(NMDeviceState);
void updateActions(NMDeviceState);
void updateActiveConnection(NMDeviceState);
void enterEvent (TQEvent*);
void loadIcons();
DeviceTrayPrivate* d;
NMDeviceState m_currentIconState;
};
#endif /* KNETWORKMANAGER_DEVICE_TRAY_H */

@ -0,0 +1,220 @@
/***************************************************************************
*
* knetworkmanager-devicestore.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <NetworkManager.h>
#include "knetworkmanager.h"
#include "knetworkmanager-devicestore.h"
#include "knetworkmanager-wired_device.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-gsm_device.h"
#include "knetworkmanager-cdma_device.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
#include "dbus/deviceproxy.h"
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
#include <tqdbusconnection.h>
#include <kdebug.h>
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
class DeviceStorePrivate
{
public:
DeviceStorePrivate() {}
~DeviceStorePrivate() {}
TQMap<TQString, Device*> devices;
static DeviceStore* store;
};
DeviceStore* DeviceStorePrivate::store = NULL;
DeviceStore* DeviceStore::getInstance()
{
if (DeviceStorePrivate::store)
return DeviceStorePrivate::store;
return (DeviceStorePrivate::store = new DeviceStore());
}
void DeviceStore::slotDeviceRemoved(const TQT_DBusObjectPath & obj_path)
{
kdDebug() << "DeviceStore::slotDeviceRemoved" << endl;
TQMap<TQString, Device*>::Iterator it = d->devices.find(TQString(obj_path));
if (it != d->devices.end())
{
// remove this device
Device* dev = it.data();
emit DeviceRemoved(dev);
d->devices.remove(it);
delete dev;
dev = NULL;
}
}
void DeviceStore::slotDeviceAdded(const TQT_DBusObjectPath & obj_path)
{
// just start an update
Device* dev = createDevice(obj_path);
if (dev)
emit DeviceAdded(dev);
}
Device* DeviceStore::createDevice(const TQT_DBusObjectPath &obj_path)
{
TQT_DBusError err;
// if we have this device already in our list goto the next one
TQMap<TQString, Device*>::Iterator it = d->devices.find(obj_path);
if ( it != d->devices.end())
return it.data();
// FIXME: ugly stuff is going on here, better pass the DeviceProxy to the Device's constructor instead of the object_path
DBus::DeviceProxy* dev = new DBus::DeviceProxy(NM_DBUS_SERVICE, obj_path);
Device* new_dev = NULL;
if (dev)
{
dev->setConnection(TQT_DBusConnection::systemBus());
TQ_UINT32 type = dev->getDeviceType(err);
//printf("Device obj_path: %s\n\r", obj_path->data());
// FIXME: This should not be hardcoded, it would be better if wireless, wired etc. modules register their device type
// select the right device type and create the appropriate objects
switch(type)
{
#if NM_CHECK_VERSION(0,8,992)
case NM_DEVICE_TYPE_WIFI:
#else
case DEVICE_TYPE_802_11_WIRELESS:
#endif
new_dev = new WirelessDevice(obj_path);
break;
#if NM_CHECK_VERSION(0,8,992)
case NM_DEVICE_TYPE_ETHERNET:
#else
case DEVICE_TYPE_802_3_ETHERNET:
#endif
new_dev = new WiredDevice(obj_path);
break;
#if NM_CHECK_VERSION(0,8,992)
case NM_DEVICE_TYPE_MODEM:
#else
case DEVICE_TYPE_GSM:
#endif
new_dev = new GSMDevice(obj_path);
break;
#if NM_CHECK_VERSION(0,8,992)
#else
case DEVICE_TYPE_CDMA:
#endif
new_dev = new CDMADevice(obj_path);
break;
default:
kdWarning() << k_funcinfo << "Unknown devicetype" << endl;
new_dev = new Device(obj_path);
break;
}
// insert the new device into our list
if (new_dev)
d->devices.insert(obj_path, new_dev);
delete dev;
}
else
kdWarning() << k_funcinfo << "Dev is Null" << endl;
return new_dev;
}
void DeviceStore::updateDevices()
{
NMProxy* nm = NMProxy::getInstance();
TQValueList<TQT_DBusObjectPath> obj_paths;
TQT_DBusError err;
// get a list of NM devices
nm->GetDevices(obj_paths, err);
// create a list of KNM devices
for (TQValueList<TQT_DBusObjectPath>::Iterator it = obj_paths.begin(); it != obj_paths.end(); ++it)
{
createDevice((*it));
}
}
TQValueList<Device*> DeviceStore::getDevices(TQ_UINT32 type)
{
updateDevices();
if (type == 0)
return d->devices.values();
else
{
// only return devices of a special type
TQValueList<Device*> devs;
for (TQMap<TQString, Device*>::Iterator it = d->devices.begin(); it != d->devices.end(); ++it)
{
if (it.data()->getDeviceType() == type)
devs.append(it.data());
}
return devs;
}
}
Device* DeviceStore::getDevice(TQT_DBusObjectPath objpath)
{
return d->devices[objpath];
}
DeviceStore::DeviceStore ( TQObject * parent, const char * name ) : TQObject( parent, name )
{
d = new DeviceStorePrivate();
// get notified from NM when devices are added or removed
NMProxy* nm = NMProxy::getInstance();
connect(nm, TQT_SIGNAL(DeviceAdded(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceAdded(const TQT_DBusObjectPath&)));
connect(nm, TQT_SIGNAL(DeviceRemoved(const TQT_DBusObjectPath& )), this, TQT_SLOT(slotDeviceRemoved(const TQT_DBusObjectPath&)));
}
DeviceStore::~DeviceStore ()
{
// delete all devicepointers
while (d->devices.begin() != d->devices.end())
delete d->devices.begin().data();
// delete private data
delete d;
}
#include "knetworkmanager-devicestore.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-devicestore.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_DEVICESTORE_H
#define KNETWORKMANAGER_DEVICESTORE_H
#include "knetworkmanager.h"
class TQT_DBusObjectPath;
class DeviceStorePrivate;
class Device;
class DeviceStore : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
static DeviceStore* getInstance();
TQValueList<Device*> getDevices(TQ_UINT32 type = 0);
Device* getDevice(TQT_DBusObjectPath);
public slots:
void slotDeviceAdded(const TQT_DBusObjectPath&);
void slotDeviceRemoved(const TQT_DBusObjectPath&);
protected:
DeviceStore ( TQObject * parent = 0, const char * name = 0);
~DeviceStore ();
signals:
void DeviceStoreChanged();
void DeviceAdded(Device*);
void DeviceRemoved(Device*);
private:
void updateDevices();
Device* createDevice(const TQT_DBusObjectPath&);
DeviceStorePrivate* d;
};
#endif /* KNETWORKMANAGER_DEVICESTORE_H */

@ -0,0 +1,91 @@
/***************************************************************************
*
* knetworkmanager-generic_connection.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-generic_connection.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-nmsettings.h"
using namespace ConnectionSettings;
/*
class GenericConnection
*/
GenericConnection::GenericConnection(const TQString& type)
: Connection()
{
// every connection needs an info-setting
appendSetting(new Info(this, type, ""));
}
TQString
GenericConnection::getType()
{
Info* info = dynamic_cast<Info*>(getSetting("connection"));
if (info)
return info->getDevType();
else
return TQString();
}
TQString
GenericConnection::getID() const
{
return getInfoSetting()->getUUID();
}
void
GenericConnection::setID(const TQString& id)
{
getInfoSetting()->setUUID(id);
}
Info* GenericConnection::getInfoSetting() const
{
return dynamic_cast<Info*>(getSetting("connection"));
}
#include "knetworkmanager-generic_connection.moc"

@ -0,0 +1,58 @@
/***************************************************************************
*
* knetworkmanager-generic_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_GENERIC_CONNECTION_H
#define KNETWORKMANAGER_GENERIC_CONNECTION_H
#include <tqmap.h>
#include <tqobject.h>
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting.h"
#include "dbus/connection.h"
#include "dbus/connectionnode.h"
class TQDBusObjectPath;
namespace ConnectionSettings
{
class ConnectionSetting;
class Info;
class GenericConnection : public Connection
{
Q_OBJECT
TQ_OBJECT
public:
GenericConnection(const TQString&);
TQString getType();
TQString getID() const;
void setID(const TQString& id);
Info* getInfoSetting() const;
};
}
#endif /* KNETWORKMANAGER_GENERIC_CONNECTION_H */

@ -0,0 +1,60 @@
/***************************************************************************
*
* knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager-gsm_connection.h"
#include <nm-setting-gsm.h>
#include "knetworkmanager-connection_setting_serial.h"
ConnectionSettings::GSMConnection::GSMConnection()
: PPPConnection(NM_SETTING_GSM_SETTING_NAME)
{
appendSetting(new GSM(this));
appendSetting(new Serial(this));
}
ConnectionSettings::GSMConnection::~GSMConnection()
{
}
ConnectionSettings::GSM* ConnectionSettings::GSMConnection::getGSMSetting() const
{
return dynamic_cast<GSM*>(getSetting(NM_SETTING_GSM_SETTING_NAME));
}
ConnectionSettings::Serial* ConnectionSettings::GSMConnection::getSerialSetting() const
{
return dynamic_cast<Serial*>(getSetting(NM_SETTING_SERIAL_SETTING_NAME));
}
ConnectionSettings::Connection* ConnectionSettings::GSMConnection::duplicate()
{
GSMConnection* conn = new GSMConnection();
conn->updateSettings(this);
return conn;
}
#include "knetworkmanager-gsm_connection.moc"
// vim: sw=4 sts=4 noet tw=100

@ -0,0 +1,50 @@
/***************************************************************************
*
* knetworkmanager-gsm_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_GSM_CONNECTION_H
#define KNETWORKMANAGER_GSM_CONNECTION_H
#include "knetworkmanager-ppp_connection.h"
#include "knetworkmanager-connection_setting_gsm.h"
namespace ConnectionSettings
{
class GSM;
class Serial;
class GSMConnection : public PPPConnection
{
Q_OBJECT
TQ_OBJECT
public:
GSMConnection();
~GSMConnection();
GSM* getGSMSetting() const;
Serial* getSerialSetting() const;
Connection* duplicate();
};
}; // namespace ConnectionSettings
#endif

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-gsm_device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-gsm_device.h"
#include "dbus/gsmproxy.h"
class GSMDevicePrivate
{
public:
GSMDevicePrivate(TQString service, TQString obj_path)
: nmGSM(service, obj_path)
{}
~GSMDevicePrivate() {}
DBus::GSMDeviceProxy nmGSM;
};
GSMDevice::GSMDevice (const TQString & obj_path)
: CellularDevice(obj_path)
{
d = new GSMDevicePrivate(NM_DBUS_SERVICE, obj_path);
d->nmGSM.setConnection(TQT_DBusConnection::systemBus());
}
GSMDevice::~GSMDevice ()
{
delete d;
}
#include "knetworkmanager-gsm_device.moc"

@ -0,0 +1,51 @@
/***************************************************************************
*
* knetworkmanager-gsm_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_GSMDEVICE_H
#define KNETWORKMANAGER_GSMDEVICE_H
// std includes
#include <stdint.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-cellular_device.h"
class KNetworkManager;
class GSMDevicePrivate;
class GSMDevice : public CellularDevice
{
Q_OBJECT
TQ_OBJECT
public:
GSMDevice (const TQString & obj_path );
~GSMDevice ();
private:
GSMDevicePrivate * d;
};
#endif /* KNETWORKMANAGER_GSMDEVICE_H */

@ -0,0 +1,126 @@
/***************************************************************************
*
* knetworkmanager-device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager.h"
#include "knetworkmanager-hal_device_proxy.h"
#include <kdebug.h>
#include <tqhostaddress.h>
class HalDeviceProxyPrivate
{
public:
HalDeviceProxyPrivate() {}
~HalDeviceProxyPrivate() {}
void getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result);
TQString udi;
};
HalDeviceProxy::HalDeviceProxy (const TQString & udi)
{
d = new HalDeviceProxyPrivate;
d->udi = udi;
}
HalDeviceProxy::~HalDeviceProxy ()
{
delete d;
}
bustype
HalDeviceProxy::getBustype () const
{
TQCString device_udi = d->udi.utf8();
TQCString parent_udi = "";
TQCString subsystem = "";
d->getHalProperty (device_udi, "info.parent", parent_udi);
d->getHalProperty (parent_udi, "linux.subsystem", subsystem);
if (TQString::compare (subsystem, "pci") == 0)
return BUS_PCI;
else if (TQString::compare (subsystem, "usb") == 0)
return BUS_USB;
else if (TQString::compare (subsystem, "pcmcia") == 0)
return BUS_PCMCIA;
else
return BUS_UNKNOWN;
}
TQString
HalDeviceProxy::getProduct () const
{
return "";
}
TQString
HalDeviceProxy::getVendor () const
{
return "";
}
void
HalDeviceProxyPrivate::getHalProperty (const TQCString& udi, const TQCString& property, TQCString& result)
{
//FIXME: convert to qt3-dbus-api
/*
DBusConnection* con = _ctx->getDBus ()->getConnection ();
LibHalContext* hal_ctx = NULL;
char* prop_val = NULL;
if (!con || !property) {
goto out;
}
if (!dbus_bus_name_has_owner (con, "org.freedesktop.Hal", NULL)) {
kdDebug() << "Error: HAL seems not to be running." << endl;
goto out;
}
hal_ctx = libhal_ctx_new ();
if (!libhal_ctx_set_dbus_connection (hal_ctx, con)) {
goto out;
}
if (!libhal_ctx_init (hal_ctx, NULL)) {
goto out;
}
prop_val = libhal_device_get_property_string (hal_ctx, udi, property, NULL);
result = prop_val;
libhal_free_string (prop_val);
out:
if (hal_ctx) {
libhal_ctx_shutdown (hal_ctx, NULL);
libhal_ctx_free (hal_ctx);
}
*/
return;
}
#include "knetworkmanager-hal_device_proxy.moc"

@ -0,0 +1,65 @@
/***************************************************************************
*
* knetworkmanager-device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_HALDEVICEPROXY_H
#define KNETWORKMANAGER_HALDEVICEPROXY_H
// KNM includes
#include "knetworkmanager.h"
// HAL includes
#include <hal/libhal.h>
// std includes
#include <stdint.h>
class KNetworkManager;
enum bustype {
BUS_PCI = 0,
BUS_USB = 1,
BUS_PCMCIA = 2,
BUS_UNKNOWN = 15
};
class HalDeviceProxyPrivate;
class HalDeviceProxy : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
HalDeviceProxy (const TQString & udi);
~HalDeviceProxy ();
bustype getBustype (void) const;
TQString getProduct (void) const;
TQString getVendor (void) const;
private:
HalDeviceProxyPrivate * d;
};
#endif /* KNETWORKMANAGER_HALDEVICEPROXY_H */

@ -0,0 +1,76 @@
/***************************************************************************
*
* knetworkmanager-tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Valentine Sinitsyn <e_val@inbox.ru>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
class WirelessDialog;
#include <tqevent.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <dcopclient.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <knotifyclient.h>
#include <knotifydialog.h>
#include <klocale.h>
#include <kstdguiitem.h>
#include <khelpmenu.h>
#include <kprocess.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include "knetworkmanager-menu_subhead.h"
Subhead::Subhead (TQWidget* parent, const char* name, const TQString & caption, const TQPixmap icon)
: TQWidget (parent, name)
{
TQBoxLayout* l = new TQHBoxLayout (this);
TQLabel* lbl_icon = new TQLabel (NULL, this);
TQLabel* lbl_caption = new TQLabel (caption, this);
TQSpacerItem* sp_item = new TQSpacerItem (20, 10);
TQFont font;
font.setBold(true);
lbl_caption->setFont(font);
lbl_icon->setPixmap (icon);
l->addWidget (lbl_icon);
l->addWidget (lbl_caption);
l->addItem (sp_item);
l->activate ();
}
Subhead::~Subhead()
{
}

@ -0,0 +1,56 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_MENU_SUBHEAD_H
#define KNETWORKMANAGER_MENU_SUBHEAD_H
#include <tqmap.h>
#include <tqtimer.h>
#include <tqtooltip.h>
#include <ksystemtray.h>
#include <kuniqueapplication.h>
#include <kpopupmenu.h>
#include <kactionclasses.h>
#include <kstdaction.h>
#include <kstdguiitem.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqprogressbar.h>
#include <tqguardedptr.h>
#include "knetworkmanager.h"
class Subhead : public TQWidget
{
public:
Subhead (TQWidget*, const char *, const TQString &, const TQPixmap);
~Subhead ();
};
#endif /* KNETWORKMANAGER_MENU_SUBHEAD_H */

@ -0,0 +1,140 @@
/***************************************************************************
*
* knetworkmanager-menuitem.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006, 2008 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Valentine Sinitsyn <e_val@inbox.ru>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager-menuitem.h"
#include <tqevent.h>
#include <tqguardedptr.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <dcopclient.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <knotifyclient.h>
#include <knotifydialog.h>
#include <klocale.h>
#include <kstdguiitem.h>
#include <khelpmenu.h>
#include <kprocess.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include <tqdbusobjectpath.h>
#include <tqdbuserror.h>
#include "knetworkmanager-connection.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-vpn_plugin.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
TQString currentVPNDevice;
TQT_DBusObjectPath vpn_attempt_this_conn;
using namespace ConnectionSettings;
class NetworkMenuItemPrivate
{
public:
NetworkMenuItemPrivate(Device* device, Connection* connection)
: dev(device), conn(connection)
{
}
~NetworkMenuItemPrivate() {}
TQGuardedPtr<Device> dev;
TQGuardedPtr<Connection> conn;
};
void NetworkMenuItem::slotActivate()
{
int id;
TQT_DBusError err;
kdDebug() << "NetworkMenuItem::slotActivate()" << endl;
NMProxy* nm = NMProxy::getInstance();
if (d->dev && d->conn)
{
NMProxy* nm = NMProxy::getInstance();
if (nm)
{
kdDebug() << "Activate Connection " << d->conn->getObjectPath().data() << " on Device " << d->dev->getObjectPath().ascii() << endl;
printf("Activate Connection %s on Device %s\n\r", d->conn->getObjectPath().data(), d->dev->getObjectPath().ascii());
#if NM_CHECK_VERSION(0,8,992)
if (nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", d->conn->getObjectPath(), TQT_DBusObjectPath(QCString(d->dev->getObjectPath())), d->conn->getObjectPath(), err))
#else
if (nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, d->conn->getObjectPath(), TQT_DBusObjectPath(TQCString(d->dev->getObjectPath())), d->conn->getObjectPath(), err))
#endif
{
}
else
kdDebug() << "ActivateDevice failed" << endl;
}
}
else if (d->conn)
{
// no device given, just take the default device
printf("Activate Connection %s on default device\n\r", d->conn->getObjectPath().data());
TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
vpn_attempt_this_conn = d->conn->getObjectPath();
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", d->conn->getObjectPath(), device, act_conn, err);
#else
nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, d->conn->getObjectPath(), device, act_conn, err);
#endif
}
else
kdDebug() << "Device or Connection invalid" << endl;
}
NetworkMenuItem::NetworkMenuItem (Device* dev, Connection* conn, TQObject* parent, const char* name)
: TQObject(parent, name)
{
d = new NetworkMenuItemPrivate(dev, conn);
}
NetworkMenuItem::~NetworkMenuItem ()
{
delete d;
}
#include "knetworkmanager-menuitem.moc"

@ -0,0 +1,54 @@
/***************************************************************************
*
* knetworkmanager-menuitem.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006, 2008 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_MENUITEM_H
#define KNETWORKMANAGER_MENUITEM_H
#include <tqobject.h>
class Device;
class NetworkMenuItemPrivate;
namespace ConnectionSettings
{
class Connection;
}
class NetworkMenuItem : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
NetworkMenuItem (Device* dev, ConnectionSettings::Connection* conn, TQObject* parent = 0, const char* name = 0);
~NetworkMenuItem ();
public slots:
void slotActivate();
private:
NetworkMenuItemPrivate* d;
};
#endif /* KNETWORKMANAGER_MENUITEM_H */

@ -0,0 +1,329 @@
/***************************************************************************
*
* knetworkmanager-device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQtDBus includes
#include <tqdbusconnection.h>
#include <tqdbusproxy.h>
#include <tqdbusdata.h>
#include <tqdbusdatalist.h>
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-devicestore.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_store.h"
#include "dbus/activeconnectionproxy.h"
class NMProxyPrivate
{
public:
NMProxyPrivate()
{}
static NMProxy* nm;
};
NMProxy* NMProxyPrivate::nm = NULL;
Device* NMProxy::getDefaultDevice()
{
TQT_DBusObjectPath connpath = getDefaultActiveConnection();
if (!connpath.isEmpty())
{
TQT_DBusObjectPath devpath = getDeviceForActiveConnection(connpath);
if (!devpath.isEmpty())
return DeviceStore::getInstance()->getDevice(devpath);
}
return NULL;
}
TQT_DBusObjectPath NMProxy::getDeviceForActiveConnection(TQT_DBusObjectPath act_conn_path)
{
TQT_DBusError err;
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, act_conn_path);
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
// get details about the active connection
TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
if (!devs.isEmpty())
return devs.first();
delete act_conn;
}
return TQT_DBusObjectPath();
}
TQT_DBusObjectPath NMProxy::getDefaultActiveConnection()
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> connections;
// get a list of all active connections from NM
connections = NetworkManagerProxy::getActiveConnections(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
if (act_conn->getDefault(err))
{
delete act_conn;
return *it;
}
delete act_conn;
}
}
return TQT_DBusObjectPath();
}
ConnectionSettings::Connection* NMProxy::getActiveConnection(const Device* dev)
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> connections;
// get a list of all active connections from NM
connections = NetworkManagerProxy::getActiveConnections(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
// get details about the active connection
TQString service = act_conn->getServiceName(err);
TQT_DBusObjectPath conn = act_conn->getConnection(err);
TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err);
TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
{
if (TQString(*it2) == dev->getObjectPath())
{
// here is the connection we were looking for
ConnectionStore* cstore = ConnectionStore::getInstance();
if (cstore)
return cstore->getConnection(TQString(conn));
}
}
delete act_conn;
}
}
return NULL;
}
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > NMProxy::getActiveConnectionsMap()
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> connections;
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map;
ConnectionStore* cstore = ConnectionStore::getInstance();
DeviceStore* dstore = DeviceStore::getInstance();
bool found = false;
if (!dstore || !cstore)
return map;
// get a list of all active connections from NM
connections = NetworkManagerProxy::getActiveConnections(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
// get details about the active connection
TQString service = act_conn->getServiceName(err);
TQT_DBusObjectPath conn = act_conn->getConnection(err);
TQT_DBusObjectPath specific_obj = act_conn->getSpecificObject(err);
TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
found = false;
for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
{
Device* device = dstore->getDevice(*it2);
ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn));
if (connection)
{
map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, device));
found = true;
}
}
if (!found)
{
// no device found for this connection -> just add it without device
ConnectionSettings::Connection* connection = cstore->getConnection(TQString(conn));
if (connection)
map.append(TQPair<ConnectionSettings::Connection*, Device*>(connection, NULL));
}
delete act_conn;
}
}
return map;
}
NMProxy::NMProxy()
: NetworkManagerProxy(NM_DBUS_SERVICE, NM_DBUS_PATH)
{
d = new NMProxyPrivate();
NetworkManagerProxy::setConnection(TQT_DBusConnection::systemBus());
}
void NMProxy::deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev)
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> connections;
// get a list of all active connections from NM
connections = NetworkManagerProxy::getActiveConnections(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
if (act_conn->getConnection(err) == conn->getObjectPath())
{
if (dev)
{
// get details about the active connection
TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
{
if (TQString(*it2) == dev->getObjectPath())
{
// this is the right one
DeactivateConnection(*it, err);
return;
}
}
}
else
{
DeactivateConnection(*it, err);
}
}
delete act_conn;
}
}
}
void NMProxy::deactivateConnectionPath(TQT_DBusObjectPath obj_path)
{
TQT_DBusError err;
DeactivateConnection(obj_path, err);
}
void NMProxy::deactivateDevice(const Device* dev)
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> connections;
// get a list of all active connections from NM
connections = NetworkManagerProxy::getActiveConnections(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// we need a proxy for every active connection
DBus::ActiveConnectionProxy* act_conn = new DBus::ActiveConnectionProxy(NM_DBUS_SERVICE, (*it));
act_conn->setConnection(TQT_DBusConnection::systemBus());
if (act_conn)
{
// get details about the active connection
TQValueList<TQT_DBusObjectPath> devs = act_conn->getDevices(err);
for (TQValueList<TQT_DBusObjectPath>::Iterator it2 = devs.begin(); it2 != devs.end(); ++it2)
{
if (TQString(*it2) == dev->getObjectPath())
{
// this is the right one
DeactivateConnection(*it, err);
return;
}
}
delete act_conn;
}
}
}
bool NMProxy::isNMRunning()
{
// Ask DBus if the NetworkManager service is available
TQT_DBusProxy* proxy = new TQT_DBusProxy("org.freedesktop.DBus", "/", "org.freedesktop.DBus", TQT_DBusConnection::systemBus());
TQValueList<TQT_DBusData> params;
params.append(TQT_DBusData::fromString(NM_DBUS_SERVICE));
TQT_DBusMessage reply = proxy->sendWithReply("NameHasOwner", params);
bool ret = reply.first().toBool();
delete proxy;
return ret;
}
NMProxy::~NMProxy()
{
delete d;
}
NMProxy* NMProxy::getInstance()
{
if (NMProxyPrivate::nm)
return NMProxyPrivate::nm;
return (NMProxyPrivate::nm = new NMProxy());
}
#include "knetworkmanager-nm_proxy.moc"

@ -0,0 +1,62 @@
/***************************************************************************
*
* knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_NMPROXY_H
#define KNETWORKMANAGER_NMPROXY_H
#include "dbus/networkmanagerproxy.h"
namespace ConnectionSettings
{
class Connection;
}
class Device;
class NMProxyPrivate;
class NMProxy : public DBus::NetworkManagerProxy
{
Q_OBJECT
TQ_OBJECT
public:
static NMProxy* getInstance();
Device* getDefaultDevice();
TQT_DBusObjectPath getDeviceForActiveConnection(TQT_DBusObjectPath act_conn);
TQT_DBusObjectPath getDefaultActiveConnection();
ConnectionSettings::Connection* getActiveConnection(const Device* dev);
void deactivateDevice(const Device* dev);
void deactivateConnection(const ConnectionSettings::Connection* conn, const Device* dev);
void deactivateConnectionPath(TQT_DBusObjectPath obj_path);
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > getActiveConnectionsMap();
bool isNMRunning();
protected:
NMProxy ();
~NMProxy ();
private:
NMProxyPrivate * d;
};
#endif /* KNETWORKMANAGER_NMPROXY_H */

@ -0,0 +1,81 @@
/***************************************************************************
*
* knetworkmanager-device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQtDBus includes
#include <tqdbusconnection.h>
#include <tqdbusproxy.h>
#include <tqdbusdata.h>
#include <tqdbusdatalist.h>
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
// NM includes
#include <NetworkManager.h>
#include <NetworkManagerVPN.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-nm_vpn_proxy.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-devicestore.h"
//#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_store.h"
#include "dbus/vpnconnectionproxy.h"
class NMVPNProxyPrivate
{
public:
NMVPNProxyPrivate()
{}
static NMVPNProxy* nm;
};
NMVPNProxy* NMVPNProxyPrivate::nm = NULL;
NMVPNProxy::NMVPNProxy()
: NetworkManagerVPNProxy(NM_DBUS_SERVICE, NM_DBUS_PATH_VPN_CONNECTION)
{
d = new NMVPNProxyPrivate();
NetworkManagerVPNProxy::setConnection(TQDBusConnection::systemBus());
}
NMVPNProxy::~NMVPNProxy()
{
delete d;
}
NMVPNProxy* NMVPNProxy::getInstance()
{
if (NMVPNProxyPrivate::nm)
return NMVPNProxyPrivate::nm;
return (NMVPNProxyPrivate::nm = new NMVPNProxy());
}
#include "knetworkmanager-nm_vpn_proxy.moc"

@ -0,0 +1,52 @@
/***************************************************************************
*
* knetworkmanager-nm_proxy.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_NMVPNPROXY_H
#define KNETWORKMANAGER_NMVPNPROXY_H
#include "dbus/networkmanagervpnproxy.h"
namespace ConnectionSettings
{
class Connection;
}
class Device;
class NMVPNProxyPrivate;
class NMVPNProxy : public DBus::NetworkManagerVPNProxy
{
Q_OBJECT
TQ_OBJECT
public:
static NMVPNProxy* getInstance();
protected:
NMVPNProxy ();
~NMVPNProxy ();
private:
NMVPNProxyPrivate * d;
};
#endif /* KNETWORKMANAGER_NMVPNPROXY_H */

@ -0,0 +1,162 @@
/***************************************************************************
*
* knetworkmanager-nminfo_dbus.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Valentine Sinitsyn <e_val@inbox.ru>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <stdlib.h>
#include <kdebug.h>
#include <NetworkManager.h>
#include <tqdbusobjectpath.h>
#include <tqdbusconnection.h>
#include "knetworkmanager.h"
#include "knetworkmanager-nmsettings.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
class NMSettingsPrivate
{
public:
NMSettingsPrivate()
: obj_path_index(0)
{
}
~NMSettingsPrivate()
{
}
int obj_path_index;
};
NMSettings* NMSettings::_instance = NULL;
NMSettings* NMSettings::getInstance()
{
// return singleton instance
if (_instance)
return _instance;
return (_instance = new NMSettings());
}
NMSettings::NMSettings()
{
d = new NMSettingsPrivate();
TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
kdDebug() << "NMSettings::NMSettings" << endl;
#if NM_CHECK_VERSION(0,8,992)
if (!conn.requestName("org.freedesktop.NetworkManagerUserSettings"))
kdError() << "req name failed for " << "org.freedesktop.NetworkManagerUserSettings" << endl;
#else
// request the name for the settings interface
if (!conn.requestName(NM_DBUS_SERVICE_USER_SETTINGS))
kdError() << "req name failed for " << NM_DBUS_SERVICE_USER_SETTINGS << endl;
#endif
// request the name for the connections here too
if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION))
kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION << endl;
// request the name for the connections here too
if (!conn.requestName(NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS))
kdError() << "req name failed for " << NM_DBUS_IFACE_SETTINGS_CONNECTION_SECRETS << endl;
// register on the DBus
if (!conn.registerObject(objectPath(), this))
kdError() << "registerobjectpath failed" << endl;
ConnectionStore* cstore = ConnectionStore::getInstance();
// we need to get informed about new connections...
connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotNewConnection(ConnectionSettings::Connection*)));
}
NMSettings::~NMSettings()
{
delete d;
TQT_DBusConnection conn = TQT_DBusConnection::systemBus();
conn.unregisterObject(NM_DBUS_PATH_SETTINGS);
}
bool NMSettings::handleSignalSend(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
return true;
}
TQString NMSettings::objectPath() const
{
return TQString(NM_DBUS_PATH_SETTINGS);
}
bool NMSettings::ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& /*error*/)
{
// return connections
ConnectionStore* cstore = ConnectionStore::getInstance();
TQValueList<ConnectionSettings::Connection*> conns = cstore->getConnections();
for (TQValueList<ConnectionSettings::Connection*>::Iterator it = conns.begin(); it != conns.end(); ++it)
{
ConnectionSettings::Connection* conn = (*it);
connections.append(conn->getObjectPath());
}
return true;
}
void NMSettings::handleMethodReply(const TQT_DBusMessage& reply)
{
TQT_DBusConnection::systemBus().send(reply);
}
TQT_DBusObjectPath
NMSettings::getObjPathForConnection()
{
// just increase the number for this connection
TQT_DBusObjectPath obj_path(NM_DBUS_PATH_SETTINGS_CONNECTION"/");
obj_path += TQString::number(d->obj_path_index++);
return obj_path;
}
void
NMSettings::slotNewConnection(ConnectionSettings::Connection* conn)
{
emitNewConnection(conn->getObjectPath());
}
#include "knetworkmanager-nmsettings.moc"

@ -0,0 +1,77 @@
/***************************************************************************
*
* knetworkmanager-nminfo_dbus.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_NMSETTINGS_H
#define KNETWORKMANAGER_NMSETTINGS_H
#include <tqobject.h>
#include "knetworkmanager-connection_setting.h"
#include "dbus/networkmanagersettings.h"
class Network;
class TQT_DBusObjectPath;
class NMSettingsPrivate;
class NMSettings : public TQObject, DBus::SettingsInterface
{
Q_OBJECT
TQ_OBJECT
public:
/* get singleton */
static NMSettings* getInstance();
~NMSettings();
/* request the required interface from the DBus */
// void requestName (DBusMessage*);
/* functions for handling method calls sended _by_ NetworkManager */
// void getConnections (DBusMessage*);
bool handleSignalSend(const TQT_DBusMessage& reply);
TQString objectPath() const;
bool ListConnections(TQValueList<TQT_DBusObjectPath>& connections, TQT_DBusError& error);
void handleMethodReply(const TQT_DBusMessage& reply);
/* get Connection from obj_path */
TQT_DBusObjectPath getObjPathForConnection();
public slots:
/* notification about new connections */
void slotNewConnection (ConnectionSettings::Connection*);
private:
NMSettingsPrivate* d;
/* private constructor -> singleton */
NMSettings();
/* functions for sending signals/methodcalls _to_ NetworkManager */
void signalNewConnection (const char*);
/* pointer to the singleton class */
static NMSettings* _instance;
};
#endif /* KNETWORKMANAGER_NMSETTINGS_H */

@ -0,0 +1,38 @@
/***************************************************************************
*
* knetworkmanager-plugin.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager-plugin.h"
Plugin::Plugin(TQObject* parent, const char* name, const TQStringList& )
: TQObject(parent, name)
{
}
Plugin::~Plugin()
{
}
#include "knetworkmanager-plugin.moc"

@ -0,0 +1,39 @@
/***************************************************************************
*
* knetworkmanager-plugin.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_PLUGIN_H
#define KNETWORKMANAGER_PLUGIN_H
#include <tqobject.h>
class Plugin : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
Plugin(TQObject*, const char*, const TQStringList&);
~Plugin();
};
#endif /* KNETWORKMANAGER_PLUGIN_H */

@ -0,0 +1,184 @@
/***************************************************************************
*
* knetworkmanager-pluginmanager.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <kplugininfo.h>
#include <kparts/componentfactory.h>
#include <kdebug.h>
#include <klocale.h>
#include "knetworkmanager-pluginmanager.h"
PluginManager* PluginManager::_instance;
PluginManager* PluginManager::getInstance()
{
if (_instance)
return _instance;
return new PluginManager(TQT_TQOBJECT(KNetworkManager::getInstance()), "pluginmanager");
}
PluginManager::PluginManager(TQObject* parent, const char* name)
: TQObject(parent, name)
{
// get list of available plugins
this->_plugins = KPluginInfo::fromServices( KTrader::self()->query( TQString::tqfromLatin1( "KNetworkManager/Plugin" )));
// a bit debug output
for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
kdDebug() << k_funcinfo << TQString("Found Plugin '%1'").tqarg((*it)->pluginName()) << endl;
}
PluginManager::~PluginManager()
{
// delete all loaded plugins
while(!_loadedPlugins.empty())
{
PluginMap::Iterator it = _loadedPlugins.begin();
_loadedPlugins.remove(it);
}
// delete all available plugininfos
while(!_plugins.empty())
{
TQValueList<KPluginInfo*>::Iterator it = _plugins.begin();
delete *it;
_plugins.remove(it);
}
}
TQStringList PluginManager::getPluginList(const TQString& serviceType, const TQString& property, const TQString& value) const
{
TQStringList ret;
// find a suitable plugin
for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
{
if ((*it)->service()->serviceTypes().contains(serviceType) > 0)
if ((*it)->property(property).toString().contains(value))
ret.append( (*it)->pluginName() );
}
return ret;
}
Plugin* PluginManager::getPlugin(const TQString& pluginID)
{
KPluginInfo* info = infoForPluginID(pluginID);
if (_loadedPlugins.contains(info))
{
return _loadedPlugins[info];
}
else
{
return loadPlugin(pluginID);
}
return NULL;
}
const KPluginInfo* PluginManager::getPluginInfo(const TQString& pluginID)
{
return infoForPluginID(pluginID);
}
const KPluginInfo* PluginManager::getPluginInfo(const Plugin* plugin)
{
for(PluginMap::ConstIterator it = _loadedPlugins.begin(); it != _loadedPlugins.end(); ++it)
{
if (it.data() == plugin)
return it.key();
}
return NULL;
}
void PluginManager::loadAllPlugins()
{
// iterate over all plugins
for(TQValueList<KPluginInfo*>::ConstIterator it = _plugins.begin(); it != _plugins.end(); ++it)
{
// load Plugin
loadPlugin((*it)->pluginName());
}
}
Plugin* PluginManager::loadPlugin(const TQString& pluginID)
{
// try to load Plugin
int error = 0;
KPluginInfo* info = infoForPluginID(pluginID);
Plugin *plugin = KParts::ComponentFactory::createInstanceFromQuery<Plugin>( TQString::tqfromLatin1( "KNetworkManager/Plugin" ),
TQString::tqfromLatin1( "[X-KDE-PluginInfo-Name]=='%1'" ).tqarg( pluginID ), this, 0, TQStringList(), &error );
// plugin loaded?
if (plugin)
{
kdDebug() << k_funcinfo << TQString(i18n("successfully loaded plugin '%1'")).tqarg(info->pluginName()) << endl;
_loadedPlugins.insert(info, plugin);
}
else
{
// error
switch( error )
{
case KParts::ComponentFactory::ErrNoServiceFound:
kdDebug( ) << k_funcinfo << "No service implementing the given mimetype "
<< "and fullfilling the given constraint expression can be found." << endl;
break;
case KParts::ComponentFactory::ErrServiceProvidesNoLibrary:
kdDebug( ) << "the specified service provides no shared library." << endl;
break;
case KParts::ComponentFactory::ErrNoLibrary:
kdDebug( ) << "the specified library could not be loaded." << endl;
break;
case KParts::ComponentFactory::ErrNoFactory:
kdDebug( ) << "the library does not export a factory for creating components." << endl;
break;
case KParts::ComponentFactory::ErrNoComponent:
kdDebug( ) << "the factory does not support creating components of the specified type." << endl;
break;
}
kdDebug() << k_funcinfo << "Loading plugin '" << pluginID << "' failed, KLibLoader reported error: '" << endl
<< KLibLoader::self()->lastErrorMessage() << "'" << endl;
}
return plugin;
}
KPluginInfo * PluginManager::infoForPluginID( const TQString& pluginID ) const
{
TQValueList<KPluginInfo *>::ConstIterator it;
for ( it = this->_plugins.begin(); it != this->_plugins.end(); ++it )
{
if ( ( *it )->pluginName() == pluginID )
return *it;
}
return 0L;
}
#include "knetworkmanager-pluginmanager.moc"

@ -0,0 +1,67 @@
/***************************************************************************
*
* knetworkmanager-pluginmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_PLUGINMANAGER_H
#define KNETWORKMANAGER_PLUGINMANAGER_H
#include <tqobject.h>
#include <tqmap.h>
#include <tqvaluelist.h>
#include "knetworkmanager-plugin.h"
#include "knetworkmanager.h"
class KPluginInfo;
typedef TQMap<KPluginInfo*, Plugin*> PluginMap;
class PluginManager : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
PluginManager(TQObject*, const char*);
~PluginManager();
TQStringList getPluginList(const TQString&, const TQString&, const TQString&) const;
Plugin* getPlugin(const TQString&);
const KPluginInfo* getPluginInfo(const TQString&);
const KPluginInfo* getPluginInfo(const Plugin*);
static PluginManager* getInstance (void);
public slots:
void loadAllPlugins();
private:
TQValueList<KPluginInfo*> _plugins;
PluginMap _loadedPlugins;
Plugin* loadPlugin(const TQString& pluginID);
KPluginInfo* infoForPluginID(const TQString& pluginID) const;
static PluginManager* _instance;
};
#endif /* KNETWORKMANAGER_PLUGINMANAGER_H */

@ -0,0 +1,54 @@
/***************************************************************************
*
* knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include "knetworkmanager-ppp_connection.h"
#include <nm-setting-ppp.h>
#include <nm-setting-ip4-config.h>
ConnectionSettings::PPPConnection::PPPConnection(const TQString & infoName)
: GenericConnection(infoName)
{
appendSetting(new IPv4(this));
appendSetting(new PPP(this));
}
ConnectionSettings::PPPConnection::~PPPConnection()
{
}
ConnectionSettings::IPv4* ConnectionSettings::PPPConnection::getIPv4Setting() const
{
return dynamic_cast<ConnectionSettings::IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
}
ConnectionSettings::PPP* ConnectionSettings::PPPConnection::getPPPSetting() const
{
return dynamic_cast<PPP*>(getSetting(NM_SETTING_PPP_SETTING_NAME));
}
#include "knetworkmanager-ppp_connection.moc"
// vim: sw=4 sts=4 noet tw=100

@ -0,0 +1,51 @@
/***************************************************************************
*
* knetworkmanager-ppp_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2008 Novell, Inc.
*
* Author: Will Stephenson <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_PPP_CONNECTION_H
#define KNETWORKMANAGER_PPP_CONNECTION_H
#include "knetworkmanager-generic_connection.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_ppp.h"
namespace ConnectionSettings
{
class Info;
class IPv4;
class PPP;
class PPPConnection : public GenericConnection
{
Q_OBJECT
TQ_OBJECT
public:
PPPConnection(const TQString& infoName);
~PPPConnection();
PPP* getPPPSetting() const;
IPv4* getIPv4Setting() const;
};
} // namespace ConnectionSettings
#endif

@ -0,0 +1,634 @@
/***************************************************************************
*
* knetworkmanager-storage.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqtimer.h>
#include <kglobal.h>
#include <kconfig.h>
#include <kstaticdeleter.h>
#include <kdebug.h>
#include "knetworkmanager-storage.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-cdma_connection.h"
#include "knetworkmanager-gsm_connection.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting.h"
#include "xmlmarshaller.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_ipv4.h"
using namespace ConnectionSettings;
static KStaticDeleter<Storage> sd2;
// private stuff
class StoragePrivate
{
public:
StoragePrivate() {};
~StoragePrivate() {};
static Storage* _instance;
};
Storage* StoragePrivate::_instance = NULL;
Storage*
Storage::getInstance()
{
if (StoragePrivate::_instance)
return StoragePrivate::_instance;
return sd2.setObject(StoragePrivate::_instance, new Storage());
}
Storage::Storage()
{
d = new StoragePrivate();
// defer the connection init a bit
TQTimer::singleShot(0, this, TQT_SLOT(slotInit()));
}
Storage::~Storage()
{
delete d;
}
void
Storage::slotInit()
{
ConnectionStore* cstore = ConnectionStore::getInstance();
// we want to get notified whenever a new connection is created, edited or deleted
connect(cstore, TQT_SIGNAL(signalConnectionAdded(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionAdded(ConnectionSettings::Connection*)));
connect(cstore, TQT_SIGNAL(signalConnectionRemoved(ConnectionSettings::Connection*)), this, TQT_SLOT(slotConnectionRemoved(ConnectionSettings::Connection*)));
}
void
Storage::slotConnectionAdded(Connection* con)
{
// connection added, save it
saveConnection(con);
KGlobal::config()->sync();
}
void
Storage::slotConnectionRemoved(Connection* con)
{
// find the appropriate connection and delete it from the storage
deleteConnection(con);
KGlobal::config()->sync();
}
Connection*
Storage::createConnectionByType(const TQString& cType)
{
// TODO: use a factory class here
if (cType == NM_SETTING_WIRELESS_SETTING_NAME)
return new WirelessConnection();
else if (cType == NM_SETTING_WIRED_SETTING_NAME)
return new WiredConnection();
else if(cType == NM_SETTING_CDMA_SETTING_NAME)
return new CDMAConnection();
else if(cType == NM_SETTING_GSM_SETTING_NAME)
return new GSMConnection();
else if (cType == NM_SETTING_VPN_SETTING_NAME)
return new VPNConnection();
else
return NULL;
}
void
Storage::restoreConnections()
{
kdDebug() << k_funcinfo << endl;
// let's read all connections from the config-file and add them to the connection-store
ConnectionStore* store = ConnectionStore::getInstance();
TQStringList groups = KGlobal::config()->groupList();
const TQStringList::Iterator end = groups.end();
for ( TQStringList::Iterator it = groups.begin(); it != end; ++it )
{
if ( !(*it).startsWith( "Connection_" ) )
continue;
// restore that connection
Connection* conn = NULL;
if ( (conn = restoreConnection(*it)) != NULL)
{
// add the connection to the store
store->addConnection(conn);
}
}
}
Connection*
Storage::restoreConnection(const TQString& grpname)
{
Connection* conn = NULL;
kdDebug() << k_funcinfo << " " << grpname << endl;
// we have a connection to restore
KConfigGroup grp( KGlobal::config(), grpname);
TQString id = grp.readEntry("Id");
TQString cType = grp.readEntry("Type");
// ID is needed!
if (id.isEmpty() || cType.isEmpty())
return NULL;
// create a new connection object by its type
conn = createConnectionByType(cType);
// check if the connection was successfully created
if (!conn)
return NULL;
// set the connection ID
conn->setID(id);
// restore all appropriate settings
TQStringList settings = grp.readListEntry("Settings");
for (TQStringList::ConstIterator it = settings.begin(); it != settings.end(); ++it)
{
if ( !restoreSetting(conn, *it) )
{
// setting could not be restored -> Error
kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl;
kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl;
delete conn;
conn = NULL;
return NULL;
}
}
// restore all appropriate secrets
TQStringList secrets = grp.readListEntry("Secrets");
for (TQStringList::ConstIterator it = secrets.begin(); it != secrets.end(); ++it)
{
if ( !restoreSecrets(conn, *it) )
{
// setting could not be restored -> Error
kdDebug() << " Connection " << id.ascii() << " could not be restored." << endl;
kdError() << k_funcinfo << " Connection " << id << " could not be restored." << endl;
delete conn;
conn = NULL;
return NULL;
}
}
return conn;
}
bool
Storage::restoreSetting(Connection* conn, const TQString& setting_grp_name)
{
kdDebug() << k_funcinfo << " " << setting_grp_name << endl;
kdDebug() << "restore setting: " << setting_grp_name.ascii() << endl;
KConfigGroup setting_grp(KGlobal::config(), setting_grp_name);
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
TQString type = setting_grp.readEntry("Type");
// get the appropriate setting from the connection
ConnectionSetting* setting = conn->getSetting(type);
if (!setting)
{
kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Setting " << type << " could not be restored" << endl;
return false;
}
// read the SettingsMap from kconfig
SettingsMap map;
for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
{
if (!it.key().startsWith("Value_"))
continue;
TQString key = it.key();
// get the original name
key.replace("Value_", "");
TQString xmldata = it.data();
TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
map.insert(key, dbusdata);
}
// restore the setting from the generated map
setting->fromMap(map);
return true;
}
bool
Storage::restoreSecrets(Connection* conn, const TQString& secrets_grp_name)
{
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
TQString type = secrets_grp.readEntry("Type");
// get the appropriate setting from the connection
ConnectionSetting* setting = conn->getSetting(type);
if (!setting)
{
kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl;
return false;
}
// read the SettingsMap from kconfig
SettingsMap map;
for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
{
if (!it.key().startsWith("Value_"))
continue;
TQString key = it.key();
// get the original name
key.replace("Value_", "");
TQString xmldata = it.data();
TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
map.insert(key, dbusdata);
}
// restore the setting from the generated map
setting->fromSecretsMap(map);
return true;
}
bool
Storage::restoreVPNSecrets(Connection* conn, const TQString& secrets_grp_name)
{
kdDebug() << k_funcinfo << " " << secrets_grp_name << endl;
kdDebug() << "restore secret: " << secrets_grp_name.ascii() << endl;
KConfigGroup secrets_grp(KGlobal::config(), secrets_grp_name);
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(secrets_grp_name);
TQString type = secrets_grp.readEntry("Type");
// get the appropriate setting from the connection
ConnectionSetting* setting = conn->getSetting(type);
if (!setting)
{
kdWarning() << k_funcinfo << "Connection " << conn->getID() << ": Secrets for setting " << type << " could not be restored" << endl;
return false;
}
// read the SettingsMap from kconfig
SettingsMap map;
for(TQMap<TQString, TQString>::ConstIterator it = config_map.begin(); it != config_map.end(); ++it)
{
if (!it.key().startsWith("Value_"))
continue;
TQString key = it.key();
// get the original name
key.replace("Value_", "");
TQString xmldata = it.data();
TQT_DBusData dbusdata = XMLMarshaller::toTQT_DBusData(xmldata);
map.insert(key, dbusdata);
}
// restore the setting from the generated map
setting->fromSecretsMap(map);
return true;
}
void
Storage::saveConnections()
{
kdDebug() << k_funcinfo << endl;
kdDebug() << "Storage::saveConnections" << endl;
printf("Storage::saveConnections\n\r");
// write all connections we get from the connection-store to disk
ConnectionStore* store = ConnectionStore::getInstance();
TQValueList<ConnectionSettings::Connection*> connections = store->getConnections();
for (TQValueList<ConnectionSettings::Connection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
{
// save this connection
saveConnection(*it);
}
KGlobal::config()->sync();
}
bool
Storage::saveConnection(Connection* conn)
{
KConfig* config = KGlobal::config();
TQString id = conn->getID();
TQString cType = conn->getType();
kdDebug() << k_funcinfo << " <" << id << ">" << endl;
kdDebug() << "Storage::saveConnection " << id.ascii() << endl;
// connections without id are evil
if (id.isEmpty() || cType.isEmpty())
return false;
// let's get the config group for this connection
KConfigGroup grp(config, TQString("Connection_%1").tqarg(id));
TQStringList settings_grps;
TQStringList secrets_grps;
// save the connections settings to the configfile
if (saveConnectionSettings(conn, settings_grps, secrets_grps))
{
grp.writeEntry("Type", cType);
grp.writeEntry("Id", id);
// save the list of settings groups
grp.writeEntry("Settings", settings_grps);
grp.writeEntry("Secrets", secrets_grps);
}
return false;
}
bool
Storage::saveConnectionSettings(Connection* conn, TQStringList& settings_grps, TQStringList& secrets_grps)
{
TQString id = conn->getID();
// connections without id are evil
if (id.isEmpty())
return false;
// iterate over all settings
TQValueList<ConnectionSetting*> settings = conn->getSettings();
TQString setting_grp;
TQString secrets_grp;
// save all settings
for (TQValueList<ConnectionSetting*>::ConstIterator it = settings.begin(); it != settings.end(); ++it)
{
if (!saveConnectionSetting(conn, *it, setting_grp))
return false;
if ((*it)->hasSecrets())
{
if (!saveConnectionSecrets(conn, *it, secrets_grp))
return false;
secrets_grps.append(secrets_grp);
}
settings_grps.append(setting_grp);
}
return true;
}
bool
Storage::saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
{
KConfig* config = KGlobal::config();
TQString id = conn->getID();
TQString type = setting->getType();
kdDebug() << k_funcinfo << " <" << id << "> <" << type << ">" << endl;
// ID is necessary
if (id.isEmpty())
return false;
// get a group for this setting
setting_grp = TQString("ConnectionSetting_%1_%2").tqarg(id).tqarg(type);
KConfigGroup grp(config, setting_grp);
// write the type
grp.writeEntry("Type", type);
// write the values
SettingsMap map = setting->toMap();
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
kdDebug() << k_funcinfo << " " << TQString("Value_%1").tqarg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl;
grp.writeEntry(TQString("Value_%1").tqarg(it.key()), XMLMarshaller::fromTQT_DBusData( it.data() ));
}
return true;
}
bool
Storage::saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& setting_grp)
{
KConfig* config = KGlobal::config();
TQString id = conn->getID();
TQString type = setting->getType();
bool storage_requested;
kdDebug() << k_funcinfo << " <" << id << "> <" << type << ">" << endl;
// ID is necessary
if (id.isEmpty())
return false;
// see if permanent storage was requested by the user
SettingsMap setting_map = setting->toMap();
storage_requested = true;
for (SettingsMap::ConstIterator it = setting_map.begin(); it != setting_map.end(); ++it)
{
if (it.key() == "Commit to disk") {
if (XMLMarshaller::fromTQT_DBusData(it.data()) == TQString("true")) {
storage_requested = true;
}
if (XMLMarshaller::fromTQT_DBusData(it.data()) == TQString("false")) {
storage_requested = false;
}
}
}
printf("Secrets storage requested: %d\n\r", storage_requested);
// get a group for this setting
setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
KConfigGroup grp(config, setting_grp);
// write the type
grp.writeEntry("Type", type);
// write the values
SettingsMap map = setting->toSecretsMap(false);
for (SettingsMap::ConstIterator it = map.begin(); it != map.end(); ++it)
{
kdDebug() << k_funcinfo << " " << TQString("Value_%1").tqarg(it.key()) << " = " << XMLMarshaller::fromTQT_DBusData( it.data() )<< endl;
if (storage_requested == true) {
grp.writeEntry(TQString("Value_%1").tqarg(it.key()), XMLMarshaller::fromTQT_DBusData( it.data() ));
}
else {
grp.writeEntry(TQString("Value_%1").tqarg(it.key()), TQString("") );
}
}
return true;
}
bool
Storage::hasSecretsStored(Connection* connection)
{
TQString id = connection->getID();
// ID is necessary
if (id.isEmpty())
return false;
TQValueList<ConnectionSetting*> settings = connection->getSettings();
for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
{
if (hasSecretsStored(connection, *it))
return true;
}
return false;
}
bool
Storage::hasSecretsStored(Connection* connection, ConnectionSetting* setting)
{
TQString id = connection->getID();
TQString type = setting->getType();
kdDebug() << "Storage::hasSecretsStored" << endl;
// ID is necessary
if (id.isEmpty())
return false;
// get a group for this setting
TQString setting_grp_name = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
TQMap<TQString, TQString> config_map = KGlobal::config()->entryMap(setting_grp_name);
return !(config_map.isEmpty());
}
bool
Storage::restoreAllSecrets(Connection* connection)
{
TQString id = connection->getID();
bool retval = true;
if (id.isEmpty())
return false;
TQValueList<ConnectionSetting*> settings = connection->getSettings();
for (TQValueList<ConnectionSetting*>::Iterator it = settings.begin(); it != settings.end(); ++it)
{
if (hasSecretsStored(connection, *it))
if (!restoreSecrets(connection, *it))
retval = false;
}
return retval;
}
bool
Storage::restoreSecrets(Connection* connection, ConnectionSetting* setting)
{
TQString id = connection->getID();
TQString type = setting->getType();
kdDebug() << "Storage::restoreSecrets" << endl;
// ID is necessary
if (id.isEmpty())
return false;
// get a group for this setting
TQString setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
// restore the setting
return restoreSecrets(connection, setting_grp);
}
bool
Storage::restoreVPNSecrets(Connection* connection, ConnectionSetting* setting)
{
TQString id = connection->getID();
TQString type = setting->getType();
printf("Storage::restoreVPNSecrets\n\r");
kdDebug() << "Storage::restoreVPNSecrets" << endl;
// ID is necessary
if (id.isEmpty())
return false;
// get a group for this setting
TQString setting_grp = TQString("ConnectionSecrets_%1_%2").tqarg(id).tqarg(type);
// restore the setting
return restoreVPNSecrets(connection, setting_grp);
}
bool
Storage::deleteConnection(Connection* conn)
{
KConfig* config = KGlobal::config();
TQString id = conn->getID();
TQString cType = conn->getType();
kdDebug() << k_funcinfo << " <" << id << ">" << endl;
kdDebug() << "Storage::deleteConnection " << id.ascii() << endl;
// connections without id are evil
if (id.isEmpty() || cType.isEmpty())
return false;
// let's get the config group for this connection
KConfigGroup grp(config, TQString("Connection_%1").tqarg(id));
// delete all associated settings
TQStringList settings = grp.readListEntry("Settings");
for (TQStringList::ConstIterator it = settings.begin(); it != settings.end(); ++it)
{
KConfigGroup setting(config, *it);
setting.deleteGroup();
}
// delete all associated secrets
TQStringList secrets = grp.readListEntry("Secrets");
for (TQStringList::ConstIterator it = secrets.begin(); it != secrets.end(); ++it)
{
KConfigGroup setting(config, *it);
setting.deleteGroup();
}
grp.deleteGroup();
return true;
}
#include "knetworkmanager-storage.moc"

@ -0,0 +1,101 @@
/***************************************************************************
*
* knetworkmanager-storage.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_STORAGE_H
#define KNETWORKMANAGER_STORAGE_H
#include <tqvaluelist.h>
#include <tqobject.h>
namespace ConnectionSettings
{
class Connection;
class ConnectionSetting;
}
using namespace ConnectionSettings;
class StoragePrivate;
// This class abstracts the storage of settings and connections to the disk
class Storage : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
// Singleton
static Storage* getInstance();
// restore all available connections
void restoreConnections();
// save all connections to the config file
void saveConnections();
// restore all settings secrets as they are not restored automatically
bool restoreAllSecrets(Connection*);
// restore a settings secrets as they are not restored automatically
bool restoreSecrets(Connection*, ConnectionSetting*);
bool restoreVPNSecrets(Connection*, ConnectionSetting*);
// check whether we have the secrets stored, either in KWallet or in the configfile
bool hasSecretsStored(Connection*, ConnectionSetting*);
bool hasSecretsStored(Connection*);
~Storage();
public slots:
void slotInit();
// called for every newly created connection
void slotConnectionAdded(ConnectionSettings::Connection*);
// called for every removed connection
void slotConnectionRemoved(ConnectionSettings::Connection*);
signals:
private:
Storage();
Connection* createConnectionByType(const TQString&);
Connection* restoreConnection(const TQString&);
bool restoreSecrets(Connection*, const TQString&);
bool restoreVPNSecrets(Connection*, const TQString&);
bool restoreSetting(Connection*, const TQString&);
bool saveConnection(Connection* conn);
bool saveConnectionSettings(Connection* conn, TQStringList&, TQStringList&);
bool saveConnectionSetting(Connection* conn, ConnectionSetting* setting, TQString& grp);
bool saveConnectionSecrets(Connection* conn, ConnectionSetting* setting, TQString& grp);
bool deleteConnection(Connection* conn);
StoragePrivate* d;
};
#endif /* KNETWORKMANAGER_STORAGE_H */

File diff suppressed because it is too large Load Diff

@ -0,0 +1,140 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
* Alexander Naumov <anaumov@suse.de>, <posix.ru@gmail.com>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_TRAY_H
#define KNETWORKMANAGER_TRAY_H
#include <tqmap.h>
#include <tqtimer.h>
#include <tqtooltip.h>
#include <ksystemtray.h>
#include <kuniqueapplication.h>
#include <kpopupmenu.h>
#include <kactionclasses.h>
#include <kstdaction.h>
#include <kstdguiitem.h>
#include <tqdialog.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqprogressbar.h>
#include <tqguardedptr.h>
#include "knetworkmanager.h"
namespace ConnectionSettings
{
class Connection;
class ConnectionSetting;
}
class TQMouseEvent;
class TrayComponent;
class TrayPrivate;
class TQDialog;
class TQPushButton;
class TQLabel;
class Tray : public KSystemTray
{
Q_OBJECT
TQ_OBJECT
public:
Tray ();
~Tray ();
static Tray* getInstance();
void contextMenuAboutToShow (KPopupMenu* menu);
signals:
public slots:
void slotOfflineMode();
void slotOnlineMode();
void slotEnableWireless();
void slotDisableWireless();
void slotEditConnections();
void slotStateChanged(TQ_UINT32 state);
void slotVPNSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
void slotSecretsNeeded(ConnectionSettings::Connection* connection, ConnectionSettings::ConnectionSetting* setting, const TQStringList& hints, bool request_new);
void slotDeviceAddedNotify(Device*);
void slotDeviceRemovedNotify(Device*);
void slotStateChangedNotify(TQ_UINT32 state);
void slotUpdateDeviceState();
void slotUpdateDeviceState(NMDeviceState);
void slotNewVPNConnection();
void slotVPNBannerShow(const TQString& vpnbanner);
protected slots:
void updateDeviceTrays();
void slotAddDeviceTrayComponent(Device*);
void slotRemoveDeviceTrayComponent(Device*);
void slotDeactivateConnection(int);
void trayComponentNeedsCenterStage(TrayComponent*, bool);
void trayUiChanged();
void slotEditNotifications();
private:
void updateTrayIcon(NMDeviceState);
void updateActiveConnection(NMDeviceState);
void mousePressEvent( TQMouseEvent *e );
void createVPNTrayComponent();
void createDeviceTrayComponent(Device*);
void enterEvent (TQEvent*);
TrayPrivate* d;
};
class NewSecretsDialog : public TQDialog
{
Q_OBJECT
TQ_OBJECT
public:
NewSecretsDialog(ConnectionSettings::Connection* connection, TQWidget * parent, const char * name, bool modal = false, TQt::WFlags f = 0);
~NewSecretsDialog();
void init();
public slots:
void slotDialogEdit();
void reject();
private:
ConnectionSettings::Connection* _connection;
};
#endif /* KNETWORKMANAGER_TRAY_H */

@ -0,0 +1,85 @@
/***************************************************************************
*
* knetworkmanager-vpn_connection.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_vpn.h"
#include "knetworkmanager-nmsettings.h"
using namespace ConnectionSettings;
/*
class VPNConnection
*/
VPNConnection::VPNConnection()
: GenericConnection(NM_SETTING_VPN_SETTING_NAME)
{
// add all settings needed for a VPN connection
appendSetting(new VPN(this));
// TODO: Maybe IPv4 Setting?
}
VPN* VPNConnection::getVPNSetting() const
{
return dynamic_cast<VPN*>(getSetting(NM_SETTING_VPN_SETTING_NAME));
}
ConnectionSetting* VPNConnection::getVPNSettingConnectionCore() const
{
return getSetting(NM_SETTING_VPN_SETTING_NAME);
}
Connection* VPNConnection::duplicate()
{
VPNConnection* conn = new VPNConnection();
conn->updateSettings(this);
return conn;
}
#include "knetworkmanager-vpn_connection.moc"

@ -0,0 +1,54 @@
/***************************************************************************
*
* knetworkmanager-vpn_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPN_CONNECTION_H
#define KNETWORKMANAGER_VPN_CONNECTION_H
#include <tqmap.h>
#include <tqobject.h>
#include "knetworkmanager-generic_connection.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_vpn.h"
class TQDBusObjectPath;
namespace ConnectionSettings
{
class VPN;
class VPNConnection : public GenericConnection
{
Q_OBJECT
TQ_OBJECT
public:
VPNConnection();
VPN* getVPNSetting() const;
ConnectionSetting* getVPNSettingConnectionCore() const;
Connection* duplicate();
};
}
#endif /* KNETWORKMANAGER_VPN_CONNECTION_H */

@ -0,0 +1,75 @@
/***************************************************************************
*
* knetworkmanager-vpn_device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
// NM includes
#include <NetworkManager.h>
#include <NetworkManagerVPN.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-vpn_device.h"
#include "dbus/vpnconnectionproxy.h"
#include "knetworkmanager-hal_device_proxy.h"
class VPNDevicePrivate
{
public:
VPNDevicePrivate(TQString service, TQString obj_path)
: nmVPN(service, obj_path)
{}
~VPNDevicePrivate() {}
DBus::VPNConnectionProxy nmVPN;
};
TQ_UINT32 VPNDevice::getState()
{
TQT_DBusError err;
return d->nmVPN.getVpnState(err);
}
VPNDevice::VPNDevice (const TQString & obj_path)
: Device(obj_path)
{
d = new VPNDevicePrivate(NM_DBUS_IFACE_SETTINGS_CONNECTION, obj_path);
d->nmVPN.setConnection(TQT_DBusConnection::systemBus());
}
VPNDevice::~VPNDevice ()
{
delete d;
}
#include "knetworkmanager-vpn_device.moc"

@ -0,0 +1,53 @@
/***************************************************************************
*
* knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNDEVICE_H
#define KNETWORKMANAGER_VPNDEVICE_H
// std includes
#include <stdint.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-device.h"
class KNetworkManager;
class VPNDevicePrivate;
class VPNDevice : public Device
{
Q_OBJECT
TQ_OBJECT
public:
VPNDevice (const TQString & obj_path );
~VPNDevice ();
TQ_UINT32 getState();
private:
VPNDevicePrivate * d;
};
#endif /* KNETWORKMANAGER_VPNDEVICE_H */

@ -0,0 +1,132 @@
/***************************************************************************
*
* knetworkmanager-vpn_plugin.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
// NM includes
#include <NetworkManager.h>
#include <NetworkManagerVPN.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-tray.h"
#include "knetworkmanager-vpn_plugin.h"
#include "dbus/vpnpluginproxy.h"
#include "knetworkmanager-hal_device_proxy.h"
#include "knetworkmanager-nm_proxy.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
unsigned int current_vpn_state = 0;
extern NMDeviceState nm_device_state_global;
extern TQT_DBusObjectPath vpn_attempt_this_conn;
unsigned char vpn_new_credentials_needed = 0;
class VPNDBUSPluginPrivate
{
public:
VPNDBUSPluginPrivate(TQString service, TQString obj_path)
: nmVPNDBUS(service, obj_path)
{}
~VPNDBUSPluginPrivate() {}
DBus::VPNPluginProxy nmVPNDBUS;
};
TQ_UINT32 VPNDBUSPlugin::getState()
{
TQT_DBusError err;
return d->nmVPNDBUS.getState(err);
}
void VPNDBUSPlugin::slotStateChanged(TQ_UINT32 state)
{
current_vpn_state = state+1;
Tray* tray = Tray::getInstance();
tray->slotUpdateDeviceState(nm_device_state_global);
//emit StateChanged((NMDeviceState)state);
}
void VPNDBUSPlugin::slotLoginBanner(const TQString& banner)
{
Tray* tray = Tray::getInstance();
tray->slotVPNBannerShow(banner);
}
void VPNDBUSPlugin::slotFailure(TQ_UINT32 failure_reason)
{
printf("VPN failure code %d\n\r", failure_reason);
if ((failure_reason == 0) || (failure_reason == 1) || (failure_reason == 2)) {
// Try to connect again using cached information; request new login though
printf("Reactivate VPN connection on default device\n\r");
vpn_new_credentials_needed = 1;
int id;
TQT_DBusError err;
NMProxy* nm = NMProxy::getInstance();
TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id,"org.freedesktop.NetworkManagerUserSettings", vpn_attempt_this_conn, device, act_conn, err);
#else
nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, vpn_attempt_this_conn, device, act_conn, err);
#endif
}
}
VPNDBUSPlugin::VPNDBUSPlugin ()
: TQObject()
{
d = new VPNDBUSPluginPrivate(NM_VPN_DBUS_PLUGIN_INTERFACE, NM_VPN_DBUS_PLUGIN_PATH);
d->nmVPNDBUS.setConnection(TQT_DBusConnection::systemBus());
// Connect the state changed signal to the handler
connect(&(d->nmVPNDBUS), TQT_SIGNAL(StateChanged(TQ_UINT32)), this, TQT_SLOT(slotStateChanged(TQ_UINT32)));
// Connect the failure signal to the handler
connect(&(d->nmVPNDBUS), TQT_SIGNAL(Failure(TQ_UINT32)), this, TQT_SLOT(slotFailure(TQ_UINT32)));
// And the banner signal
connect(&(d->nmVPNDBUS), TQT_SIGNAL(LoginBanner(const TQString&)), this, TQT_SLOT(slotLoginBanner(const TQString&)));
}
VPNDBUSPlugin::~VPNDBUSPlugin ()
{
delete d;
}
#include "knetworkmanager-vpn_plugin.moc"

@ -0,0 +1,62 @@
/***************************************************************************
*
* knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNDBUSPLUGIN_H
#define KNETWORKMANAGER_VPNDBUSPLUGIN_H
// std includes
#include <stdint.h>
// KNM includes
#include "knetworkmanager.h"
class KNetworkManager;
class VPNDBUSPluginPrivate;
class VPNDBUSPlugin : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
VPNDBUSPlugin ();
~VPNDBUSPlugin ();
TQ_UINT32 getState();
private:
VPNDBUSPluginPrivate * d;
// signals:
// void StateChanged(NMDeviceState);
public slots:
void slotFailure(TQ_UINT32);
void slotStateChanged(TQ_UINT32);
void slotLoginBanner(const TQString&);
// void slotDeactivate();
};
#endif /* KNETWORKMANAGER_VPNDBUSPLUGIN_H */

@ -0,0 +1,179 @@
/***************************************************************************
*
* knetworkmanager-vpnauthenticationdialog.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <stdlib.h>
#include <kpushbutton.h>
#include <tqbuttongroup.h>
#include <tqcombobox.h>
#include <tqmessagebox.h>
#include <tqwidgetstack.h>
#include <klineedit.h>
#include <tqlabel.h>
#include <klocale.h>
#include <kdebug.h>
#include <tqobjectlist.h>
#include <tqcheckbox.h>
#include <tqfocusdata.h>
#include <kiconloader.h>
#include <tqmap.h>
#include <tqdbusobjectpath.h>
#include <tqdbuserror.h>
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnmanager.h"
#include "knetworkmanager-vpnauthenticationdialog.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-connection_setting_vpn.h"
#include "knetworkmanager-connection_setting_info.h"
extern TQT_DBusObjectPath vpn_attempt_this_conn;
using namespace ConnectionSettings;
/*
* class VPNAuthenticationDialog
*
*/
VPNAuthenticationDialog::VPNAuthenticationDialog(VPNConnection* conn, TQWidget* parent, const char* name, bool modal, WFlags fl)
: AuthenticationDialog(parent, name, modal, fl)
, _conn(conn)
{
this->setIcon(SmallIcon("encrypted", TQIconSet::Automatic));
this->setCaption(i18n("VPN Authentication for %1").tqarg(conn->getInfoSetting()->getName()));
labelPixmap->setPixmap(KGlobal::instance()->iconLoader()->loadIcon("encrypted", KIcon::Small, 32));
// nice icons
pushOK->setIconSet(SmallIcon("button_ok", TQIconSet::Automatic));
pushCancel->setIconSet(SmallIcon("button_cancel", TQIconSet::Automatic));
// we need the last widget in the focus queue
TQFocusData* foc = focusData();
TQWidget* lastFocusWidget = foc->last();
VPN* vpn = conn->getVPNSetting();
VPNService* vpnservice = VPNManager::getVPNService(vpn->getServiceType());
// get the appropriate plugin and create the authentication widget
VPNPlugin* vpnPlugin = vpnservice->getVPNPlugin();
if (vpnPlugin)
{
_vpnAuthWidget = vpnPlugin->CreateAuthenticationWidget(widgetStack);
if (_vpnAuthWidget)
{
_vpnAuthWidget->setVPNData(conn->getVPNSetting()->getRoutes(), conn->getVPNSetting()->getData());
widgetStack->raiseWidget(_vpnAuthWidget);
}
}
/*
the widgets inside the authenticationwidget are now in the focus queue
==> we can now search the first widget inside the authenticationwidget
which has to get the focus
*/
TQWidget* widget = foc->home();
for (int i = 0; i < foc->count(); ++i)
{
if (widget == lastFocusWidget)
{
// the next one is the first widget inside the authwidget
widget = foc->next();
break;
}
widget = foc->next();
}
if (widget)
widget->setFocus();
// resize
this->resize(tqminimumSizeHint());
}
VPNAuthenticationDialog::~VPNAuthenticationDialog()
{
}
bool VPNAuthenticationDialog::close(bool alsoDelete)
{
// no secrets provided, tell NM
_conn->slotSecretsError();
return AuthenticationDialog::close(alsoDelete);
}
void VPNAuthenticationDialog::ok()
{
// Good, we have new secrets now, update the settings
TQMap<TQString, TQString> mypwds;
mypwds = _vpnAuthWidget->getPasswords();
ConnectionSetting* propcore = _conn->getVPNSettingConnectionCore();
SettingsMap othersettingsmap = propcore->toMap();
// Pull the username and gateway out of mypwds to stuff in the NM standard settings matrix
othersettingsmap.insert("user", TQT_DBusData::fromString(mypwds["user"]));
mypwds.erase("user");
othersettingsmap.insert("domain", TQT_DBusData::fromString(mypwds["domain"]));
mypwds.erase("domain");
// othersettingsmap.erase("Commit to disk");
// if (chkStorePasswordsPermanent->isChecked() == true) {
// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("true"));
// }
// else {
// othersettingsmap.insert("Commit to disk", TQT_DBusData::fromString("false"));
// }
propcore->fromMap(othersettingsmap);
VPN* prop = dynamic_cast<VPN*>(propcore);
prop->setSecrets(mypwds);
_conn->slotSecretsProvided(prop);
TQDialog::done(0);
}
void VPNAuthenticationDialog::setPasswords(TQString name, TQString value) {
if (value.length() > 0) {
chkStorePasswordsPermanent->setChecked(true);
_vpnAuthWidget->setPasswords(name, value);
}
}
void VPNAuthenticationDialog::cancel()
{
/*
TQStringList x;
emit done (true, x, false, false);
TQDialog::done(1);*/
printf("Attempting to deactivate VPN connection...\n\r");
// Disconnect the attempted connection
_conn->slotSecretsError();
// Quit the dialog
TQDialog::done(1);
}
#include "knetworkmanager-vpnauthenticationdialog.moc"

@ -0,0 +1,69 @@
/***************************************************************************
*
* knetworkmanager-authenticationdialog.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H
#define KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H
#include <tqdir.h>
#include <tqobject.h>
#include <kprocess.h>
#include <kconfig.h>
#include "knetworkmanager.h"
#include "vpnauthentication.h"
#include "knetworkmanager-vpnplugin.h"
#include "knetworkmanager-vpnmanager.h"
class KNetworkManager;
class ManageConnectionsDialog;
class VPNService;
namespace ConnectionSettings
{
class VPNConnection;
}
class VPNAuthenticationDialog : public AuthenticationDialog
{
Q_OBJECT
TQ_OBJECT
public:
VPNAuthenticationDialog(ConnectionSettings::VPNConnection* conn = NULL, TQWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
~VPNAuthenticationDialog();
void setPasswords(TQString name, TQString value);
virtual bool close(bool);
protected slots:
void ok();
void cancel();
private:
VPNAuthenticationWidget* _vpnAuthWidget;
ConnectionSettings::VPNConnection* _conn;
signals:
void done(bool, TQStringList &, bool, bool);
};
#endif /* KNETWORKMANAGER_VPNAUTHENTICATIONDIALOG_H */

@ -0,0 +1,107 @@
/***************************************************************************
*
* knetworkmanager-vpnmanager.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#define SERVICE_DIR "/etc/NetworkManager/VPN"
#include <klocale.h>
#include <tqdir.h>
#include <kdebug.h>
#include <kconfig.h>
#include "knetworkmanager-vpnmanager.h"
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnplugin.h"
/*
* class VPNManager
*
*/
VPNServiceList
VPNManager::getVPNServices ()
{
bool status = false;
VPNServiceList list;
TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files);
TQStringList services = serviceDir.entryList ().grep (".name", true);
if (services.count () > 0)
{
status = true;
// read in all available Services
for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) {
TQString service = SERVICE_DIR + TQString ("/") + *i;
KConfig* kconfig = new KConfig (service, true, true, "config");
kconfig->setGroup ("VPN Connection");
kdDebug() << "VPN Service " << kconfig->readEntry ("name", TQString()).ascii() << endl;
// create new VPNService Object
VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance()));
if (!vpnservice->getVPNPlugin())
delete vpnservice;
else
list.push_back(vpnservice);
delete kconfig;
}
}
return list;
}
VPNService*
VPNManager::getVPNService(TQString service_type)
{
bool status = false;
VPNServiceList list;
TQDir serviceDir(SERVICE_DIR, TQString(), TQDir::Name|TQDir::IgnoreCase, TQDir::Files);
TQStringList services = serviceDir.entryList ().grep (".name", true);
if (services.count () > 0)
{
status = true;
// read in all available Services
for (TQStringList::Iterator i = services.begin (); i != services.end (); ++i) {
TQString service = SERVICE_DIR + TQString ("/") + *i;
KConfig* kconfig = new KConfig (service, true, true, "config");
kconfig->setGroup ("VPN Connection");
if (kconfig->readEntry ("service", TQString()) == service_type)
{
// create new VPNService Object
VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", TQString()), kconfig->readEntry ("service", TQString()), TQT_TQOBJECT(KNetworkManager::getInstance()));
if (!vpnservice->getVPNPlugin())
delete vpnservice;
else
return vpnservice;
}
}
}
return NULL;
}
#include "knetworkmanager-vpnmanager.moc"

@ -0,0 +1,53 @@
/***************************************************************************
*
* knetworkmanager-vpnmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Helmut Schaa <hschaa@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNMANAGER_H
#define KNETWORKMANAGER_VPNMANAGER_H
#include <NetworkManager/NetworkManager.h>
#include <NetworkManager/NetworkManagerVPN.h>
#include <tqobject.h>
#include <tqguardedptr.h>
#include "knetworkmanager.h"
#include "knetworkmanager-vpnplugin.h"
class KNetworkManager;
class VPNService;
typedef TQValueList<VPNService*> VPNServiceList;
class VPNManager : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
static VPNService* getVPNService(TQString);
static VPNServiceList getVPNServices ();
};
#endif /* KNETWORKMANAGER_VPNMANAGER_H */

@ -0,0 +1,128 @@
/***************************************************************************
*
* knetworkmanager-vpnplugin.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqwidget.h>
#include "knetworkmanager-vpnplugin.h"
/***********************
* class VPNConfigWidget
***********************/
VPNConfigWidget::~VPNConfigWidget()
{
}
VPNConfigWidget::VPNConfigWidget(TQWidget* parent, const char* name)
: TQWidget(parent, name)
{
}
void VPNConfigWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/)
{
}
TQMap<TQString, TQString> VPNConfigWidget::getVPNProperties()
{
return TQMap<TQString, TQString>();
}
TQStringList VPNConfigWidget::getVPNRoutes()
{
return TQStringList();
}
bool VPNConfigWidget::hasChanged()
{
return true;
}
bool VPNConfigWidget::isValid(TQStringList& /*err_msg*/)
{
return true;
}
/******************************
* class VPNAuthentiactionWidget
******************************/
VPNAuthenticationWidget::VPNAuthenticationWidget(TQWidget* parent, const char* name)
: TQWidget(parent, name)
{
}
VPNAuthenticationWidget::~VPNAuthenticationWidget()
{
}
TQMap<TQString, TQString> VPNAuthenticationWidget::getPasswords()
{
return TQMap<TQString, TQString>();
}
void VPNAuthenticationWidget::setPasswords(TQString name, TQString value)
{
}
void VPNAuthenticationWidget::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& /*properties*/)
{
}
bool VPNAuthenticationWidget::needsUserInteraction()
{
return true;
}
/****************
* class VPNPlugin
****************/
VPNPlugin::VPNPlugin(TQObject* parent, const char* name, const TQStringList& args)
: Plugin(parent, name, args)
{
}
VPNPlugin::~VPNPlugin()
{
}
VPNConfigWidget* VPNPlugin::CreateConfigWidget(TQWidget*)
{
return NULL;
}
VPNAuthenticationWidget* VPNPlugin::CreateAuthenticationWidget(TQWidget*)
{
return NULL;
}
#include "knetworkmanager-vpnplugin.moc"

@ -0,0 +1,79 @@
/***************************************************************************
*
* knetworkmanager-vpnplugin.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNPLUGIN_H
#define KNETWORKMANAGER_VPNPLUGIN_H
#include <tqwidget.h>
#include <tqmap.h>
#include <tqdbusdata.h>
#include <tqdbusvariant.h>
#include "knetworkmanager-plugin.h"
#define KNETWORKMANAGER_VPNPLUGIN "KNetworkManager/VPNPlugin"
class VPNConfigWidget : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
virtual ~VPNConfigWidget();
VPNConfigWidget(TQWidget* parent = NULL, const char* name = NULL);
virtual void setVPNData(const TQStringList&, const TQMap<TQString,TQString>&);
virtual TQMap<TQString, TQString> getVPNProperties();
virtual TQStringList getVPNRoutes();
virtual bool hasChanged();
virtual bool isValid(TQStringList&);
};
class VPNAuthenticationWidget : public TQWidget
{
Q_OBJECT
TQ_OBJECT
public:
virtual ~VPNAuthenticationWidget();
VPNAuthenticationWidget(TQWidget* parent = NULL, const char* name = NULL);
virtual void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&);
virtual TQMap<TQString, TQString> getPasswords();
virtual void setPasswords(TQString value, TQString data);
virtual bool needsUserInteraction();
};
class VPNPlugin : public Plugin
{
Q_OBJECT
TQ_OBJECT
public:
VPNPlugin(TQObject*, const char*, const TQStringList&);
virtual ~VPNPlugin();
virtual VPNConfigWidget* CreateConfigWidget(TQWidget* parent = 0);
virtual VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent = 0);
};
#endif /* KNETWORKMANAGER_VPNPLUGIN_H */

@ -0,0 +1,123 @@
/***************************************************************************
*
* knetworkmanager-vpnservice.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#define SERVICE_DIR "/etc/NetworkManager/VPN"
#include <stdlib.h>
#include <kconfig.h>
#include <tqdom.h>
#include <tqdir.h>
#include <klocale.h>
#include <kdebug.h>
#include <kstddirs.h>
#include <kprocess.h>
#include <kconfig.h>
#include <kplugininfo.h>
#include "knetworkmanager-pluginmanager.h"
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnplugin.h"
/*
* class VPNService
*
*/
VPNService::VPNService(const TQString& serviceName, const TQString& service, TQObject* parent, const char* name)
: TQObject(parent, name)
{
_name = serviceName;
_service = service;
_vpnPlugin = NULL;
// query if a plugin for this vpn service is available
PluginManager* plugMan = PluginManager::getInstance();
if (plugMan)
{
TQStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName);
if (list.size() > 0)
{
// get the first VPN Plugin handling our VPNService
VPNPlugin* vpnPlugin = dynamic_cast<VPNPlugin*>( plugMan->getPlugin(list.first()) );
if (vpnPlugin)
{
kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").tqarg(list.first()).tqarg(serviceName) << endl;
_vpnPlugin = vpnPlugin;
}
}
}
}
VPNService::~VPNService()
{
}
TQString VPNService::getIcon()
{
if (!_vpnPlugin.isNull())
{
PluginManager* plugMan = PluginManager::getInstance();
if (plugMan)
{
const KPluginInfo* info = plugMan->getPluginInfo(_vpnPlugin);
if (info)
{
TQString icon = info->icon();
if (!icon.isEmpty())
return icon;
}
}
}
return "encrypted";
}
VPNPlugin* VPNService::getVPNPlugin()
{
return _vpnPlugin;
}
TQString VPNService::getService() const
{
return _service;
}
TQString VPNService::getDisplayName() const
{
const KPluginInfo* info = NULL;
PluginManager* plugMan = PluginManager::getInstance();
if (_vpnPlugin && plugMan)
if ( (info = plugMan->getPluginInfo(_vpnPlugin)) )
if (!info->name().isEmpty())
return info->name();
return _name;
}
TQString VPNService::getName() const
{
return _name;
}
#include "knetworkmanager-vpnservice.moc"

@ -0,0 +1,63 @@
/***************************************************************************
*
* knetworkmanager-vpnservice.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Helmut Schaa <hschaa@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPN_SERVICE_H
#define KNETWORKMANAGER_VPN_SERVICE_H
#include <NetworkManager/NetworkManager.h>
#include <NetworkManager/NetworkManagerVPN.h>
#include <tqobject.h>
#include <tqguardedptr.h>
#include "knetworkmanager.h"
#include "knetworkmanager-vpnplugin.h"
class KNetworkManager;
class VPNService;
class KConfigGroup;
class VPNService : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
VPNService(const TQString& serviceName, const TQString& service, TQObject* parent, const char* name = 0);
~VPNService();
TQString getDisplayName() const;
TQString getName() const;
TQString getService() const;
VPNPlugin* getVPNPlugin();
TQString getIcon();
private:
TQString _name;
TQString _service;
TQGuardedPtr<VPNPlugin> _vpnPlugin;
};
#endif /* KNETWORKMANAGER_VPN_SERVICE_H */

@ -0,0 +1,84 @@
/***************************************************************************
*
* knetworkmanager-wired_connection.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "knetworkmanager-nmsettings.h"
using namespace ConnectionSettings;
/*
class WiredConnection
*/
WiredConnection::WiredConnection()
: GenericConnection(NM_SETTING_WIRED_SETTING_NAME)
{
// add all settings needed for a wired connection
appendSetting(new Wired(this));
appendSetting(new IPv4(this));
}
Wired* WiredConnection::getWiredSetting() const
{
return dynamic_cast<Wired*>(getSetting(NM_SETTING_WIRED_SETTING_NAME));
}
IPv4* WiredConnection::getIPv4Setting() const
{
return dynamic_cast<IPv4*>(getSetting("ipv4"));
}
Connection* WiredConnection::duplicate()
{
WiredConnection* conn = new WiredConnection();
conn->updateSettings(this);
return conn;
}
#include "knetworkmanager-wired_connection.moc"

@ -0,0 +1,55 @@
/***************************************************************************
*
* knetworkmanager-wired_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRED_CONNECTION_H
#define KNETWORKMANAGER_WIRED_CONNECTION_H
#include <tqmap.h>
#include <tqobject.h>
#include <nm-setting-wired.h>
#include "knetworkmanager-generic_connection.h"
#include "knetworkmanager-connection_setting.h"
class TQDBusObjectPath;
namespace ConnectionSettings
{
class Wired;
class IPv4;
class WiredConnection : public GenericConnection
{
Q_OBJECT
TQ_OBJECT
public:
WiredConnection();
Wired* getWiredSetting() const;
IPv4* getIPv4Setting() const;
Connection* duplicate();
};
}
#endif /* KNETWORKMANAGER_WIRED_CONNECTION_H */

@ -0,0 +1,86 @@
/***************************************************************************
*
* knetworkmanager-wired_device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
// TQT_DBus includes
#include <tqdbuserror.h>
#include <tqdbusconnection.h>
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-wired_device.h"
#include "dbus/wiredproxy.h"
#include "knetworkmanager-hal_device_proxy.h"
class WiredDevicePrivate
{
public:
WiredDevicePrivate(TQString service, TQString obj_path)
: nmWired(service, obj_path)
{}
~WiredDevicePrivate() {}
DBus::WiredDeviceProxy nmWired;
};
TQString WiredDevice::getHwAddress()
{
TQT_DBusError err;
return d->nmWired.getHwAddress(err);
}
TQ_UINT32 WiredDevice::getSpeed()
{
TQT_DBusError err;
return d->nmWired.getSpeed(err);
}
bool WiredDevice::getCarrier() const
{
TQT_DBusError err;
return d->nmWired.getCarrier(err);
}
WiredDevice::WiredDevice (const TQString & obj_path)
: Device(obj_path)
{
d = new WiredDevicePrivate(NM_DBUS_SERVICE, obj_path);
d->nmWired.setConnection(TQT_DBusConnection::systemBus());
}
WiredDevice::~WiredDevice ()
{
delete d;
}
#include "knetworkmanager-wired_device.moc"

@ -0,0 +1,55 @@
/***************************************************************************
*
* knetworkmanager-wired_device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIREDDEVICE_H
#define KNETWORKMANAGER_WIREDDEVICE_H
// std includes
#include <stdint.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-device.h"
class KNetworkManager;
class WiredDevicePrivate;
class WiredDevice : public Device
{
Q_OBJECT
TQ_OBJECT
public:
WiredDevice (const TQString & obj_path );
~WiredDevice ();
TQString getHwAddress();
TQ_UINT32 getSpeed();
bool getCarrier() const;
private:
WiredDevicePrivate * d;
};
#endif /* KNETWORKMANAGER_WIREDDEVICE_H */

@ -0,0 +1,162 @@
/***************************************************************************
*
* knetworkmanager-wired_device_tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// TQt includes
#include <tqevent.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqbitmap.h>
#include <tqimage.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqstring.h>
// KDE includes
#include <kdebug.h>
#include <klocale.h>
#include <kiconloader.h>
// TQt DBus
#include <tqdbusobjectpath.h>
// KNM includes
#include "knetworkmanager-wired_device_tray.h"
#include "knetworkmanager-wired_device.h"
#include "knetworkmanager-menuitem.h"
#include "knetworkmanager-menu_subhead.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wired.h"
#include "knetworkmanager-connection_settings_dialog.h"
using namespace ConnectionSettings;
class WiredDeviceTrayPrivate
{
public:
WiredDeviceTrayPrivate() {}
~WiredDeviceTrayPrivate() {}
WiredDevice* dev;
};
void WiredDeviceTray::newConnection()
{
// create a new wired connection
Connection* conn = new WiredConnection();
// edit the new connection
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
dlg->show();
}
void WiredDeviceTray::addMenuItems(KPopupMenu* menu)
{
ConnectionStore* connectionStore = ConnectionStore::getInstance();
// device title
Subhead* subhead = new Subhead (menu, "subhead", TQString("Wired Connection (%1)").tqarg(d->dev->getInterface()), SmallIcon("wired", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
// bolding subhead instead
//menu->insertSeparator();
if (!d->dev->getCarrier())
{
// no carrier -> do not show any connections
subhead = new Subhead(menu, "subhead2", i18n("Cable disconnected"), SmallIcon("no", TQIconSet::Automatic));
menu->insertItem(subhead, -1, -1);
}
else
{
NMProxy* nm = NMProxy::getInstance();
Connection* active_conn = nm->getActiveConnection(d->dev);
if (active_conn)
kdDebug() << active_conn->getObjectPath().data() << endl;
// get all available Connections for wired devices
TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_WIRED_SETTING_NAME);
int connectionItems = 0;
for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
{
WiredConnection* wiredconn = dynamic_cast<WiredConnection*>(*it);
if (wiredconn)
{
// wired connection found :)
Info* info = wiredconn->getInfoSetting();
IPv4* ip = wiredconn->getIPv4Setting();
// lets create a nice name for this connection
if (info)
{
TQString title = info->getName();
if (ip)
title += TQString(" (%1)").tqarg(ip->getMethod() == IPv4::METHOD_DHCP ? i18n("DHCP") : i18n("Manual IP config"));
NetworkMenuItem* item = new NetworkMenuItem(d->dev, wiredconn, TQT_TQOBJECT(menu));
connectionItems += 1;
int id = menu->insertItem(title, item, TQT_SLOT(slotActivate()));
menu->setItemChecked(id, ((*it) == active_conn));
}
}
}
if ( connectionItems == 0) {
// menu->insertSeparator();
int id = menu->insertItem(SmallIcon("filenew", TQIconSet::Automatic), i18n("Create new wired connection"), this, TQT_SLOT(newConnection()));
}
// bring the device down
KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
if (deactivate)
deactivate->plug(menu);
}
}
WiredDeviceTray::WiredDeviceTray (WiredDevice* dev, KSystemTray * parent, const char * name )
: DeviceTrayComponent (dev, parent, name)
{
d = new WiredDeviceTrayPrivate();
d->dev = dev;
setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_device_wired");
}
WiredDeviceTray::~WiredDeviceTray ()
{
delete d;
}
#include "knetworkmanager-wired_device_tray.moc"

@ -0,0 +1,57 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRED_DEVICE_TRAY_H
#define KNETWORKMANAGER_WIRED_DEVICE_TRAY_H
// KNM includes
#include "devicetraycomponent.h"
#include "knetworkmanager.h"
// predefs
class WiredDevice;
class WiredDeviceTrayPrivate;
class WiredDeviceTray : public DeviceTrayComponent
{
Q_OBJECT
TQ_OBJECT
public:
WiredDeviceTray (WiredDevice*, KSystemTray * parent = 0, const char * name = 0);
~WiredDeviceTray ();
void addMenuItems(KPopupMenu* menu);
public slots:
void newConnection();
private:
WiredDeviceTrayPrivate* d;
};
#endif /* KNETWORKMANAGER_WIRED_DEVICE_TRAY_H */

@ -0,0 +1,94 @@
/***************************************************************************
*
* knetworkmanager-wireless_connection.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
/* qt headers */
#include <tqhostaddress.h>
#include <tqvariant.h>
#include <tqvaluelist.h>
/* kde headers */
#include <kdebug.h>
#include <klocale.h>
/* TQDbus headers */
#include <tqdbusconnection.h>
#include <tqdbusobjectpath.h>
#include <tqdbusdata.h>
#include <tqdbusdatamap.h>
#include <tqdbusvariant.h>
/* NM headers */
#include <NetworkManager.h>
/* knetworkmanager headers */
#include "knetworkmanager.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-connection_dbus.h"
#include "knetworkmanager-connection_secrets_dbus.h"
#include "knetworkmanager-connection_setting.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_ipv4.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "knetworkmanager-nmsettings.h"
using namespace ConnectionSettings;
/*
class WirelessConnection
*/
WirelessConnection::WirelessConnection()
: GenericConnection(NM_SETTING_WIRELESS_SETTING_NAME)
{
// create all settings needed for a wireless connection
appendSetting(new IPv4(this));
appendSetting(new Wireless(this));
appendSetting(new WirelessSecurity(this));
appendSetting(new IEEE8021x(this));
}
Wireless* WirelessConnection::getWirelessSetting() const
{
return dynamic_cast<Wireless*>(getSetting(NM_SETTING_WIRELESS_SETTING_NAME));
}
WirelessSecurity* WirelessConnection::getWirelessSecuritySetting() const
{
return dynamic_cast<WirelessSecurity*>(getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME));
}
IPv4* WirelessConnection::getIPv4Setting() const
{
return dynamic_cast<IPv4*>(getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME));
}
Connection* WirelessConnection::duplicate()
{
WirelessConnection* conn = new WirelessConnection();
conn->updateSettings(this);
return conn;
}
#include "knetworkmanager-wireless_connection.moc"

@ -0,0 +1,59 @@
/***************************************************************************
*
* knetworkmanager-wireless_connection.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESS_CONNECTION_H
#define KNETWORKMANAGER_WIRELESS_CONNECTION_H
#include <tqmap.h>
#include <tqobject.h>
#include <nm-setting-wireless.h>
#include "knetworkmanager-generic_connection.h"
#include "knetworkmanager-connection_setting.h"
class TQDBusObjectPath;
namespace ConnectionSettings
{
class Info;
class Wireless;
class WirelessSecurity;
class IPv4;
typedef TQMap<TQString, SettingsMap> ConnectionMap;
class WirelessConnection : public GenericConnection
{
Q_OBJECT
TQ_OBJECT
public:
WirelessConnection();
Wireless* getWirelessSetting() const;
WirelessSecurity* getWirelessSecuritySetting() const;
IPv4* getIPv4Setting() const;
Connection* duplicate();
};
}
#endif /* KNETWORKMANAGER_WIRELESS_CONNECTION_H */

@ -0,0 +1,207 @@
/***************************************************************************
*
* knetworkmanager-device.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-wireless_device.h"
#include "dbus/accesspointproxy.h"
#include "dbus/wirelessproxy.h"
#include "knetworkmanager-accesspoint.h"
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
#include <tqmap.h>
#include <tqvaluelist.h>
// TQt-Dbus includes
#include <tqdbusconnection.h>
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
class WirelessDevicePrivate
{
public:
WirelessDevicePrivate(TQString service, TQString obj_path)
: nmWireless(service, obj_path)
{}
~WirelessDevicePrivate()
{
// cleanup the AP-list
for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it)
{
AccessPoint* p = it.data();
delete p;
}
}
DBus::WirelessDeviceProxy nmWireless;
TQMap<TQT_DBusObjectPath, AccessPoint *> aps;
};
WirelessDevice::WirelessDevice (const TQString & obj_path)
: Device(obj_path)
{
d = new WirelessDevicePrivate(NM_DBUS_SERVICE, obj_path);
d->nmWireless.setConnection(TQT_DBusConnection::systemBus());
// get notified when the devices properties change
connect(&(d->nmWireless), TQT_SIGNAL(PropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)), this, TQT_SLOT(slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>&)));
connect(&(d->nmWireless), TQT_SIGNAL(AccessPointAdded(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointAdded(const TQT_DBusObjectPath&)));
connect(&(d->nmWireless), TQT_SIGNAL(AccessPointRemoved(const TQT_DBusObjectPath&)), this, TQT_SLOT(slotAccessPointRemoved(const TQT_DBusObjectPath&)));
}
WirelessDevice::~WirelessDevice ()
{
delete d;
}
void WirelessDevice::slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties)
{
// TODO: optimization: emit different signals for each property
emit propertiesChanged();
}
void WirelessDevice::slotAccessPointAdded(const TQT_DBusObjectPath& obj_path)
{
AccessPoint* ap = 0;
if ( !d->aps.contains(obj_path)) {
// we do not know this AP yet, add it to the list
ap = new AccessPoint(obj_path, this, "access_point_object");
d->aps.insert(obj_path, ap);
}
else
ap = d->aps[obj_path];
// notify about the new accesspoint
emit accessPointAdded(ap);
}
void WirelessDevice::slotAccessPointRemoved(const TQT_DBusObjectPath& obj_path)
{
AccessPoint* ap = 0;
if ( d->aps.contains(obj_path)) {
ap = d->aps[obj_path];
// notify about the AP removal
emit accessPointRemoved(obj_path);
// remove the appropriate AP from our list
d->aps.remove(obj_path);
delete ap;
}
else
{
// nothing we can do here
kdDebug() << k_funcinfo << "NM requests removal of unknown AP " << obj_path << endl;
}
}
TQValueList<AccessPoint*> WirelessDevice::accessPoints()
{
// update our AP list
if (d->aps.isEmpty()) {
updateAPList();
}
return d->aps.values();
}
void WirelessDevice::updateAPList()
{
TQT_DBusError err;
TQValueList<TQT_DBusObjectPath> aps;
// get the APs from NM
if (d->nmWireless.GetAccessPoints(aps, err))
{
// for each AP
for (TQValueList<TQT_DBusObjectPath>::iterator it = aps.begin(); it != aps.end(); ++it)
{
// create an AP-object for each objectpath
if (d->aps.contains(*it)) {
continue;
}
AccessPoint* ap = new AccessPoint(*it, this, "access_point_object");
d->aps.insert(*it, ap);
}
}
else
kdWarning() << k_funcinfo << "Could not get a list of wireless accesspoints over DBus." << endl;
}
TQValueList<AccessPoint*> WirelessDevice::accessPointsForEssid( TQByteArray essid)
{
TQValueList<AccessPoint*> aps;
// the DBus proxy is shared
for (TQMap<TQT_DBusObjectPath, AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
AccessPoint * ap = it.data();
if (essid.isNull() || (ap && ap->getSsidByteArray() == essid))
aps.append(ap);
}
return aps;
}
AccessPoint * WirelessDevice::getActiveAccessPoint()
{
TQT_DBusError err;
TQT_DBusObjectPath obj_path;
AccessPoint * ap = 0;
//fixme, listen to signal and use cached value
obj_path = d->nmWireless.getActiveAccessPoint(err);
if (!obj_path.isEmpty()) {
if (d->aps.contains(obj_path)) {
ap = d->aps[obj_path];
} else {
kdWarning() << k_funcinfo << "No object for active access point found!" << endl;
}
}
return ap;
}
TQ_UINT32 WirelessDevice::getWirelessCapabilities() const
{
TQT_DBusError err;
return d->nmWireless.getWirelessCapabilities(err);
}
TQ_UINT32 WirelessDevice::getBitrate() const
{
TQT_DBusError err;
return d->nmWireless.getBitrate(err);
}
#include "knetworkmanager-wireless_device.moc"

@ -0,0 +1,70 @@
/***************************************************************************
*
* knetworkmanager-device.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESS_DEVICE_H
#define KNETWORKMANAGER_WIRELESS_DEVICE_H
#include "knetworkmanager.h"
#include "knetworkmanager-device.h"
#include <stdint.h>
#include <tqdbusvariant.h>
class KNetworkManager;
class AccessPoint;
class WirelessDevicePrivate;
class WirelessDevice : public Device
{
Q_OBJECT
TQ_OBJECT
public:
WirelessDevice (const TQString & obj_path );
~WirelessDevice ();
TQ_UINT32 getWirelessCapabilities() const;
TQValueList<AccessPoint*> accessPointsForEssid(TQByteArray essid = TQByteArray());
TQValueList<AccessPoint*> accessPoints();
AccessPoint * getActiveAccessPoint();
TQ_UINT32 getBitrate() const;
public slots:
void slotPropertiesChanged(const TQMap<TQString, TQT_DBusVariant>& properties);
void slotAccessPointAdded(const TQT_DBusObjectPath&);
void slotAccessPointRemoved(const TQT_DBusObjectPath&);
signals:
void propertiesChanged();
void accessPointAdded(AccessPoint *);
void accessPointRemoved(const TQString &);
private:
void updateAPList();
WirelessDevicePrivate * d;
};
#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_H */

@ -0,0 +1,391 @@
/***************************************************************************
*
* knetworkmanager-wireless_device_tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// TQt includes
#include <tqevent.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqbitmap.h>
#include <tqimage.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <tqstring.h>
#include <tqguardedptr.h>
// KDE includes
#include <kdebug.h>
#include <kiconloader.h>
#include <klocale.h>
#include <knotifyclient.h>
// QT DBus
#include <tqdbuserror.h>
#include <tqdbusobjectpath.h>
// KNM includes
#include "knetworkmanager-wireless_device_tray.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-wireless_menuitem.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-menu_subhead.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-wireless_manager.h"
#include "knetworkmanager-connection_settings_dialog.h"
using namespace ConnectionSettings;
extern char use_new_wireless_essid;
extern TQByteArray new_wireless_essid;
class WirelessDeviceTrayPrivate
{
public:
WirelessDeviceTrayPrivate() :dev(0), activeAccessPoint(0) { }
~WirelessDeviceTrayPrivate() {}
WirelessDevice* dev;
TQGuardedPtr<AccessPoint> activeAccessPoint;
};
TQStringList WirelessDeviceTray::getToolTipText()
{
TQStringList tooltip = DeviceTrayComponent::getToolTipText();
AccessPoint * ap = d->dev->getActiveAccessPoint();
if (ap)
tooltip.append(i18n("Network: %1").tqarg(ap->getDisplaySsid()));
return tooltip;
}
void WirelessDeviceTray::newConnection()
{
// create a new wireless connection
Connection* conn = new WirelessConnection();
// open a dialog for editing the connection
use_new_wireless_essid = 0; // deactivate autofill for now
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
dlg->show();
}
bool WirelessDeviceTray::findMatchingNetwork(const WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net)
{
Wireless* wireless = conn->getWirelessSetting();
WirelessSecurity* security = conn->getWirelessSecuritySetting();
if (!wireless && !security)
return false;
for (TQValueList<WirelessNetwork>::ConstIterator it = nets.begin(); it != nets.end(); ++it)
{
if (wireless->getEssid() == (*it).getSsid())
{
net = *it;
return true;
}
}
return false;
}
WirelessConnection* WirelessDeviceTray::findMatchingConnection(const WirelessNetwork& net, const TQValueList<WirelessConnection*>& connections)
{
// try to find a connection matching this network
for (TQValueList<WirelessConnection*>::ConstIterator it = connections.begin(); it != connections.end(); ++it)
{
Wireless* wireless = (*it)->getWirelessSetting();
WirelessSecurity* security = (*it)->getWirelessSecuritySetting();
// should not happen but its ever better to check
if (!wireless || !security)
continue;
if (wireless->getEssid() == net.getSsid())
{
return *it;
}
}
return NULL;
}
void WirelessDeviceTray::addWirelessNetworks(KPopupMenu* menu)
{
printf("Updating wireless network list\n\r");
// get all wireless networks
TQValueList<WirelessNetwork> nets = WirelessManager::getWirelessNetworks(d->dev);
// get all wireless connections
TQValueList<WirelessConnection*> conns = WirelessManager::getWirelessConnections();
// get the currently active connection
NMProxy* nm = NMProxy::getInstance();
Connection* active_conn = nm->getActiveConnection(d->dev);
if (active_conn)
kdDebug() << active_conn->getObjectPath().data() << endl;
// add all wireless connections in range
// (we may have more then one connection per network)
for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
{
WirelessNetworkItem* wirelessNetworkItem;
WirelessNetwork net;
// only show connections which are in range
if ( !findMatchingNetwork(*it, nets, net) )
continue;
wirelessNetworkItem = new WirelessNetworkItem (menu,
d->dev,
net,
*it,
false);
int id = menu->insertItem (wirelessNetworkItem, -1, -1);
menu->setItemChecked(id, ((Connection*)(*it) == active_conn));
menu->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate()));
}
// now add all connections which are not in range to a submenu
TQPopupMenu* popup = new TQPopupMenu(menu);
uint networkItemsAdded = 0;
for (TQValueList<WirelessConnection*>::iterator it = conns.begin(); it != conns.end(); ++it)
{
WirelessNetworkItem* wirelessNetworkItem;
WirelessNetwork net;
// only show connections which are out of range
if ( findMatchingNetwork(*it, nets, net) )
continue;
Info* info = (*it)->getInfoSetting();
Wireless* wireless = (*it)->getWirelessSetting();
if (!info || !wireless)
continue;
wirelessNetworkItem = new WirelessNetworkItem (menu,
d->dev,
net,
*it,
false);
int id = popup->insertItem (wirelessNetworkItem, -1, -1);
popup->connectItem(id, wirelessNetworkItem, TQT_SLOT(slotActivate()));
networkItemsAdded += 1;
}
if (networkItemsAdded) {
menu->insertSeparator();
menu->insertItem(i18n("Connect to saved network"), popup);
}
// // List available unsaved networks
TQPopupMenu* newpopup = new TQPopupMenu(menu);
WirelessConnection* newconn;
uint newnetworkItemsAdded = 0;
TQValueList<WirelessNetwork> newnets = WirelessManager::getWirelessNetworks(0, WirelessNetwork::MATCH_SSID);
for (TQValueList<WirelessNetwork>::Iterator it = newnets.begin(); it != newnets.end(); ++it)
{
// Only display networks with no existing connnection
if ( findMatchingConnection(*it, conns) != NULL)
continue;
WirelessNetworkItem* wirelessNetworkItem;
wirelessNetworkItem = new WirelessNetworkItem (menu,
d->dev,
*it,
NULL,
false);
int id = newpopup->insertItem (wirelessNetworkItem, -1, -1);
newpopup->connectItem(id, this, TQT_SLOT(newConnection()));
newnetworkItemsAdded += 1;
}
if (newnetworkItemsAdded) {
menu->insertSeparator();
menu->insertItem(i18n("Connect to new network"), newpopup);
}
// Signal done with wireless menu
//menu->insertSeparator();
}
void WirelessDeviceTray::addMenuItems(KPopupMenu* menu)
{
NMProxy* nm = NMProxy::getInstance();
TQT_DBusError err;
// device title
Subhead* subhead = new Subhead (menu, "subhead", TQString("Wireless Connection (%1)").tqarg(d->dev->getInterface()), SmallIcon("wireless", TQIconSet::Automatic));
menu->insertItem (subhead, -1, -1);
// bolding subhead instead
//menu->insertSeparator();
if (!nm->getWirelessEnabled(err))
{
// wireless disabled -> do not show any connections
subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled"), SmallIcon("no", TQIconSet::Automatic));
menu->insertItem(subhead, -1, -1);
}
else if (!nm->getWirelessHardwareEnabled(err))
{
// wireless disabled -> do not show any connections
subhead = new Subhead(menu, "subhead2", i18n("Wireless disabled by Killswitch"), SmallIcon("no", TQIconSet::Automatic));
menu->insertItem(subhead, -1, -1);
}
else
{
// networks
addWirelessNetworks(menu);
// bring the device down
KAction* deactivate = tray()->actionCollection()->action("deactivate_device");
if (deactivate)
deactivate->plug(menu);
}
menu->insertSeparator();
}
void WirelessDeviceTray::slotUpdateDeviceState(NMDeviceState state)
{
slotCheckActiveAccessPoint();
if (state == NM_DEVICE_STATE_ACTIVATED)
{
// trigger an update of the connections seen bssids property
AccessPoint * ap = d->dev->getActiveAccessPoint();
if (ap) {
int strength = ap->getStrength();
if (strength > 80)
setPixmapForState((NMDeviceState)state, "nm_signal_100");
else if (strength > 55)
setPixmapForState((NMDeviceState)state, "nm_signal_75");
else if (strength > 30)
setPixmapForState((NMDeviceState)state, "nm_signal_50");
else if (strength > 5)
setPixmapForState((NMDeviceState)state, "nm_signal_25");
else
setPixmapForState((NMDeviceState)state, "nm_signal_00");
}
}
}
void WirelessDeviceTray::slotCheckActiveAccessPoint()
{
// the active AP changed, if a connection is already active we have roamed
// thus add the bssid to the list of seen bssids
NMProxy* nm = NMProxy::getInstance();
if (!nm)
return;
WirelessConnection* active_conn = dynamic_cast<WirelessConnection*>(nm->getActiveConnection(d->dev));
if (active_conn && d->dev->getState() == NM_DEVICE_STATE_ACTIVATED)
{
if ( d->dev->getActiveAccessPoint() != d->activeAccessPoint) {
if (!d->activeAccessPoint.isNull())
disconnect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8)));
d->activeAccessPoint = d->dev->getActiveAccessPoint();
if ( d->activeAccessPoint ) {
connect( d->activeAccessPoint, TQT_SIGNAL(strengthChanged(TQ_UINT8)), this, TQT_SLOT(apStrengthChanged(TQ_UINT8)));
ConnectionSettings::Wireless* wireless = active_conn->getWirelessSetting();
wireless->addSeenBssid(d->activeAccessPoint->getHwAddress());
}
}
}
}
void WirelessDeviceTray::apStrengthChanged(TQ_UINT8 strength)
{
kdDebug() << k_funcinfo << (uint)strength << endl;
NMDeviceState state = device()->getState();
if (strength > 80)
setPixmapForState(state, "nm_signal_100");
else if (strength > 55)
setPixmapForState(state, "nm_signal_75");
else if (strength > 30)
setPixmapForState(state, "nm_signal_50");
else if (strength > 5)
setPixmapForState(state, "nm_signal_25");
else
setPixmapForState(state, "nm_signal_00");
emit uiUpdated();
}
void WirelessDeviceTray::slotAccessPointAdded(AccessPoint* ap)
{
KNotifyClient::event( tray()->winId(), "knm-nm-network-found", i18n("KNetworkManager New Wireless Network Found") );
}
void WirelessDeviceTray::slotAccessPointRemoved(const TQString&)
{
KNotifyClient::event( tray()->winId(), "knm-nm-network-gone", i18n("KNetworkManager Wireless Network Disappeared") );
}
WirelessDeviceTray::WirelessDeviceTray (WirelessDevice* dev, KSystemTray * parent, const char * name)
: DeviceTrayComponent (dev, parent, name)
{
d = new WirelessDeviceTrayPrivate();
d->dev = dev;
// we want other icons for wireless devices
setPixmapForState(NM_DEVICE_STATE_UNKNOWN, "wireless_off");
setPixmapForState(NM_DEVICE_STATE_UNAVAILABLE, "wireless_off");
setPixmapForState(NM_DEVICE_STATE_UNMANAGED, "wireless_off");
setPixmapForState(NM_DEVICE_STATE_DISCONNECTED, "wireless");
setPixmapForState(NM_DEVICE_STATE_ACTIVATED, "nm_signal_50");
// get notified when the device state changes
connect(dev, TQT_SIGNAL(StateChanged(NMDeviceState)), this, TQT_SLOT(slotUpdateDeviceState(NMDeviceState)));
// if the active access point changed but not the connection we roamed to a new AP
connect(dev, TQT_SIGNAL(propertiesChanged()), this, TQT_SLOT(slotCheckActiveAccessPoint()));
// get notified of all AP changes
connect(dev, TQT_SIGNAL(accessPointAdded(AccessPoint*)), this, TQT_SLOT(slotAccessPointAdded(AccessPoint*)));
connect(dev, TQT_SIGNAL(accessPointRemoved(const TQString&)), this, TQT_SLOT(slotAccessPointRemoved(const TQString&)));
}
WirelessDeviceTray::~WirelessDeviceTray ()
{
delete d;
}
#include "knetworkmanager-wireless_device_tray.moc"

@ -0,0 +1,82 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H
#define KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H
// KNM includes
#include "knetworkmanager.h"
#include "devicetraycomponent.h"
#include "knetworkmanager-wireless_network.h"
// predefinitions
class WirelessDevice;
class WirelessDeviceTrayPrivate;
namespace ConnectionSettings
{
class Connection;
class WirelessConnection;
}
class WirelessDeviceTray : public DeviceTrayComponent
{
Q_OBJECT
TQ_OBJECT
public:
WirelessDeviceTray (WirelessDevice*, KSystemTray * parent = 0, const char * name = 0);
~WirelessDeviceTray ();
void addMenuItems(KPopupMenu* menu);
protected:
/**
* Reimplementation
*/
TQStringList getToolTipText();
public slots:
void slotUpdateDeviceState(NMDeviceState);
void slotCheckActiveAccessPoint();
void newConnection();
protected slots:
void apStrengthChanged(TQ_UINT8 strength);
void slotAccessPointAdded(AccessPoint*);
void slotAccessPointRemoved(const TQString&);
private:
void addWirelessNetworks (KPopupMenu* menu);
TQValueList<WirelessNetwork> getWirelessNetworks();
TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections();
ConnectionSettings::WirelessConnection* findMatchingConnection(const WirelessNetwork& net, const TQValueList<ConnectionSettings::WirelessConnection*>& connection);
bool findMatchingNetwork(const ConnectionSettings::WirelessConnection* conn, const TQValueList<WirelessNetwork>& nets, WirelessNetwork& net);
WirelessDeviceTrayPrivate* d;
};
#endif /* KNETWORKMANAGER_WIRELESS_DEVICE_TRAY_H */

@ -0,0 +1,179 @@
/***************************************************************************
*
* knetworkmanager-wireless_manager.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// other includes
#include <time.h>
// QT DBus
#include <tqdbusobjectpath.h>
// KNM includes
#include "knetworkmanager-wireless_manager.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-devicestore.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(WirelessDevice* dev, TQ_UINT32 match)
{
TQValueList<WirelessNetwork> nets;
TQValueList<AccessPoint*> aps;
// fetch all APs
aps = WirelessManager::getAccessPoints(dev);
// now group the APs together according to their security settings
for (TQValueList<AccessPoint*>::Iterator apit = aps.begin(); apit != aps.end(); ++apit)
{
bool found = false;
// no hidden APs
AccessPoint * ap = *apit;
if ( ap ) {
if (!ap->isValid())
continue;
if (ap->getSsid().count() == 0)
continue;
// check if we have a network matching this AP
for (TQValueList<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt)
{
if ((*netIt).contains(ap) )
{
// we alread have a network where this AP belongs to
found = true;
// attach this ap to the network
(*netIt).addAP(ap);
/* // FIXME active?
if (active_ap)
{
// here is the active_ap
if (!(*net).getActive() && ((*ap) == *active_ap))
(*net).setActive(true);
}*/
break;
}
}
if (!found)
{
// create a new network-descriptor according to this ap
WirelessNetwork net(match);
net.addAP(ap);
nets.append(net);
}
}
}
return nets;
}
TQValueList<AccessPoint*> WirelessManager::getAccessPoints(WirelessDevice* dev)
{
// build up AP list depending on one device or on all devices
if (dev) {
return dev->accessPoints();
}
else {
TQValueList<AccessPoint *> aps;
DeviceStore* store = DeviceStore::getInstance();
if (store)
{
#if NM_CHECK_VERSION(0,8,992)
TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
#else
TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS);
#endif
for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
{
WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it);
if (!wdev)
continue;
// add all APs from this device
aps +=wdev->accessPoints();
}
}
return aps;
}
}
TQValueList<WirelessConnection*> WirelessManager::getWirelessConnections()
{
TQValueList<WirelessConnection*> conns;
ConnectionStore* store = ConnectionStore::getInstance();
// get all wireless connections
TQValueList<Connection*> connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME);
for (TQValueList<Connection*>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// cast to WirelessConnection*
WirelessConnection* wireless_conn = dynamic_cast<WirelessConnection*>(*it);
if (!wireless_conn)
continue;
conns.append(wireless_conn);
}
return conns;
}
TQValueList<AccessPoint*> WirelessManager::getAccessPointsForEssid(TQByteArray essid, WirelessDevice* dev)
{
// build up AP list depending on one device or on all devices
if (dev)
return dev->accessPointsForEssid(essid);
else
{
TQValueList<AccessPoint*> aps;
DeviceStore* store = DeviceStore::getInstance();
if (store)
{
#if NM_CHECK_VERSION(0,8,992)
TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
#else
TQValueList<Device*> devs = store->getDevices(DEVICE_TYPE_802_11_WIRELESS);
#endif
for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
{
WirelessDevice* wdev = dynamic_cast<WirelessDevice*>(*it);
if (!wdev)
continue;
// add all APs from this device
aps += wdev->accessPointsForEssid(essid);
}
}
return aps;
}
}

@ -0,0 +1,62 @@
/***************************************************************************
*
* knetworkmanager-wireless_manager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESS_MANAGER_H
#define KNETWORKMANAGER_WIRELESS_MANAGER_H
// TQt includes
#include <tqguardedptr.h>
#include <tqmap.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-device_tray.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-wireless_network.h"
namespace ConnectionSettings
{
class WirelessConnection;
}
class WirelessManager
{
public:
// get all accesspoints from device dev or from all devices if dev is NULL
// and group them together using all properties specified in match
static TQValueList<WirelessNetwork> getWirelessNetworks(WirelessDevice* dev = 0, TQ_UINT32 match = WirelessNetwork::MATCH_SSID);
// get all aps from either one device or from all available devices
static TQValueList<AccessPoint*> getAccessPoints(WirelessDevice* dev = 0);
// get a list of all known wireless connections
static TQValueList<ConnectionSettings::WirelessConnection*> getWirelessConnections();
// get a list of all APs with a specific SSID
static TQValueList<AccessPoint*> getAccessPointsForEssid(TQByteArray, WirelessDevice* dev = 0);
};
#endif /* KNETWORKMANAGER_WIRELESS_MANAGER_H */

@ -0,0 +1,238 @@
/***************************************************************************
*
* knetworkmanager-tray.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
* Will Stephenson <wstephenson@suse.de>, <wstephenson@kde.org>
* Valentine Sinitsyn <e_val@inbox.ru>
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqevent.h>
#include <tqvbox.h>
#include <tqlayout.h>
#include <tqpushbutton.h>
#include <tqpixmap.h>
#include <tqpixmapcache.h>
#include <tqpainter.h>
#include <tqstyle.h>
#include <dcopclient.h>
#include <kdebug.h>
#include <kdialogbase.h>
#include <knotifyclient.h>
#include <knotifydialog.h>
#include <klocale.h>
#include <kstdguiitem.h>
#include <khelpmenu.h>
#include <kprocess.h>
#include <kiconloader.h>
#include <kconfig.h>
#include <kmessagebox.h>
#include <NetworkManager.h>
#include <tqdbusobjectpath.h>
#include <tqdbuserror.h>
#include "knetworkmanager-wireless_menuitem.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-nm_proxy.h"
#if !defined(NM_CHECK_VERSION)
#define NM_CHECK_VERSION(x,y,z) 0
#endif
using namespace ConnectionSettings;
void WirelessNetworkItem::slotActivate()
{
NMProxy* nm = NMProxy::getInstance();
int id;
TQT_DBusError err;
printf("slotActivate\n\r");
if (_dev && nm)
{
if ( _conn )
{
kdDebug() << "Activate Connection " << _conn->getObjectPath().data() << " on Device " << _dev->getObjectPath().ascii() << endl;
#if NM_CHECK_VERSION(0,8,992)
if (!nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(_dev->getObjectPath())), _conn->getObjectPath(), err))
#else
if (!nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(_dev->getObjectPath())), _conn->getObjectPath(), err))
#endif
kdDebug() << "ActivateDevice failed" << endl;
}
else
{
// TODO: create new connection based upon the network and show the dialog
printf("New network support not implemented yet\n\r");
}
}
}
TQString WirelessNetworkItem::getDisplayText()
{
TQString security = "";
if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE && _net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
security = TQString("(%1/%2)").tqarg(i18n("WPA")).tqarg(i18n("RSN"));
else if (_net.getWpaFlags() != NM_802_11_AP_SEC_NONE)
security = TQString("(%1)").tqarg(i18n("WPA"));
else if (_net.getRsnFlags() != NM_802_11_AP_SEC_NONE)
security = TQString("(%2)").tqarg(i18n("RSN"));
Info* info = NULL;
if (_conn)
info = _conn->getInfoSetting();
if (info && info->getName() != _net.getDisplaySsid())
return TQString("%2/%1 %3").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(info->getName()).tqarg(security);
else
return TQString("%1 %2").tqarg(TQString::fromUtf8(_net.getDisplaySsid())).tqarg(security);
}
void
WirelessNetworkItem::paint (TQPainter *p, const TQColorGroup &/*cg*/, bool highlighted, bool /*enabled*/, int x, int y, int w, int h)
{
int spacer = 0;
pbarStrength->setTotalSteps (100);
pbarStrength->tqsetSizePolicy (TQSizePolicy ((TQSizePolicy::SizeType) 0, (TQSizePolicy::SizeType) 0, 0, 0, pbarStrength->sizePolicy ().hasHeightForWidth ()));
pbarStrength->setFixedHeight (_height - 2);
pbarStrength->setProgress (_net.getStrength());
pbarStrength->setPercentageVisible (false);
if (highlighted) {
p->setPen(parent->tqpalette ().active ().highlightedText ());
pbarStrength->setBackgroundMode( TQt::PaletteHighlight, TQt::PaletteHighlight );
} else {
p->setPen(parent->tqpalette ().active ().text ());
}
p->drawText (x, y, w, h, AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText());
if (_net.isEncrypted()) {
TQPixmap pmLock = SmallIcon ("lock", TQIconSet::Automatic);
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmLock.size ().width () - 6, y + _border, pmLock);
spacer = pmLock.size ().width () + 4;
}
if (_adhoc) {
TQPixmap pmAdHoc = SmallIcon ("system", TQIconSet::Automatic);
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space - pmAdHoc.size ().width () - spacer - 6, y + _border, pmAdHoc);
}
p->drawPixmap (parent->tqsizeHint ().width () - pbarStrength->width () - _space, y +_border, TQPixmap::grabWidget (pbarStrength));
}
TQSize
WirelessNetworkItem::tqsizeHint ()
{
return TQSize (_width, _height);
}
WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, WirelessConnection* conn, bool adhoc)
: NetworkMenuItem(dev, conn, 0, 0 ), TQCustomMenuItem ()
{
parent = p;
_adhoc = adhoc;
_net = net;
_dev = dev;
_conn = conn;
pbarStrength = new TQProgressBar (this->parent, "pbarStrength");
pbarStrength->hide();
// TODO make all this neat or at least static
/* px between pmLock and pbarStrength */
_space = 5;
/* the following code should not be used as teaching material in any kind */
// set the widget height to that of a small icon
_widgetHeight = SmallIcon (NULL, TQIconSet::Automatic).height ();
// figure out the height of the text
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
// the item is height of the text plus the default frame width
_height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
if (_height < _widgetHeight) {
_height = _widgetHeight + 2;
}
/* border required for pmLock and pbarStrength */
_border = 1;
if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
_border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
if (_border == 0)
_border ++;
_width = kapp->fontMetrics().size(AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText()).width(); /* essid */
_width += SmallIcon (NULL, TQIconSet::Automatic).width (); /* pmLock */
_width += _space; /* pmLock <-> pbarStrength */
_width += 100; /* pbarStrength */
_width += _space; /* pbarStrength -> contextMenu */
}
WirelessNetworkItem::WirelessNetworkItem (TQWidget* p, Device* dev, WirelessNetwork& net, bool adhoc)
: NetworkMenuItem(dev, NULL, 0, 0 ), TQCustomMenuItem ()
{
parent = p;
_adhoc = adhoc;
_net = net;
_dev = dev;
pbarStrength = new TQProgressBar (this->parent, "pbarStrength");
pbarStrength->hide();
// TODO make all this neat or at least static
/* px between pmLock and pbarStrength */
_space = 5;
/* the following code should not be used as teaching material in any kind */
// set the widget height to that of a small icon
_widgetHeight = SmallIcon (NULL, TQIconSet::Automatic).height ();
// figure out the height of the text
_textHeight = kapp->fontMetrics ().size (AlignLeft | AlignVCenter | DontClip | ShowPrefix, _net.getDisplaySsid()).height ();
// the item is height of the text plus the default frame width
_height = _textHeight + kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
/* _height needs to be at least the height of a SmallIcon plus a border of one px (top & bottom)*/
if (_height < _widgetHeight) {
_height = _widgetHeight + 2;
}
/* border required for pmLock and pbarStrength */
_border = 1;
if (_border == kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth))
_border += 2 * kapp->tqstyle ().tqpixelMetric (TQStyle::PM_DefaultFrameWidth);
if (_border == 0)
_border ++;
_width = kapp->fontMetrics().size(AlignLeft | AlignVCenter | DontClip | ShowPrefix, getDisplayText()).width(); /* essid */
_width += SmallIcon (NULL, TQIconSet::Automatic).width (); /* pmLock */
_width += _space; /* pmLock <-> pbarStrength */
_width += 100; /* pbarStrength */
_width += _space; /* pbarStrength -> contextMenu */
}
WirelessNetworkItem::~WirelessNetworkItem ()
{
}
#include "knetworkmanager-wireless_menuitem.moc"

@ -0,0 +1,88 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESSMENUITEM_H
#define KNETWORKMANAGER_WIRELESSMENUITEM_H
#include "knetworkmanager-menuitem.h"
#include <tqmap.h>
#include <tqtimer.h>
#include <tqtooltip.h>
#include <ksystemtray.h>
#include <kuniqueapplication.h>
#include <kpopupmenu.h>
#include <kactionclasses.h>
#include <kstdaction.h>
#include <kstdguiitem.h>
#include <tqlayout.h>
#include <tqlabel.h>
#include <tqcheckbox.h>
#include <tqprogressbar.h>
#include <tqguardedptr.h>
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-connection.h"
class WirelessNetworkItem : public NetworkMenuItem, public TQCustomMenuItem
{
Q_OBJECT
TQ_OBJECT
public:
WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, ConnectionSettings::WirelessConnection* conn, bool adhoc);
WirelessNetworkItem (TQWidget*, Device* dev, WirelessNetwork& net, bool adhoc);
~WirelessNetworkItem ();
TQWidget* parent;
TQProgressBar* pbarStrength;
void paint (TQPainter*, const TQColorGroup&, bool, bool, int, int, int, int);
TQSize tqsizeHint ();
public slots:
void slotActivate();
private:
TQString getDisplayText();
bool _adhoc;
WirelessNetwork _net;
Device* _dev;
ConnectionSettings::WirelessConnection* _conn;
/* menu item */
int _width;
int _height;
int _border;
/* elements */
int _textHeight;
int _widgetHeight;
int _space;
};
#endif /* KNETWORKMANAGER_WIRELESSMENUITEM_H */

@ -0,0 +1,179 @@
/***************************************************************************
*
* knetworkmanager-wireless_network.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// NM includes
#include <NetworkManager.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-wireless_network.h"
// KDE includes
#include <kdebug.h>
// TQt includes
#include <tqhostaddress.h>
#include <tqvaluelist.h>
using namespace ConnectionSettings;
class WirelessNetworkPrivate
{
public:
WirelessNetworkPrivate()
: active(false)
{
}
~WirelessNetworkPrivate()
{
}
bool active;
TQ_UINT32 match;
TQValueList<const AccessPoint*> aps;
};
WirelessNetwork::WirelessNetwork(const WirelessNetwork& other)
{
d = new WirelessNetworkPrivate(*other.d);
}
WirelessNetwork::WirelessNetwork(TQ_UINT32 match)
{
d = new WirelessNetworkPrivate();
// which attributes have to match
d->match = match;
}
WirelessNetwork::~WirelessNetwork()
{
delete d;
}
WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
{
if (d)
delete d;
d = new WirelessNetworkPrivate(*other.d);
return *this;
}
bool WirelessNetwork::contains (const AccessPoint * const ap)
{
if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray())
return false;
// AP matches
return true;
}
bool WirelessNetwork::addAP(const AccessPoint * const ap)
{
if ( this->contains( ap ) || d->aps.isEmpty())
{
d->aps.append(ap);
return true;
}
return false;
}
const TQByteArray WirelessNetwork::getSsid() const
{
if ( !d->aps.isEmpty() ) {
return (*(d->aps.begin()))->getSsidByteArray();
} else {
return TQByteArray();
}
}
TQString WirelessNetwork::getDisplaySsid() const
{
if (!d->aps.isEmpty()) {
return (*(d->aps.begin()))->getDisplaySsid();
} else {
return TQString();
}
}
TQ_UINT32 WirelessNetwork::getFlags() const
{
TQ_UINT32 flags = NM_802_11_AP_FLAGS_NONE;
for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getFlags();
}
return flags;
}
TQ_UINT32 WirelessNetwork::getWpaFlags() const
{
TQ_UINT32 flags = NM_802_11_AP_SEC_NONE;
for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getWpaFlags();
}
return flags;
}
TQ_UINT32 WirelessNetwork::getRsnFlags() const
{
TQ_UINT32 flags = NM_802_11_AP_SEC_NONE;
for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getRsnFlags();
}
return flags;
}
bool WirelessNetwork::isEncrypted() const
{
return (getFlags() && NM_802_11_AP_FLAGS_PRIVACY);
}
TQ_UINT8 WirelessNetwork::getStrength() const
{
TQ_UINT8 strength = 0;
for (TQValueList<const AccessPoint*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
if ((*it)->getStrength() > strength)
strength = (*it)->getStrength();
}
return strength;
}
void WirelessNetwork::setActive(bool a)
{
d->active=a;
}
bool WirelessNetwork::getActive() const
{
return d->active;
}

@ -0,0 +1,96 @@
/***************************************************************************
*
* knetworkmanager-wireless_network.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_WIRELESS_NETWORK_H
#define KNETWORKMANAGER_WIRELESS_NETWORK_H
#include "knetworkmanager.h"
#include "knetworkmanager-device.h"
#include <stdint.h>
class KNetworkManager;
class AccessPoint;
class WirelessNetworkPrivate;
namespace ConnectionSettings
{
class WirelessConnection;
}
/*
A wireless network represents multiple accesspoints
that share the same essid and security-caps
*/
class WirelessNetwork
{
public:
// bitwise encoded enum
// allows the specification on how multiple APs get grouped together
enum MATCH_ATTRIBUTES
{
// only match APs with the same ssid
MATCH_SSID = 1
};
WirelessNetwork(const WirelessNetwork& other);
WirelessNetwork (TQ_UINT32 match = MATCH_SSID);
~WirelessNetwork ();
WirelessNetwork& operator= (const WirelessNetwork&);
// check if the AccessPoint represents the same net
bool contains(const AccessPoint * const);
// add an AP to the Network
bool addAP(const AccessPoint * const);
// combined flags of all APs
TQ_UINT32 getFlags() const;
// combined wpa-flags of all APs
TQ_UINT32 getWpaFlags() const;
// combined rsn-flags of all APs
TQ_UINT32 getRsnFlags() const;
// ssid of all APs
const TQByteArray getSsid() const;
TQString getDisplaySsid() const;
bool isEncrypted() const;
// strength of the best AP
TQ_UINT8 getStrength() const;
void setActive(bool active);
bool getActive() const;
bool operator==(const WirelessNetwork&);
private:
WirelessNetworkPrivate * d;
};
#endif /* KNETWORKMANAGER_WIRELESS_NETWORK_H */

@ -0,0 +1,142 @@
/***************************************************************************
*
* knetworkmanager.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
#include <klocale.h>
// NM includes
#include <NetworkManager.h>
#include <NetworkManagerVPN.h>
// TQDBus includes
#include <tqdbusdata.h>
// KNM includes
#include "knetworkmanager.h"
#include "knetworkmanager-tray.h"
#include "knetworkmanager-devicestore.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-cellular_device.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-wired_device.h"
#include "knetworkmanager-vpn_device.h"
#include "knetworkmanager-cellular_device_tray.h"
#include "knetworkmanager-wireless_device_tray.h"
#include "knetworkmanager-wired_device_tray.h"
#include "knetworkmanager-nmsettings.h"
#include "knetworkmanager-storage.h"
#include "xmlmarshaller.h"
// KNM includes
#include "vpn_tray_component.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-vpn_plugin.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_vpn.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include <stdio.h>
// TQt includes
#include <tqstring.h>
#include <tqobject.h>
// KDE includes
#include <kglobal.h>
#include <kiconloader.h>
char active_vpn_prev = 0;
extern NMDeviceState nm_device_state_global;
VPNDBUSPlugin* vpnproxy;
class KNetworkManagerPrivate
{
public:
KNetworkManagerPrivate() {}
~KNetworkManagerPrivate() {}
static KNetworkManager* _ctx;
};
KNetworkManager* KNetworkManagerPrivate::_ctx = NULL;
KNetworkManager* KNetworkManager::getInstance()
{
return KNetworkManagerPrivate::_ctx;
}
void
KNetworkManager::slotShutDown()
{
// cleanup code
Storage* storage = Storage::getInstance();
// save all connections (if not done already)
storage->saveConnections();
}
void KNetworkManager::timerEvent( TQTimerEvent *e )
{
Tray* tray = Tray::getInstance();
tray->slotUpdateDeviceState(nm_device_state_global);
}
KNetworkManager::KNetworkManager () : KUniqueApplication ()
{
d = new KNetworkManagerPrivate();
d->_ctx = this;
// we need to get informed when shutting down
connect(this, TQT_SIGNAL(shutDown()), this, TQT_SLOT(slotShutDown()));
// Start the VPN icon timer
// startTimer( 1000 ); // 1-second timer
// Connect to the VPN bus
vpnproxy = new VPNDBUSPlugin();
// create the main-tray-icon
Tray* tray = Tray::getInstance();
tray->show();
setMainWidget(tray);
// create the settings interface
NMSettings::getInstance();
// restore all known connections first
Storage* storage = Storage::getInstance();
storage->restoreConnections();
}
KNetworkManager::~KNetworkManager()
{
delete vpnproxy;
delete d;
}
#include "knetworkmanager.moc"

@ -0,0 +1,47 @@
[Desktop Entry]
Encoding=UTF-8
Name=KNetworkManager
Name[bn]=কে-নেটওয়ার্ক-ম্যানেজার
Name[sv]=Knetworkmanager
GenericName=Network Manager
GenericName[bn]=নেটওয়ার্ক ম্যানেজার
GenericName[br]=Merour rouedad
GenericName[da]=Netværkshåndtering
GenericName[de]=Netzwerkverwaltung
GenericName[el]=Διαχειριστής δικτύου
GenericName[es]=Gestor de red
GenericName[et]=Võrguhaldur
GenericName[it]=Gestore di rete
GenericName[ja]=ネットワークマネージャ
GenericName[nl]=Netwerkbeheer
GenericName[pt]=Gestor de Redes
GenericName[sr]=Управник мреже
GenericName[sr@Latn]=Upravnik mreže
GenericName[sv]=Nätverksverktyg
GenericName[tr]=Ağ Yöneticisi
Exec=knetworkmanager
Icon=knetworkmanager
Type=Application
Comment=A KDE frontend for NetworkManager
Comment[bg]=Интерфейс за NetworkManager (KDE)
Comment[bn]=নেটওয়ার্ক-ম্যানেজারের জন্য একটি কেডিই ফ্রন্ট-এন্ড
Comment[ca]=Un frontal del KDE per al NetworkManager
Comment[da]=En KDE-grænseflade for Networkmanager
Comment[de]=Eine KDE-Oberfläche für NetworkManager
Comment[el]=Μια διασύνδεση περιβάλλοντος για το NetworkManager
Comment[es]=Una interfaz de KDE a NetworkManager
Comment[et]=KDE NetworkManageri kasutajaliides
Comment[it]=Un front-end di NetworkManager per KDE
Comment[ja]=NetworkManager の KDE フロントエンド
Comment[nl]=Een KDE-schil voor NetworkManager
Comment[pt]=Uma interface para KDE do NetworkManager
Comment[sr]=KDE програм за NetworkManager
Comment[sr@Latn]=KDE program za NetworkManager
Comment[sv]=Ett gränssnitt till Networkmanager för KDE
Comment[tr]=NetworkManager için bir KDE ön yüzü
X-KDE-autostart-after=panel
X-KDE-StartupNotify=false
X-KDE-UniqueApplet=true
X-DCOP-ServiceType=Unique
X-KDE-autostart-condition=knetworkmanagerrc:General:Autostart:true
Categories=Qt;KDE;Network;Applet;

@ -0,0 +1,57 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_H
#define KNETWORKMANAGER_H
// KDE includes
#include <kuniqueapplication.h>
// KNM includes
#include "config.h"
class KNetworkManagerPrivate;
class Device;
class KNetworkManager : public KUniqueApplication
{
Q_OBJECT
TQ_OBJECT
public:
KNetworkManager ();
~KNetworkManager ();
static KNetworkManager* getInstance (void);
public slots:
void slotShutDown();
private:
KNetworkManagerPrivate* d;
protected:
void timerEvent( TQTimerEvent *e );
};
#endif /* KNETWORKMANAGER_H */

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

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

@ -0,0 +1,31 @@
[Desktop Entry]
Encoding=UTF-8
Type=ServiceType
X-KDE-ServiceType=KNetworkManager/Plugin
X-KDE-Derived=KPluginInfo
Name=KNetworkManager Plugin
Name[et]=KNetworkManageri plugin
Name[ja]=KNetworkManager プラグイン
Name[sr]=Прикључак KNetworkManager-а
Name[sr@Latn]=Прикључак KNetworkManager-а
Name[sv]=Nätverkshantering insticksprogram
Comment=KNetworkManager Plugin
Comment[bg]=Приставка за KNetworkManager
Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার প্লাগিন
Comment[br]=Lugent KNetworkManager
Comment[ca]=Connector del KNetworkManager
Comment[da]=Netværkshåndtering-plugin
Comment[de]=KNetworkManager-Modul
Comment[el]=Πρόσθετο του KNetworkManager
Comment[es]=Complemento de KNetworkManager
Comment[et]=KNetworkManageri plugin
Comment[it]=Plugin di KNetworkManager
Comment[ja]=KNetworkManager プラグイン
Comment[nl]=KNetworkManager-plugin
Comment[pt]='Plugin' do KNetworkManager
Comment[sr]=Прикључак KNetworkManager-а
Comment[sr@Latn]=Priključak KNetworkManager-a
Comment[sv]=Nätverkshantering insticksprogram
Comment[tr]=KNetworkManager Eklentisi
Comment[xx]=xxKNetworkManager Pluginxx

@ -0,0 +1,33 @@
[Desktop Entry]
Encoding=UTF-8
Type=ServiceType
X-KDE-ServiceType=KNetworkManager/VPNPlugin
X-KDE-Derived=KNetworkManager/Plugin
Name=KNetworkManager VPN Plugin
Name[et]=KNetworkManageri VPN-plugin
Name[ja]=KNetworkManager VPN プラグイン
Name[sr]=Прикључак KNetworkManager-а за VPN
Name[sr@Latn]=Прикључак KNetworkManager-а за VPN
Name[sv]=Nätverkshantering VPN-insticksprogram
Comment=KNetworkManager VPN Plugin
Comment[bg]=VPN приставка за KNetworkManager
Comment[bn]=কে-নেটওয়ার্ক-ম্যানেজার ভিপিএন প্লাগিন
Comment[br]=Lugent VPN evit KNetworkManager
Comment[ca]=Connector VPN del KNetworkManager
Comment[da]=KNetworkManager VPN-plugin
Comment[de]=KNetworkManager-VPN-Modul
Comment[el]=Πρόσθετο VPN του KNetworkManager
Comment[es]=Complemento de VPN de KNetworkManager
Comment[et]=KNetworkManageri VPN-plugin
Comment[it]=Plugin VPN di KNetworkManager
Comment[ja]=KNetworkManager VPN プラグイン
Comment[nl]=KNetworkManager VPN-plugin
Comment[pt]='Plugin' de VPN do KNetworkManager
Comment[sr]=Прикључак KNetworkManager-а за VPN
Comment[sr@Latn]=Priključak KNetworkManager-a za VPN
Comment[sv]=Nätverkshantering VPN-insticksprogram
Comment[tr]=KNetworkManager VPN Eklentisi
Comment[xx]=xxKNetworkManager VPN Pluginxx
[PropertyDef::X-NetworkManager-Services]
Type=QString

@ -0,0 +1,64 @@
/***************************************************************************
*
* main.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kaboutdata.h>
#include <kcmdlineargs.h>
#include <dcopclient.h>
#include <dcopref.h>
// TQt includes
#include <tqtimer.h>
// KNM includes
#include "knetworkmanager.h"
static const char* knm_version = I18N_NOOP(KNETWORKMANAGER_VERSION_STRING);
static const char* knm_descr = I18N_NOOP("A NetworkManager front-end for KDE");
static const char* knm_copy = I18N_NOOP("Copyright (C) 2005, 2006 Novell, Inc.");
static const char* knm_webpage = I18N_NOOP("http://opensuse.org/Projects/KNetworkManager");
extern "C" KDE_EXPORT int
kdemain (int argc, char* argv[])
{
KAboutData aboutData ("knetworkmanager", I18N_NOOP("KNetworkManager"),
knm_version, knm_descr, KAboutData::License_GPL,
knm_copy, 0, knm_webpage );
aboutData.addAuthor ("Helmut Schaa", I18N_NOOP("Maintainer"), "hschaa@suse.de");
aboutData.addAuthor ("Timo Hoenig", I18N_NOOP("Maintainer"), "thoenig@suse.de");
aboutData.addAuthor ("Will Stephenson", I18N_NOOP("Additional code"), "wstephenson@suse.de");
aboutData.addAuthor ("Valentine Sinitsyn", I18N_NOOP("Additional code"), "e_val@inbox.ru");
aboutData.addAuthor ("Stefan Bogner", I18N_NOOP("KWallet integration"), "sbogner@suse.de");
KCmdLineArgs::init (argc, argv, &aboutData);
if (KNetworkManager::start ()) {
KNetworkManager app;
app.disableSessionManagement ();
return app.exec ();
}
return 0;
}

@ -0,0 +1,292 @@
/*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* GnomeKeyringMD5Context structure, pass it to gnome_keyring_md5_init, call
* gnome_keyring_md5_update as needed on buffers full of bytes, and then call
* gnome_keyring_md5_final, which will fill a supplied 32-byte array with the
* digest in ascii form.
*
*/
#include "md5.h"
#include <string.h>
#include <stdlib.h>
static void gnome_keyring_md5_transform (guint32 buf[4],
guint32 const in[16]);
void
gnome_keyring_md5_string (const char *string, unsigned char digest[16])
{
struct GnomeKeyringMD5Context md5_context;
gnome_keyring_md5_init (&md5_context);
gnome_keyring_md5_update (&md5_context, (const unsigned char *)string, strlen (string));
gnome_keyring_md5_final (digest, &md5_context);
}
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
#define byteReverse(buf, len) /* Nothing */
#else
/*
* Note: this code is harmless on little-endian machines.
*/
static void
byteReverse(unsigned char *buf, unsigned longs)
{
guint32 t;
do {
t = (guint32) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(guint32 *) buf = t;
buf += 4;
} while (--longs);
}
#endif
char *
gnome_keyring_md5_digest_to_ascii (unsigned char digest[16])
{
static char hex_digits[] = "0123456789abcdef";
char *res;
int i;
res = (char*) malloc (33);
for (i = 0; i < 16; i++) {
res[2*i] = hex_digits[digest[i] >> 4];
res[2*i+1] = hex_digits[digest[i] & 0xf];
}
res[32] = 0;
return res;
}
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void
gnome_keyring_md5_init (struct GnomeKeyringMD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bits[0] = 0;
ctx->bits[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
gnome_keyring_md5_update (struct GnomeKeyringMD5Context *ctx,
unsigned char const *buf,
unsigned len)
{
guint32 t;
/* Update bitcount */
t = ctx->bits[0];
if ((ctx->bits[0] = t + ((guint32) len << 3)) < t)
ctx->bits[1]++; /* Carry from low to high */
ctx->bits[1] += len >> 29;
t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */
/* Handle any leading odd-sized chunks */
if (t) {
unsigned char *p = (unsigned char *) ctx->in + t;
t = 64 - t;
if (len < t) {
memcpy (p, buf, len);
return;
}
memcpy (p, buf, t);
byteReverse (ctx->in, 16);
gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
buf += t;
len -= t;
}
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy (ctx->in, buf, 64);
byteReverse (ctx->in, 16);
gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
gnome_keyring_md5_final (unsigned char digest[16], struct GnomeKeyringMD5Context *ctx)
{
unsigned count;
unsigned char *p;
/* Compute number of bytes mod 64 */
count = (ctx->bits[0] >> 3) & 0x3F;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = ctx->in + count;
*p++ = 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
memset (p, 0, count);
byteReverse (ctx->in, 16);
gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
/* Now fill the next block with 56 bytes */
memset(ctx->in, 0, 56);
} else {
/* Pad block to 56 bytes */
memset(p, 0, count - 8);
}
byteReverse(ctx->in, 14);
/* Append length in bits and transform */
((guint32 *) ctx->in)[14] = ctx->bits[0];
((guint32 *) ctx->in)[15] = ctx->bits[1];
gnome_keyring_md5_transform (ctx->buf, (guint32 *) ctx->in);
byteReverse ((unsigned char *) ctx->buf, 4);
memcpy (digest, ctx->buf, 16);
memset (ctx, 0, sizeof(ctx)); /* In case it's sensitive */
}
/* The four core functions - F1 is optimized somewhat */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1 (z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define gnome_keyring_md5_step(f, w, x, y, z, data, s) \
( w += f(x, y, z) + data, w = w<<s | w>>(32-s), w += x )
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. GnomeKeyringMD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
static void
gnome_keyring_md5_transform (guint32 buf[4], guint32 const in[16])
{
register guint32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
gnome_keyring_md5_step(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
gnome_keyring_md5_step(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
gnome_keyring_md5_step(F1, c, d, a, b, in[2] + 0x242070db, 17);
gnome_keyring_md5_step(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
gnome_keyring_md5_step(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
gnome_keyring_md5_step(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
gnome_keyring_md5_step(F1, c, d, a, b, in[6] + 0xa8304613, 17);
gnome_keyring_md5_step(F1, b, c, d, a, in[7] + 0xfd469501, 22);
gnome_keyring_md5_step(F1, a, b, c, d, in[8] + 0x698098d8, 7);
gnome_keyring_md5_step(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
gnome_keyring_md5_step(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
gnome_keyring_md5_step(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
gnome_keyring_md5_step(F1, a, b, c, d, in[12] + 0x6b901122, 7);
gnome_keyring_md5_step(F1, d, a, b, c, in[13] + 0xfd987193, 12);
gnome_keyring_md5_step(F1, c, d, a, b, in[14] + 0xa679438e, 17);
gnome_keyring_md5_step(F1, b, c, d, a, in[15] + 0x49b40821, 22);
gnome_keyring_md5_step(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
gnome_keyring_md5_step(F2, d, a, b, c, in[6] + 0xc040b340, 9);
gnome_keyring_md5_step(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
gnome_keyring_md5_step(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
gnome_keyring_md5_step(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
gnome_keyring_md5_step(F2, d, a, b, c, in[10] + 0x02441453, 9);
gnome_keyring_md5_step(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
gnome_keyring_md5_step(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
gnome_keyring_md5_step(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
gnome_keyring_md5_step(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
gnome_keyring_md5_step(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
gnome_keyring_md5_step(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
gnome_keyring_md5_step(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
gnome_keyring_md5_step(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
gnome_keyring_md5_step(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
gnome_keyring_md5_step(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
gnome_keyring_md5_step(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
gnome_keyring_md5_step(F3, d, a, b, c, in[8] + 0x8771f681, 11);
gnome_keyring_md5_step(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
gnome_keyring_md5_step(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
gnome_keyring_md5_step(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
gnome_keyring_md5_step(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
gnome_keyring_md5_step(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
gnome_keyring_md5_step(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
gnome_keyring_md5_step(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
gnome_keyring_md5_step(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
gnome_keyring_md5_step(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
gnome_keyring_md5_step(F3, b, c, d, a, in[6] + 0x04881d05, 23);
gnome_keyring_md5_step(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
gnome_keyring_md5_step(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
gnome_keyring_md5_step(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
gnome_keyring_md5_step(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
gnome_keyring_md5_step(F4, a, b, c, d, in[0] + 0xf4292244, 6);
gnome_keyring_md5_step(F4, d, a, b, c, in[7] + 0x432aff97, 10);
gnome_keyring_md5_step(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
gnome_keyring_md5_step(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
gnome_keyring_md5_step(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
gnome_keyring_md5_step(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
gnome_keyring_md5_step(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
gnome_keyring_md5_step(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
gnome_keyring_md5_step(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
gnome_keyring_md5_step(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
gnome_keyring_md5_step(F4, c, d, a, b, in[6] + 0xa3014314, 15);
gnome_keyring_md5_step(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
gnome_keyring_md5_step(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
gnome_keyring_md5_step(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
gnome_keyring_md5_step(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
gnome_keyring_md5_step(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}

@ -0,0 +1,22 @@
#ifndef GNOME_KEYRING_MD5_H
#define GNOME_KEYRING_MD5_H
#include <glib.h>
struct GnomeKeyringMD5Context {
guint32 buf[4];
guint32 bits[2];
unsigned char in[64];
};
char *gnome_keyring_md5_digest_to_ascii (unsigned char digest[16]);
void gnome_keyring_md5_string (const char *string,
unsigned char digest[16]);
void gnome_keyring_md5_init (struct GnomeKeyringMD5Context *ctx);
void gnome_keyring_md5_update (struct GnomeKeyringMD5Context *ctx,
unsigned char const *buf,
unsigned len);
void gnome_keyring_md5_final (unsigned char digest[16],
struct GnomeKeyringMD5Context *ctx);
#endif /* GNOME_KEYRING_MD5_H */

@ -0,0 +1,47 @@
/***************************************************************************
*
* qbidiractionalmap.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef TQBIDIRECTIONALMAP_H
#define TQBIDIRECTIONALMAP_H
#include <tqmap.h>
template<class Key, class T> class TQBiDirectionalMap : public TQMap<Key, T>
{
public:
TQMapIterator<Key, T> findData(const T & data)
{
for (TQMapIterator<Key,T> it = TQMap<Key, T>::begin(); it != TQMap<Key, T>::end(); ++it)
{
if(it.data() == data)
{
return it;
}
}
return TQMap<Key,T>::end();
}
};
#endif

@ -0,0 +1,54 @@
/***************************************************************************
*
* secret_storage_plugin.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <tqobject.h>
#include "secret_storage_plugin.h"
SecretStoragePlugin::SecretStoragePlugin(TQObject* parent, const char* name, const TQStringList& args)
: Plugin(parent, name, args)
{
}
SecretStoragePlugin::~SecretStoragePlugin()
{
}
bool SecretStoragePlugin::saveSecret(TQString& key, TQMap<TQString, TQString>& secrets)
{
return false;
}
void SecretStoragePlugin::restoreSecretsAsync(TQString& key)
{
// just emit an error
TQMap<TQString, TQString> empty;
emit signalSecretsRestored(key, empty, false);
}
#include "secret_storage_plugin.moc"

@ -0,0 +1,53 @@
/***************************************************************************
*
* secret_storage_plugin.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H
#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H
#include <tqwidget.h>
#include <tqmap.h>
#include <tqdbusdata.h>
#include <tqdbusvariant.h>
#include "knetworkmanager-plugin.h"
#define KNETWORKMANAGER_SECRET_STORAGE_PLUGIN "KNetworkManager/SecretStoragePlugin"
class SecretStoragePlugin : public Plugin
{
Q_OBJECT
TQ_OBJECT
public:
SecretStoragePlugin(TQObject*, const char*, const TQStringList&);
virtual ~SecretStoragePlugin();
virtual bool saveSecret(TQString& key, TQMap<TQString, TQString>& secrets);
virtual void restoreSecretsAsync(TQString& key);
signals:
void signalSecretsRestored(TQString& key, TQMap<TQString, TQString>, bool);
};
#endif /* KNETWORKMANAGER_SECRET_STORAGE_PLUGIN_H */

@ -0,0 +1,6 @@
# Code generation options for kconfig_compiler
File=knetworkmanager.kcfg
ClassName=Settings
Singleton=true
Mutators=true
# will create the necessary code for setting those variables

@ -0,0 +1,684 @@
/*
* SHA1 hash implementation and interface functions
* Copyright (c) 2003-2005, Jouni Malinen <jkmaline@cc.hut.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#include <stdlib.h>
#include <string.h>
#include "sha1.h"
/* Define types for stupid code. Userspace should
* be using u_*_t rather than kernel-space u* types.
*/
typedef u_int8_t u8;
typedef u_int16_t u16;
typedef u_int32_t u32;
typedef u_int64_t u64;
void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac);
void sha1_transform(u8 *state, const u8 data[64]);
void sha1_mac(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
u8 *mac)
{
const u8 *addr[3];
size_t len[3];
addr[0] = key;
len[0] = key_len;
addr[1] = data;
len[1] = data_len;
addr[2] = key;
len[2] = key_len;
sha1_vector(3, addr, len, mac);
}
/* HMAC code is based on RFC 2104 */
void hmac_sha1_vector(const u8 *key, size_t key_len, size_t num_elem,
const u8 *addr[], const size_t *len, u8 *mac)
{
unsigned char k_pad[64]; /* padding - key XORd with ipad/opad */
unsigned char tk[20];
const u8 *_addr[6];
size_t _len[6], i;
if (num_elem > 5) {
/*
* Fixed limit on the number of fragments to avoid having to
* allocate memory (which could fail).
*/
return;
}
/* if key is longer than 64 bytes reset it to key = SHA1(key) */
if (key_len > 64) {
sha1_vector(1, &key, &key_len, tk);
key = tk;
key_len = 20;
}
/* the HMAC_SHA1 transform looks like:
*
* SHA1(K XOR opad, SHA1(K XOR ipad, text))
*
* where K is an n byte key
* ipad is the byte 0x36 repeated 64 times
* opad is the byte 0x5c repeated 64 times
* and text is the data being protected */
/* start out by storing key in ipad */
memset(k_pad, 0, sizeof(k_pad));
memcpy(k_pad, key, key_len);
/* XOR key with ipad values */
for (i = 0; i < 64; i++)
k_pad[i] ^= 0x36;
/* perform inner SHA1 */
_addr[0] = k_pad;
_len[0] = 64;
for (i = 0; i < num_elem; i++) {
_addr[i + 1] = addr[i];
_len[i + 1] = len[i];
}
sha1_vector(1 + num_elem, _addr, _len, mac);
memset(k_pad, 0, sizeof(k_pad));
memcpy(k_pad, key, key_len);
/* XOR key with opad values */
for (i = 0; i < 64; i++)
k_pad[i] ^= 0x5c;
/* perform outer SHA1 */
_addr[0] = k_pad;
_len[0] = 64;
_addr[1] = mac;
_len[1] = SHA1_MAC_LEN;
sha1_vector(2, _addr, _len, mac);
}
void hmac_sha1(const u8 *key, size_t key_len, const u8 *data, size_t data_len,
u8 *mac)
{
hmac_sha1_vector(key, key_len, 1, &data, &data_len, mac);
}
void sha1_prf(const u8 *key, size_t key_len, const char *label,
const u8 *data, size_t data_len, u8 *buf, size_t buf_len)
{
u8 zero = 0, counter = 0;
size_t pos, plen;
u8 hash[SHA1_MAC_LEN];
size_t label_len = strlen(label);
const unsigned char *addr[4];
size_t len[4];
addr[0] = (u8 *) label;
len[0] = label_len;
addr[1] = &zero;
len[1] = 1;
addr[2] = data;
len[2] = data_len;
addr[3] = &counter;
len[3] = 1;
pos = 0;
while (pos < buf_len) {
plen = buf_len - pos;
if (plen >= SHA1_MAC_LEN) {
hmac_sha1_vector(key, key_len, 4, addr, len,
&buf[pos]);
pos += SHA1_MAC_LEN;
} else {
hmac_sha1_vector(key, key_len, 4, addr, len,
hash);
memcpy(&buf[pos], hash, plen);
break;
}
counter++;
}
}
static void pbkdf2_sha1_f(const char *passphrase, const char *ssid,
size_t ssid_len, int iterations, int count,
u8 *digest)
{
unsigned char tmp[SHA1_MAC_LEN], tmp2[SHA1_MAC_LEN];
int i, j;
unsigned char count_buf[4];
const u8 *addr[2];
size_t len[2];
size_t passphrase_len = strlen(passphrase);
addr[0] = (u8 *) ssid;
len[0] = ssid_len;
addr[1] = count_buf;
len[1] = 4;
/* F(P, S, c, i) = U1 xor U2 xor ... Uc
* U1 = PRF(P, S || i)
* U2 = PRF(P, U1)
* Uc = PRF(P, Uc-1)
*/
count_buf[0] = (count >> 24) & 0xff;
count_buf[1] = (count >> 16) & 0xff;
count_buf[2] = (count >> 8) & 0xff;
count_buf[3] = count & 0xff;
hmac_sha1_vector((u8 *) passphrase, passphrase_len, 2, addr, len, tmp);
memcpy(digest, tmp, SHA1_MAC_LEN);
for (i = 1; i < iterations; i++) {
hmac_sha1((u8 *) passphrase, passphrase_len, tmp, SHA1_MAC_LEN,
tmp2);
memcpy(tmp, tmp2, SHA1_MAC_LEN);
for (j = 0; j < SHA1_MAC_LEN; j++)
digest[j] ^= tmp2[j];
}
}
void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
int iterations, u8 *buf, size_t buflen)
{
int count = 0;
unsigned char *pos = buf;
size_t left = buflen;
size_t plen;
unsigned char digest[SHA1_MAC_LEN];
while (left > 0) {
count++;
pbkdf2_sha1_f(passphrase, ssid, ssid_len, iterations, count,
digest);
plen = left > SHA1_MAC_LEN ? SHA1_MAC_LEN : left;
memcpy(pos, digest, plen);
pos += plen;
left -= plen;
}
}
#ifndef EAP_TLS_FUNCS
typedef struct {
u32 state[5];
u32 count[2];
unsigned char buffer[64];
} SHA1_CTX;
static void SHA1Init(SHA1_CTX *context);
static void SHA1Update(SHA1_CTX *context, const void *data, u32 len);
static void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
static void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
/**
* sha1_vector - SHA-1 hash for data vector
* @num_elem: Number of elements in the data vector
* @addr: Pointers to the data areas
* @len: Lengths of the data blocks
* @mac: Buffer for the hash
*/
void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
u8 *mac)
{
SHA1_CTX ctx;
size_t i;
SHA1Init(&ctx);
for (i = 0; i < num_elem; i++)
SHA1Update(&ctx, addr[i], len[i]);
SHA1Final(mac, &ctx);
}
/**
* sha1_transform - Perform one SHA-1 transform step
* @state: SHA-1 state
* @data: Input data for the SHA-1 transform
*
* This function is used to implement random number generation specified in
* NIST FIPS Publication 186-2 for EAP-SIM. This PRF uses a function that is
* similar to SHA-1, but has different message padding and as such, access to
* just part of the SHA-1 is needed.
*/
void sha1_transform(u8 *state, const u8 data[64])
{
SHA1Transform((u32 *) state, data);
}
/* ===== start - public domain SHA1 implementation ===== */
/*
SHA-1 in C
By Steve Reid <sreid@sea-to-sky.net>
100% Public Domain
-----------------
Modified 7/98
By James H. Brown <jbrown@burgoyne.com>
Still 100% Public Domain
Corrected a problem which generated improper hash values on 16 bit machines
Routine SHA1Update changed from
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int
len)
to
void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned
long len)
The 'len' parameter was declared an int which works fine on 32 bit machines.
However, on 16 bit machines an int is too small for the shifts being done
against
it. This caused the hash function to generate incorrect values if len was
greater than 8191 (8K - 1) due to the 'len << 3' on line 3 of SHA1Update().
Since the file IO in main() reads 16K at a time, any file 8K or larger would
be guaranteed to generate the wrong hash (e.g. Test Vector #3, a million
"a"s).
I also changed the declaration of variables i & j in SHA1Update to
unsigned long from unsigned int for the same reason.
These changes should make no difference to any 32 bit implementations since
an
int and a long are the same size in those environments.
--
I also corrected a few compiler warnings generated by Borland C.
1. Added #include <process.h> for exit() prototype
2. Removed unused variable 'j' in SHA1Final
3. Changed exit(0) to return(0) at end of main.
ALL changes I made can be located by searching for comments containing 'JHB'
-----------------
Modified 8/98
By Steve Reid <sreid@sea-to-sky.net>
Still 100% public domain
1- Removed #include <process.h> and used return() instead of exit()
2- Fixed overwriting of finalcount in SHA1Final() (discovered by Chris Hall)
3- Changed email address from steve@edmweb.com to sreid@sea-to-sky.net
-----------------
Modified 4/01
By Saul Kravitz <Saul.Kravitz@celera.com>
Still 100% PD
Modified to run on Compaq Alpha hardware.
-----------------
Modified 4/01
By Jouni Malinen <jkmaline@cc.hut.fi>
Minor changes to match the coding style used in Dynamics.
Modified September 24, 2004
By Jouni Malinen <jkmaline@cc.hut.fi>
Fixed tqalignment issue in SHA1Transform when SHA1HANDSOFF is defined.
*/
/*
Test Vectors (from FIPS PUB 180-1)
"abc"
A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
A million repetitions of "a"
34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
*/
#define SHA1HANDSOFF
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
/* blk0() and blk() perform the initial expand. */
/* I got the idea of expanding during the round function from SSLeay */
#ifndef WORDS_BIGENDIAN
#define blk0(i) (block->l[i] = (rol(block->l[i], 24) & 0xFF00FF00) | \
(rol(block->l[i], 8) & 0x00FF00FF))
#else
#define blk0(i) block->l[i]
#endif
#define blk(i) (block->l[i & 15] = rol(block->l[(i + 13) & 15] ^ \
block->l[(i + 8) & 15] ^ block->l[(i + 2) & 15] ^ block->l[i & 15], 1))
/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
#define R0(v,w,x,y,z,i) \
z += ((w & (x ^ y)) ^ y) + blk0(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
#define R1(v,w,x,y,z,i) \
z += ((w & (x ^ y)) ^ y) + blk(i) + 0x5A827999 + rol(v, 5); \
w = rol(w, 30);
#define R2(v,w,x,y,z,i) \
z += (w ^ x ^ y) + blk(i) + 0x6ED9EBA1 + rol(v, 5); w = rol(w, 30);
#define R3(v,w,x,y,z,i) \
z += (((w | x) & y) | (w & x)) + blk(i) + 0x8F1BBCDC + rol(v, 5); \
w = rol(w, 30);
#define R4(v,w,x,y,z,i) \
z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \
w=rol(w, 30);
#ifdef VERBOSE /* SAK */
void SHAPrintContext(SHA1_CTX *context, char *msg)
{
kdDebug() << msg << " (" << context->count[0] << "," << context->count[1] << ") " << context->state[0] << " " << context->state[1] << " " << context->state[2] << " " << context->state[3] << " " << context->state[4] << endl;
}
#endif
/* Hash a single 512-bit block. This is the core of the algorithm. */
void SHA1Transform(u32 state[5], const unsigned char buffer[64])
{
u32 a, b, c, d, e;
typedef union {
unsigned char c[64];
u32 l[16];
} CHAR64LONG16;
CHAR64LONG16* block;
#ifdef SHA1HANDSOFF
u32 workspace[16];
block = (CHAR64LONG16 *) workspace;
memcpy(block, buffer, 64);
#else
block = (CHAR64LONG16 *) buffer;
#endif
/* Copy context->state[] to working vars */
a = state[0];
b = state[1];
c = state[2];
d = state[3];
e = state[4];
/* 4 rounds of 20 operations each. Loop unrolled. */
R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
/* Add the working vars back into context.state[] */
state[0] += a;
state[1] += b;
state[2] += c;
state[3] += d;
state[4] += e;
/* Wipe variables */
a = b = c = d = e = 0;
#ifdef SHA1HANDSOFF
memset(block, 0, 64);
#endif
}
/* SHA1Init - Initialize new context */
static void SHA1Init(SHA1_CTX* context)
{
/* SHA1 initialization constants */
context->state[0] = 0x67452301;
context->state[1] = 0xEFCDAB89;
context->state[2] = 0x98BADCFE;
context->state[3] = 0x10325476;
context->state[4] = 0xC3D2E1F0;
context->count[0] = context->count[1] = 0;
}
/* Run your data through this. */
static void SHA1Update(SHA1_CTX* context, const void *_data, u32 len)
{
u32 i, j;
const unsigned char *data = (const unsigned char*) _data;
#ifdef VERBOSE
SHAPrintContext(context, "before");
#endif
j = (context->count[0] >> 3) & 63;
if ((context->count[0] += len << 3) < (len << 3))
context->count[1]++;
context->count[1] += (len >> 29);
if ((j + len) > 63) {
memcpy(&context->buffer[j], data, (i = 64-j));
SHA1Transform(context->state, context->buffer);
for ( ; i + 63 < len; i += 64) {
SHA1Transform(context->state, &data[i]);
}
j = 0;
}
else i = 0;
memcpy(&context->buffer[j], &data[i], len - i);
#ifdef VERBOSE
SHAPrintContext(context, "after ");
#endif
}
/* Add padding and return the message digest. */
static void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
{
u32 i;
unsigned char finalcount[8];
for (i = 0; i < 8; i++) {
finalcount[i] = (unsigned char)
((context->count[(i >= 4 ? 0 : 1)] >>
((3-(i & 3)) * 8) ) & 255); /* Endian independent */
}
SHA1Update(context, (unsigned char *) "\200", 1);
while ((context->count[0] & 504) != 448) {
SHA1Update(context, (unsigned char *) "\0", 1);
}
SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform()
*/
for (i = 0; i < 20; i++) {
digest[i] = (unsigned char)
((context->state[i >> 2] >> ((3 - (i & 3)) * 8)) &
255);
}
/* Wipe variables */
i = 0;
memset(context->buffer, 0, 64);
memset(context->state, 0, 20);
memset(context->count, 0, 8);
memset(finalcount, 0, 8);
}
/* ===== end - public domain SHA1 implementation ===== */
#endif /* EAP_TLS_FUNCS */
#ifdef TEST_MAIN
static u8 key0[] =
{
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
0x0b, 0x0b, 0x0b, 0x0b
};
static u8 data0[] = "Hi There";
static u8 prf0[] =
{
0xbc, 0xd4, 0xc6, 0x50, 0xb3, 0x0b, 0x96, 0x84,
0x95, 0x18, 0x29, 0xe0, 0xd7, 0x5f, 0x9d, 0x54,
0xb8, 0x62, 0x17, 0x5e, 0xd9, 0xf0, 0x06, 0x06,
0xe1, 0x7d, 0x8d, 0xa3, 0x54, 0x02, 0xff, 0xee,
0x75, 0xdf, 0x78, 0xc3, 0xd3, 0x1e, 0x0f, 0x88,
0x9f, 0x01, 0x21, 0x20, 0xc0, 0x86, 0x2b, 0xeb,
0x67, 0x75, 0x3e, 0x74, 0x39, 0xae, 0x24, 0x2e,
0xdb, 0x83, 0x73, 0x69, 0x83, 0x56, 0xcf, 0x5a
};
static u8 key1[] = "Jefe";
static u8 data1[] = "what do ya want for nothing?";
static u8 prf1[] =
{
0x51, 0xf4, 0xde, 0x5b, 0x33, 0xf2, 0x49, 0xad,
0xf8, 0x1a, 0xeb, 0x71, 0x3a, 0x3c, 0x20, 0xf4,
0xfe, 0x63, 0x14, 0x46, 0xfa, 0xbd, 0xfa, 0x58,
0x24, 0x47, 0x59, 0xae, 0x58, 0xef, 0x90, 0x09,
0xa9, 0x9a, 0xbf, 0x4e, 0xac, 0x2c, 0xa5, 0xfa,
0x87, 0xe6, 0x92, 0xc4, 0x40, 0xeb, 0x40, 0x02,
0x3e, 0x7b, 0xab, 0xb2, 0x06, 0xd6, 0x1d, 0xe7,
0xb9, 0x2f, 0x41, 0x52, 0x90, 0x92, 0xb8, 0xfc
};
static u8 key2[] =
{
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa,
0xaa, 0xaa, 0xaa, 0xaa
};
static u8 data2[] =
{
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd,
0xdd, 0xdd
};
static u8 prf2[] =
{
0xe1, 0xac, 0x54, 0x6e, 0xc4, 0xcb, 0x63, 0x6f,
0x99, 0x76, 0x48, 0x7b, 0xe5, 0xc8, 0x6b, 0xe1,
0x7a, 0x02, 0x52, 0xca, 0x5d, 0x8d, 0x8d, 0xf1,
0x2c, 0xfb, 0x04, 0x73, 0x52, 0x52, 0x49, 0xce,
0x9d, 0xd8, 0xd1, 0x77, 0xea, 0xd7, 0x10, 0xbc,
0x9b, 0x59, 0x05, 0x47, 0x23, 0x91, 0x07, 0xae,
0xf7, 0xb4, 0xab, 0xd4, 0x3d, 0x87, 0xf0, 0xa6,
0x8f, 0x1c, 0xbd, 0x9e, 0x2b, 0x6f, 0x76, 0x07
};
struct passphrase_test {
char *passphrase;
char *ssid;
char psk[32];
};
static struct passphrase_test passphrase_tests[] =
{
{
"password",
"IEEE",
{
0xf4, 0x2c, 0x6f, 0xc5, 0x2d, 0xf0, 0xeb, 0xef,
0x9e, 0xbb, 0x4b, 0x90, 0xb3, 0x8a, 0x5f, 0x90,
0x2e, 0x83, 0xfe, 0x1b, 0x13, 0x5a, 0x70, 0xe2,
0x3a, 0xed, 0x76, 0x2e, 0x97, 0x10, 0xa1, 0x2e
}
},
{
"ThisIsAPassword",
"ThisIsASSID",
{
0x0d, 0xc0, 0xd6, 0xeb, 0x90, 0x55, 0x5e, 0xd6,
0x41, 0x97, 0x56, 0xb9, 0xa1, 0x5e, 0xc3, 0xe3,
0x20, 0x9b, 0x63, 0xdf, 0x70, 0x7d, 0xd5, 0x08,
0xd1, 0x45, 0x81, 0xf8, 0x98, 0x27, 0x21, 0xaf
}
},
{
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ",
{
0xbe, 0xcb, 0x93, 0x86, 0x6b, 0xb8, 0xc3, 0x83,
0x2c, 0xb7, 0x77, 0xc2, 0xf5, 0x59, 0x80, 0x7c,
0x8c, 0x59, 0xaf, 0xcb, 0x6e, 0xae, 0x73, 0x48,
0x85, 0x00, 0x13, 0x00, 0xa9, 0x81, 0xcc, 0x62
}
},
};
#define NUM_PASSPHRASE_TESTS \
(sizeof(passphrase_tests) / sizeof(passphrase_tests[0]))
int main(int argc, char *argv[])
{
u8 res[512];
int ret = 0, i;
kdDebug() << "PRF-SHA1 test cases:" << endl;
sha1_prf(key0, sizeof(key0), "prefix", data0, sizeof(data0) - 1,
res, sizeof(prf0));
if (memcmp(res, prf0, sizeof(prf0)) == 0)
kdDebug() << "Test case 0 - OK" << endl;
else {
kdDebug() << "Test case 0 - FAILED!" << endl;
ret++;
}
sha1_prf(key1, sizeof(key1) - 1, "prefix", data1, sizeof(data1) - 1,
res, sizeof(prf1));
if (memcmp(res, prf1, sizeof(prf1)) == 0)
kdDebug() << "Test case 1 - OK" << endl;
else {
kdDebug() << "Test case 1 - FAILED!" << endl;
ret++;
}
sha1_prf(key2, sizeof(key2), "prefix", data2, sizeof(data2),
res, sizeof(prf2));
if (memcmp(res, prf2, sizeof(prf2)) == 0)
kdDebug() << "Test case 2 - OK" << endl;
else {
kdDebug() << "Test case 2 - FAILED!" << endl;
ret++;
}
ret += test_eap_fast();
kdDebug() << "PBKDF2-SHA1 Passphrase test cases:" << endl;
for (i = 0; i < NUM_PASSPHRASE_TESTS; i++) {
u8 psk[32];
struct passphrase_test *test = &passphrase_tests[i];
pbkdf2_sha1(test->passphrase,
test->ssid, strlen(test->ssid),
4096, psk, 32);
if (memcmp(psk, test->psk, 32) == 0)
kdDebug() << "Test case " << i << " - OK" << endl;
else {
kdDebug() << "Test case " << i << " - FAILED!" << endl;
ret++;
}
}
return ret;
}
#endif /* TEST_MAIN */

@ -0,0 +1,34 @@
/*
* SHA1 hash implementation and interface functions
* Copyright (c) 2003-2005, Jouni Malinen <jkmaline@cc.hut.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Alternatively, this software may be distributed under the terms of BSD
* license.
*
* See README and COPYING for more details.
*/
#ifndef SHA1_H
#define SHA1_H
#include <sys/types.h>
#define SHA1_MAC_LEN 20
void sha1_mac(const u_int8_t *key, size_t key_len, const u_int8_t *data, size_t data_len,
u_int8_t *mac);
void hmac_sha1_vector(const u_int8_t *key, size_t key_len, size_t num_elem,
const u_int8_t *addr[], const size_t *len, u_int8_t *mac);
void hmac_sha1(const u_int8_t *key, size_t key_len, const u_int8_t *data, size_t data_len,
u_int8_t *mac);
void sha1_prf(const u_int8_t *key, size_t key_len, const char *label,
const u_int8_t *data, size_t data_len, u_int8_t *buf, size_t buf_len);
void pbkdf2_sha1(const char *passphrase, const char *ssid, size_t ssid_len,
int iterations, u_int8_t *buf, size_t buflen);
#endif /* SHA1_H */

@ -0,0 +1,46 @@
/*
Copyright 2008 Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#include "traycomponent.h"
#include <klocale.h>
#include <ksystemtray.h>
TrayComponent::TrayComponent(KSystemTray * parent, const char * name )
: TQObject(parent, name), m_tray(parent)
{
}
TrayComponent::~TrayComponent()
{
}
KSystemTray * TrayComponent::tray() const
{
return m_tray;
}
TQStringList TrayComponent::getToolTipText()
{
return TQStringList();
}
#include "traycomponent.moc"

@ -0,0 +1,49 @@
/*
Copyright 2008 Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
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) version 3 or any later version
accepted by the membership of KDE e.V. (or its successor approved
by the membership of KDE e.V.), which shall act as a proxy
defined in Section 14 of version 3 of the license.
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, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRAY_COMPONENT_H
#define TRAY_COMPONENT_H
#include <NetworkManager.h>
#include <tqmap.h>
#include <tqmovie.h>
#include <tqobject.h>
#include <tqpixmap.h>
class KPopupMenu;
class KSystemTray;
class TrayComponent : public TQObject
{
Q_OBJECT
TQ_OBJECT
public:
TrayComponent(KSystemTray * parent, const char * name );
virtual ~TrayComponent();
virtual void addMenuItems(KPopupMenu* menu) = 0;
KSystemTray * tray() const;;
virtual TQStringList getToolTipText();
signals:
void uiUpdated();
private:
KSystemTray * m_tray;
};
#endif // TRAY_COMPONENT_H

@ -0,0 +1,150 @@
/***************************************************************************
*
* vpn_tray_componenet.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
// KDE includes
#include <kdebug.h>
#include <klocale.h>
#include <kiconloader.h>
// TQt DBus
#include <tqdbusobjectpath.h>
// KNM includes
#include "vpn_tray_component.h"
#include "knetworkmanager-menuitem.h"
#include "knetworkmanager-menu_subhead.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_vpn.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include <stdio.h>
using namespace ConnectionSettings;
void VPNTrayComponent::slotShowNewConnectionDialog()
{
// create a new VPN connection
Connection* conn = new VPNConnection();
// edit the new connection
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, NULL, tray(), "connect_something", false, TQt::WDestructiveClose);
dlg->show();
}
void VPNTrayComponent::addMenuItems(KPopupMenu* menu)
{
int inactive_vpn_connections = 0;
char vpn_found;
char any_vpn_found = 0;
ConnectionStore* connectionStore = ConnectionStore::getInstance();
// Get all active connections
NMProxy* nm = NMProxy::getInstance();
TQValueList<TQPair<ConnectionSettings::Connection*, Device*> > map = nm->getActiveConnectionsMap();
// get all available VPN Connections
TQValueList<Connection*> connections = connectionStore->getConnections(NM_SETTING_VPN_SETTING_NAME);
if (!connections.empty())
{
TQPopupMenu* popup = new TQPopupMenu(menu);
for (TQValueList<Connection*>::iterator it = connections.begin(); it != connections.end(); ++it)
{
VPNConnection* vpnconn = dynamic_cast<VPNConnection*>(*it);
if (vpnconn)
{
// VPN connection found :)
Info* info = vpnconn->getInfoSetting();
// lets create a nice name for this connection
if (info)
{
TQString title = info->getName();
NetworkMenuItem* item = new NetworkMenuItem(NULL, vpnconn, TQT_TQOBJECT(menu));
vpn_found = 0;
for (TQValueList<TQPair<ConnectionSettings::Connection*, Device*> >::Iterator it = map.begin(); it != map.end(); ++it)
{
ConnectionSettings::GenericConnection* conn = dynamic_cast<ConnectionSettings::GenericConnection*>((*it).first);
if (conn) {
if (strcmp(info->getName(), conn->getInfoSetting()->getName()) == 0) {
vpn_found = 1;
any_vpn_found = 1;
}
}
}
if (vpn_found == 1) {
printf("Active VPN connection found\n\r");
}
else {
int id = popup->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), title, item, TQT_SLOT(slotActivate()));
inactive_vpn_connections++;
}
//menu->setItemChecked(id, ((*it) == active_conn));
}
}
}
TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
if (any_vpn_found == 1) {
inactive_vpn_connections = 0;
}
if (device.isNull()) {
inactive_vpn_connections = 0;
}
if (inactive_vpn_connections > 0) {
menu->insertItem(SmallIcon ("encrypted", TQIconSet::Automatic), i18n("Start VPN connection"), popup);
menu->insertSeparator();
}
}
}
VPNTrayComponent::VPNTrayComponent (KSystemTray * parent, const char * name )
: TrayComponent (parent, name)
{
//Actions used for plugging into the menu
new KAction (i18n ("New connection ..."),
SmallIcon ("encrypted", TQIconSet::Automatic), 0,
this, TQT_SLOT (slotShowNewConnectionDialog()), parent->actionCollection (), "create_new_vpn_connection");
}
VPNTrayComponent::~VPNTrayComponent ()
{
}
#include "vpn_tray_component.moc"

@ -0,0 +1,50 @@
/***************************************************************************
*
* knetworkmanager.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2005, 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef VPN_TRAY_COMPONENT_H
#define VPN_TRAY_COMPONENT_H
// KNM includes
#include "traycomponent.h"
#include "knetworkmanager.h"
class VPNTrayComponent : public TrayComponent
{
Q_OBJECT
TQ_OBJECT
public:
VPNTrayComponent (KSystemTray * parent = 0, const char * name = 0);
~VPNTrayComponent ();
void addMenuItems(KPopupMenu* menu);
public slots:
void slotShowNewConnectionDialog();
private:
};
#endif /* VPN_TRAY_COMPONENT_H */

@ -0,0 +1,149 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>AuthenticationDialog</class>
<widget class="TQDialog">
<property name="name">
<cstring>AuthenticationDialog</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>426</width>
<height>224</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>7</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="caption">
<string>AuthenticationDialog</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KPushButton" row="4" column="1">
<property name="name">
<cstring>pushOK</cstring>
</property>
<property name="text">
<string>OK</string>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
<widget class="TQCheckBox" row="3" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>chkStorePasswordsPermanent</cstring>
</property>
<property name="text">
<string>Save passwords permanent</string>
</property>
</widget>
<widget class="KPushButton" row="4" column="2">
<property name="name">
<cstring>pushCancel</cstring>
</property>
<property name="text">
<string>Cancel</string>
</property>
</widget>
<spacer row="4" column="0">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="0" rowspan="4" colspan="1">
<property name="name">
<cstring>labelPixmap</cstring>
</property>
<property name="scaledContents">
<bool>false</bool>
</property>
<property name="tqalignment">
<set>AlignTop</set>
</property>
</widget>
<spacer row="2" column="1">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQWidgetStack" row="1" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>widgetStack</cstring>
</property>
<property name="frameShape">
<enum>NoFrame</enum>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>0</number>
</attribute>
</widget>
</widget>
</grid>
</widget>
<connections>
<connection>
<sender>pushCancel</sender>
<signal>clicked()</signal>
<receiver>AuthenticationDialog</receiver>
<slot>cancel()</slot>
</connection>
<connection>
<sender>pushOK</sender>
<signal>clicked()</signal>
<receiver>AuthenticationDialog</receiver>
<slot>ok()</slot>
</connection>
</connections>
<tabstops>
<tabstop>pushOK</tabstop>
<tabstop>pushCancel</tabstop>
<tabstop>chkStorePasswordsPermanent</tabstop>
<tabstop>widgetStack</tabstop>
</tabstops>
<Q_SLOTS>
<slot access="protected">ok()</slot>
<slot access="protected">cancel()</slot>
</Q_SLOTS>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>kpushbutton.h</includehint>
<includehint>kpushbutton.h</includehint>
</includehints>
</UI>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,42 @@
/***************************************************************************
*
* Copyright (C) 2008 by Kevin Krammer <k.krammer@gmx.at>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef XMLMARSHALLER_H
#define XMLMARSHALLER_H
class TQT_DBusData;
class TQDomDocument;
class TQDomElement;
class TQString;
class XMLMarshaller
{
public:
static TQDomElement fromTQT_DBusData(const TQT_DBusData& data, const TQDomDocument& ownerDoc);
static TQT_DBusData toTQT_DBusData(const TQDomElement& element);
static TQString fromTQT_DBusData(const TQT_DBusData& data);
static TQT_DBusData toTQT_DBusData(const TQString& xmlString);
};
#endif

@ -0,0 +1,17 @@
SUBDIRS=
if WITH_OPENVPN
SUBDIRS += openvpn
endif
if WITH_VPNC
SUBDIRS += vpnc
endif
if WITH_STRONGSWAN
SUBDIRS += strongswan
endif
if WITH_PPTP
SUBDIRS += pptp
endif

@ -0,0 +1,2 @@
Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
Thomas Kallenberg <tkallenb@hsr.ch> <thomas@no-more-secrets.ch>

@ -0,0 +1,5 @@
SUBDIRS = src
service_DATA = knetworkmanager_openvpn.desktop
servicedir = $(kde_servicesdir)

@ -0,0 +1,14 @@
KNETWORKMANAGER_OPENVPN_VERSION=0.1
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_OPENVPN_VERSION, $KNETWORKMANAGER_OPENVPN_VERSION, [KNetworkManager OpenVPN Plugin Version])
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_OPENVPN_VERSION_STRING, "$KNETWORKMANAGER_OPENVPN_VERSION", [KNetworkManager OpenVPN Plugin Version String])
PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([TQT dbus bindings missing])
])
OPENVPN_CFLAGS="$DBUS_TQT_CFLAGS"
OPENVPN_LIBS="$DBUS_TQT_LIBS"
AC_SUBST(OPENVPN_CFLAGS)
AC_SUBST(OPENVPN_LIBS)

@ -0,0 +1,25 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
Icon=
ServiceTypes=KNetworkManager/VPNPlugin
X-KDE-Library=knetworkmanager_openvpn
X-NetworkManager-Services=openvpn
X-KDE-PluginInfo-Author=Helmut Schaa
X-KDE-PluginInfo-Email=hschaa@suse.de
X-KDE-PluginInfo-Name=knetworkmanager_openvpn
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=VPNService
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
Name=OpenVPN
Name[bn]=ওপেন-ভিপিএন
Name[ca]=VPN oberta
Name[xx]=xxOpenVPNxx
Comment=OpenVPN
Comment[bn]=ওপেন-ভিপিএন
Comment[ca]=VPN oberta
Comment[xx]=xxOpenVPNxx

@ -0,0 +1,12 @@
INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(OPENVPN_CFLAGS) $(all_includes)
METASOURCES = AUTO
kde_module_LTLIBRARIES = knetworkmanager_openvpn.la
knetworkmanager_openvpn_la_SOURCES = knetworkmanager-openvpn.cpp \
openvpnprop.ui \
openvpnauth.ui
noinst_HEADERS = knetworkmanager-openvpn.h
knetworkmanager_openvpn_la_LDFLAGS = -module $(all_libraries)
knetworkmanager_openvpn_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)

@ -0,0 +1,566 @@
/***************************************************************************
*
* knetworkmanager-openvpn.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <klocale.h>
#include <tqmessagebox.h>
#include <tqbutton.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <tqobjectlist.h>
#include <tqobject.h>
#include <tqcheckbox.h>
#include <kpassdlg.h>
#include <kgenericfactory.h>
#include <tqwidgetstack.h>
#include <tqfileinfo.h>
#include <tqhostaddress.h>
#include <tqdbusdata.h>
#include "knetworkmanager-openvpn.h"
typedef KGenericFactory<OpenVPNPlugin> OpenVPNPluginFactory;
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_openvpn, OpenVPNPluginFactory("knetworkmanager_openvpn"));
/************************************
* OpenVPNPlugin
************************************/
OpenVPNPlugin::OpenVPNPlugin(TQObject* parent, const char* name, const TQStringList& args)
: VPNPlugin(parent, name, args)
{
}
OpenVPNPlugin::~OpenVPNPlugin()
{
}
VPNConfigWidget* OpenVPNPlugin::CreateConfigWidget(TQWidget* parent)
{
return new OpenVPNConfig(parent);
}
VPNAuthenticationWidget* OpenVPNPlugin::CreateAuthenticationWidget(TQWidget* parent)
{
return new OpenVPNAuthentication(parent);
}
/************************************
* OpenVPNConnectionType
************************************/
OpenVPNConnectionType::CONNECTIONTYPE OpenVPNConnectionType::mapString2ConnectionType(int prop)
{
if (prop == 0)
return X509;
else if (prop == 1)
return SHARED_KEY;
else if (prop == 2)
return PASSWORD;
else if (prop == 3)
return X509USERPASS;
return UNKNOWN;
}
int OpenVPNConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
{
switch(connType)
{
case X509:
return 0;
case SHARED_KEY:
return 1;
case PASSWORD:
return 2;
case X509USERPASS:
return 3;
default:
return -1;
}
return -1;
}
/************************************
* OpenVPNConfig
************************************/
OpenVPNConfig::OpenVPNConfig(TQWidget* parent)
: VPNConfigWidget(parent)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_openvpnWidget = new OpenVPNConfigWidget(this);
tqlayout->addWidget(_openvpnWidget);
connect(_openvpnWidget->chkUseCipher, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboCipher, TQT_SLOT(setEnabled(bool)));
connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->cboDirection, TQT_SLOT(setEnabled(bool)));
connect(_openvpnWidget->chkUseTLS, TQT_SIGNAL(toggled(bool)), _openvpnWidget->editTLSAuth, TQT_SLOT(setEnabled(bool)));
connect(_openvpnWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _openvpnWidget->routes, TQT_SLOT(setEnabled(bool)));
// add all Cipher modes to the Combobox
getCipherModes();
// switch to the right configuration interface when selecting the connection type
connect(_openvpnWidget->cboConnectionType, TQT_SIGNAL( activated(int)), _openvpnWidget->widgetStack, TQT_SLOT(raiseWidget(int)));
this->languageChange();
}
OpenVPNConfig::~OpenVPNConfig()
{
}
void OpenVPNConfig::languageChange()
{
_openvpnWidget->cboConnectionType->insertItem(i18n("X.509 Certificates"), OpenVPNConnectionType::X509 );
_openvpnWidget->cboConnectionType->insertItem(i18n("Pre-shared key") , OpenVPNConnectionType::SHARED_KEY );
_openvpnWidget->cboConnectionType->insertItem(i18n("Password Authentication") , OpenVPNConnectionType::PASSWORD );
_openvpnWidget->cboConnectionType->insertItem(i18n("X.509 with Password Authentication") , OpenVPNConnectionType::X509USERPASS );
_openvpnWidget->cboDirection->insertItem(i18n("none"));
_openvpnWidget->cboDirection->insertItem(i18n("0"));
_openvpnWidget->cboDirection->insertItem(i18n("1"));
}
TQString OpenVPNConfig::findOpenVPNBinary()
{
static const char *openvpn_binary_paths[] =
{
"/usr/sbin/openvpn",
"/sbin/openvpn",
NULL
};
const char **openvpn_binary = openvpn_binary_paths;
while (*openvpn_binary != NULL) {
if ( TQFileInfo(*openvpn_binary).exists())
break;
openvpn_binary++;
}
return *openvpn_binary;
}
void OpenVPNConfig::receiveCipherData(KProcess*, char* buffer, int len)
{
// add possible cipher modes to the combobox
TQStringList cipherModes = TQStringList::split("\n", TQString::tqfromLatin1(buffer, len), false );
for (TQStringList::ConstIterator it = cipherModes.begin(); it != cipherModes.end(); ++it)
{
_openvpnWidget->cboCipher->insertItem((*it));
}
}
void OpenVPNConfig::getCipherModes()
{
// get all possible cipher modes
TQString openvpn = findOpenVPNBinary();
if (!openvpn.isNull())
{
KProcess* cipherHelper = new KProcess();
cipherHelper->setUseShell(true, "/bin/sh");
*cipherHelper << TQString::tqfromLatin1("%1 --show-ciphers | awk '/^[A-Z][A-Z0-9]+-/ { print $1 }'").tqarg(openvpn);
connect (cipherHelper, TQT_SIGNAL(receivedStdout(KProcess*, char*, int)), this, TQT_SLOT(receiveCipherData(KProcess*, char*, int)));
kdDebug() << "starting openvpn to get cipher modes" << endl;
if (!cipherHelper->start(KProcess::Block, KProcess::Stdout))
kdDebug() << "error starting openvpn" << endl;
}
}
void OpenVPNConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
{
// fill up our inputfields
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
TQString entry = it.key();
TQString value = it.data();
if (entry == "connection-type")
{
OpenVPNConnectionType::CONNECTIONTYPE type = OpenVPNConnectionType::mapString2ConnectionType(value.toInt());
_openvpnWidget->cboConnectionType->setCurrentItem(type);
_openvpnWidget->widgetStack->raiseWidget(type);
}
else if (entry == "remote")
{
_openvpnWidget->gateway->setText(value);
}
else if (entry == "port")
{
if (value.toInt() > 0)
{
_openvpnWidget->port->setText(value);
_openvpnWidget->chkDefaultPort->setChecked(false);
}
else
{
_openvpnWidget->chkDefaultPort->setChecked(true);
}
}
else if (entry == "proto" || entry == "proto-tcp")
{
_openvpnWidget->chkUseTCP->setChecked( value == "yes");
}
else if (entry == "ca")
{
_openvpnWidget->editCA->setURL(value);
}
else if (entry == "cert")
{
_openvpnWidget->editCert->setURL(value);
}
else if (entry == "key")
{
_openvpnWidget->editKey->setURL(value);
}
else if (entry == "cipher")
{
_openvpnWidget->chkUseCipher->setChecked(true);
_openvpnWidget->cboCipher->setCurrentItem(value);
}
else if (entry == "comp-lzo")
{
_openvpnWidget->chkUseLZO->setChecked(value == "true");
}
else if (entry == "shared-key" || entry == "static-key")
{
_openvpnWidget->editSharedKey->setURL(value);
}
else if (entry == "username")
{
_openvpnWidget->editUsername->setText(value);
}
else if (entry == "local-ip")
{
_openvpnWidget->editLocalIP->setText(value);
}
else if (entry == "remote-ip")
{
_openvpnWidget->editRemoteIP->setText(value);
}
else if (entry == "dev" || entry == "tap-dev") {
_openvpnWidget->chkUseTAP->setChecked(value == "true");
}
else if (entry == "ta")
{
_openvpnWidget->chkUseTLS->setChecked(true);
_openvpnWidget->editTLSAuth->setURL(value);
}
else if (entry == "ta-dir")
{
_openvpnWidget->cboDirection->setCurrentItem(value);
}
else
{
kdDebug() << TQString("OpenVPN: Property '%1' not handled").tqarg(entry) << endl;
}
}
// set routes
if (!routes.empty())
{
_openvpnWidget->chkIPAdresses->setChecked(true);
_openvpnWidget->routes->setText(routes.join(" "));
}
}
TQMap<TQString, TQString>OpenVPNConfig::getVPNProperties()
{
// build a StingList of properties
TQMap<TQString, TQString> strlist;
strlist.insert("connection-type", TQString::number(OpenVPNConnectionType::mapConnectionType2String((OpenVPNConnectionType::CONNECTIONTYPE)_openvpnWidget->cboConnectionType->currentItem())));
strlist.insert("remote", TQString(_openvpnWidget->gateway->text()));
// port is not necessary
if (!_openvpnWidget->port->text().isEmpty() && !_openvpnWidget->chkDefaultPort->isChecked())
strlist.insert("port", _openvpnWidget->port->text());
strlist.insert("ca", TQString(_openvpnWidget->editCA->url()));
strlist.insert("cert",TQString(_openvpnWidget->editCert->url() ));
strlist.insert("key", TQString(_openvpnWidget->editKey->url()));
if (_openvpnWidget->chkUseCipher->isChecked())
strlist.insert("cipher", TQString(_openvpnWidget->cboCipher->currentText()));
if (_openvpnWidget->chkUseLZO->isChecked())
strlist.insert("comp-lzo", TQString("true"));
else
strlist.insert("comp-lzo", TQString("false"));
strlist.insert("static-key", TQString(_openvpnWidget->editSharedKey->url()));
strlist.insert("username", TQString(_openvpnWidget->editUsername->text()));
strlist.insert("local-ip", TQString(_openvpnWidget->editLocalIP->text()));
strlist.insert("remote-ip", TQString(_openvpnWidget->editRemoteIP->text()));
if (_openvpnWidget->chkUseTAP->isChecked()) {
strlist.insert("tap-dev", "true");
strlist.insert("proto-tcp", "true");
} else {
strlist.insert("tap-dev", "false");
strlist.insert("proto-tcp", "false");
}
if (_openvpnWidget->chkUseTLS->isChecked())
strlist.insert("ta", TQString(_openvpnWidget->editTLSAuth->url()));
strlist.insert("ta-dir", TQString(_openvpnWidget->cboDirection->currentText()));
return strlist;
}
TQStringList OpenVPNConfig::getVPNRoutes()
{
TQStringList strlist;
if(_openvpnWidget->chkIPAdresses->isChecked())
{
strlist = TQStringList::split(" ", _openvpnWidget->routes->text());
}
return strlist;
}
bool OpenVPNConfig::hasChanged()
{
return true;
}
bool OpenVPNConfig::isValid(TQStringList& err_msg)
{
bool retval = true;
// check gateway
if (_openvpnWidget->gateway->text().isEmpty())
{
err_msg.append(i18n("You have to specify a gateway"));
retval = false;
}
bool ok = false;
_openvpnWidget->port->text().toULong(&ok);
if (!ok && !_openvpnWidget->port->text().isEmpty() )
{
err_msg.append(i18n("The port number has to be numeric"));
retval = false;
}
switch(_openvpnWidget->cboConnectionType->currentItem())
{
case OpenVPNConnectionType::X509:
// check if ca file is correct
if (_openvpnWidget->editCA->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no CA file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
{
retval = false;
err_msg.append(i18n("CA file not valid"));
}
// check if cert file is correct
if (_openvpnWidget->editCert->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no CERT file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile())
{
retval = false;
err_msg.append(i18n("CERT file not valid"));
}
// check if key file is correct
if (_openvpnWidget->editKey->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no Key file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile())
{
retval = false;
err_msg.append(i18n("Key file not valid"));
}
break;
case OpenVPNConnectionType::SHARED_KEY:
// check if a shared key is selected
if (_openvpnWidget->editSharedKey->url().isEmpty())
{
retval = false;
err_msg.append(i18n("Please provide a valid shared key"));
}
// check if the shared key file exists
else if (!TQFileInfo(_openvpnWidget->editSharedKey->url()).exists())
{
retval = false;
err_msg.append(i18n("Please provide a valid shared key"));
}
// check if local ip is valid
if (!TQHostAddress().setAddress(_openvpnWidget->editLocalIP->text()))
{
retval = false;
err_msg.append(i18n("local IP is invalid"));
}
// check if remote ip is valid
if (!TQHostAddress().setAddress(_openvpnWidget->editRemoteIP->text()))
{
retval = false;
err_msg.append(i18n("remote IP is invalid"));
}
break;
case OpenVPNConnectionType::PASSWORD:
// check if username is suplied
if (_openvpnWidget->editUsername->text().isEmpty())
{
retval = false;
err_msg.append(i18n("no username provided"));
}
// check if ca file is correct
if (_openvpnWidget->editCA->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no CA file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
{
retval = false;
err_msg.append(i18n("CA file not valid"));
}
break;
case OpenVPNConnectionType::X509USERPASS:
// check if username is suplied
if (_openvpnWidget->editUsername->text().isEmpty())
{
retval = false;
err_msg.append(i18n("no username provided"));
}
// check if ca file is correct
if (_openvpnWidget->editCA->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no CA file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editCA->url()).isFile())
{
retval = false;
err_msg.append(i18n("CA file not valid"));
}
// check if cert file is correct
if (_openvpnWidget->editCert->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no CERT file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editCert->url()).isFile())
{
retval = false;
err_msg.append(i18n("CERT file not valid"));
}
// check if key file is correct
if (_openvpnWidget->editKey->url().isEmpty())
{
retval = false;
err_msg.append(i18n("no Key file provided"));
}
else if (!TQFileInfo(_openvpnWidget->editKey->url()).isFile())
{
retval = false;
err_msg.append(i18n("Key file not valid"));
}
break;
}
return retval;
}
/************************************
* OpenVPNAuthentication
************************************/
OpenVPNAuthentication::OpenVPNAuthentication(TQWidget* parent, char* name)
: VPNAuthenticationWidget(parent, name)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_openvpnAuth = new OpenVPNAuthenticationWidget(this);
tqlayout->addWidget(_openvpnAuth);
}
OpenVPNAuthentication::~OpenVPNAuthentication()
{
}
void OpenVPNAuthentication::setVPNData(const TQStringList& /*routes*/, const TQMap<TQString, TQString>& properties)
{
// find the connection type property
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
if (it.key() == "connection-type")
{
_connectionType = OpenVPNConnectionType::mapString2ConnectionType(it.data().toInt());
break;
}
}
}
TQMap<TQString, TQString> OpenVPNAuthentication::getPasswords()
{
TQMap<TQString, TQString> pwds;
if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS))
pwds.insert("password", TQString(_openvpnAuth->editUserPassword->password()));
else
pwds.insert("no-secret", TQString("true"));
return pwds;
}
void OpenVPNAuthentication::setPasswords(TQString name, TQString value) {
if (name == TQString("password")) {
_openvpnAuth->editUserPassword->erase();
_openvpnAuth->editUserPassword->insert(value);
}
}
bool OpenVPNAuthentication::needsUserInteraction()
{
if ((_connectionType == OpenVPNConnectionType::PASSWORD) || (_connectionType == OpenVPNConnectionType::X509USERPASS))
return true;
return false;
}

@ -0,0 +1,110 @@
/***************************************************************************
*
* knetworkmanager-openvpn.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_OPENVPN_H
#define KNETWORKMANAGER_OPENVPN_H
#include <tqmap.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include <kprocess.h>
#include "knetworkmanager-vpnplugin.h"
#include "openvpnprop.h"
#include "openvpnauth.h"
class OpenVPNPlugin : public VPNPlugin
{
Q_OBJECT
TQ_OBJECT
public:
OpenVPNPlugin(TQObject*, const char*, const TQStringList&);
~OpenVPNPlugin();
VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
};
class OpenVPNConnectionType
{
public:
enum CONNECTIONTYPE
{
UNKNOWN = -1
, X509 = 0
, SHARED_KEY
, PASSWORD
, X509USERPASS
};
static CONNECTIONTYPE mapString2ConnectionType(int string);
static int mapConnectionType2String(CONNECTIONTYPE connectionType);
};
class OpenVPNConfig : public VPNConfigWidget
{
Q_OBJECT
TQ_OBJECT
public:
void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
TQMap<TQString, TQString> getVPNProperties();
TQStringList getVPNRoutes();
bool hasChanged();
bool isValid(TQStringList& );
OpenVPNConfig(TQWidget* parent);
~OpenVPNConfig();
public slots:
void receiveCipherData(KProcess*, char*, int);
private:
OpenVPNConfigWidget* _openvpnWidget;
void getCipherModes();
TQString findOpenVPNBinary();
protected slots:
void languageChange();
};
class OpenVPNAuthentication : public VPNAuthenticationWidget
{
Q_OBJECT
TQ_OBJECT
public:
OpenVPNAuthentication(TQWidget* parent = NULL, char* name = NULL);
~OpenVPNAuthentication();
void setVPNData(const TQStringList&, const TQMap<TQString, TQString>&);
TQMap<TQString, TQString> getPasswords();
void setPasswords(TQString name, TQString value);
bool needsUserInteraction();
private:
OpenVPNAuthenticationWidget* _openvpnAuth;
OpenVPNConnectionType::CONNECTIONTYPE _connectionType;
};
#endif /* KNETWORKMANAGER_OPENVPN_H */

@ -0,0 +1,80 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>OpenVPNAuthenticationWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>OpenVPNAuthenticationWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>171</height>
</rect>
</property>
<property name="caption">
<string>OpenVPNAuthentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<spacer row="0" column="2">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<spacer row="2" column="1">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<widget class="KPasswordEdit" row="0" column="1">
<property name="name">
<cstring>editUserPassword</cstring>
</property>
</widget>
</grid>
</widget>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,619 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>OpenVPNConfigWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>OpenVPNConfigWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>322</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>kTabWidget1</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Required Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer row="4" column="1">
<property name="name">
<cstring>spacer9</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
<widget class="TQWidgetStack" row="3" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>widgetStack</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>0</number>
</attribute>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox5</cstring>
</property>
<property name="title">
<string>X.509</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KURLRequester" row="0" column="1">
<property name="name">
<cstring>editCA2</cstring>
</property>
</widget>
<widget class="KURLRequester" row="1" column="1">
<property name="name">
<cstring>editCert2</cstring>
</property>
</widget>
<widget class="KURLRequester" row="2" column="1">
<property name="name">
<cstring>editKey2</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>CA file</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel3_2</cstring>
</property>
<property name="text">
<string>Certificate</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>Key</string>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>1</number>
</attribute>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox5_2</cstring>
</property>
<property name="title">
<string>Shared key</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KURLRequester" row="0" column="1">
<property name="name">
<cstring>editSharedKey</cstring>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
<property name="name">
<cstring>editLocalIP</cstring>
</property>
</widget>
<widget class="KLineEdit" row="2" column="1">
<property name="name">
<cstring>editRemoteIP</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>Shared Key</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Local IP</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="text">
<string>Remote IP</string>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>2</number>
</attribute>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox5_2_2</cstring>
</property>
<property name="title">
<string>Password</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KURLRequester" row="0" column="1">
<property name="name">
<cstring>editCA3</cstring>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
<property name="name">
<cstring>editUsername2</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel8</cstring>
</property>
<property name="text">
<string>CA file</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel9</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>WStackPage</cstring>
</property>
<attribute name="id">
<number>3</number>
</attribute>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQGroupBox">
<property name="name">
<cstring>groupBox5_3</cstring>
</property>
<property name="title">
<string>X.509 with password authentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KURLRequester" row="0" column="1">
<property name="name">
<cstring>editCA</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
<string>CA file</string>
</property>
</widget>
<widget class="KURLRequester" row="1" column="1">
<property name="name">
<cstring>editCert</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel3_2_2</cstring>
</property>
<property name="text">
<string>Certificate</string>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel4_2</cstring>
</property>
<property name="text">
<string>Key</string>
</property>
</widget>
<widget class="KURLRequester" row="2" column="1">
<property name="name">
<cstring>editKey</cstring>
</property>
</widget>
<widget class="KLineEdit" row="3" column="1">
<property name="name">
<cstring>editUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel9_2</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
</grid>
</widget>
</hbox>
</widget>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>labelConnectionType</cstring>
</property>
<property name="text">
<string>Connection Type</string>
</property>
</widget>
<widget class="KComboBox" row="2" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>cboConnectionType</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Gateway</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel3_3</cstring>
</property>
<property name="text">
<string>Port</string>
</property>
</widget>
<widget class="KLineEdit" row="0" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>gateway</cstring>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
<property name="name">
<cstring>port</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="2">
<property name="name">
<cstring>chkDefaultPort</cstring>
</property>
<property name="text">
<string>Use Default</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</grid>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Optional Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KLineEdit" row="7" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>routes</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkIPAdresses</cstring>
</property>
<property name="text">
<string>Only use VPN Connection for these Addresses (eg: 172.16.0.0/16 10.11.12.0/24)</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkUseTAP</cstring>
</property>
<property name="text">
<string>Use TAP device</string>
</property>
</widget>
<widget class="TQCheckBox" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkUseLZO</cstring>
</property>
<property name="text">
<string>Use LZO compression</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkUseTCP</cstring>
</property>
<property name="text">
<string>Use TCP connection</string>
</property>
</widget>
<spacer row="8" column="1">
<property name="name">
<cstring>spacer10</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
<widget class="TQCheckBox" row="3" column="0">
<property name="name">
<cstring>chkUseCipher</cstring>
</property>
<property name="text">
<string>Use cipher</string>
</property>
</widget>
<widget class="TQCheckBox" row="4" column="0">
<property name="name">
<cstring>chkUseTLS</cstring>
</property>
<property name="text">
<string>Use TLS auth</string>
</property>
</widget>
<widget class="TQLabel" row="5" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Direction:</string>
</property>
</widget>
<widget class="KComboBox" row="5" column="1">
<property name="name">
<cstring>cboDirection</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="KURLRequester" row="4" column="1">
<property name="name">
<cstring>editTLSAuth</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="KComboBox" row="3" column="1">
<property name="name">
<cstring>cboCipher</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<customwidgets>
</customwidgets>
<connections>
<connection>
<sender>editCA</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA2</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCA</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA3</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCA2</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCA2</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA3</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCA3</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA2</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCA3</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCA</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCert</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCert2</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editCert2</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editCert</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editKey</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editKey2</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editKey2</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editKey</receiver>
<slot>setURL(const QString&amp;)</slot>
</connection>
<connection>
<sender>editUsername</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editUsername2</receiver>
<slot>setText(const QString&amp;)</slot>
</connection>
<connection>
<sender>editUsername2</sender>
<signal>textChanged(const QString&amp;)</signal>
<receiver>editUsername</receiver>
<slot>setText(const QString&amp;)</slot>
</connection>
<connection>
<sender>chkDefaultPort</sender>
<signal>toggled(bool)</signal>
<receiver>port</receiver>
<slot>setDisabled(bool)</slot>
</connection>
</connections>
<tabstops>
<tabstop>kTabWidget1</tabstop>
<tabstop>chkUseLZO</tabstop>
<tabstop>chkUseTAP</tabstop>
<tabstop>chkUseTCP</tabstop>
<tabstop>chkUseCipher</tabstop>
<tabstop>cboCipher</tabstop>
<tabstop>chkUseTLS</tabstop>
<tabstop>editTLSAuth</tabstop>
<tabstop>cboDirection</tabstop>
<tabstop>chkIPAdresses</tabstop>
<tabstop>routes</tabstop>
<tabstop>gateway</tabstop>
<tabstop>cboConnectionType</tabstop>
<tabstop>editCA2</tabstop>
<tabstop>editCert2</tabstop>
<tabstop>editKey2</tabstop>
<tabstop>editSharedKey</tabstop>
<tabstop>editLocalIP</tabstop>
<tabstop>editRemoteIP</tabstop>
<tabstop>editCA3</tabstop>
<tabstop>editUsername2</tabstop>
<tabstop>editCA</tabstop>
<tabstop>editCert</tabstop>
<tabstop>editKey</tabstop>
<tabstop>editUsername</tabstop>
</tabstops>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1 @@
Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>

@ -0,0 +1,5 @@
SUBDIRS = src
service_DATA = knetworkmanager_pptp.desktop
servicedir = $(kde_servicesdir)

@ -0,0 +1,5 @@
KNETWORKMANAGER_PPTP_VERSION=0.1
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_PPTP_VERSION, $KNETWORKMANAGER_PPTP_VERSION, [KNetworkManager PPTP Plugin Version])
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_PPTP_VERSION_STRING, "$KNETWORKMANAGER_PPTP_VERSION", [KNetworkManager PPTP Plugin Version String])

@ -0,0 +1,23 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
Icon=
ServiceTypes=KNetworkManager/VPNPlugin
X-KDE-Library=knetworkmanager_pptp
X-NetworkManager-Services=pptp
X-KDE-PluginInfo-Author=Helmut Schaa
X-KDE-PluginInfo-Email=hschaa@suse.de
X-KDE-PluginInfo-Name=knetworkmanager_pptp
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=VPNService
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
Name=PPTP
Name[bn]=পিপিটিপি
Name[xx]=xxPPTPxx
Comment=PPTP
Comment[bn]=পিপিটিপি
Comment[xx]=xxPPTPxx

@ -0,0 +1,12 @@
INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(PACKAGE_CFLAGS) $(all_includes)
METASOURCES = AUTO
kde_module_LTLIBRARIES = knetworkmanager_pptp.la
knetworkmanager_pptp_la_SOURCES = knetworkmanager-pptp.cpp \
pptpprop.ui \
pptpauth.ui
noinst_HEADERS = knetworkmanager-pptp.h
knetworkmanager_pptp_la_LDFLAGS = -module $(all_libraries)
knetworkmanager_pptp_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)

@ -0,0 +1,34 @@
INCLUDES = $(PACKAGE_CFLAGS) $(all_includes)
# rule for creating tqmoc files
%.tqmoc.cpp: %.h
$(TQMOC) -o $@ $<
# rules for creating .h and .cpp from .ui
%.cpp: %.ui %.h
$(UIC) -tr tr2i18n -pch klocale.h -o $@ -impl $*.h $<
%.h: %.ui
$(UIC) -o $@ $<
all_TQMOC = knetworkmanager-vpnc.tqmoc.cpp \
vpncauth.tqmoc.cpp \
vpncprop.tqmoc.cpp
all_METASOURCES = vpncauth.cpp \
vpncprop.cpp
all_IMPLEMENTATIONS = knetworkmanager-vpnc.cpp
kde_module_LTLIBRARIES = knetworkmanager_vpnc.la
knetworkmanager_vpnc_la_SOURCES = $(all_METASOURCES) $(all_TQMOC) $(all_IMPLEMENTATIONS)
noinst_HEADERS = knetworkmanager-vpnc.h
knetworkmanager_vpnc_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN)
knetworkmanager_vpnc_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)
service_DATA = knetworkmanager_vpnc.desktop
servicedir = $(kde_servicesdir)
CLEANFILES = $(all_TQMOC) $(all_METASOURCES)

@ -0,0 +1,231 @@
/***************************************************************************
*
* knetworkmanager-pptp.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <klocale.h>
#include <tqmessagebox.h>
#include <tqbutton.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <tqobjectlist.h>
#include <tqobject.h>
#include <tqcheckbox.h>
#include <kpassdlg.h>
#include <kgenericfactory.h>
#include <tqlabel.h>
#include "knetworkmanager-pptp.h"
typedef KGenericFactory<PPTPPlugin> PPTPPluginFactory;
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp"));
PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args)
: VPNPlugin(parent, name, args)
{
KLocale* loc = KGlobal::locale();
loc->insertCatalogue("NetworkManager-pptp");
}
PPTPPlugin::~PPTPPlugin()
{
}
VPNConfigWidget* PPTPPlugin::CreateConfigWidget(TQWidget* parent)
{
return new PPTPConfig(parent);
}
VPNAuthenticationWidget* PPTPPlugin::CreateAuthenticationWidget(TQWidget* parent)
{
return new PPTPAuthentication(parent);
}
PPTPConfig::PPTPConfig(TQWidget* parent)
: VPNConfigWidget(parent)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_pptpWidget = new PPTPConfigWidget(this);
tqlayout->addWidget(_pptpWidget);
connect(_pptpWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _pptpWidget->routes, TQT_SLOT(setEnabled(bool)));
this->languageChange();
}
PPTPConfig::~PPTPConfig()
{
}
void PPTPConfig::languageChange()
{
}
void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
{
// fill up our inputfields (only textfields atm)
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
TQString entry = it.key();
TQString value = it.data();
if (entry == "gateway")
{
_pptpWidget->gateway->setText(value);
}
else if (entry == "refuse-eap")
{
_pptpWidget->chk_refuseeap->setChecked(value == "yes" || value == "true");
}
else if (entry == "refuse-pap")
{
_pptpWidget->chk_refusepap->setChecked(value == "yes" || value == "true");
}
else if (entry == "refuse-chap")
{
_pptpWidget->chk_refusechap->setChecked(value == "yes" || value == "true");
}
else if (entry == "refuse-mschap")
{
_pptpWidget->chk_refusemschap->setChecked(value == "yes" || value == "true");
}
else if (entry == "refuse-mschapv2")
{
_pptpWidget->chk_refusemschapv2->setChecked(value == "yes" || value == "true");
}
else if (entry == "require-mppe")
{
_pptpWidget->chk_requiremppe->setChecked(value == "yes" || value == "true");
}
else if (entry == "require-mppe-40")
{
_pptpWidget->chk_requiremppe40->setChecked(value == "yes" || value == "true");
}
else if (entry == "require-mppe-128")
{
_pptpWidget->chk_requiremppe128->setChecked(value == "yes" || value == "true");
}
else if (entry == "mppe-stateful")
{
_pptpWidget->chk_mppestateful->setChecked(value == "yes" || value == "true");
}
else if (entry == "nodeflate")
{
_pptpWidget->chk_nodeflate->setChecked(value == "yes" || value == "true");
}
}
// set routes
if (!routes.empty())
{
_pptpWidget->chkIPAdresses->setChecked(true);
_pptpWidget->routes->setText(routes.join(" "));
}
}
TQMap<TQString, TQString> PPTPConfig::getVPNProperties()
{
// build a StingList of properties
TQMap<TQString, TQString> strlist;
strlist.insert("gateway", TQString(_pptpWidget->gateway->text()));
strlist.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no"));
strlist.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no"));
strlist.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no"));
strlist.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no"));
strlist.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no"));
strlist.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no"));
strlist.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no"));
strlist.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no"));
strlist.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no"));
strlist.insert("nodeflate", TQString(_pptpWidget->chk_nodeflate->isChecked() ? "yes" : "no"));
// Current network-manager-pptp plugin supports bluetooth-gprs,dialup and pptp.
// We want a pptp connection.
//strlist.insert("ppp-connection-type", "pptp");
return strlist;
}
TQStringList PPTPConfig::getVPNRoutes()
{
TQStringList strlist;
if(_pptpWidget->chkIPAdresses->isChecked())
{
strlist = TQStringList::split(" ", _pptpWidget->routes->text());
}
return strlist;
}
bool PPTPConfig::hasChanged()
{
return true;
}
bool PPTPConfig::isValid(TQStringList& err_msg)
{
bool retval = true;
if(_pptpWidget->gateway->text() == "")
{
err_msg.append(i18n("At least the gateway has to be supplied."));
retval = false;
}
return retval;
}
PPTPAuthentication::PPTPAuthentication(TQWidget* parent, char* name)
: VPNAuthenticationWidget(parent, name)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_pptpAuth = new PPTPAuthenticationWidget(this);
tqlayout->addWidget(_pptpAuth);
}
PPTPAuthentication::~PPTPAuthentication()
{
}
TQMap<TQString, TQString> PPTPAuthentication::getPasswords()
{
// network-manager-pptp will fail hard if "CHAP" is not the
// first element in the username&password list.
TQMap<TQString, TQString> pwds;
//pwds.insert("CHAP", "CHAP");
pwds.insert("user", TQString(_pptpAuth->username->text()));
pwds.insert("password", TQString(_pptpAuth->password->password()));
pwds.insert("domain", TQString(_pptpAuth->domain->text()));
return pwds;
}
void PPTPAuthentication::setPasswords(TQString name, TQString value) {
if (name == TQString("password")) {
_pptpAuth->password->erase();
_pptpAuth->password->insert(value);
}
}

@ -0,0 +1,84 @@
/***************************************************************************
*
* knetworkmanager-vpnc.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_PPTP_H
#define KNETWORKMANAGER_PPTP_H
#include <tqmap.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include "knetworkmanager-vpnplugin.h"
#include "pptpprop.h"
#include "pptpauth.h"
class PPTPPlugin : public VPNPlugin
{
Q_OBJECT
TQ_OBJECT
public:
PPTPPlugin(TQObject*, const char*, const TQStringList&);
~PPTPPlugin();
VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
};
class PPTPConfig : public VPNConfigWidget
{
Q_OBJECT
TQ_OBJECT
public:
void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
TQMap<TQString, TQString> getVPNProperties();
TQStringList getVPNRoutes();
bool hasChanged();
bool isValid(TQStringList& );
PPTPConfig(TQWidget* parent);
~PPTPConfig();
private:
PPTPConfigWidget* _pptpWidget;
protected slots:
void languageChange();
};
class PPTPAuthentication : public VPNAuthenticationWidget
{
Q_OBJECT
TQ_OBJECT
public:
PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL);
~PPTPAuthentication();
TQMap<TQString, TQString> getPasswords();
void setPasswords(TQString name, TQString value);
private:
PPTPAuthenticationWidget* _pptpAuth;
};
#endif /* KNETWORKMANAGER_PPTP_H */

@ -0,0 +1,95 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>PPTPAuthenticationWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>PPTPAuthenticationWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>277</width>
<height>111</height>
</rect>
</property>
<property name="caption">
<string>PPTPAuthentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<spacer row="3" column="1">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Domain</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
<widget class="KLineEdit" row="2" column="1">
<property name="name">
<cstring>domain</cstring>
</property>
</widget>
<widget class="KPasswordEdit" row="1" column="1">
<property name="name">
<cstring>password</cstring>
</property>
</widget>
<widget class="KLineEdit" row="0" column="1">
<property name="name">
<cstring>username</cstring>
</property>
</widget>
</grid>
</widget>
<tabstops>
<tabstop>username</tabstop>
<tabstop>password</tabstop>
<tabstop>domain</tabstop>
</tabstops>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,244 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>PPTPConfigWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>PPTPConfigWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>535</width>
<height>303</height>
</rect>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>kTabWidget1</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Required Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Gateway:</string>
</property>
<property name="buddy" stdset="0">
<cstring>IPSec_gateway</cstring>
</property>
</widget>
<widget class="KLineEdit" row="0" column="1">
<property name="name">
<cstring>gateway</cstring>
</property>
</widget>
<spacer row="11" column="1">
<property name="name">
<cstring>spacer9</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</grid>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Optional Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="11" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkIPAdresses</cstring>
</property>
<property name="text">
<string>Only use VPN Connection for these Adresses
(for example: 172.16.0.0/16 10.11.12.0/24)</string>
</property>
</widget>
<spacer row="13" column="0">
<property name="name">
<cstring>spacer10</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
<widget class="KLineEdit" row="12" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>routes</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<spacer row="0" column="1">
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>220</width>
<height>20</height>
</size>
</property>
</spacer>
<spacer row="1" column="1">
<property name="name">
<cstring>spacer3</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>230</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>chk_refuseeap</cstring>
</property>
<property name="text">
<string>Refuse EAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>chk_refusepap</cstring>
</property>
<property name="text">
<string>Refuse PAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0">
<property name="name">
<cstring>chk_refusechap</cstring>
</property>
<property name="text">
<string>Refuse CHAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="3" column="0">
<property name="name">
<cstring>chk_refusemschap</cstring>
</property>
<property name="text">
<string>Refuse MSCHAP</string>
</property>
</widget>
<widget class="TQCheckBox" row="4" column="0">
<property name="name">
<cstring>chk_refusemschapv2</cstring>
</property>
<property name="text">
<string>Refuse MSCHAP v2</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="0">
<property name="name">
<cstring>chk_requiremppe</cstring>
</property>
<property name="text">
<string>Require MPPE Encryption</string>
</property>
</widget>
<widget class="TQCheckBox" row="6" column="0">
<property name="name">
<cstring>chk_requiremppe40</cstring>
</property>
<property name="text">
<string>Require MPPE 40-bit Encryption</string>
</property>
</widget>
<widget class="TQCheckBox" row="7" column="0">
<property name="name">
<cstring>chk_requiremppe128</cstring>
</property>
<property name="text">
<string>Require MPPE 128-bit Encryption</string>
</property>
</widget>
<widget class="TQCheckBox" row="8" column="0">
<property name="name">
<cstring>chk_mppestateful</cstring>
</property>
<property name="text">
<string>Use MPPE Stateful Encryption</string>
</property>
</widget>
<widget class="TQCheckBox" row="9" column="0">
<property name="name">
<cstring>chk_nodeflate</cstring>
</property>
<property name="text">
<string>No Deflation</string>
</property>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,5 @@
SUBDIRS = src
service_DATA = knetworkmanager_strongswan.desktop
servicedir = $(kde_servicesdir)

@ -0,0 +1 @@
Thomas Kallenberg <tkallenb@hsr.ch>, <thomas@no-more-secrets.ch>

@ -0,0 +1,14 @@
KNETWORKMANAGER_STRONGSWAN_VERSION=0.1
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_STRONGSWAN_VERSION, $KNETWORKMANAGER_STRONGSWAN_VERSION, [KNetworkManager StrongSwan Plugin Version])
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_STRONGSWAN_VERSION_STRING, "$KNETWORKMANAGER_STRONGSWAN_VERSION", [KNetworkManager StrongSwan Plugin Version String])
PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([TQT dbus bindings missing])
])
STRONGSWAN_CFLAGS="$DBUS_TQT_CFLAGS"
STRONGSWAN_LIBS="$DBUS_TQT_LIBS"
AC_SUBST(STRONGSWAN_CFLAGS)
AC_SUBST(STRONGSWAN_LIBS)

@ -0,0 +1,21 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
Icon=
ServiceTypes=KNetworkManager/VPNPlugin
X-KDE-Library=knetworkmanager_strongswan
X-NetworkManager-Services=strongswan
X-KDE-PluginInfo-Author=Thomas Kallenberg
X-KDE-PluginInfo-Email=tkallenb@hsr.ch
X-KDE-PluginInfo-Name=knetworkmanager_strongswan
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=VPNService
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
Name=StrongSwan
Name[xx]=xxStrongSwanxx
Comment=StrongSwan
Comment[xx]=xxStrongSwanxx

@ -0,0 +1,12 @@
INCLUDES = $(PACKAGE_CFLAGS) $(KNETWORKMANAGER_CFLAGS) $(SSWAN_FLAGS) $(all_includes)
METASOURCES = AUTO
kde_module_LTLIBRARIES = knetworkmanager_strongswan.la
knetworkmanager_strongswan_la_SOURCES = knetworkmanager-strongswan.cpp \
strongswanprop.ui \
strongswanauth.ui
noinst_HEADERS = knetworkmanager-strongswan.h
knetworkmanager_strongswan_la_LDFLAGS = -module $(all_libraries)
knetworkmanager_strongswan_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)

@ -0,0 +1,234 @@
/***************************************************************************
*
* knetworkmanager-strongswan.cpp - A NetworkManager frontend for KDE
*
* Author: Thomas Kallenberg <tkallenb@hsr.ch>, <thomas@no-more-secrets.ch>
*
* Strongly based on the Code of Helmut Schaa <hschaa@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <klocale.h>
#include <tqmessagebox.h>
#include <tqbutton.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <tqobjectlist.h>
#include <tqobject.h>
#include <tqcheckbox.h>
#include <kpassdlg.h>
#include <kgenericfactory.h>
#include <tqlabel.h>
#include "knetworkmanager-strongswan.h"
typedef KGenericFactory<StrongswanPlugin> StrongswanPluginFactory;
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_strongswan, StrongswanPluginFactory("knetworkmanager_strongswan"));
StrongswanPlugin::StrongswanPlugin(TQObject* parent, const char* name, const TQStringList& args)
: VPNPlugin(parent, name, args)
{
KLocale* loc = KGlobal::locale();
loc->insertCatalogue("NetworkManager-strongswan");
}
StrongswanPlugin::~StrongswanPlugin()
{
}
VPNConfigWidget* StrongswanPlugin::CreateConfigWidget(TQWidget* parent)
{
return new StrongswanConfig(parent);
}
VPNAuthenticationWidget* StrongswanPlugin::CreateAuthenticationWidget(TQWidget* parent)
{
return new StrongswanAuthentication(parent);
}
StrongswanConfig::StrongswanConfig(TQWidget* parent)
: VPNConfigWidget(parent)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_strongswanWidget = new StrongswanConfigWidget(this);
tqlayout->addWidget(_strongswanWidget);
/* TODO not sure if we need this here */
this->languageChange();
}
StrongswanConfig::~StrongswanConfig()
{
}
void StrongswanConfig::languageChange()
{
}
// usercert agent password userkey
StrongswanConnectionType::CONNECTIONTYPE StrongswanConnectionType::mapString2ConnectionType(int prop)
{
if (prop == 0)
return psk;
else if (prop == 1)
return key;
else if (prop == 2)
return agent;
return UNKNOWN;
}
int StrongswanConnectionType::mapConnectionType2String(CONNECTIONTYPE connType)
{
switch(connType)
{
case psk:
return 0;
case key:
return 1;
case agent:
return 2;
default:
return -1;
}
return -1;
}
void StrongswanConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
{
// fill up our inputfields (only textfields atm)
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
TQString entry = it.key();
TQString value = it.data();
if (entry == "gateway")
{
_strongswanWidget->gateway->setText(value);
}
else if (entry == "certificate")
{
_strongswanWidget->certificate->setURL(value);
}
else if (entry == "username")
{
_strongswanWidget->username->setText(value);
}
else if (entry == "method")
{
StrongswanConnectionType::CONNECTIONTYPE type = StrongswanConnectionType::mapString2ConnectionType(value.toInt());
_strongswanWidget->authtype->setCurrentItem(type);
}
// Options
else if (entry == "chkUDPenc")
{
_strongswanWidget->chkUDPenc->setChecked(value == "true");
}
else if (entry == "chkIPcomp")
{
_strongswanWidget->chkIPcomp->setChecked(value == "true");
}
else if (entry == "chkIPinner")
{
_strongswanWidget->chkIPinner->setChecked(value == "true");
}
}
}
TQMap<TQString, TQString> StrongswanConfig::getVPNProperties()
{
// build a StingList of properties
TQMap<TQString, TQString> strlist;
strlist.insert("gateway", TQString(_strongswanWidget->gateway->text()));
strlist.insert("certificate", TQString(_strongswanWidget->certificate->url()));
strlist.insert("username", TQString(_strongswanWidget->username->text()));
strlist.insert("method",
TQString::number(StrongswanConnectionType::mapConnectionType2String((StrongswanConnectionType::CONNECTIONTYPE)_strongswanWidget->authtype->currentItem())));
if (_strongswanWidget->chkUDPenc->isChecked())
strlist.insert("encap", TQString("yes"));
if (_strongswanWidget->chkIPcomp->isChecked())
strlist.insert("ipcomp", TQString("yes"));
if (_strongswanWidget->chkIPinner->isChecked())
strlist.insert("virtual", TQString("yes"));
return strlist;
}
TQStringList StrongswanConfig::getVPNRoutes()
{
TQStringList strlist;
/*if(_strongswanWidget->chkIPAdresses->isChecked())
{
strlist = TQStringList::split(" ", _strongswanWidget->routes->text());
}
*/
return strlist;
}
bool StrongswanConfig::hasChanged()
{
return true;
}
bool StrongswanConfig::isValid(TQStringList& err_msg)
{
bool retval = true;
if(_strongswanWidget->gateway->text() == "" || _strongswanWidget->username->text() == "")
{
err_msg.append(i18n("At least the gateway and group has to be supplied."));
retval = false;
}
return retval;
}
StrongswanAuthentication::StrongswanAuthentication(TQWidget* parent, char* name)
: VPNAuthenticationWidget(parent, name)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_strongswanAuth = new StrongswanAuthenticationWidget(this);
tqlayout->addWidget(_strongswanAuth);
}
StrongswanAuthentication::~StrongswanAuthentication()
{
}
TQMap<TQString, TQString> StrongswanAuthentication::getPasswords()
{
TQMap<TQString, TQString> pwds;
pwds.insert("user", TQString(_strongswanAuth->username->text()));
pwds.insert("password", TQString(_strongswanAuth->password->password()));
return pwds;
}
void StrongswanAuthentication::setPasswords(TQString name, TQString value) {
if (name == TQString("password")) {
_strongswanAuth->password->erase();
_strongswanAuth->password->insert(value);
}
}

@ -0,0 +1,99 @@
/***************************************************************************
*
* knetworkmanager-strongswan.h - A NetworkManager frontend for KDE
*
* Author: Thomas Kallenberg <tkallenb@hsr.ch>, <thomas@no-more-secrets.ch>
*
* Strongly based on the Code of Helmut Schaa <hschaa@suse.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_STRONGSWAN_H
#define KNETWORKMANAGER_STRONGSWAN_H
#include <tqmap.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include "knetworkmanager-vpnplugin.h"
#include "strongswanprop.h"
#include "strongswanauth.h"
class StrongswanPlugin : public VPNPlugin
{
Q_OBJECT
TQ_OBJECT
public:
StrongswanPlugin(TQObject*, const char*, const TQStringList&);
~StrongswanPlugin();
VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
};
class StrongswanConnectionType
{
public:
enum CONNECTIONTYPE
{
UNKNOWN = -1
, psk = 0
, key
, agent
};
static CONNECTIONTYPE mapString2ConnectionType(int string);
static int mapConnectionType2String(CONNECTIONTYPE connectionType);
};
class StrongswanConfig : public VPNConfigWidget
{
Q_OBJECT
TQ_OBJECT
public:
void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
TQMap<TQString, TQString> getVPNProperties();
TQStringList getVPNRoutes();
bool hasChanged();
bool isValid(TQStringList& );
StrongswanConfig(TQWidget* parent);
~StrongswanConfig();
private:
StrongswanConfigWidget* _strongswanWidget;
protected slots:
void languageChange();
};
class StrongswanAuthentication : public VPNAuthenticationWidget
{
Q_OBJECT
TQ_OBJECT
public:
StrongswanAuthentication(TQWidget* parent = NULL, char* name = NULL);
~StrongswanAuthentication();
TQMap<TQString, TQString> getPasswords();
void setPasswords(TQString name, TQString value);
private:
StrongswanAuthenticationWidget* _strongswanAuth;
};
#endif /* KNETWORKMANAGER_STRONGSWAN_H */

@ -0,0 +1,88 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>StrongswanAuthenticationWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>StrongswanAuthenticationWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>171</height>
</rect>
</property>
<property name="caption">
<string>StrongswanAuthentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<spacer row="2" column="1">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>100</height>
</size>
</property>
</spacer>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
<widget class="KPasswordEdit" row="1" column="1">
<property name="name">
<cstring>password</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="0" column="1">
<property name="name">
<cstring>username</cstring>
</property>
</widget>
<spacer row="1" column="2">
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>130</width>
<height>20</height>
</size>
</property>
</spacer>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
</UI>

@ -0,0 +1,236 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>StrongswanConfigWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>StrongswanConfigWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>442</width>
<height>260</height>
</rect>
</property>
<property name="caption">
<string>StrongswanConfigWidget</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>tabWidget2</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>Required Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>&lt;font size="+1"&gt;&lt;b&gt;Gateway&lt;/b&gt;&lt;/font&gt;</string>
</property>
</widget>
<widget class="TQLabel" row="4" column="0">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>&lt;font size="+1"&gt;&lt;b&gt;Authentication&lt;/b&gt;&lt;/font&gt;</string>
</property>
</widget>
<widget class="TQLabel" row="6" column="0">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Method</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0" rowspan="2" colspan="1">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Address</string>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Certificate</string>
</property>
</widget>
<widget class="TQLabel" row="5" column="0">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>Username</string>
</property>
</widget>
<widget class="TQComboBox" row="6" column="1">
<item>
<property name="text">
<string>Key</string>
</property>
</item>
<item>
<property name="text">
<string>PSK</string>
</property>
</item>
<item>
<property name="text">
<string>Agent</string>
</property>
</item>
<property name="name">
<cstring>authtype</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="5" column="1">
<property name="name">
<cstring>username</cstring>
</property>
</widget>
<widget class="TQLineEdit" row="1" column="1">
<property name="name">
<cstring>gateway</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="KURLRequester" row="2" column="1" rowspan="2" colspan="1">
<property name="name">
<cstring>certificate</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<spacer row="7" column="1">
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>16</height>
</size>
</property>
</spacer>
</grid>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>Optional Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="0" column="0">
<property name="name">
<cstring>chkUDPenc</cstring>
</property>
<property name="text">
<string>Enforce UDP encapsulation</string>
</property>
</widget>
<widget class="TQCheckBox" row="1" column="0">
<property name="name">
<cstring>chkIPcomp</cstring>
</property>
<property name="text">
<string>Use IP compression</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0">
<property name="name">
<cstring>chkIPinner</cstring>
</property>
<property name="text">
<string>Request inner IP</string>
</property>
</widget>
<spacer row="3" column="0">
<property name="name">
<cstring>spacer3</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>51</height>
</size>
</property>
</spacer>
<spacer row="1" column="1" rowspan="2" colspan="1">
<property name="name">
<cstring>spacer4</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>231</width>
<height>31</height>
</size>
</property>
</spacer>
</grid>
</widget>
</widget>
</grid>
</widget>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>klineedit.h</includehint>
<includehint>kpushbutton.h</includehint>
</includehints>
</UI>

@ -0,0 +1,2 @@
Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
Thomas Kallenberg <tkallenb@hsr.ch> <thomas@no-more-secrets.ch>

@ -0,0 +1,5 @@
SUBDIRS = src
service_DATA = knetworkmanager_vpnc.desktop
servicedir = $(kde_servicesdir)

@ -0,0 +1,14 @@
KNETWORKMANAGER_VPNC_VERSION=0.1
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VPNC_VERSION, $KNETWORKMANAGER_VPNC_VERSION, [KNetworkManager VPNC Plugin Version])
AC_DEFINE_UNQUOTED(KNETWORKMANAGER_VPNC_VERSION_STRING, "$KNETWORKMANAGER_VPNC_VERSION", [KNetworkManager VPNC Plugin Version String])
PKG_CHECK_MODULES(DBUS_TQT, [dbus-1-tqt >= 0.8.1], [], [
AC_MSG_RESULT([no])
AC_MSG_ERROR([TQT dbus bindings missing])
])
VPNC_CFLAGS="$DBUS_TQT_CFLAGS"
VPNC_LIBS="$DBUS_TQT_LIBS"
AC_SUBST(VPNC_CFLAGS)
AC_SUBST(VPNC_LIBS)

@ -0,0 +1,23 @@
[Desktop Entry]
Encoding=UTF-8
Type=Service
Icon=
ServiceTypes=KNetworkManager/VPNPlugin
X-KDE-Library=knetworkmanager_vpnc
X-NetworkManager-Services=vpnc
X-KDE-PluginInfo-Author=Helmut Schaa
X-KDE-PluginInfo-Email=hschaa@suse.de
X-KDE-PluginInfo-Name=knetworkmanager_vpnc
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=
X-KDE-PluginInfo-Category=VPNService
X-KDE-PluginInfo-Depends=
X-KDE-PluginInfo-License=GPL
X-KDE-PluginInfo-EnabledByDefault=false
Name=VPNC
Name[bn]=ভিপিএনসি
Name[xx]=xxVPNCxx
Comment=VPNC
Comment[bn]=ভিপিএনসি
Comment[xx]=xxVPNCxx

@ -0,0 +1,12 @@
INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(VPNC_CFLAGS) $(all_includes)
METASOURCES = AUTO
kde_module_LTLIBRARIES = knetworkmanager_vpnc.la
knetworkmanager_vpnc_la_SOURCES = knetworkmanager-vpnc.cpp \
vpncprop.ui \
vpncauth.ui
noinst_HEADERS = knetworkmanager-vpnc.h
knetworkmanager_vpnc_la_LDFLAGS = -module $(all_libraries)
knetworkmanager_vpnc_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT)

@ -0,0 +1,402 @@
/***************************************************************************
*
* knetworkmanager-vpnc.cpp - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#include <klocale.h>
#include <kmessagebox.h>
#include <tqmessagebox.h>
#include <tqbutton.h>
#include <kcombobox.h>
#include <klineedit.h>
#include <kurlrequester.h>
#include <tqobjectlist.h>
#include <tqobject.h>
#include <tqcheckbox.h>
#include <kpassdlg.h>
#include <kgenericfactory.h>
#include <tqlabel.h>
#include <string>
#include <stdio.h>
#include "knetworkmanager-vpnc.h"
using namespace std;
typedef KGenericFactory<VPNCPlugin> VPNCPluginFactory;
K_EXPORT_COMPONENT_FACTORY( knetworkmanager_vpnc, VPNCPluginFactory("knetworkmanager_vpnc"));
#define NAT_MODE_CISCO 0
#define NAT_MODE_NATT 1
#define NAT_MODE_DISABLED 2
char linedata [2048];
VPNCPlugin::VPNCPlugin(TQObject* parent, const char* name, const TQStringList& args)
: VPNPlugin(parent, name, args)
{
KLocale* loc = KGlobal::locale();
loc->insertCatalogue("NetworkManager-vpnc");
}
VPNCPlugin::~VPNCPlugin()
{
}
VPNConfigWidget* VPNCPlugin::CreateConfigWidget(TQWidget* parent)
{
return new VPNCConfig(parent);
}
VPNAuthenticationWidget* VPNCPlugin::CreateAuthenticationWidget(TQWidget* parent)
{
return new VPNCAuthentication(parent);
}
VPNCConfig::VPNCConfig(TQWidget* parent)
: VPNConfigWidget(parent)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_vpncWidget = new VPNCConfigWidget(this);
tqlayout->addWidget(_vpncWidget);
connect(_vpncWidget->pcfImport, TQT_SIGNAL(clicked()), this, TQT_SLOT( pcfImport()) );
//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->Xauth_username, TQT_SLOT(setEnabled(bool)));
//connect(_vpncWidget->chkOverrideUsername, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblUsername, TQT_SLOT(setEnabled(bool)));
connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->Domain, TQT_SLOT(setEnabled(bool)));
connect(_vpncWidget->chkUseDomain, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblDomain, TQT_SLOT(setEnabled(bool)));
connect(_vpncWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _vpncWidget->routes, TQT_SLOT(setEnabled(bool)));
connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->nat_keep_alive_interval, TQT_SLOT(setEnabled(bool)));
connect(_vpncWidget->chkUseKeepAlive, TQT_SIGNAL(toggled(bool)), _vpncWidget->lblKeepAliveInterval, TQT_SLOT(setEnabled(bool)));
_vpncWidget->cboNAT->insertItem(i18n("Cisco UDP (default)"), NAT_MODE_CISCO);
_vpncWidget->cboNAT->insertItem(i18n("NAT-T"), NAT_MODE_NATT);
_vpncWidget->cboNAT->insertItem(i18n("Disabled"), NAT_MODE_DISABLED);
this->languageChange();
}
VPNCConfig::~VPNCConfig()
{
}
void VPNCConfig::languageChange()
{
}
int VPNCConfig::getFileConfig(char *parameter, char *line) {
int i;
if (strstr(line, parameter) != NULL) {
if ((strstr(line, parameter) - line) == 0) {
for (i=0; i<(strlen(line)-strlen(parameter));i++) {
linedata[i] = line[i+strlen(parameter)];
if ((linedata[i] == 10) || (linedata[i] == 13)) {
linedata[i] = 0;
}
}
linedata[i-1]=0;
return 0;
}
else {
return 1;
}
}
else {
return 1;
}
}
void VPNCConfig::pcfImport()
{
const TQString& pcf_file = TQString(_vpncWidget->editPCF->url());
printf("Asked for PCF import from file %s\n\r", pcf_file.ascii());
int i;
FILE *file = fopen ( pcf_file.ascii(), "r" );
if ( file != NULL ) {
char line [2048]; // or other suitable maximum line size
// read a line
while ( fgets ( line, sizeof line, file ) != NULL ) {
// Parse the line and update global variables (current line in variable "line")
if (getFileConfig("Host=", line) == 0) {
//strdup(linedata)
printf("Got configuration parameter Host with data %s\n\r", linedata);
_vpncWidget->IPSec_gateway->setText(linedata);
}
if (getFileConfig("GroupName=", line) == 0) {
printf("Got configuration parameter GroupName with data %s\n\r", linedata);
_vpncWidget->IPSec_ID->setText(linedata);
}
// if (getFileConfig("TcpTunnelingPort=", line) == 0) {
// printf("Got configuration parameter TcpTunnelingPort with data %s\n\r", linedata);
// _vpncWidget->IPSec_ID->setText(linedata);
// }
if (getFileConfig("NTDomain=", line) == 0) {
if (strlen(linedata) > 0) {
printf("Got configuration parameter NTDomain with data %s\n\r", linedata);
_vpncWidget->Domain->setText(linedata);
_vpncWidget->chkUseDomain->setChecked(true);
}
}
if (getFileConfig("GroupPwd=", line) == 0) {
if (strlen(linedata) > 0) {
printf("Got configuration parameter GroupPwd with data %s\n\r", linedata);
KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").tqarg(linedata));
}
}
if (getFileConfig("enc_GroupPwd=", line) == 0) {
if (strlen(linedata) > 0) {
printf("Got configuration parameter enc_GroupPwd with data %s\n\r", linedata);
// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
FILE *pipe_decrypt;
char decrypted_result[2048];
int i;
decryptcommand.append(linedata);
printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
{
printf("Group password decrypt error\n\r");
}
else {
fgets(decrypted_result, 2048, pipe_decrypt);
pclose(pipe_decrypt);
for (i=0;i<2048;i++) {
if (decrypted_result[i] == 0) {
decrypted_result[i-1]=0;
i=2048;
}
}
printf("Group password decrypt result: '%s'\n\r", decrypted_result);
}
KMessageBox::information(this, TQString("Your group password is: %1\n\r\n\rYou will need this information when you log on").tqarg(decrypted_result));
}
}
}
fclose ( file );
}
else
{
//printf("[WARN] Unable to open configuration file %s\n\r", pcf_file.ascii());
KMessageBox::error(this, i18n("That configuration file does not exist!"));
}
}
void VPNCConfig::setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties)
{
// fill up our inputfields (only textfields atm)
for(TQMap<TQString, TQString>::ConstIterator it = properties.begin(); it != properties.end(); ++it)
{
TQString entry = it.key();
TQString value = it.data();
if (entry == "IPSec gateway")
{
_vpncWidget->IPSec_gateway->setText(value);
}
else if (entry == "IPSec ID")
{
_vpncWidget->IPSec_ID->setText(value);
}
else if (entry == "Xauth username")
{
_vpncWidget->Xauth_username->setText(value);
//_vpncWidget->chkOverrideUsername->setChecked(true);
}
else if (entry == "Domain")
{
_vpncWidget->Domain->setText(value);
_vpncWidget->chkUseDomain->setChecked(true);
}
else if (entry == "NAT-Keepalive packet interval")
{
_vpncWidget->nat_keep_alive_interval->setText(value);
_vpncWidget->chkUseKeepAlive->setChecked(true);
}
// backwards compatibility
else if (entry == "Disable NAT Traversal")
{
_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
}
else if (entry == "NAT Traversal Mode")
{
if (value == "natt")
_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_NATT);
else if (value == "cisco-udp")
_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_CISCO);
else if (value == "none")
_vpncWidget->cboNAT->setCurrentItem(NAT_MODE_DISABLED);
else
{
// FIXME: unknown NAT mode
}
}
else if (entry == "Enable Single DES")
{
_vpncWidget->chkSingleDES->setChecked(value == "yes" || value == "true");
}
}
// set routes
if (!routes.empty())
{
_vpncWidget->chkIPAdresses->setChecked(true);
_vpncWidget->routes->setText(routes.join(" "));
}
}
TQMap<TQString, TQString> VPNCConfig::getVPNProperties()
{
// build a StingList of properties
TQMap<TQString, TQString> strlist;
strlist.insert("IPSec gateway", TQString(_vpncWidget->IPSec_gateway->text()));
strlist.insert("IPSec ID", TQString(_vpncWidget->IPSec_ID->text()));
//if (_vpncWidget->chkOverrideUsername->isChecked())
strlist.insert("Xauth username", TQString(_vpncWidget->Xauth_username->text()));
if (_vpncWidget->chkUseDomain->isChecked())
strlist.insert("Domain", TQString(_vpncWidget->Domain->text()));
if (_vpncWidget->chkUseKeepAlive->isChecked())
strlist.insert("NAT-Keepalive packet interval", TQString(_vpncWidget->nat_keep_alive_interval->text()));
switch (_vpncWidget->cboNAT->currentItem())
{
case NAT_MODE_CISCO:
strlist.insert("NAT Traversal Mode", "cisco-udp");
break;
case NAT_MODE_NATT:
strlist.insert("NAT Traversal Mode", "natt");
break;
case NAT_MODE_DISABLED:
default:
strlist.insert("NAT Traversal Mode", "none");
break;
}
if (_vpncWidget->chkSingleDES->isChecked())
strlist.insert("Enable Single DES", "yes");
else
strlist.insert("Enable Single DES", "no");
return strlist;
}
TQStringList VPNCConfig::getVPNRoutes()
{
TQStringList strlist;
if(_vpncWidget->chkIPAdresses->isChecked())
{
strlist = TQStringList::split(" ", _vpncWidget->routes->text());
}
return strlist;
}
bool VPNCConfig::hasChanged()
{
return true;
}
bool VPNCConfig::isValid(TQStringList& err_msg)
{
bool retval = true;
if(_vpncWidget->IPSec_gateway->text() == "" || _vpncWidget->IPSec_ID->text() == "")
{
err_msg.append(i18n("At least the gateway and group has to be supplied."));
retval = false;
}
return retval;
}
VPNCAuthentication::VPNCAuthentication(TQWidget* parent, char* name)
: VPNAuthenticationWidget(parent, name)
{
TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1);
_vpncAuth = new VPNCAuthenticationWidget(this);
tqlayout->addWidget(_vpncAuth);
}
VPNCAuthentication::~VPNCAuthentication()
{
}
TQMap<TQString, TQString> VPNCAuthentication::getPasswords()
{
TQMap<TQString, TQString> pwds;
pwds.insert("Xauth password", TQString(_vpncAuth->editUserPassword->password()));
if (_vpncAuth->chkObfusticated->isChecked()) {
// Decrypt the obfusticated password with /usr/lib/vpnc/cisco-decrypt
string decryptcommand="/usr/lib/vpnc/cisco-decrypt ";
FILE *pipe_decrypt;
char decrypted_result[2048];
int i;
decryptcommand.append(_vpncAuth->editGroupPassword->password());
printf("Group password decrypt command: %s\n\r", decryptcommand.c_str());
if ((pipe_decrypt = popen(decryptcommand.c_str(), "r")) == NULL)
{
printf("Group password decrypt error\n\r");
}
else {
fgets(decrypted_result, 2048, pipe_decrypt);
pclose(pipe_decrypt);
for (i=0;i<2048;i++) {
if (decrypted_result[i] == 0) {
decrypted_result[i-1]=0;
i=2048;
}
}
printf("Group password decrypt result: '%s'\n\r", decrypted_result);
pwds.insert("IPSec secret", TQString(decrypted_result));
}
}
else {
pwds.insert("IPSec secret", TQString(_vpncAuth->editGroupPassword->password()));
}
return pwds;
}
void VPNCAuthentication::setPasswords(TQString name, TQString value) {
if (name == TQString("Xauth password")) {
_vpncAuth->editUserPassword->erase();
_vpncAuth->editUserPassword->insert(value);
}
else if (name == TQString("IPSec secret")) {
_vpncAuth->editGroupPassword->erase();
_vpncAuth->editGroupPassword->insert(value);
}
}

@ -0,0 +1,89 @@
/***************************************************************************
*
* knetworkmanager-vpnc.h - A NetworkManager frontend for KDE
*
* Copyright (C) 2006 Novell, Inc.
*
* Author: Helmut Schaa <hschaa@suse.de>, <Helmut.Schaa@gmx.de>
* Author: Timothy Pearson <kb9vqf@pearsoncomputing.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
**************************************************************************/
#ifndef KNETWORKMANAGER_VPNC_H
#define KNETWORKMANAGER_VPNC_H
#include <tqmap.h>
#include <tqstring.h>
#include <tqwidget.h>
#include <tqlayout.h>
#include "knetworkmanager-vpnplugin.h"
#include "vpncprop.h"
#include "vpncauth.h"
class VPNCPlugin : public VPNPlugin
{
Q_OBJECT
TQ_OBJECT
public:
VPNCPlugin(TQObject*, const char*, const TQStringList&);
~VPNCPlugin();
VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0);
VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0);
};
class VPNCConfig : public VPNConfigWidget
{
Q_OBJECT
TQ_OBJECT
public:
void setVPNData(const TQStringList& routes, const TQMap<TQString, TQString>& properties);
TQMap<TQString, TQString> getVPNProperties();
TQStringList getVPNRoutes();
bool hasChanged();
bool isValid(TQStringList& );
VPNCConfig(TQWidget* parent);
~VPNCConfig();
public slots:
void pcfImport();
private:
VPNCConfigWidget* _vpncWidget;
int getFileConfig(char *parameter, char *line);
protected slots:
void languageChange();
};
class VPNCAuthentication : public VPNAuthenticationWidget
{
Q_OBJECT
TQ_OBJECT
public:
VPNCAuthentication(TQWidget* parent = NULL, char* name = NULL);
~VPNCAuthentication();
TQMap<TQString, TQString> getPasswords();
void setPasswords(TQString name, TQString value);
private:
VPNCAuthenticationWidget* _vpncAuth;
};
#endif /* KNETWORKMANAGER_VPNC_H */

@ -0,0 +1,68 @@
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
<class>VPNCAuthenticationWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>VPNCAuthenticationWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>372</width>
<height>75</height>
</rect>
</property>
<property name="caption">
<string>VPNCAuthentication</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Password</string>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Group Password</string>
</property>
</widget>
<widget class="KPasswordEdit" row="0" column="1">
<property name="name">
<cstring>editUserPassword</cstring>
</property>
</widget>
<widget class="KPasswordEdit" row="1" column="1">
<property name="name">
<cstring>editGroupPassword</cstring>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkObfusticated</cstring>
</property>
<property name="text">
<string>Group password is hashed</string>
</property>
</widget>
</grid>
</widget>
<customwidgets>
</customwidgets>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>

@ -0,0 +1,279 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>VPNCConfigWidget</class>
<widget class="TQWidget">
<property name="name">
<cstring>VPNCConfigWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>667</width>
<height>435</height>
</rect>
</property>
<property name="caption">
<string>VPNCConfigWidget</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<widget class="TQTabWidget" row="0" column="0">
<property name="name">
<cstring>kTabWidget1</cstring>
</property>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Required Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>Gateway</string>
</property>
<property name="buddy" stdset="0">
<cstring>IPSec_gateway</cstring>
</property>
</widget>
<widget class="KLineEdit" row="0" column="1">
<property name="name">
<cstring>IPSec_gateway</cstring>
</property>
</widget>
<widget class="TQLabel" row="1" column="0">
<property name="name">
<cstring>labelGroup</cstring>
</property>
<property name="text">
<string>Group Name</string>
</property>
<property name="buddy" stdset="0">
<cstring>IPSec_ID</cstring>
</property>
</widget>
<widget class="KLineEdit" row="1" column="1">
<property name="name">
<cstring>IPSec_ID</cstring>
</property>
</widget>
<widget class="TQLabel" row="2" column="0">
<property name="name">
<cstring>lblUsername</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>User Name</string>
</property>
</widget>
<widget class="KLineEdit" row="2" column="1">
<property name="name">
<cstring>Xauth_username</cstring>
</property>
<property name="enabled">
<bool>true</bool>
</property>
</widget>
<widget class="TQGroupBox" row="5" column="0" colspan="2">
<property name="name">
<cstring>groupBox5_3</cstring>
</property>
<property name="title">
<string>Import settings from Cisco PCF file</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="KURLRequester" row="0" column="1">
<property name="name">
<cstring>editPCF</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>textLabel2_2</cstring>
</property>
<property name="text">
<string>PCF File</string>
</property>
</widget>
<widget class="KPushButton" row="1" column="0" colspan="2">
<property name="name">
<cstring>pcfImport</cstring>
</property>
<property name="text">
<string>Import</string>
</property>
</widget>
</grid>
</widget>
<spacer row="6" column="1">
<property name="name">
<cstring>spacer9</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</grid>
</widget>
<widget class="TQWidget">
<property name="name">
<cstring>TabPage</cstring>
</property>
<attribute name="title">
<string>Optional Information</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQCheckBox" row="4" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkUseKeepAlive</cstring>
</property>
<property name="text">
<string>Use NAT keep alive packets</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkUseDomain</cstring>
</property>
<property name="text">
<string>Use domain for authentication</string>
</property>
</widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>lblDomain</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Domain</string>
</property>
</widget>
<widget class="TQLabel" row="5" column="0">
<property name="name">
<cstring>lblKeepAliveInterval</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Interval</string>
</property>
</widget>
<widget class="TQLineEdit" row="5" column="1">
<property name="name">
<cstring>nat_keep_alive_interval</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
<widget class="KLineEdit" row="3" column="1">
<property name="name">
<cstring>Domain</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
<widget class="TQLabel" row="6" column="0">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>NAT traversal</string>
</property>
</widget>
<widget class="TQComboBox" row="6" column="1">
<property name="name">
<cstring>cboNAT</cstring>
</property>
</widget>
<widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkSingleDES</cstring>
</property>
<property name="text">
<string>Enable weak single DES encryption</string>
</property>
</widget>
<widget class="TQCheckBox" row="8" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>chkIPAdresses</cstring>
</property>
<property name="text">
<string>Only use VPN Connection for these Adresses (for example: 172.16.0.0/16 10.11.12.0/24)</string>
</property>
</widget>
<spacer row="10" column="1">
<property name="name">
<cstring>spacer10</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="tqsizeHint">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="KLineEdit" row="9" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>routes</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</grid>
</widget>
</widget>
</grid>
</widget>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
</includehints>
</UI>
Loading…
Cancel
Save