Added KDE3 version of knemo
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knemo@1091560 283d02a7-25f6-0310-bc7c-ecb5cbfe19dav3.5.13-sru
commit
ccceabd36e
@ -0,0 +1,35 @@
|
||||
KNemo:
|
||||
Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
Signal Plotter:
|
||||
Taken from KSysGuard
|
||||
Chris Schlaeger <cs@kde.org>
|
||||
|
||||
List of current translators:
|
||||
Zlatko Popov <zlatkopopov@fsa-bg.org> (bg)
|
||||
Thierry Vignaud <tvignaud@mandriva.com> (br)
|
||||
Jakub Friedl <jfriedl@suse.cz> Klara Cihlarova <koty@seznam.cz> (cs)
|
||||
FULL NAME <EMAIL@ADDRESS> (cy)
|
||||
Erik Kjær Pedersen <erik@binghamton.edu> (da)
|
||||
Jannick Kuhr <jannick.kuhr@kdemail.net> (de)
|
||||
Spiros Georgaras <sngeorgaras@otenet.gr> (el)
|
||||
Malcolm Hunter <malcolm.hunter@gmx.co.uk> (en_GB)
|
||||
Enrique Matias Sanchez (aka Quique) <cronopios@gmail.com> (es)
|
||||
Marek Laane <bald@starman.ee> (et)
|
||||
Julien Morot <julien@momonux.org> (fr)
|
||||
Kevin Patrick Scannell <scannell@SLU.EDU> (ga)
|
||||
Kroly Barcza (VectoR) <kbarcza@blackpanther.hu> (hu)
|
||||
Samuele Kaplun <samuele.kaplun@collegiodimilano.it> (it)
|
||||
Yukiko Bando <ybando@k6.dion.ne.jp> (ja)
|
||||
Giasher <giasher@telenet.ge> (ka)
|
||||
Donatas Glodenis <dgvirtual@akl.lt> (lt)
|
||||
Bram Schoenmakers <bramschoenmakers@kde.nl> Rinse de Vries <rinsedevries@kde.nl> (nl)
|
||||
Marcin Zasada <emzeta76@gazeta.pl> (pl)
|
||||
José Nuno Coelho Pires <jncp@netcabo.pt> (pt)
|
||||
Lisiane Sztoltz Teixeira <lisiane@kdemail.net> (pt_BR)
|
||||
Alexander Shiyan <shc@users.sourceforge.net> (ru)
|
||||
Steve Murphy <murf@e-tools.com> (rw)
|
||||
Slobodan Simic <simicsl@verat.net> (sr)
|
||||
Slobodan Simic <simicsl@verat.net> (sr@Latn)
|
||||
Stefan Asserhäll <stefan.asserhall@comhem.se> (sv)
|
||||
Bulent SENER <bsener@inonu.edu.tr> (tr)
|
@ -0,0 +1,14 @@
|
||||
#project(extragear-network)
|
||||
|
||||
#set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/modules )
|
||||
|
||||
# search packages used by KDE
|
||||
find_package(KDE4 REQUIRED)
|
||||
include (KDE4Defaults)
|
||||
include (MacroLibrary)
|
||||
include(MacroOptionalAddSubdirectory)
|
||||
|
||||
|
||||
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
|
||||
macro_optional_add_subdirectory(kftpgrabber)
|
@ -0,0 +1,184 @@
|
||||
Version 0.4.8:
|
||||
* fixed high CPU load when the default gateway is missing (sysbackend)
|
||||
|
||||
Version 0.4.7:
|
||||
* fixed missing tray icon caused by too many opened sockets
|
||||
* fixed crash when non-wireless interfaces get disconnected
|
||||
* make KNemo compilable on systems without iw lib
|
||||
|
||||
Version 0.4.6:
|
||||
* disable statistics entries in configuration dialog if statistics are
|
||||
not activated for at least one interface
|
||||
* sys backend uses ioctls for network addresses
|
||||
* sys backend uses proc filesystem for default gateway
|
||||
* sys backend uses iwlib for wireless information
|
||||
* wireless tab of status dialog was redesigned
|
||||
* improved switching of status dialog and signal plotter
|
||||
* if the PPP driver resets its data on disconnection KNemo should
|
||||
also start to count the data from zero for every new connection
|
||||
|
||||
Version 0.4.5:
|
||||
* fixed counting of transmitted data for sys backend
|
||||
* changed handling of KNemo as a service:
|
||||
KNemo must now be started using its control center module. This was
|
||||
necessary to keep KNemo from starting automatically for every user
|
||||
in a multiuser environment.
|
||||
* fixed calculation of transfer speed
|
||||
* redesigned the status dialog
|
||||
|
||||
Version 0.4.4:
|
||||
* fixed counting of transfered data for ppp interfaces
|
||||
|
||||
Version 0.4.3:
|
||||
* updated Russian translation
|
||||
* support for different backends to gather information
|
||||
|
||||
Version 0.4.2:
|
||||
* fixed crash when opening status dialog or tooltips
|
||||
|
||||
Version 0.4.1:
|
||||
* added Hungarian translation
|
||||
* updated Russian translation
|
||||
* added timer to store statistics periodically
|
||||
* made location of statistic files configurable
|
||||
* made update interval of interface informations configurable
|
||||
|
||||
Version 0.4.0 (april fool release):
|
||||
* added statistics for every day, month and year that show the
|
||||
incoming, outgoing and total traffic.
|
||||
* some minor improvements and changes
|
||||
|
||||
Version 0.3.1 (birthday release):
|
||||
* added Russian translation
|
||||
* updated Brazilian Portuguese translation
|
||||
* updated French translation
|
||||
* it's possible to move the custom menu entries up and down
|
||||
* added preview for iconsets
|
||||
* if visible but not on top RMB and MMB will bring traffic plotter to front
|
||||
instead of hiding it
|
||||
* same for LMB and status dialog
|
||||
* status dialog and traffic plotter store their position and size in the
|
||||
config file so that they keep them between 2 KDE sessions
|
||||
|
||||
Version 0.3.0:
|
||||
* updated Czech translation
|
||||
* updated Italian translation
|
||||
* added support for dynamic number of entries in the context menu. Useful
|
||||
to start/stop/restart interfaces or to configure them using external tools
|
||||
like KNetworkConf or NetGo.
|
||||
|
||||
Version 0.2.3 (the illuminated release)
|
||||
* updated Czech translation
|
||||
* updated German translation
|
||||
* updated Brazilian Portuguese translation
|
||||
* updated Spanish translation
|
||||
* updated French translation
|
||||
* KNemo now supports iconsets. This is the same behaviour as the previous
|
||||
'indication of connection type'. This checkbox was removed and an entry
|
||||
'Monitors' added to the combobox. The monitors are still default but now
|
||||
you can select a different set of icons for every interface.
|
||||
Thanks to SarahB for this proposal.
|
||||
|
||||
Version 0.2.2 (maintenance release):
|
||||
* added Dutch translation
|
||||
* updated Italian translation
|
||||
* updated Brazilian Portuguese translation
|
||||
* the system tray icon can indicate the connection type
|
||||
drawback: you need to tell KNemo the type of connection as KNemo can
|
||||
only detect the type when the interface is connected. So offline
|
||||
interfaces would display the wrong icon. Automatic detection of the
|
||||
connection type will be turned off if the user sets it manually.
|
||||
* traffic plotter now also accessible through context menu
|
||||
* status dialog and traffic plotter store their position on the screen
|
||||
between closing and reopening
|
||||
|
||||
Version 0.2.1 (maintenance release):
|
||||
* added French translation
|
||||
* added Brazilian Portuguese translation
|
||||
* updated Czech translation
|
||||
* added KNemo application icon ( Danke Bernd ;-) )
|
||||
* show correct uptime in the tooltip
|
||||
|
||||
Version 0.2.0:
|
||||
* added Italian translation
|
||||
* added Czech translation
|
||||
* fixed: selecting a different interface in the configuration dialog activated
|
||||
the 'Apply' button
|
||||
* fixed the 4GB bug: Knemo reported 4GB of sent and received traffic
|
||||
shortly after the connection was established
|
||||
* added status information for ethernet interfaces: broadcast address
|
||||
and default gateway
|
||||
* added traffic information: transfer speed for up- and download
|
||||
* added notification for 'interface does not exist'
|
||||
* status dialog: made all labels on the IP-tab selectable making it possible
|
||||
to copy&paste the information on this tab
|
||||
* middle-clicking on an icon displays a traffic plotter that was taken
|
||||
from KSysGuard (2nd click hides dialog)
|
||||
|
||||
Version 0.1.10 (maintenance release):
|
||||
* removed the entry 'Quit' in the context menu as it shouldn't be used
|
||||
for daemons (moreover it doesn't work for them correctly)
|
||||
* fixed the German translation
|
||||
* updated Bulgarian and Spanish translation
|
||||
* fixed a compile problem with KDE-CVS
|
||||
* improved configure check of 'ifconfig' and 'iwconfig'
|
||||
* don't display empty line in tooltip if no alias is set
|
||||
* small fix for Bit Rate detection of wireless interfaces
|
||||
|
||||
Version 0.1.9:
|
||||
* fixed recognition of connection status for interfaces that are IPv6 enabled
|
||||
* don't compile and install documentation as long as there is none
|
||||
* added GPL header in all source files
|
||||
* added Bulgarian translations by Malin Malinov <lgmim@club-35.com>
|
||||
* ESSIDs can now contain any character
|
||||
* KNemo counts the number of transfered bytes and no longer depends on the
|
||||
output of 'ifconfig' for the total number of transfered bytes. This way
|
||||
KNemo can even display a hugh amount of traffic while 'ifconfig' has an
|
||||
overflow at 4GB.
|
||||
* added "About KNemo" dialog
|
||||
* added "Report Bug" entry in context menu
|
||||
* KNemo now distinguishs between the interface not being connected and
|
||||
the interface not existing. Added an option to hide the icon when the
|
||||
interface does not exist. This is useful for interfaces that are dynamically
|
||||
created and destroyed, for example interfaces of bluetooth adapters.
|
||||
* tooltips don't display uptime and wireless information when not connected
|
||||
or the interface does not exist
|
||||
* statusdialog uses correct icon and displays the interface name in the
|
||||
title to avoid <2> etc in the title when opening more than one dialog
|
||||
* 'ifconfig' and 'iwconfig' are now called with LANG and LC_ALL set to C
|
||||
to avoid problems with localized output
|
||||
* configure will now search for 'ifconfig' and 'iwconfig' so it is no
|
||||
longer neccessary to setup the path in the config dialog
|
||||
|
||||
Version 0.1.8:
|
||||
* fixed a bug with localized output of 'ifconfig' (parsing of received
|
||||
and send packets)
|
||||
* fixed a bug with uptime using QDateTime::daysTo() which doesn't
|
||||
give the correct results when you are interessted in complete days
|
||||
* added support for notifications
|
||||
* started with localization
|
||||
|
||||
Version 0.1.7
|
||||
* custom tooltips: the tooltips can now be configured to show some (or all)
|
||||
of the information available in the status dialog. This is meant for easy
|
||||
and quick access to often needed information.
|
||||
* opening the control center module from the context menu will preselect
|
||||
the interface the context menu belongs to
|
||||
* fixed handling of 'Reset' in the control center
|
||||
|
||||
Version 0.1.6
|
||||
* left-clicking an icon toggles the status dialog
|
||||
* 2 optional custom entries in the context menu to start and stop the
|
||||
interface
|
||||
* using the more standard icons
|
||||
- network_disconnected
|
||||
- network_connected
|
||||
- network_incoming
|
||||
- network_outgoing
|
||||
- network_traffic
|
||||
* install the icons under $KDEDIR/share/icons/crystalsvg/22x22/actions
|
||||
* fixed a problem with QTime when uptime became negative after midnight
|
||||
|
||||
Version 0.1.5
|
||||
* Initial Release
|
||||
|
@ -0,0 +1,181 @@
|
||||
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 awhile. While running, it prints some
|
||||
messages telling which features it is checking for.
|
||||
|
||||
2. Type `make' to compile the package.
|
||||
|
||||
3. Optionally, type `make check' to run any self-tests that come with
|
||||
the package.
|
||||
|
||||
4. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
5. You can remove the program binaries and object files from the
|
||||
source code directory by typing `make clean'. To also remove the
|
||||
files that `configure' created (so you can compile the package for
|
||||
a different kind of computer), type `make distclean'. There is
|
||||
also a `make maintainer-clean' target, but that is intended mainly
|
||||
for the package's developers. If you use it, you may have to get
|
||||
all sorts of other programs in order to regenerate files that came
|
||||
with the distribution.
|
||||
|
||||
Compilers and Options
|
||||
=====================
|
||||
|
||||
Some systems require unusual options for compilation or linking that
|
||||
the `configure' script does not know about. You can give `configure'
|
||||
initial values for variables by setting them in the environment. Using
|
||||
a Bourne-compatible shell, you can do that on the command line like
|
||||
this:
|
||||
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
|
||||
|
||||
Or on systems that have the `env' program, you can do it like this:
|
||||
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
|
||||
|
||||
Compiling For Multiple Architectures
|
||||
====================================
|
||||
|
||||
You can compile the package for more than one kind of computer at the
|
||||
same time, by placing the object files for each architecture in their
|
||||
own directory. To do this, you must use a version of `make' that
|
||||
supports the `VPATH' variable, such as GNU `make'. `cd' to the
|
||||
directory where you want the object files and executables to go and run
|
||||
the `configure' script. `configure' automatically checks for the
|
||||
source code in the directory that `configure' is in and in `..'.
|
||||
|
||||
If you have to use a `make' that does not supports the `VPATH'
|
||||
variable, you have to compile the package for one architecture at a time
|
||||
in the source code directory. After you have installed the package for
|
||||
one architecture, use `make distclean' before reconfiguring for another
|
||||
architecture.
|
||||
|
||||
Installation Names
|
||||
==================
|
||||
|
||||
By default, `make install' will install the package's files in
|
||||
`/usr/local/bin', `/usr/local/man', etc. You can specify an
|
||||
installation prefix other than `/usr/local' by giving `configure' the
|
||||
option `--prefix=PATH'.
|
||||
|
||||
You can specify separate installation prefixes for
|
||||
architecture-specific files and architecture-independent files. If you
|
||||
give `configure' the option `--exec-prefix=PATH', the package will use
|
||||
PATH as the prefix for installing programs and libraries.
|
||||
Documentation and other data files will still use the regular prefix.
|
||||
|
||||
In addition, if you use an unusual directory layout you can give
|
||||
options like `--bindir=PATH' to specify different values for particular
|
||||
kinds of files. Run `configure --help' for a list of the directories
|
||||
you can set and what kinds of files go in them.
|
||||
|
||||
If the package supports it, you can cause programs to be installed
|
||||
with an extra prefix or suffix on their names by giving `configure' the
|
||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
|
||||
|
||||
Optional Features
|
||||
=================
|
||||
|
||||
Some packages pay attention to `--enable-FEATURE' options to
|
||||
`configure', where FEATURE indicates an optional part of the package.
|
||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
|
||||
is something like `gnu-as' or `x' (for the X Window System). The
|
||||
`README' should mention any `--enable-' and `--with-' options that the
|
||||
package recognizes.
|
||||
|
||||
For packages that use the X Window System, `configure' can usually
|
||||
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,5 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.6.1
|
||||
|
||||
include admin/deps.am
|
||||
include admin/Doxyfile.am
|
||||
SUBDIRS=$(TOPSUBDIRS)
|
@ -0,0 +1,4 @@
|
||||
AUTOMAKE_OPTIONS = foreign 1.6.1
|
||||
|
||||
include admin/deps.am
|
||||
include admin/Doxyfile.am
|
@ -0,0 +1,36 @@
|
||||
KNemo - the KDE Network Monitor
|
||||
|
||||
KNemo offers a network monitor similar to the one found in Windows.
|
||||
For every network interface it displays an icon in the systray.
|
||||
|
||||
IMPORTANT: KNemo has to be started using KDE Control Center/Internet & Network/
|
||||
Network Monitor. Please do no longer use the KDE Service Manager to start and
|
||||
stop KNemo. This change was necessary to keep KNemo from starting automatically
|
||||
for every user in a multiuser environment.
|
||||
|
||||
Features of version 0.4.5 include:
|
||||
* support for ethernet (including wireless) and ppp connections
|
||||
* the icon shows incoming/outgoing traffic
|
||||
* hiding of icon when the interface is not available
|
||||
* hiding of icon when the interface does not exist (useful for interfaces that
|
||||
are dynamically created and and removed)
|
||||
* automatic detection of wireless extensions for ethernet interfaces
|
||||
* left-clicking on an icon displays a status dialog with information about the
|
||||
selected interface (2nd click hides dialog)
|
||||
* middle-clicking on an icon displays a traffic plotter that was taken from
|
||||
KSysGuard (2nd click hides dialog)
|
||||
* configuration via context menu or control center module (Internet & Network/
|
||||
Network Monitor)
|
||||
* customizable tooltip for quick access to often needed information
|
||||
* custom entries in the context menu. Useful to start/stop/restart interfaces
|
||||
or to configure them using external tools.
|
||||
* automatic detection of available interfaces (click on 'Default' in the
|
||||
configuration dialog and KNemo will look under /proc/net/dev for interfaces)
|
||||
* support for notifications via sound and passive popups
|
||||
* KNemo counts the number of transfered bytes and does not depend on the output
|
||||
of 'ifconfig' for the total number of transfered bytes. This way KNemo can
|
||||
even display a hugh amount of traffic while 'ifconfig' has an overflow at 4GB.
|
||||
* support for different iconsets for every interface
|
||||
* support for daily, monthly and yearly statistics
|
||||
* configurable update interval for interface informations
|
||||
* support for different backends to gather information
|
@ -0,0 +1,9 @@
|
||||
* create the plotter (but keep it hidden) when an interface
|
||||
gets connected, so that we have sort of memory for the plotter
|
||||
* include an option: "show as line" - like the signal plotter in kppp
|
||||
* another option: "show up/down speed" in the bottom right (those numbers
|
||||
shown in tooltip)
|
||||
* add a button for context menu entries presets. I mean it would be great
|
||||
if newbies could select entries for kppp, network start/stop/restart
|
||||
* show two dynamic bars with the current netload instead of an icon
|
||||
* It would also be great if the color of the animation tray icon will reflect the current bandwidth... For example gray for 0-25%, light green 25-50% green 50-75%, red 75-100%. (The simplest way to achieve this is to have 14 icons for each set. Or N icons and allow the user to select a bandwith range and appropriate icon.)
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,863 @@
|
||||
# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
|
||||
# 2005 Free Software Foundation, Inc.
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_AUTOMAKE_VERSION(VERSION)
|
||||
# ----------------------------
|
||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been
|
||||
# generated from the m4 files accompanying Automake X.Y.
|
||||
AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
|
||||
|
||||
# AM_SET_CURRENT_AUTOMAKE_VERSION
|
||||
# -------------------------------
|
||||
# Call AM_AUTOMAKE_VERSION so it can be traced.
|
||||
# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
|
||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
|
||||
[AM_AUTOMAKE_VERSION([1.9.6])])
|
||||
|
||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
|
||||
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
|
||||
# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
|
||||
#
|
||||
# Of course, Automake must honor this variable whenever it calls a
|
||||
# tool from the auxiliary directory. The problem is that $srcdir (and
|
||||
# therefore $ac_aux_dir as well) can be either absolute or relative,
|
||||
# depending on how configure is run. This is pretty annoying, since
|
||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top
|
||||
# source directory, any form will work fine, but in subdirectories a
|
||||
# relative path needs to be adjusted first.
|
||||
#
|
||||
# $ac_aux_dir/missing
|
||||
# fails when called from a subdirectory if $ac_aux_dir is relative
|
||||
# $top_srcdir/$ac_aux_dir/missing
|
||||
# fails if $ac_aux_dir is absolute,
|
||||
# fails when called from a subdirectory in a VPATH build with
|
||||
# a relative $ac_aux_dir
|
||||
#
|
||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
|
||||
# are both prefixed by $srcdir. In an in-source build this is usually
|
||||
# harmless because $srcdir is `.', but things will broke when you
|
||||
# start a VPATH build or use an absolute $srcdir.
|
||||
#
|
||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
|
||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
|
||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
|
||||
# and then we would define $MISSING as
|
||||
# MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# This will work as long as MISSING is not called from configure, because
|
||||
# unfortunately $(top_srcdir) has no meaning in configure.
|
||||
# However there are other variables, like CC, which are often used in
|
||||
# configure, and could therefore not use this "fixed" $ac_aux_dir.
|
||||
#
|
||||
# Another solution, used here, is to always expand $ac_aux_dir to an
|
||||
# absolute PATH. The drawback is that using absolute paths prevent a
|
||||
# configured tree to be moved without reconfiguration.
|
||||
|
||||
AC_DEFUN([AM_AUX_DIR_EXPAND],
|
||||
[dnl Rely on autoconf to set up CDPATH properly.
|
||||
AC_PREREQ([2.50])dnl
|
||||
# expand $ac_aux_dir to an absolute path
|
||||
am_aux_dir=`cd $ac_aux_dir && pwd`
|
||||
])
|
||||
|
||||
# AM_CONDITIONAL -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 7
|
||||
|
||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
|
||||
# -------------------------------------
|
||||
# Define a conditional.
|
||||
AC_DEFUN([AM_CONDITIONAL],
|
||||
[AC_PREREQ(2.52)dnl
|
||||
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
|
||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
|
||||
AC_SUBST([$1_TRUE])
|
||||
AC_SUBST([$1_FALSE])
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
$1_TRUE='#'
|
||||
$1_FALSE=
|
||||
fi
|
||||
AC_CONFIG_COMMANDS_PRE(
|
||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
|
||||
AC_MSG_ERROR([[conditional "$1" was never defined.
|
||||
Usually this means the macro was only invoked conditionally.]])
|
||||
fi])])
|
||||
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
|
||||
# written in clear, in which case automake, when reading aclocal.m4,
|
||||
# will think it sees a *use*, and therefore will trigger all it's
|
||||
# C support machinery. Also note that it means that autoscan, seeing
|
||||
# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
|
||||
|
||||
|
||||
# _AM_DEPENDENCIES(NAME)
|
||||
# ----------------------
|
||||
# See how the compiler implements dependency checking.
|
||||
# NAME is "CC", "CXX", "GCJ", or "OBJC".
|
||||
# We try a few techniques and use that to set a single cache variable.
|
||||
#
|
||||
# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
|
||||
# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
|
||||
# dependency, and given that the user is not expected to run this macro,
|
||||
# just rely on AC_PROG_CC.
|
||||
AC_DEFUN([_AM_DEPENDENCIES],
|
||||
[AC_REQUIRE([AM_SET_DEPDIR])dnl
|
||||
AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
|
||||
AC_REQUIRE([AM_MAKE_INCLUDE])dnl
|
||||
AC_REQUIRE([AM_DEP_TRACK])dnl
|
||||
|
||||
ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
|
||||
[$1], CXX, [depcc="$CXX" am_compiler_list=],
|
||||
[$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
|
||||
[$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
|
||||
[depcc="$$1" am_compiler_list=])
|
||||
|
||||
AC_CACHE_CHECK([dependency style of $depcc],
|
||||
[am_cv_$1_dependencies_compiler_type],
|
||||
[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
|
||||
# We make a subdir and do the tests there. Otherwise we can end up
|
||||
# making bogus files that we don't know about and never remove. For
|
||||
# instance it was reported that on HP-UX the gcc test will end up
|
||||
# making a dummy file named `D' -- because `-MD' means `put the output
|
||||
# in D'.
|
||||
mkdir conftest.dir
|
||||
# Copy depcomp to subdir because otherwise we won't find it if we're
|
||||
# using a relative directory.
|
||||
cp "$am_depcomp" conftest.dir
|
||||
cd conftest.dir
|
||||
# We will build objects and dependencies in a subdirectory because
|
||||
# it helps to detect inapplicable dependency modes. For instance
|
||||
# both Tru64's cc and ICC support -MD to output dependencies as a
|
||||
# side effect of compilation, but ICC will put the dependencies in
|
||||
# the current directory while Tru64 will put them in the object
|
||||
# directory.
|
||||
mkdir sub
|
||||
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
if test "$am_compiler_list" = ""; then
|
||||
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
|
||||
fi
|
||||
for depmode in $am_compiler_list; do
|
||||
# Setup a source with many dependencies, because some compilers
|
||||
# like to wrap large dependency lists on column 80 (with \), and
|
||||
# we should not choose a depcomp mode which is confused by this.
|
||||
#
|
||||
# We need to recreate these files for each test, as the compiler may
|
||||
# overwrite some of them when testing with obscure command lines.
|
||||
# This happens at least with the AIX C compiler.
|
||||
: > sub/conftest.c
|
||||
for i in 1 2 3 4 5 6; do
|
||||
echo '#include "conftst'$i'.h"' >> sub/conftest.c
|
||||
# Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
|
||||
# Solaris 8's {/usr,}/bin/sh.
|
||||
touch sub/conftst$i.h
|
||||
done
|
||||
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
|
||||
|
||||
case $depmode in
|
||||
nosideeffect)
|
||||
# after this tag, mechanisms are not by side-effect, so they'll
|
||||
# only be used when explicitly requested
|
||||
if test "x$enable_dependency_tracking" = xyes; then
|
||||
continue
|
||||
else
|
||||
break
|
||||
fi
|
||||
;;
|
||||
none) break ;;
|
||||
esac
|
||||
# We check with `-c' and `-o' for the sake of the "dashmstdout"
|
||||
# mode. It turns out that the SunPro C++ compiler does not properly
|
||||
# handle `-M -o', and we need to detect this.
|
||||
if depmode=$depmode \
|
||||
source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
|
||||
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
|
||||
$SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
|
||||
>/dev/null 2>conftest.err &&
|
||||
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
|
||||
grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
|
||||
${MAKE-make} -s -f confmf > /dev/null 2>&1; then
|
||||
# icc doesn't choke on unknown options, it will just issue warnings
|
||||
# or remarks (even with -Werror). So we grep stderr for any message
|
||||
# that says an option was ignored or not supported.
|
||||
# When given -MP, icc 7.0 and 7.1 complain thusly:
|
||||
# icc: Command line warning: ignoring option '-M'; no argument required
|
||||
# The diagnosis changed in icc 8.0:
|
||||
# icc: Command line remark: option '-MP' not supported
|
||||
if (grep 'ignoring option' conftest.err ||
|
||||
grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
|
||||
am_cv_$1_dependencies_compiler_type=$depmode
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
cd ..
|
||||
rm -rf conftest.dir
|
||||
else
|
||||
am_cv_$1_dependencies_compiler_type=none
|
||||
fi
|
||||
])
|
||||
AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
|
||||
AM_CONDITIONAL([am__fastdep$1], [
|
||||
test "x$enable_dependency_tracking" != xno \
|
||||
&& test "$am_cv_$1_dependencies_compiler_type" = gcc3])
|
||||
])
|
||||
|
||||
|
||||
# AM_SET_DEPDIR
|
||||
# -------------
|
||||
# Choose a directory name for dependency files.
|
||||
# This macro is AC_REQUIREd in _AM_DEPENDENCIES
|
||||
AC_DEFUN([AM_SET_DEPDIR],
|
||||
[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
|
||||
])
|
||||
|
||||
|
||||
# AM_DEP_TRACK
|
||||
# ------------
|
||||
AC_DEFUN([AM_DEP_TRACK],
|
||||
[AC_ARG_ENABLE(dependency-tracking,
|
||||
[ --disable-dependency-tracking speeds up one-time build
|
||||
--enable-dependency-tracking do not reject slow dependency extractors])
|
||||
if test "x$enable_dependency_tracking" != xno; then
|
||||
am_depcomp="$ac_aux_dir/depcomp"
|
||||
AMDEPBACKSLASH='\'
|
||||
fi
|
||||
AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
|
||||
AC_SUBST([AMDEPBACKSLASH])
|
||||
])
|
||||
|
||||
# Generate code to set up dependency tracking. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
#serial 3
|
||||
|
||||
# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# ------------------------------
|
||||
AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[for mf in $CONFIG_FILES; do
|
||||
# Strip MF so we end up with the name of the file.
|
||||
mf=`echo "$mf" | sed -e 's/:.*$//'`
|
||||
# Check whether this is an Automake generated Makefile or not.
|
||||
# We used to match only the files named `Makefile.in', but
|
||||
# some people rename them; so instead we look at the file content.
|
||||
# Grep'ing the first line is not enough: some people post-process
|
||||
# each Makefile.in and add a new line on top of each file to say so.
|
||||
# So let's grep whole file.
|
||||
if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
|
||||
dirpart=`AS_DIRNAME("$mf")`
|
||||
else
|
||||
continue
|
||||
fi
|
||||
# Extract the definition of DEPDIR, am__include, and am__quote
|
||||
# from the Makefile without running `make'.
|
||||
DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
|
||||
test -z "$DEPDIR" && continue
|
||||
am__include=`sed -n 's/^am__include = //p' < "$mf"`
|
||||
test -z "am__include" && continue
|
||||
am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
|
||||
# When using ansi2knr, U may be empty or an underscore; expand it
|
||||
U=`sed -n 's/^U = //p' < "$mf"`
|
||||
# Find all dependency output files, they are included files with
|
||||
# $(DEPDIR) in their names. We invoke sed twice because it is the
|
||||
# simplest approach to changing $(DEPDIR) to its actual value in the
|
||||
# expansion.
|
||||
for file in `sed -n "
|
||||
s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
|
||||
sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
|
||||
# Make sure the directory exists.
|
||||
test -f "$dirpart/$file" && continue
|
||||
fdir=`AS_DIRNAME(["$file"])`
|
||||
AS_MKDIR_P([$dirpart/$fdir])
|
||||
# echo "creating $dirpart/$file"
|
||||
echo '# dummy' > "$dirpart/$file"
|
||||
done
|
||||
done
|
||||
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
|
||||
|
||||
# AM_OUTPUT_DEPENDENCY_COMMANDS
|
||||
# -----------------------------
|
||||
# This macro should only be invoked once -- use via AC_REQUIRE.
|
||||
#
|
||||
# This code is only required when automatic dependency tracking
|
||||
# is enabled. FIXME. This creates each `.P' file that we will
|
||||
# need in order to bootstrap the dependency handling code.
|
||||
AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AC_CONFIG_COMMANDS([depfiles],
|
||||
[test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
|
||||
[AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
|
||||
])
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 8
|
||||
|
||||
# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
|
||||
AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
|
||||
|
||||
# Do all the work for Automake. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 12
|
||||
|
||||
# This macro actually does too much. Some checks are only needed if
|
||||
# your package does certain things. But this isn't really a big deal.
|
||||
|
||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
|
||||
# AM_INIT_AUTOMAKE([OPTIONS])
|
||||
# -----------------------------------------------
|
||||
# The call with PACKAGE and VERSION arguments is the old style
|
||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE
|
||||
# and VERSION should now be passed to AC_INIT and removed from
|
||||
# the call to AM_INIT_AUTOMAKE.
|
||||
# We support both call styles for the transition. After
|
||||
# the next Automake release, Autoconf can make the AC_INIT
|
||||
# arguments mandatory, and then we can depend on a new Autoconf
|
||||
# release and drop the old call support.
|
||||
AC_DEFUN([AM_INIT_AUTOMAKE],
|
||||
[AC_PREREQ([2.58])dnl
|
||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow
|
||||
dnl the ones we care about.
|
||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
|
||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
|
||||
AC_REQUIRE([AC_PROG_INSTALL])dnl
|
||||
# test to see if srcdir already configured
|
||||
if test "`cd $srcdir && pwd`" != "`pwd`" &&
|
||||
test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
|
||||
# test whether we have cygpath
|
||||
if test -z "$CYGPATH_W"; then
|
||||
if (cygpath --version) >/dev/null 2>/dev/null; then
|
||||
CYGPATH_W='cygpath -w'
|
||||
else
|
||||
CYGPATH_W=echo
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([CYGPATH_W])
|
||||
|
||||
# Define the identity of the package.
|
||||
dnl Distinguish between old-style and new-style calls.
|
||||
m4_ifval([$2],
|
||||
[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
|
||||
AC_SUBST([PACKAGE], [$1])dnl
|
||||
AC_SUBST([VERSION], [$2])],
|
||||
[_AM_SET_OPTIONS([$1])dnl
|
||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
|
||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
|
||||
|
||||
_AM_IF_OPTION([no-define],,
|
||||
[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
|
||||
|
||||
# Some tools Automake needs.
|
||||
AC_REQUIRE([AM_SANITY_CHECK])dnl
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl
|
||||
AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOCONF, autoconf)
|
||||
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
|
||||
AM_MISSING_PROG(AUTOHEADER, autoheader)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo)
|
||||
AM_PROG_INSTALL_SH
|
||||
AM_PROG_INSTALL_STRIP
|
||||
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
|
||||
# We need awk for the "check" target. The system "awk" is bad on
|
||||
# some platforms.
|
||||
AC_REQUIRE([AC_PROG_AWK])dnl
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
|
||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
|
||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
|
||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
|
||||
[_AM_PROG_TAR([v7])])])
|
||||
_AM_IF_OPTION([no-dependencies],,
|
||||
[AC_PROVIDE_IFELSE([AC_PROG_CC],
|
||||
[_AM_DEPENDENCIES(CC)],
|
||||
[define([AC_PROG_CC],
|
||||
defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
|
||||
AC_PROVIDE_IFELSE([AC_PROG_CXX],
|
||||
[_AM_DEPENDENCIES(CXX)],
|
||||
[define([AC_PROG_CXX],
|
||||
defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
|
||||
])
|
||||
])
|
||||
|
||||
|
||||
# When config.status generates a header, we must update the stamp-h file.
|
||||
# This file resides in the same directory as the config header
|
||||
# that is generated. The stamp files are numbered to have different names.
|
||||
|
||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
|
||||
# loop where config.status creates the headers, so we can generate
|
||||
# our stamp files there.
|
||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
|
||||
[# Compute $1's index in $config_headers.
|
||||
_am_stamp_count=1
|
||||
for _am_header in $config_headers :; do
|
||||
case $_am_header in
|
||||
$1 | $1:* )
|
||||
break ;;
|
||||
* )
|
||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
|
||||
esac
|
||||
done
|
||||
echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_SH
|
||||
# ------------------
|
||||
# Define $install_sh.
|
||||
AC_DEFUN([AM_PROG_INSTALL_SH],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
install_sh=${install_sh-"$am_aux_dir/install-sh"}
|
||||
AC_SUBST(install_sh)])
|
||||
|
||||
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# Check whether the underlying file-system supports filenames
|
||||
# with a leading dot. For instance MS-DOS doesn't.
|
||||
AC_DEFUN([AM_SET_LEADING_DOT],
|
||||
[rm -rf .tst 2>/dev/null
|
||||
mkdir .tst 2>/dev/null
|
||||
if test -d .tst; then
|
||||
am__leading_dot=.
|
||||
else
|
||||
am__leading_dot=_
|
||||
fi
|
||||
rmdir .tst 2>/dev/null
|
||||
AC_SUBST([am__leading_dot])])
|
||||
|
||||
# Check to see how 'make' treats includes. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# AM_MAKE_INCLUDE()
|
||||
# -----------------
|
||||
# Check to see how make treats includes.
|
||||
AC_DEFUN([AM_MAKE_INCLUDE],
|
||||
[am_make=${MAKE-make}
|
||||
cat > confinc << 'END'
|
||||
am__doit:
|
||||
@echo done
|
||||
.PHONY: am__doit
|
||||
END
|
||||
# If we don't find an include directive, just comment out the code.
|
||||
AC_MSG_CHECKING([for style of include used by $am_make])
|
||||
am__include="#"
|
||||
am__quote=
|
||||
_am_result=none
|
||||
# First try GNU make style include.
|
||||
echo "include confinc" > confmf
|
||||
# We grep out `Entering directory' and `Leaving directory'
|
||||
# messages which can occur if `w' ends up in MAKEFLAGS.
|
||||
# In particular we don't look at `^make:' because GNU make might
|
||||
# be invoked under some other name (usually "gmake"), in which
|
||||
# case it prints its new name instead of `make'.
|
||||
if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
|
||||
am__include=include
|
||||
am__quote=
|
||||
_am_result=GNU
|
||||
fi
|
||||
# Now try BSD make style include.
|
||||
if test "$am__include" = "#"; then
|
||||
echo '.include "confinc"' > confmf
|
||||
if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
|
||||
am__include=.include
|
||||
am__quote="\""
|
||||
_am_result=BSD
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([am__include])
|
||||
AC_SUBST([am__quote])
|
||||
AC_MSG_RESULT([$_am_result])
|
||||
rm -f confinc confmf
|
||||
])
|
||||
|
||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_MISSING_PROG(NAME, PROGRAM)
|
||||
# ------------------------------
|
||||
AC_DEFUN([AM_MISSING_PROG],
|
||||
[AC_REQUIRE([AM_MISSING_HAS_RUN])
|
||||
$1=${$1-"${am_missing_run}$2"}
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# AM_MISSING_HAS_RUN
|
||||
# ------------------
|
||||
# Define MISSING if not defined so far and test if it supports --run.
|
||||
# If it does, set am_missing_run to use it, otherwise, to nothing.
|
||||
AC_DEFUN([AM_MISSING_HAS_RUN],
|
||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
|
||||
test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
|
||||
# Use eval to expand $SHELL
|
||||
if eval "$MISSING --run true"; then
|
||||
am_missing_run="$MISSING --run "
|
||||
else
|
||||
am_missing_run=
|
||||
AC_MSG_WARN([`missing' script is too old or missing])
|
||||
fi
|
||||
])
|
||||
|
||||
# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_MKDIR_P
|
||||
# ---------------
|
||||
# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
|
||||
#
|
||||
# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
|
||||
# created by `make install' are always world readable, even if the
|
||||
# installer happens to have an overly restrictive umask (e.g. 077).
|
||||
# This was a mistake. There are at least two reasons why we must not
|
||||
# use `-m 0755':
|
||||
# - it causes special bits like SGID to be ignored,
|
||||
# - it may be too restrictive (some setups expect 775 directories).
|
||||
#
|
||||
# Do not use -m 0755 and let people choose whatever they expect by
|
||||
# setting umask.
|
||||
#
|
||||
# We cannot accept any implementation of `mkdir' that recognizes `-p'.
|
||||
# Some implementations (such as Solaris 8's) are not thread-safe: if a
|
||||
# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
|
||||
# concurrently, both version can detect that a/ is missing, but only
|
||||
# one can create it and the other will error out. Consequently we
|
||||
# restrict ourselves to GNU make (using the --version option ensures
|
||||
# this.)
|
||||
AC_DEFUN([AM_PROG_MKDIR_P],
|
||||
[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
|
||||
# We used to keeping the `.' as first argument, in order to
|
||||
# allow $(mkdir_p) to be used without argument. As in
|
||||
# $(mkdir_p) $(somedir)
|
||||
# where $(somedir) is conditionally defined. However this is wrong
|
||||
# for two reasons:
|
||||
# 1. if the package is installed by a user who cannot write `.'
|
||||
# make install will fail,
|
||||
# 2. the above comment should most certainly read
|
||||
# $(mkdir_p) $(DESTDIR)$(somedir)
|
||||
# so it does not work when $(somedir) is undefined and
|
||||
# $(DESTDIR) is not.
|
||||
# To support the latter case, we have to write
|
||||
# test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
|
||||
# so the `.' trick is pointless.
|
||||
mkdir_p='mkdir -p --'
|
||||
else
|
||||
# On NextStep and OpenStep, the `mkdir' command does not
|
||||
# recognize any option. It will interpret all options as
|
||||
# directories to create, and then abort because `.' already
|
||||
# exists.
|
||||
for d in ./-p ./--version;
|
||||
do
|
||||
test -d $d && rmdir $d
|
||||
done
|
||||
# $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
|
||||
if test -f "$ac_aux_dir/mkinstalldirs"; then
|
||||
mkdir_p='$(mkinstalldirs)'
|
||||
else
|
||||
mkdir_p='$(install_sh) -d'
|
||||
fi
|
||||
fi
|
||||
AC_SUBST([mkdir_p])])
|
||||
|
||||
# Helper functions for option handling. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 3
|
||||
|
||||
# _AM_MANGLE_OPTION(NAME)
|
||||
# -----------------------
|
||||
AC_DEFUN([_AM_MANGLE_OPTION],
|
||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
|
||||
|
||||
# _AM_SET_OPTION(NAME)
|
||||
# ------------------------------
|
||||
# Set option NAME. Presently that only means defining a flag for this option.
|
||||
AC_DEFUN([_AM_SET_OPTION],
|
||||
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
|
||||
|
||||
# _AM_SET_OPTIONS(OPTIONS)
|
||||
# ----------------------------------
|
||||
# OPTIONS is a space-separated list of Automake options.
|
||||
AC_DEFUN([_AM_SET_OPTIONS],
|
||||
[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
|
||||
|
||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
|
||||
# -------------------------------------------
|
||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
|
||||
AC_DEFUN([_AM_IF_OPTION],
|
||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
|
||||
|
||||
# Check to make sure that the build environment is sane. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
|
||||
# Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 4
|
||||
|
||||
# AM_SANITY_CHECK
|
||||
# ---------------
|
||||
AC_DEFUN([AM_SANITY_CHECK],
|
||||
[AC_MSG_CHECKING([whether build environment is sane])
|
||||
# Just in case
|
||||
sleep 1
|
||||
echo timestamp > conftest.file
|
||||
# Do `set' in a subshell so we don't clobber the current shell's
|
||||
# arguments. Must try -L first in case configure is actually a
|
||||
# symlink; some systems play weird games with the mod time of symlinks
|
||||
# (eg FreeBSD returns the mod time of the symlink's containing
|
||||
# directory).
|
||||
if (
|
||||
set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
||||
if test "$[*]" = "X"; then
|
||||
# -L didn't work.
|
||||
set X `ls -t $srcdir/configure conftest.file`
|
||||
fi
|
||||
rm -f conftest.file
|
||||
if test "$[*]" != "X $srcdir/configure conftest.file" \
|
||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then
|
||||
|
||||
# If neither matched, then we have a broken ls. This can happen
|
||||
# if, for instance, CONFIG_SHELL is bash and it inherits a
|
||||
# broken ls alias from the environment. This has actually
|
||||
# happened. Such a system could not be considered "sane".
|
||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
|
||||
alias in your environment])
|
||||
fi
|
||||
|
||||
test "$[2]" = conftest.file
|
||||
)
|
||||
then
|
||||
# Ok.
|
||||
:
|
||||
else
|
||||
AC_MSG_ERROR([newly created file is older than distributed files!
|
||||
Check your system clock])
|
||||
fi
|
||||
AC_MSG_RESULT(yes)])
|
||||
|
||||
# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# AM_PROG_INSTALL_STRIP
|
||||
# ---------------------
|
||||
# One issue with vendor `install' (even GNU) is that you can't
|
||||
# specify the program used to strip binaries. This is especially
|
||||
# annoying in cross-compiling environments, where the build's strip
|
||||
# is unlikely to handle the host's binaries.
|
||||
# Fortunately install-sh will honor a STRIPPROG variable, so we
|
||||
# always use install-sh in `make install-strip', and initialize
|
||||
# STRIPPROG with the value of the STRIP variable (set by the user).
|
||||
AC_DEFUN([AM_PROG_INSTALL_STRIP],
|
||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
|
||||
# Installed binaries are usually stripped using `strip' when the user
|
||||
# run `make install-strip'. However `strip' might not be the right
|
||||
# tool to use in cross-compilation environments, therefore Automake
|
||||
# will honor the `STRIP' environment variable to overrule this program.
|
||||
dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
|
||||
if test "$cross_compiling" != no; then
|
||||
AC_CHECK_TOOL([STRIP], [strip], :)
|
||||
fi
|
||||
INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
|
||||
AC_SUBST([INSTALL_STRIP_PROGRAM])])
|
||||
|
||||
# Check how to create a tarball. -*- Autoconf -*-
|
||||
|
||||
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# This file is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# serial 2
|
||||
|
||||
# _AM_PROG_TAR(FORMAT)
|
||||
# --------------------
|
||||
# Check how to create a tarball in format FORMAT.
|
||||
# FORMAT should be one of `v7', `ustar', or `pax'.
|
||||
#
|
||||
# Substitute a variable $(am__tar) that is a command
|
||||
# writing to stdout a FORMAT-tarball containing the directory
|
||||
# $tardir.
|
||||
# tardir=directory && $(am__tar) > result.tar
|
||||
#
|
||||
# Substitute a variable $(am__untar) that extract such
|
||||
# a tarball read from stdin.
|
||||
# $(am__untar) < result.tar
|
||||
AC_DEFUN([_AM_PROG_TAR],
|
||||
[# Always define AMTAR for backward compatibility.
|
||||
AM_MISSING_PROG([AMTAR], [tar])
|
||||
m4_if([$1], [v7],
|
||||
[am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
|
||||
[m4_case([$1], [ustar],, [pax],,
|
||||
[m4_fatal([Unknown tar format])])
|
||||
AC_MSG_CHECKING([how to create a $1 tar archive])
|
||||
# Loop over all known methods to create a tar archive until one works.
|
||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
|
||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools}
|
||||
# Do not fold the above two line into one, because Tru64 sh and
|
||||
# Solaris sh will not grok spaces in the rhs of `-'.
|
||||
for _am_tool in $_am_tools
|
||||
do
|
||||
case $_am_tool in
|
||||
gnutar)
|
||||
for _am_tar in tar gnutar gtar;
|
||||
do
|
||||
AM_RUN_LOG([$_am_tar --version]) && break
|
||||
done
|
||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
|
||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
|
||||
am__untar="$_am_tar -xf -"
|
||||
;;
|
||||
plaintar)
|
||||
# Must skip GNU tar: if it does not support --format= it doesn't create
|
||||
# ustar tarball either.
|
||||
(tar --version) >/dev/null 2>&1 && continue
|
||||
am__tar='tar chf - "$$tardir"'
|
||||
am__tar_='tar chf - "$tardir"'
|
||||
am__untar='tar xf -'
|
||||
;;
|
||||
pax)
|
||||
am__tar='pax -L -x $1 -w "$$tardir"'
|
||||
am__tar_='pax -L -x $1 -w "$tardir"'
|
||||
am__untar='pax -r'
|
||||
;;
|
||||
cpio)
|
||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
|
||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
|
||||
am__untar='cpio -i -H $1 -d'
|
||||
;;
|
||||
none)
|
||||
am__tar=false
|
||||
am__tar_=false
|
||||
am__untar=false
|
||||
;;
|
||||
esac
|
||||
|
||||
# If the value was cached, stop now. We just wanted to have am__tar
|
||||
# and am__untar set.
|
||||
test -n "${am_cv_prog_tar_$1}" && break
|
||||
|
||||
# tar/untar a dummy directory, and stop if the command works
|
||||
rm -rf conftest.dir
|
||||
mkdir conftest.dir
|
||||
echo GrepMe > conftest.dir/file
|
||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
|
||||
rm -rf conftest.dir
|
||||
if test -s conftest.tar; then
|
||||
AM_RUN_LOG([$am__untar <conftest.tar])
|
||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
|
||||
fi
|
||||
done
|
||||
rm -rf conftest.dir
|
||||
|
||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
|
||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])])
|
||||
AC_SUBST([am__tar])
|
||||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([acinclude.m4])
|
@ -0,0 +1,282 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <Carbon/Carbon.h> header file. */
|
||||
#undef HAVE_CARBON_CARBON_H
|
||||
|
||||
/* Define if you have the CoreAudio API */
|
||||
#undef HAVE_COREAUDIO
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#undef HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Defines if your system has the crypt function */
|
||||
#undef HAVE_CRYPT
|
||||
|
||||
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `iw' library (-liw). */
|
||||
#undef HAVE_LIBIW
|
||||
|
||||
/* Define if you have libjpeg */
|
||||
#undef HAVE_LIBJPEG
|
||||
|
||||
/* Define if you have libpng */
|
||||
#undef HAVE_LIBPNG
|
||||
|
||||
/* Define if you have a working libpthread (will enable threaded code) */
|
||||
#undef HAVE_LIBPTHREAD
|
||||
|
||||
/* Define if you have libz */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if your system needs _NSGetEnviron to set up the environment */
|
||||
#undef HAVE_NSGETENVIRON
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#undef HAVE_PATHS_H
|
||||
|
||||
/* Define if you have res_init */
|
||||
#undef HAVE_RES_INIT
|
||||
|
||||
/* Define if you have the res_init prototype */
|
||||
#undef HAVE_RES_INIT_PROTO
|
||||
|
||||
/* Define if you have a STL implementation by SGI */
|
||||
#undef HAVE_SGI_STL
|
||||
|
||||
/* Define to 1 if you have the `snprintf' function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define if you have strlcat */
|
||||
#undef HAVE_STRLCAT
|
||||
|
||||
/* Define if you have the strlcat prototype */
|
||||
#undef HAVE_STRLCAT_PROTO
|
||||
|
||||
/* Define if you have strlcpy */
|
||||
#undef HAVE_STRLCPY
|
||||
|
||||
/* Define if you have the strlcpy prototype */
|
||||
#undef HAVE_STRLCPY_PROTO
|
||||
|
||||
/* Define to 1 if you have the <sys/bitypes.h> header file. */
|
||||
#undef HAVE_SYS_BITYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
|
||||
*/
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the `usleep' function. */
|
||||
#undef HAVE_USLEEP
|
||||
|
||||
/* Define to 1 if you have the `vsnprintf' function. */
|
||||
#undef HAVE_VSNPRINTF
|
||||
|
||||
/* Suffix for lib directories */
|
||||
#undef KDELIBSUFF
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Path of ifconfig program */
|
||||
#undef PATH_IFCONFIG
|
||||
|
||||
/* Path of iwconfig program */
|
||||
#undef PATH_IWCONFIG
|
||||
|
||||
/* Path of route program */
|
||||
#undef PATH_ROUTE
|
||||
|
||||
/* The size of `char *', as computed by sizeof. */
|
||||
#undef SIZEOF_CHAR_P
|
||||
|
||||
/* The size of `int', as computed by sizeof. */
|
||||
#undef SIZEOF_INT
|
||||
|
||||
/* The size of `long', as computed by sizeof. */
|
||||
#undef SIZEOF_LONG
|
||||
|
||||
/* The size of `short', as computed by sizeof. */
|
||||
#undef SIZEOF_SHORT
|
||||
|
||||
/* The size of `size_t', as computed by sizeof. */
|
||||
#undef SIZEOF_SIZE_T
|
||||
|
||||
/* The size of `unsigned long', as computed by sizeof. */
|
||||
#undef SIZEOF_UNSIGNED_LONG
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* If we use arts volume */
|
||||
#undef USE_ARTS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Defined if compiling without arts */
|
||||
#undef WITHOUT_ARTS
|
||||
|
||||
/*
|
||||
* jpeg.h needs HAVE_BOOLEAN, when the system uses boolean in system
|
||||
* headers and I'm too lazy to write a configure test as long as only
|
||||
* unixware is related
|
||||
*/
|
||||
#ifdef _UNIXWARE
|
||||
#define HAVE_BOOLEAN
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* AIX defines FD_SET in terms of bzero, but fails to include <strings.h>
|
||||
* that defines bzero.
|
||||
*/
|
||||
|
||||
#if defined(_AIX)
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(HAVE_NSGETENVIRON) && defined(HAVE_CRT_EXTERNS_H)
|
||||
# include <sys/time.h>
|
||||
# include <crt_externs.h>
|
||||
# define environ (*_NSGetEnviron())
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_RES_INIT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int res_init(void);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCAT_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcat(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if !defined(HAVE_STRLCPY_PROTO)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned long strlcpy(char*, const char*, unsigned long);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* On HP-UX, the declaration of vsnprintf() is needed every time !
|
||||
*/
|
||||
|
||||
#if !defined(HAVE_VSNPRINTF) || defined(hpux)
|
||||
#if __STDC__
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int vsnprintf(char *str, size_t n, char const *fmt, va_list ap);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
int snprintf(char *str, size_t n, char const *fmt, ...);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if defined(__SVR4) && !defined(__svr4__)
|
||||
#define __svr4__ 1
|
||||
#endif
|
||||
|
||||
|
||||
/* type to use in place of socklen_t if not defined */
|
||||
#undef kde_socklen_t
|
||||
|
||||
/* type to use in place of socklen_t if not defined (deprecated, use
|
||||
kde_socklen_t) */
|
||||
#undef ksize_t
|
@ -0,0 +1,5 @@
|
||||
./admin/configure.in.min
|
||||
configure.in.in
|
||||
./src/configure.in.bot
|
||||
./src/configure.in.in
|
||||
configure.in.bot
|
@ -0,0 +1,270 @@
|
||||
dnl =======================================================
|
||||
dnl FILE: ./admin/configure.in.min
|
||||
dnl =======================================================
|
||||
|
||||
dnl This file is part of the KDE libraries/packages
|
||||
dnl Copyright (C) 2001 Stephan Kulow (coolo@kde.org)
|
||||
|
||||
dnl This file is free software; you can redistribute it and/or
|
||||
dnl modify it under the terms of the GNU Library General Public
|
||||
dnl License as published by the Free Software Foundation; either
|
||||
dnl version 2 of the License, or (at your option) any later version.
|
||||
|
||||
dnl This library is distributed in the hope that it will be useful,
|
||||
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
dnl Library General Public License for more details.
|
||||
|
||||
dnl You should have received a copy of the GNU Library General Public License
|
||||
dnl along with this library; see the file COPYING.LIB. If not, write to
|
||||
dnl the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
dnl Boston, MA 02110-1301, USA.
|
||||
|
||||
# Original Author was Kalle@kde.org
|
||||
# I lifted it in some mater. (Stephan Kulow)
|
||||
# I used much code from Janos Farkas
|
||||
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_INIT(acinclude.m4) dnl a source file from your sub dir
|
||||
|
||||
dnl This is so we can use kde-common
|
||||
AC_CONFIG_AUX_DIR(admin)
|
||||
|
||||
dnl This ksh/zsh feature conflicts with `cd blah ; pwd`
|
||||
unset CDPATH
|
||||
|
||||
dnl Checking host/target/build systems, for make, install etc.
|
||||
AC_CANONICAL_SYSTEM
|
||||
dnl Perform program name transformation
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
dnl Automake doc recommends to do this only here. (Janos)
|
||||
AM_INIT_AUTOMAKE(knemo-0.4.8, "3.5.7") dnl searches for some needed programs
|
||||
|
||||
KDE_SET_PREFIX
|
||||
|
||||
dnl generate the config header
|
||||
AM_CONFIG_HEADER(config.h) dnl at the distribution this done
|
||||
|
||||
dnl Checks for programs.
|
||||
AC_CHECK_COMPILERS
|
||||
AC_ENABLE_SHARED(yes)
|
||||
AC_ENABLE_STATIC(no)
|
||||
KDE_PROG_LIBTOOL
|
||||
|
||||
dnl for NLS support. Call them in this order!
|
||||
dnl WITH_NLS is for the po files
|
||||
AM_KDE_WITH_NLS
|
||||
|
||||
KDE_USE_QT(3.2)
|
||||
AC_PATH_KDE
|
||||
dnl =======================================================
|
||||
dnl FILE: configure.in.in
|
||||
dnl =======================================================
|
||||
|
||||
#MIN_CONFIG(3.2)
|
||||
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
|
||||
|
||||
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])
|
||||
|
||||
dnl =======================================================
|
||||
dnl FILE: ./src/configure.in.in
|
||||
dnl =======================================================
|
||||
|
||||
|
||||
dnl PACKAGE set before
|
||||
|
||||
dnl These are common macros that you might or might not want to use
|
||||
|
||||
dnl Image readers/writers
|
||||
dnl If you want to use this test, you have to define it somewhere
|
||||
dnl KDE_CHECK_KIMGIO
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h stdlib.h paths.h)
|
||||
AC_CHECK_FUNCS(usleep)
|
||||
AC_CHECK_LIB(iw,iw_sockets_open)
|
||||
|
||||
dnl Check path to ifconfig, iwconfig and route.
|
||||
|
||||
AC_PATH_PROG([PATH_IFCONFIG],[ifconfig],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
AC_PATH_PROG([PATH_IWCONFIG],[iwconfig],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
AC_PATH_PROG([PATH_ROUTE],[route],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
if test -n "${PATH_IFCONFIG}"; then
|
||||
AC_SUBST([PATH_IFCONFIG])
|
||||
AC_DEFINE_UNQUOTED(PATH_IFCONFIG, "${PATH_IFCONFIG}", [Path of ifconfig program])
|
||||
fi
|
||||
if test -n "${PATH_IWCONFIG}"; then
|
||||
AC_SUBST([PATH_IWCONFIG])
|
||||
AC_DEFINE_UNQUOTED(PATH_IWCONFIG, "${PATH_IWCONFIG}", [Path of iwconfig program])
|
||||
fi
|
||||
if test -n "${PATH_ROUTE}"; then
|
||||
AC_SUBST([PATH_ROUTE])
|
||||
AC_DEFINE_UNQUOTED(PATH_ROUTE, "${PATH_ROUTE}", [Path of route program])
|
||||
fi
|
||||
KDE_CREATE_SUBDIRSLIST
|
||||
AM_CONDITIONAL(src_SUBDIR_included, test "x$src_SUBDIR_included" = xyes)
|
||||
AM_CONDITIONAL(translations_SUBDIR_included, test "x$translations_SUBDIR_included" = xyes)
|
||||
AC_CONFIG_FILES([ Makefile ])
|
||||
AC_CONFIG_FILES([ src/Makefile ])
|
||||
AC_CONFIG_FILES([ src/kcm/Makefile ])
|
||||
AC_CONFIG_FILES([ src/knemod/Makefile ])
|
||||
AC_CONFIG_FILES([ src/knemod/backends/Makefile ])
|
||||
AC_CONFIG_FILES([ src/knemod/pics/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ar/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ar/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/bg/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/bg/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/br/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/br/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/cs/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/cs/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/cy/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/cy/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/da/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/da/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/de/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/de/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/el/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/el/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/en_GB/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/en_GB/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/es/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/es/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/et/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/et/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/fr/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/fr/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ga/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ga/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/gl/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/gl/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/hu/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/hu/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/it/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/it/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ja/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ja/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ka/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ka/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/lt/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/lt/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/nl/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/nl/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pl/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pl/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pt/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pt/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pt_BR/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/pt_BR/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ru/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/ru/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/rw/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/rw/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sk/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sk/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sr/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sr/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sr@Latn/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sr@Latn/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sv/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/sv/messages/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/tr/Makefile ])
|
||||
AC_CONFIG_FILES([ translations/tr/messages/Makefile ])
|
||||
AC_OUTPUT
|
||||
dnl put here things which have to be done as very last part of configure
|
||||
|
||||
if test -z "$PATH_IFCONFIG"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'ifconfig'."
|
||||
echo "KNemo won't be able to run without it so please install 'ifconfig'"
|
||||
echo "which is normally part of a package called 'net-tools' or similar"
|
||||
echo "and run configure again."
|
||||
echo ""
|
||||
all_tests=bad
|
||||
fi
|
||||
|
||||
if test -z "$PATH_IWCONFIG"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'iwconfig'."
|
||||
echo "KNemo works without 'iwconfig' being installed but you won't be able"
|
||||
echo "to monitor the wireless extensions of wireless interfaces."
|
||||
echo "If you would like to have these additional features install"
|
||||
echo "'iwconfig' which can be found in a package called 'wireless-tools'"
|
||||
echo "or similar and run configure again."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test -z "$PATH_ROUTE"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'route'."
|
||||
echo "KNemo works without 'route' being installed but KNemo won't be able"
|
||||
echo "to display the default gateway of an interface."
|
||||
echo "If you would like to have this additional feature install"
|
||||
echo "'route' which can be found in a package called 'net-tools'"
|
||||
echo "or similar and run configure again."
|
||||
echo ""
|
||||
fi
|
||||
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.
|
||||
|
||||
# Check if KDE_SET_PREFIX was called, and --prefix was passed to configure
|
||||
if test -n "$kde_libs_prefix" -a -n "$given_prefix"; then
|
||||
# And if so, warn when they don't match
|
||||
if test "$kde_libs_prefix" != "$given_prefix"; then
|
||||
# And if kde doesn't know about the prefix yet
|
||||
echo ":"`kde-config --path exe`":" | grep ":$given_prefix/bin/:" 2>&1 >/dev/null
|
||||
if test $? -ne 0; then
|
||||
echo ""
|
||||
echo "Warning: you chose to install this package in $given_prefix,"
|
||||
echo "but KDE was found in $kde_libs_prefix."
|
||||
echo "For this to work, you will need to tell KDE about the new prefix, by ensuring"
|
||||
echo "that KDEDIRS contains it, e.g. export KDEDIRS=$given_prefix:$kde_libs_prefix"
|
||||
echo "Then restart KDE."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$GXX = "xyes" -a x$kde_have_gcc_visibility = "xyes" -a x$kde_cv_val_qt_gcc_visibility_patched = "xno"; then
|
||||
echo ""
|
||||
echo "Your GCC supports symbol visibility, but the patch for Qt supporting visibility"
|
||||
echo "was not included. Therefore, GCC symbol visibility support remains disabled."
|
||||
echo ""
|
||||
echo "For better performance, consider including the Qt visibility supporting patch"
|
||||
echo "located at:"
|
||||
echo ""
|
||||
echo "http://bugs.kde.org/show_bug.cgi?id=109386"
|
||||
echo ""
|
||||
echo "and recompile all of Qt and KDE. Note, this is entirely optional and"
|
||||
echo "everything will continue to work just fine without it."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test "$all_tests" = "bad"; then
|
||||
if test ! "$cache_file" = "/dev/null"; then
|
||||
echo ""
|
||||
echo "Please remove the file $cache_file after changing your setup"
|
||||
echo "so that configure will find the changes next time."
|
||||
echo ""
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "Good - your configure finished. Start make now"
|
||||
echo ""
|
||||
fi
|
@ -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,11 @@
|
||||
#MIN_CONFIG(3.2)
|
||||
CXXFLAGS="$CXXFLAGS $KDE_DEFAULT_CXXFLAGS"
|
||||
|
||||
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,397 @@
|
||||
GNU Free Documentation License
|
||||
Version 1.2, November 2002
|
||||
|
||||
|
||||
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (Thus, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
@ -0,0 +1,40 @@
|
||||
These are installation instructions for Mandrake 10.0.
|
||||
|
||||
They have been tested with Mandrake 10.0 Download Edition but should
|
||||
also work for the Official Edition.
|
||||
|
||||
The simplest way to compile KNemo for Mandrake is:
|
||||
|
||||
1. `cd' to the directory containing KNemos source code and type
|
||||
`./configure --prefix=/usr' to configure the package for Mandrake.
|
||||
|
||||
2. Open the file `knemod\interfaceicon.cpp' and go to line 257.
|
||||
Change the line from
|
||||
|
||||
process << "kcmshell" << "kcm_knemo";
|
||||
|
||||
to
|
||||
|
||||
process << "kcmshell" << "/usr/share/applnk/Settings/Network/kcm_knemo";
|
||||
|
||||
Do the same in line 64 of `knemod\knemodaemon.cpp'
|
||||
|
||||
3. Save your changes.
|
||||
|
||||
4. Type `make' to compile the package.
|
||||
|
||||
5. Type `make install' to install the programs and any data files and
|
||||
documentation.
|
||||
|
||||
Now you should be able start KNemo as a KDE Service and open its
|
||||
configuration dialog from the context menu of the tray icon.
|
||||
|
||||
IMPORTANT: If you already installed and started KNemo before doing the
|
||||
above changes it may be neccessary to open the configuration dialog
|
||||
manually by running
|
||||
|
||||
kcmshell /usr/share/applnk/Settings/Network/kcm_knemo
|
||||
|
||||
on the console after you have installed KNemo with the above solution,
|
||||
because KNemo won't display any icons in the system traybar until it
|
||||
is configured to do so.
|
@ -0,0 +1,17 @@
|
||||
SUBDIRS = kcm knemod
|
||||
|
||||
#EXTRA_DIST = AUTHORS COPYING ChangeLog INSTALL README TODO knemo.lsm
|
||||
|
||||
#MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
|
||||
|
||||
|
||||
#messages: rc.cpp
|
||||
# $(EXTRACTRC) `find . -name "*.ui"` >> rc.cpp
|
||||
# $(EXTRACTRC) `find . -name "*.rc"` >> rc.cpp
|
||||
# LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \
|
||||
# if test -n "$$LIST"; then \
|
||||
# $(XGETTEXT) $$LIST -o $(podir)/knemo.pot; \
|
||||
# fi
|
||||
|
||||
#include ../admin/Doxyfile.am
|
||||
|
@ -0,0 +1 @@
|
||||
KNemo v0.4.8
|
@ -0,0 +1,94 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef DATA_H
|
||||
#define DATA_H
|
||||
|
||||
#include <qstring.h>
|
||||
#include <qvaluevector.h>
|
||||
|
||||
/**
|
||||
* This file contains data structures used to store information about
|
||||
* an interface. It is shared between the daemon and the control center
|
||||
* module.
|
||||
*
|
||||
* @short Shared data structures
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
struct InterfaceCommand
|
||||
{
|
||||
int id;
|
||||
bool runAsRoot;
|
||||
QString command;
|
||||
QString menuText;
|
||||
};
|
||||
|
||||
struct InterfaceSettings
|
||||
{
|
||||
InterfaceSettings()
|
||||
: iconSet( 0 ),
|
||||
numCommands( 0 ),
|
||||
trafficThreshold( 0 ),
|
||||
hideWhenNotExisting( false ),
|
||||
hideWhenNotAvailable( false ),
|
||||
activateStatistics( false ),
|
||||
customCommands( false )
|
||||
{}
|
||||
|
||||
int iconSet;
|
||||
int numCommands;
|
||||
int trafficThreshold;
|
||||
bool hideWhenNotExisting;
|
||||
bool hideWhenNotAvailable;
|
||||
bool activateStatistics;
|
||||
bool customCommands;
|
||||
QString alias;
|
||||
QValueVector<InterfaceCommand> commands;
|
||||
};
|
||||
|
||||
enum ToolTipEnums
|
||||
{
|
||||
INTERFACE = 0x00000001,
|
||||
ALIAS = 0x00000002,
|
||||
STATUS = 0x00000004,
|
||||
UPTIME = 0x00000008,
|
||||
IP_ADDRESS = 0x00000010,
|
||||
SUBNET_MASK = 0x00000020,
|
||||
HW_ADDRESS = 0x00000040,
|
||||
PTP_ADDRESS = 0x00000080,
|
||||
RX_PACKETS = 0x00000100,
|
||||
TX_PACKETS = 0x00000200,
|
||||
RX_BYTES = 0x00000400,
|
||||
TX_BYTES = 0x00000800,
|
||||
ESSID = 0x00001000,
|
||||
MODE = 0x00002000,
|
||||
FREQUENCY = 0x00004000,
|
||||
BIT_RATE = 0x00008000,
|
||||
ACCESS_POINT = 0x00010000,
|
||||
LINK_QUALITY = 0x00020000,
|
||||
BCAST_ADDRESS = 0x00040000,
|
||||
GATEWAY = 0x00080000,
|
||||
DOWNLOAD_SPEED = 0x00100000,
|
||||
UPLOAD_SPEED = 0x00200000,
|
||||
NICK_NAME = 0x00400000,
|
||||
ENCRYPTION = 0x00800000
|
||||
};
|
||||
|
||||
#endif // DATA_H
|
@ -0,0 +1,33 @@
|
||||
dnl put here things which have to be done as very last part of configure
|
||||
|
||||
if test -z "$PATH_IFCONFIG"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'ifconfig'."
|
||||
echo "KNemo won't be able to run without it so please install 'ifconfig'"
|
||||
echo "which is normally part of a package called 'net-tools' or similar"
|
||||
echo "and run configure again."
|
||||
echo ""
|
||||
all_tests=bad
|
||||
fi
|
||||
|
||||
if test -z "$PATH_IWCONFIG"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'iwconfig'."
|
||||
echo "KNemo works without 'iwconfig' being installed but you won't be able"
|
||||
echo "to monitor the wireless extensions of wireless interfaces."
|
||||
echo "If you would like to have these additional features install"
|
||||
echo "'iwconfig' which can be found in a package called 'wireless-tools'"
|
||||
echo "or similar and run configure again."
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if test -z "$PATH_ROUTE"; then
|
||||
echo ""
|
||||
echo "You're missing the program 'route'."
|
||||
echo "KNemo works without 'route' being installed but KNemo won't be able"
|
||||
echo "to display the default gateway of an interface."
|
||||
echo "If you would like to have this additional feature install"
|
||||
echo "'route' which can be found in a package called 'net-tools'"
|
||||
echo "or similar and run configure again."
|
||||
echo ""
|
||||
fi
|
@ -0,0 +1,37 @@
|
||||
|
||||
AM_INIT_AUTOMAKE(knemo, 0.4.8)
|
||||
|
||||
dnl These are common macros that you might or might not want to use
|
||||
|
||||
dnl Image readers/writers
|
||||
dnl If you want to use this test, you have to define it somewhere
|
||||
dnl KDE_CHECK_KIMGIO
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_STDC
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_HEADERS(fcntl.h sys/time.h unistd.h stdlib.h paths.h)
|
||||
AC_CHECK_FUNCS(usleep)
|
||||
AC_CHECK_LIB(iw,iw_sockets_open)
|
||||
|
||||
dnl Check path to ifconfig, iwconfig and route.
|
||||
|
||||
AC_PATH_PROG([PATH_IFCONFIG],[ifconfig],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
AC_PATH_PROG([PATH_IWCONFIG],[iwconfig],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
AC_PATH_PROG([PATH_ROUTE],[route],,
|
||||
[$PATH:/sbin:/usr/sbin:/usr/local/sbin])
|
||||
if test -n "${PATH_IFCONFIG}"; then
|
||||
AC_SUBST([PATH_IFCONFIG])
|
||||
AC_DEFINE_UNQUOTED(PATH_IFCONFIG, "${PATH_IFCONFIG}", [Path of ifconfig program])
|
||||
fi
|
||||
if test -n "${PATH_IWCONFIG}"; then
|
||||
AC_SUBST([PATH_IWCONFIG])
|
||||
AC_DEFINE_UNQUOTED(PATH_IWCONFIG, "${PATH_IWCONFIG}", [Path of iwconfig program])
|
||||
fi
|
||||
if test -n "${PATH_ROUTE}"; then
|
||||
AC_SUBST([PATH_ROUTE])
|
||||
AC_DEFINE_UNQUOTED(PATH_ROUTE, "${PATH_ROUTE}", [Path of route program])
|
||||
fi
|
@ -0,0 +1,28 @@
|
||||
## Makefile.am for kcm_knemo
|
||||
|
||||
messages: rc.cpp
|
||||
$(XGETTEXT) *.cpp -o $(podir)/kcm_knemo.pot
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
kde_module_LTLIBRARIES = kcm_knemo.la
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir)/../common -I$(srcdir)/../knemod/backends $(all_includes)
|
||||
|
||||
# the library search path.
|
||||
kcm_knemo_la_LDFLAGS = -module -avoid-version $(all_libraries)
|
||||
|
||||
# the libraries to link against.
|
||||
kcm_knemo_la_LIBADD = $(LIB_KDEUI)
|
||||
|
||||
# which sources should be compiled for knemo
|
||||
kcm_knemo_la_SOURCES = configdialog.cpp configdlg.ui
|
||||
|
||||
# these are the headers for your project
|
||||
noinst_HEADERS = configdialog.h
|
||||
|
||||
# let automoc handle all of the meta source files (moc)
|
||||
METASOURCES = AUTO
|
||||
|
||||
xdg_apps_DATA = kcm_knemo.desktop
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,150 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2005, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef CONFIGDIALOG_H
|
||||
#define CONFIGDIALOG_H
|
||||
|
||||
#include <qdict.h>
|
||||
#include <qpair.h>
|
||||
#include <qstring.h>
|
||||
#include <qlistview.h>
|
||||
|
||||
#include <kcmodule.h>
|
||||
|
||||
#include "data.h"
|
||||
|
||||
class QTimer;
|
||||
class ConfigDlg;
|
||||
class KNemoCheckListItem;
|
||||
|
||||
/**
|
||||
* This is the configuration dialog for KNemo
|
||||
* It is implemented as a control center module so that it is still
|
||||
* possible to configure KNemo even when there is no icon visible
|
||||
* in the system tray.
|
||||
*
|
||||
* @short Configuration dialog for KNemo
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class ConfigDialog : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
ConfigDialog( QWidget *parent, const char *name, const QStringList& );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~ConfigDialog();
|
||||
|
||||
void load();
|
||||
void save();
|
||||
void defaults();
|
||||
|
||||
private slots:
|
||||
void buttonNewSelected();
|
||||
void buttonDeleteSelected();
|
||||
void buttonAddCommandSelected();
|
||||
void buttonRemoveCommandSelected();
|
||||
void buttonCommandUpSelected();
|
||||
void buttonCommandDownSelected();
|
||||
void buttonAddToolTipSelected();
|
||||
void buttonRemoveToolTipSelected();
|
||||
void buttonNotificationsSelected();
|
||||
void buttonStatisticsDirSelected();
|
||||
void interfaceSelected( const QString& interface );
|
||||
void aliasChanged( const QString& text );
|
||||
void iconSetChanged( int set );
|
||||
void backendChanged( int set );
|
||||
void checkBoxNotConnectedToggled( bool on );
|
||||
void checkBoxNotExistingToggled( bool on );
|
||||
void checkBoxStatisticsToggled( bool on );
|
||||
void checkBoxStartKNemoToggled( bool on );
|
||||
void spinBoxTrafficValueChanged( int value );
|
||||
void checkBoxCustomToggled( bool on );
|
||||
void listViewCommandsSelectionChanged();
|
||||
void listViewCommandsCheckListItemChanged( KNemoCheckListItem* item, bool state );
|
||||
void listViewCommandsRenamed( QListViewItem* item, int col, const QString & text );
|
||||
|
||||
/**
|
||||
* These three are generic.
|
||||
* They are used for all plotter settings to activate the
|
||||
* 'Apply' button when something was changed by the user.
|
||||
*/
|
||||
void checkBoxToggled( bool );
|
||||
void spinBoxValueChanged( int );
|
||||
void kColorButtonChanged( const QColor& );
|
||||
|
||||
private:
|
||||
void setupToolTipTab();
|
||||
void setupToolTipArray();
|
||||
void updateStatisticsEntries( void );
|
||||
|
||||
enum IconSet
|
||||
{
|
||||
MONITOR = 0,
|
||||
MODEM,
|
||||
NETWORK,
|
||||
WIRELESS
|
||||
};
|
||||
|
||||
int mToolTipContent;
|
||||
bool mLock;
|
||||
ConfigDlg* mDlg;
|
||||
QColor mColorVLines;
|
||||
QColor mColorHLines;
|
||||
QColor mColorIncoming;
|
||||
QColor mColorOutgoing;
|
||||
QColor mColorBackground;
|
||||
QDict<InterfaceSettings> mSettingsDict;
|
||||
QPair<QString, int> mToolTips[25];
|
||||
|
||||
static const QString ICON_DISCONNECTED;
|
||||
static const QString ICON_CONNECTED;
|
||||
static const QString ICON_INCOMING;
|
||||
static const QString ICON_OUTGOING;
|
||||
static const QString ICON_TRAFFIC;
|
||||
static const QString SUFFIX_PPP;
|
||||
static const QString SUFFIX_LAN;
|
||||
static const QString SUFFIX_WLAN;
|
||||
};
|
||||
|
||||
class KNemoCheckListItem : public QObject, public QCheckListItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
KNemoCheckListItem( QListView* view )
|
||||
: QCheckListItem( view, QString::null, QCheckListItem::CheckBox )
|
||||
{}
|
||||
|
||||
signals:
|
||||
void stateChanged( KNemoCheckListItem*, bool );
|
||||
|
||||
protected:
|
||||
void stateChange( bool state )
|
||||
{
|
||||
emit stateChanged( this, state );
|
||||
}
|
||||
};
|
||||
|
||||
#endif // CONFIGDIALOG_H
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
Exec=kcmshell kcm_knemo
|
||||
Icon=knemo
|
||||
|
||||
X-KDE-ModuleType=Library
|
||||
X-KDE-Library=knemo
|
||||
X-KDE-FactoryName=knemo
|
||||
X-KDE-ParentApp=kcontrol
|
||||
|
||||
Name=Network Monitor
|
||||
Name[bg]=Монитор на мрежата
|
||||
Name[br]=Eveshaer ar rouedad
|
||||
Name[cs]=Monitor sítě
|
||||
Name[da]=Netværkovervågning
|
||||
Name[de]=Netzwerkmonitor
|
||||
Name[el]=Επίβλεψη δικτύου
|
||||
Name[es]=Monitor de red
|
||||
Name[et]=Võrgumonitor
|
||||
Name[ga]=Monatóir Líonra
|
||||
Name[gl]=Monitor da Rede
|
||||
Name[it]=Monitor di rete
|
||||
Name[ja]=ネットワークモニタ
|
||||
Name[ka]=ქსელის მონიტორი
|
||||
Name[lt]=Tinklo stebėjimas
|
||||
Name[nl]=Netwerkmonitor
|
||||
Name[pa]=ਨੈਟਵਰਕ ਨਿਗਰਾਨ
|
||||
Name[pl]=Monitor sieci
|
||||
Name[pt]=Monitor da Rede
|
||||
Name[pt_BR]=Monitor de Rede
|
||||
Name[ru]=Монитор сети
|
||||
Name[sr]=Надгледање мреже
|
||||
Name[sr@Latn]=Nadgledanje mreže
|
||||
Name[sv]=Nätverksövervakare
|
||||
Name[tr]=Ağ İzleyici
|
||||
Name[uk]=Монітор мережі
|
||||
Name[xx]=xxNetwork Monitorxx
|
||||
Name[zh_CN]=网络监视器
|
||||
Comment=Monitor network interfaces
|
||||
Comment[bg]=Показване на информация за мрежовите интерфейси
|
||||
Comment[br]=Eveshaer etrefasoù ar rouedad
|
||||
Comment[cs]=Rozhraní monitoru sítě
|
||||
Comment[da]=Overvåger netværkgrænseflader
|
||||
Comment[de]=Überwachung von Netzwerkschnittstellen
|
||||
Comment[el]=Επίβλεψη διασυνδέσεων δικτύου
|
||||
Comment[es]=Monitor de interfaces de red
|
||||
Comment[et]=Võrguliideste monitor
|
||||
Comment[ga]=Déan monatóireacht ar chomhéadain líonra
|
||||
Comment[gl]=Fai seguimento das interfaces de rede
|
||||
Comment[it]=Controlla le interfacce di rete
|
||||
Comment[ja]=ネットワークインターフェースを監視
|
||||
Comment[ka]=ქსელის ინტერფეისების მონიტორინგი
|
||||
Comment[lt]=Stebėti tinklo įrenginius
|
||||
Comment[nl]=Volg netwerkinterfaces
|
||||
Comment[pa]=ਨੈਟਵਰਕ ਇੰਟਰਫੇਸ ਲਈ ਨਿਗਰਾਨੀ
|
||||
Comment[pl]=Monitorowanie interfejsów sieciowych
|
||||
Comment[pt]=Vigia interfaces de rede
|
||||
Comment[pt_BR]=Monitor das interfaces de rede
|
||||
Comment[ru]=Наблюдение за сетевыми интерфейсами
|
||||
Comment[sr]=Интерфејс надгледања мреже
|
||||
Comment[sr@Latn]=Interfejs nadgledanja mreže
|
||||
Comment[sv]=Övervaka nätverksgränssnitt
|
||||
Comment[tr]=Ağ arayüzlerini izler
|
||||
Comment[uk]=Нагляд за мережними інтерфейсами
|
||||
Comment[xx]=xxMonitor network interfacesxx
|
||||
Comment[zh_CN]=监视网络接口
|
||||
|
||||
Keywords=knemo,network monitor,wlan monitor,wifi monitor,ethernet monitor,wireless monitor,systray
|
||||
Keywords[cs]=knemo,monitor sítě,monitor wlan,monitor wifi,monitor ethernetu,monitor bezdrátového připojení,systray
|
||||
Keywords[da]=knemo,netværksovervågning,WLAN-overvågning,WIFI-overvågning,Ethernet-overvågning,trådløs overvågning,statusfelt
|
||||
Keywords[de]=knemo,netzwerk-monitor,wlan-monitor,wifi-monitor,ethernet-monitor,wireless-monitor,kontrollleiste,überwachung,netzwerk,drahtlos-monitor
|
||||
Keywords[el]=knemo,επόπτης δικτύου,επόπτης wlan,επόπτης wifi,επόπτης ethernet, επόπτης wireless,πλαίσιο συστήματος
|
||||
Keywords[es]=knemo,monitor de red,monitor de wlan,monitor wifi,monitor de ethernet,monitor inalámbrico,bandeja del sistema
|
||||
Keywords[et]=knemo,võrgumonitor,wlan monitor,wifi monitor,ethernet monitor,traadita võrgu monitor,süsteemne salv
|
||||
Keywords[ga]=knemo,monatóir líonra,monatóir wlan,monatóir wifi,monatóir ethernet,monatóir líonra gan sreang,tráidire an chórais
|
||||
Keywords[gl]=knemo,monitor, rede, wlan, wifi, ethernet, wireless,systray
|
||||
Keywords[it]=knemo,monitor di rete,wlan monitor,monitor senza fili,ethernet monitor,vassoio di sistema
|
||||
Keywords[ja]=knemo,ネットワークモニタ,wlan モニタ,wifi モニタ,ethernet モニタ,ワイヤレスモニタ,システムトレイ
|
||||
Keywords[nl]=knemo,netwerkmonitor,wlan-monitor,wifi-monitor,ethernetmonitor,wireless-monitor,systeemvak
|
||||
Keywords[pt]=knemo,monitor da rede,monitor de wlan,monitor wifi,monitor de ethernet,monitor sem-fios,bandeja do sistema
|
||||
Keywords[pt_BR]=knemo,monitor de rede,wlan,monitor de wifi monitor,monitor ethernet monitor,monitor de wireless,painel do sistema, mini-aplicativo
|
||||
Keywords[ru]=knemo,мониторинг сети,мониторинг беспроводной сети,wifi монитор,монитор локальной сети,системный лоток,сеть,беспроводная сеть
|
||||
Keywords[sv]=knemo,nätverksövervakning,WLAN-övervakning,WIFI-övervakning,Ethernet-övervakning,trådlös övervakning,systembricka
|
||||
Keywords[uk]=knemo,network monitor,wlan monitor,wifi monitor,ethernet monitor,wireless monitor,systray,мережа,монітор,системний лоток,монітор wifi
|
||||
Keywords[xx]=xxknemo,network monitor,wlan monitor,wifi monitor,ethernet monitor,wireless monitor,systrayxx
|
||||
Keywords[zh_CN]=knemo,network monitor,wlan monitor,wifi monitor,ethernet monitor,wireless monitor,systray,网络监视器,无限局域网监视器,wifi 监视器以太网监视器,无线网络监视器,系统托盘
|
||||
|
||||
Categories=Qt;KDE;X-KDE-settings-network;X-KDE-systemsettings-network
|
@ -0,0 +1,16 @@
|
||||
Begin4
|
||||
Title: KNemo -- Some description
|
||||
Version: 0.1
|
||||
Entered-date: YYYY-MM-DD
|
||||
Description:
|
||||
Keywords: KDE3 Qt
|
||||
Author: Percy Leonhardt <percy@eris23.de>
|
||||
Maintained-by: Percy Leonhardt <percy@eris23.de>
|
||||
Home-page:
|
||||
Alternate-site:
|
||||
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
|
||||
xxxxxx knemo-0.1.tar.gz
|
||||
xxx knemo-0.1.lsm
|
||||
Platform: Linux. Needs KDE 2.x
|
||||
Copying-policy: GPL
|
||||
End
|
@ -0,0 +1,41 @@
|
||||
%define distversion %( perl -e 'Creating /home/percy/src/knemo-0.1/knemo.spec...=\<\>;/(\d+)\.(\d)\.?(\d)?/; print "".(||0)' /etc/*-release)
|
||||
Name: knemo
|
||||
Summary: KNemo -- Some description
|
||||
Version: 0.1
|
||||
Release: %{_vendor}_%{distversion}
|
||||
Copyright: GPL
|
||||
Group: X11/KDE/Utilities
|
||||
Source: ftp://ftp.kde.org/pub/kde/unstable/apps/utils/%{name}-%{version}.tar.gz
|
||||
Packager: Percy Leonhardt <percy@eris23.de>
|
||||
BuildRoot: /tmp/%{name}-%{version}
|
||||
Prefix: /usr/kde/3.2
|
||||
|
||||
%description
|
||||
A long description
|
||||
|
||||
%prep
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
%setup -n %{name}-%{version}
|
||||
CFLAGS="" CXXFLAGS="" ./configure --disable-debug --enable-final --prefix=%{prefix}
|
||||
|
||||
%build
|
||||
# Setup for parallel builds
|
||||
numprocs=1
|
||||
if [ "" = "0" ]; then
|
||||
numprocs=1
|
||||
fi
|
||||
|
||||
make -j
|
||||
|
||||
%install
|
||||
make install-strip DESTDIR=$RPM_BUILD_ROOT
|
||||
|
||||
cd
|
||||
find . -type d | sed '1,2d;s,^\.,\%attr(-\,root\,root) \%dir ,' > /%{name}-master.list
|
||||
find . -type f -o -type l | sed 's|^\.||' >> $RPM_BUILD_DIR/%{name}-master.list
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_DIR/%{name}-%{version}
|
||||
rm -rf $RPM_BUILD_DIR/-master.list
|
||||
|
||||
%files -f $RPM_BUILD_DIR/%{name}-master.list
|
@ -0,0 +1,47 @@
|
||||
## Makefile.am for knemo
|
||||
|
||||
messages: rc.cpp
|
||||
$(XGETTEXT) *.cpp -o $(podir)/knemod.pot
|
||||
|
||||
# this has all of the subdirectories that make will recurse into. if
|
||||
# there are none, comment this out
|
||||
SUBDIRS = pics backends
|
||||
|
||||
# this is the program that gets installed. it's name is used for all
|
||||
# of the other Makefile.am variables
|
||||
kde_module_LTLIBRARIES = kded_knemod.la
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir)/../common -I$(srcdir)/backends $(all_includes)
|
||||
|
||||
# the library search path.
|
||||
kded_knemod_la_LDFLAGS = -module -avoid-version $(all_libraries)
|
||||
|
||||
# the libraries to link against.
|
||||
kded_knemod_la_LIBADD = $(LIB_KIO) $(LIB_KUTILS) backends/libknemo_backends.la
|
||||
|
||||
# which sources should be compiled for knemo
|
||||
kded_knemod_la_SOURCES = knemodaemon.cpp knemodaemon.skel interface.cpp \
|
||||
interfaceicon.cpp interfacetray.cpp \
|
||||
interfacemonitor.cpp \
|
||||
interfacestatusdlg.ui interfacestatusdialog.cpp \
|
||||
interfacetooltip.cpp signalplotter.cpp \
|
||||
interfacestatistics.cpp interfacestatisticsdlg.ui \
|
||||
interfacestatisticsdialog.cpp
|
||||
|
||||
# these are the headers for your project
|
||||
noinst_HEADERS = knemodaemon.h interface.h interfaceicon.h \
|
||||
interfacemonitor.h \
|
||||
interfacestatusdialog.h interfacetray.h \
|
||||
interfacetooltip.h signalplotter.h \
|
||||
interfacestatistics.h global.h \
|
||||
interfacestatisticsdialog.h
|
||||
|
||||
# let automoc handle all of the meta source files (moc)
|
||||
METASOURCES = AUTO
|
||||
|
||||
services_DATA = knemod.desktop
|
||||
servicesdir = $(kde_servicesdir)/kded
|
||||
|
||||
mydata_DATA = eventsrc
|
||||
mydatadir = $(kde_datadir)/knemo
|
@ -0,0 +1,22 @@
|
||||
## Makefile.am for knemo backends
|
||||
|
||||
noinst_LTLIBRARIES = libknemo_backends.la
|
||||
|
||||
# set the include path for X, qt and KDE
|
||||
INCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../common $(all_includes)
|
||||
|
||||
# the library search path.
|
||||
libknemo_backends_la_LDFLAGS = -module -avoid-version $(all_libraries)
|
||||
|
||||
# the libraries to link against.
|
||||
libknemo_backends_la_LIBADD = $(LIB_KIO) $(LIB_KUTILS)
|
||||
|
||||
# which sources should be compiled as backends
|
||||
libknemo_backends_la_SOURCES = backendbase.cpp nettoolsbackend.cpp sysbackend.cpp
|
||||
|
||||
# the headers of the backends
|
||||
noinst_HEADERS = backendbase.h nettoolsbackend.h sysbackend.h
|
||||
|
||||
# let automoc handle all of the meta source files (moc)
|
||||
METASOURCES = AUTO
|
||||
|
@ -0,0 +1,38 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "backendbase.h"
|
||||
|
||||
BackendBase::BackendBase( QDict<Interface>& interfaces )
|
||||
: mInterfaces( interfaces )
|
||||
{
|
||||
}
|
||||
|
||||
BackendBase::~BackendBase()
|
||||
{
|
||||
}
|
||||
|
||||
void BackendBase::updateComplete()
|
||||
{
|
||||
QDictIterator<Interface> ifIt( mInterfaces );
|
||||
for ( ; ifIt.current(); ++ifIt )
|
||||
{
|
||||
ifIt.current()->activateMonitor();
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef BACKENDBASE_H
|
||||
#define BACKENDBASE_H
|
||||
|
||||
#include <qdict.h>
|
||||
#include <qstring.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "interface.h"
|
||||
|
||||
/**
|
||||
* This is the baseclass for all backends. Every backend that
|
||||
* should be used for KNemo must inherit from this class.
|
||||
*
|
||||
* @short Baseclass for all backends
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class BackendBase
|
||||
{
|
||||
public:
|
||||
BackendBase( QDict<Interface>& interfaces );
|
||||
virtual ~BackendBase();
|
||||
|
||||
/**
|
||||
* Create an instance of this backend because KNemo
|
||||
* does not know about the different types of backends.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function is called from KNemo whenever the
|
||||
* backend shall update the information of the
|
||||
* interfaces in the QDict.
|
||||
*/
|
||||
virtual void update() = 0;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Call this function when you have completed the
|
||||
* update. It will trigger the interfaces to check
|
||||
* if there state has changed.
|
||||
*/
|
||||
void updateComplete();
|
||||
|
||||
const QDict<Interface>& mInterfaces;
|
||||
};
|
||||
|
||||
#endif // BACKENDBASE_H
|
@ -0,0 +1,54 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef DAEMONREGISTRY_H
|
||||
#define DAEMONREGISTRY_H
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
#include "backendbase.h"
|
||||
#include "sysbackend.h"
|
||||
#include "nettoolsbackend.h"
|
||||
|
||||
/**
|
||||
* This registry tells KNemo what backends are available
|
||||
* and how they can be created. It is only used by the daemon
|
||||
* to create the selected backend. Two registries were
|
||||
* necessary to avoid linking the KCM module against all backends.
|
||||
*
|
||||
* @short Registry for all backends
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
struct DaemonRegistryEntry
|
||||
{
|
||||
QString name;
|
||||
BackendBase* (*function) ( QDict<Interface>& );
|
||||
};
|
||||
|
||||
DaemonRegistryEntry DaemonRegistry[] =
|
||||
{
|
||||
{ "Nettools", NetToolsBackend::createInstance },
|
||||
{ "Sys", SysBackend::createInstance },
|
||||
{ QString::null, 0 }
|
||||
};
|
||||
|
||||
#endif // DAEMONREGISTRY_H
|
@ -0,0 +1,61 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KCMREGISTRY_H
|
||||
#define KCMREGISTRY_H
|
||||
|
||||
#include <qstring.h>
|
||||
|
||||
#include <klocale.h>
|
||||
|
||||
/**
|
||||
* This registry tells the KCM module what backends are available
|
||||
* and how they can be created. It also offers a short description
|
||||
* for every backend that is used in the configuration dialog of KNemo.
|
||||
* It should describe how a backend gathers its information.
|
||||
*
|
||||
* @short Registry for all backends
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
struct KCMRegistryEntry
|
||||
{
|
||||
QString name;
|
||||
QString description;
|
||||
};
|
||||
|
||||
KCMRegistryEntry KCMRegistry[] =
|
||||
{
|
||||
{ "Nettools",
|
||||
i18n( "Uses the tools from the nettool packge like ifconfig, " \
|
||||
"iwconfig and route to read the necessary information " \
|
||||
"from the ouput of these commands.\n" \
|
||||
"This backend works rather stable but causes a relativly " \
|
||||
"high CPU load." ) },
|
||||
{ "Sys",
|
||||
i18n( "Uses the sys filesystem available in 2.6 kernels and " \
|
||||
"direct system calls to the Linux kernel.\n" \
|
||||
"This backend is rather new, so expect minor problems. " \
|
||||
"As an advantage this backend should reduce the CPU load " \
|
||||
"and should not access the harddisc while gathering " \
|
||||
"information." ) },
|
||||
{ QString::null, QString::null }
|
||||
};
|
||||
|
||||
#endif // KCMREGISTRY_H
|
@ -0,0 +1,498 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qregexp.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kprocess.h>
|
||||
#include <kio/global.h>
|
||||
|
||||
#include "nettoolsbackend.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
NetToolsBackend::NetToolsBackend( QDict<Interface>& interfaces )
|
||||
: QObject(),
|
||||
BackendBase( interfaces ),
|
||||
mRouteProcess(0L),
|
||||
mIfconfigProcess(0L),
|
||||
mIwconfigProcess(0L)
|
||||
{
|
||||
}
|
||||
|
||||
NetToolsBackend::~NetToolsBackend()
|
||||
{
|
||||
if ( mRouteProcess )
|
||||
{
|
||||
mRouteProcess->kill();
|
||||
delete mRouteProcess;
|
||||
}
|
||||
if ( mIfconfigProcess )
|
||||
{
|
||||
mIfconfigProcess->kill();
|
||||
delete mIfconfigProcess;
|
||||
}
|
||||
if ( mIwconfigProcess )
|
||||
{
|
||||
mIwconfigProcess->kill();
|
||||
delete mIwconfigProcess;
|
||||
}
|
||||
}
|
||||
|
||||
BackendBase* NetToolsBackend::createInstance( QDict<Interface>& interfaces )
|
||||
{
|
||||
return new NetToolsBackend( interfaces );
|
||||
}
|
||||
|
||||
void NetToolsBackend::update()
|
||||
{
|
||||
if ( !mIfconfigProcess )
|
||||
{
|
||||
mIfconfigStdout = QString::null;
|
||||
mIfconfigProcess = new KProcess();
|
||||
mIfconfigProcess->setEnvironment( "LANG", "C" );
|
||||
mIfconfigProcess->setEnvironment( "LC_ALL", "C" );
|
||||
*mIfconfigProcess << PATH_IFCONFIG << "-a";
|
||||
connect( mIfconfigProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ),
|
||||
this, SLOT( ifconfigProcessStdout( KProcess*, char*, int ) ) );
|
||||
connect( mIfconfigProcess, SIGNAL( processExited( KProcess* ) ),
|
||||
this, SLOT( ifconfigProcessExited( KProcess* ) ) );
|
||||
|
||||
if ( !mIfconfigProcess->start( KProcess::NotifyOnExit, KProcess::Stdout ) )
|
||||
{
|
||||
delete mIfconfigProcess;
|
||||
mIfconfigProcess = 0L;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef PATH_IWCONFIG
|
||||
if ( !mIwconfigProcess )
|
||||
{
|
||||
mIwconfigStdout = QString::null;
|
||||
mIwconfigProcess = new KProcess();
|
||||
mIwconfigProcess->setEnvironment( "LANG", "C" );
|
||||
mIwconfigProcess->setEnvironment( "LC_ALL", "C" );
|
||||
*mIwconfigProcess << PATH_IWCONFIG;
|
||||
connect( mIwconfigProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ),
|
||||
this, SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) );
|
||||
connect( mIwconfigProcess, SIGNAL( receivedStderr( KProcess*, char*, int ) ),
|
||||
this, SLOT( iwconfigProcessStdout( KProcess*, char*, int ) ) );
|
||||
connect( mIwconfigProcess, SIGNAL( processExited( KProcess* ) ),
|
||||
this, SLOT( iwconfigProcessExited( KProcess* ) ) );
|
||||
|
||||
if ( !mIwconfigProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
|
||||
{
|
||||
delete mIwconfigProcess;
|
||||
mIwconfigProcess = 0L;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PATH_ROUTE
|
||||
if ( !mRouteProcess )
|
||||
{
|
||||
mRouteStdout = QString::null;
|
||||
mRouteProcess = new KProcess();
|
||||
mRouteProcess->setEnvironment( "LANG", "C" );
|
||||
mRouteProcess->setEnvironment( "LC_ALL", "C" );
|
||||
*mRouteProcess << PATH_ROUTE << "-n";
|
||||
connect( mRouteProcess, SIGNAL( receivedStdout( KProcess*, char*, int ) ),
|
||||
this, SLOT( routeProcessStdout( KProcess*, char*, int ) ) );
|
||||
connect( mRouteProcess, SIGNAL( receivedStderr( KProcess*, char*, int ) ),
|
||||
this, SLOT( routeProcessStdout( KProcess*, char*, int ) ) );
|
||||
connect( mRouteProcess, SIGNAL( processExited( KProcess* ) ),
|
||||
this, SLOT( routeProcessExited( KProcess* ) ) );
|
||||
|
||||
if ( !mRouteProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput ) )
|
||||
{
|
||||
delete mRouteProcess;
|
||||
mRouteProcess = 0L;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void NetToolsBackend::routeProcessExited( KProcess* process )
|
||||
{
|
||||
if ( process == mRouteProcess )
|
||||
{
|
||||
mRouteProcess->deleteLater(); // we're in a slot connected to mRouteProcess
|
||||
mRouteProcess = 0L;
|
||||
parseRouteOutput();
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::routeProcessStdout( KProcess*, char* buffer, int buflen )
|
||||
{
|
||||
mRouteStdout += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
void NetToolsBackend::ifconfigProcessExited( KProcess* process )
|
||||
{
|
||||
if ( process == mIfconfigProcess )
|
||||
{
|
||||
delete mIfconfigProcess;
|
||||
mIfconfigProcess = 0L;
|
||||
parseIfconfigOutput();
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::ifconfigProcessStdout( KProcess*, char* buffer, int buflen )
|
||||
{
|
||||
mIfconfigStdout += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
void NetToolsBackend::iwconfigProcessExited( KProcess* process )
|
||||
{
|
||||
if ( process == mIwconfigProcess )
|
||||
{
|
||||
delete mIwconfigProcess;
|
||||
mIwconfigProcess = 0L;
|
||||
parseIwconfigOutput();
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::iwconfigProcessStdout( KProcess*, char* buffer, int buflen )
|
||||
{
|
||||
mIwconfigStdout += QString::fromLatin1( buffer, buflen );
|
||||
}
|
||||
|
||||
void NetToolsBackend::parseIfconfigOutput()
|
||||
{
|
||||
/* mIfconfigStdout contains the complete output of 'ifconfig' which we
|
||||
* are going to parse here.
|
||||
*/
|
||||
QMap<QString, QString> configs;
|
||||
QStringList ifList = QStringList::split( "\n\n", mIfconfigStdout );
|
||||
QStringList::Iterator it;
|
||||
for ( it = ifList.begin(); it != ifList.end(); ++it )
|
||||
{
|
||||
int index = ( *it ).find( ' ' );
|
||||
if ( index == -1 )
|
||||
continue;
|
||||
QString key = ( *it ).left( index );
|
||||
configs[key] = ( *it ).mid( index );
|
||||
}
|
||||
|
||||
/* We loop over the interfaces the user wishs to monitor.
|
||||
* If we find the interface in the output of 'ifconfig'
|
||||
* we update its data, otherwise we mark it as
|
||||
* 'not existing'.
|
||||
*/
|
||||
QDictIterator<Interface> ifIt( mInterfaces );
|
||||
for ( ; ifIt.current(); ++ifIt )
|
||||
{
|
||||
QString key = ifIt.currentKey();
|
||||
Interface* interface = ifIt.current();
|
||||
|
||||
if ( configs.find( key ) == configs.end() )
|
||||
{
|
||||
// The interface does not exist. Meaning the driver
|
||||
// isn't loaded and/or the interface has not been created.
|
||||
interface->getData().existing = false;
|
||||
interface->getData().available = false;
|
||||
}
|
||||
// JJ 2005-07-18: use RUNNING instead of UP to detect whether interface is connected
|
||||
else if ( !configs[key].contains( "inet " ) ||
|
||||
!configs[key].contains( "RUNNING" ) )
|
||||
{
|
||||
// The interface is up or has an IP assigned but not both
|
||||
interface->getData().existing = true;
|
||||
interface->getData().available = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ...determine the type of the interface
|
||||
if ( configs[key].contains( "Ethernet" ) )
|
||||
interface->setType( Interface::ETHERNET );
|
||||
else
|
||||
interface->setType( Interface::PPP );
|
||||
|
||||
// Update the interface.
|
||||
interface->getData().existing = true;
|
||||
interface->getData().available = true;
|
||||
updateInterfaceData( configs[key], interface->getData(), interface->getType() );
|
||||
}
|
||||
}
|
||||
updateComplete();
|
||||
}
|
||||
|
||||
void NetToolsBackend::updateInterfaceData( QString& config, InterfaceData& data, int type )
|
||||
{
|
||||
QRegExp regExp( ".*RX.*:(\\d+).*:\\d+.*:\\d+.*:\\d+" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.rxPackets = regExp.cap( 1 ).toULong();
|
||||
|
||||
regExp.setPattern( ".*TX.*:(\\d+).*:\\d+.*:\\d+.*:\\d+" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.txPackets = regExp.cap( 1 ).toULong();
|
||||
|
||||
regExp.setPattern( "RX bytes:(\\d+)\\s*\\(\\d+\\.\\d+\\s*\\w+\\)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
// We count the traffic on ourself to avoid an overflow after
|
||||
// 4GB of traffic.
|
||||
unsigned long currentRxBytes = regExp.cap( 1 ).toULong();
|
||||
if ( currentRxBytes < data.prevRxBytes )
|
||||
{
|
||||
// there was an overflow
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
// This makes data counting more accurate but will not work
|
||||
// for interfaces that reset the transfered data to zero
|
||||
// when deactivated like ppp does.
|
||||
data.rxBytes += 0xFFFFFFFF - data.prevRxBytes;
|
||||
}
|
||||
data.prevRxBytes = 0L;
|
||||
}
|
||||
if ( data.rxBytes == 0L )
|
||||
{
|
||||
// on startup set to currently received bytes
|
||||
data.rxBytes = currentRxBytes;
|
||||
// this is new: KNemo only counts the traffic transfered
|
||||
// while it is running. Important to not falsify statistics!
|
||||
data.prevRxBytes = currentRxBytes;
|
||||
}
|
||||
else
|
||||
// afterwards only add difference to previous number of bytes
|
||||
data.rxBytes += currentRxBytes - data.prevRxBytes;
|
||||
|
||||
data.incomingBytes = currentRxBytes - data.prevRxBytes;
|
||||
data.prevRxBytes = currentRxBytes;
|
||||
data.rxString = KIO::convertSize( data.rxBytes );
|
||||
}
|
||||
|
||||
regExp.setPattern( "TX bytes:(\\d+)\\s*\\(\\d+\\.\\d+\\s*\\w+\\)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
// We count the traffic on ourself to avoid an overflow after
|
||||
// 4GB of traffic.
|
||||
unsigned long currentTxBytes = regExp.cap( 1 ).toULong();
|
||||
if ( currentTxBytes < data.prevTxBytes )
|
||||
{
|
||||
// there was an overflow
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
// This makes data counting more accurate but will not work
|
||||
// for interfaces that reset the transfered data to zero
|
||||
// when deactivated like ppp does.
|
||||
data.txBytes += 0xFFFFFFFF - data.prevTxBytes;
|
||||
}
|
||||
data.prevTxBytes = 0L;
|
||||
}
|
||||
if ( data.txBytes == 0L )
|
||||
{
|
||||
// on startup set to currently transmitted bytes
|
||||
data.txBytes = currentTxBytes;
|
||||
// this is new: KNemo only counts the traffic transfered
|
||||
// while it is running. Important to not falsify statistics!
|
||||
data.prevTxBytes = currentTxBytes;
|
||||
}
|
||||
else
|
||||
// afterwards only add difference to previous number of bytes
|
||||
data.txBytes += currentTxBytes - data.prevTxBytes;
|
||||
|
||||
data.outgoingBytes = currentTxBytes - data.prevTxBytes;
|
||||
data.prevTxBytes = currentTxBytes;
|
||||
data.txString = KIO::convertSize( data.txBytes );
|
||||
}
|
||||
|
||||
regExp.setPattern( "inet\\s+\\w+:(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.ipAddress = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}).*(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}).*(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
data.broadcastAddress = regExp.cap( 2 );
|
||||
data.subnetMask = regExp.cap( 3 );
|
||||
}
|
||||
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
regExp.setPattern( "(.{2}:.{2}:.{2}:.{2}:.{2}:.{2})" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.hwAddress = regExp.cap( 1 );
|
||||
}
|
||||
else if ( type == Interface::PPP )
|
||||
{
|
||||
regExp.setPattern( "(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}).*(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}).*(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3})" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.ptpAddress = regExp.cap( 2 );
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::parseIwconfigOutput()
|
||||
{
|
||||
/* mIwconfigStdout contains the complete output of 'iwconfig' which we
|
||||
* are going to parse here.
|
||||
*/
|
||||
QMap<QString, QString> configs;
|
||||
QStringList ifList = QStringList::split( "\n\n", mIwconfigStdout );
|
||||
QStringList::Iterator it;
|
||||
for ( it = ifList.begin(); it != ifList.end(); ++it )
|
||||
{
|
||||
int index = ( *it ).find( ' ' );
|
||||
if ( index == -1 )
|
||||
continue;
|
||||
QString key = ( *it ).left( index );
|
||||
configs[key] = ( *it ).mid( index );
|
||||
}
|
||||
|
||||
/* We loop over the interfaces the user wishs to monitor.
|
||||
* If we find the interface in the output of 'iwconfig'
|
||||
* we update its data.
|
||||
*/
|
||||
QDictIterator<Interface> ifIt( mInterfaces );
|
||||
for ( ; ifIt.current(); ++ifIt )
|
||||
{
|
||||
QString key = ifIt.currentKey();
|
||||
Interface* interface = ifIt.current();
|
||||
|
||||
if ( configs.find( key ) == configs.end() )
|
||||
{
|
||||
// The interface was not found.
|
||||
continue;
|
||||
}
|
||||
else if ( configs[key].contains( "no wireless extensions" ) )
|
||||
{
|
||||
// The interface isn't a wireless device.
|
||||
interface->getData().wirelessDevice = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Update the wireless data of the interface.
|
||||
interface->getData().wirelessDevice = true;
|
||||
updateWirelessData( configs[key], interface->getWirelessData() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::updateWirelessData( QString& config, WirelessData& data )
|
||||
{
|
||||
QRegExp regExp( "ESSID:([^\"][\\S]*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.essid = regExp.cap( 1 );
|
||||
else
|
||||
{
|
||||
regExp.setPattern( "ESSID:\"([^\"]*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.essid = regExp.cap( 1 );
|
||||
else
|
||||
data.essid = QString::null;
|
||||
}
|
||||
|
||||
regExp.setPattern( "Mode:(\\w*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.mode = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "Frequency:([\\w|\\.]*\\s*\\w*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
data.frequency = regExp.cap( 1 );
|
||||
data.channel = "-";
|
||||
}
|
||||
else
|
||||
{
|
||||
data.frequency = "-";
|
||||
regExp.setPattern( "Channel:(\\d*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.channel = regExp.cap( 1 );
|
||||
else
|
||||
data.channel = "-";
|
||||
}
|
||||
|
||||
regExp.setPattern( "Bit Rate[=:](\\d*\\s*[\\w/]*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.bitRate = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "(.{2}:.{2}:.{2}:.{2}:.{2}:.{2})" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.accessPoint = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "Nickname:\"(\\w*)\"" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.nickName = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "Link Quality[=:]([\\d]*)" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
data.linkQuality = regExp.cap( 1 );
|
||||
|
||||
regExp.setPattern( "Encryption key:" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
regExp.setPattern( "Encryption key:off" );
|
||||
if ( regExp.search( config ) > -1 )
|
||||
{
|
||||
data.encryption = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.encryption = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data.encryption = false;
|
||||
}
|
||||
}
|
||||
|
||||
void NetToolsBackend::parseRouteOutput()
|
||||
{
|
||||
/* mRouteStdout contains the complete output of 'route' which we
|
||||
* are going to parse here.
|
||||
*/
|
||||
QMap<QString, QStringList> configs;
|
||||
QStringList routeList = QStringList::split( "\n", mRouteStdout );
|
||||
QStringList::Iterator it;
|
||||
for ( it = routeList.begin(); it != routeList.end(); ++it )
|
||||
{
|
||||
QStringList routeParameter = QStringList::split( " ", *it );
|
||||
if ( routeParameter.count() < 8 ) // no routing entry
|
||||
continue;
|
||||
if ( routeParameter[0] != "0.0.0.0" ) // no default route
|
||||
continue;
|
||||
configs[routeParameter[7]] = routeParameter;
|
||||
}
|
||||
|
||||
/* We loop over the interfaces the user wishs to monitor.
|
||||
* If we find the interface in the output of 'route' we update
|
||||
* the data of the interface.
|
||||
*/
|
||||
QDictIterator<Interface> ifIt( mInterfaces );
|
||||
for ( ; ifIt.current(); ++ifIt )
|
||||
{
|
||||
QString key = ifIt.currentKey();
|
||||
Interface* interface = ifIt.current();
|
||||
|
||||
if ( configs.find( key ) != configs.end() )
|
||||
{
|
||||
// Update the default gateway.
|
||||
QStringList routeParameter = configs[key];
|
||||
interface->getData().defaultGateway = routeParameter[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Reset the default gateway.
|
||||
interface->getData().defaultGateway = QString::null;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef NETTOOLSBACKEND_H
|
||||
#define NETTOOLSBACKEND_H
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include "backendbase.h"
|
||||
|
||||
class KProcess;
|
||||
|
||||
/**
|
||||
* The nettools backend runs 'ifconfig', 'iwconfig' and 'route'
|
||||
* and parses their output. It then triggers the interface
|
||||
* monitor to look for changes in the state of the interface.
|
||||
*
|
||||
* @short Update the information of the interfaces via nettools
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class NetToolsBackend : public QObject, BackendBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NetToolsBackend(QDict<Interface>& interfaces );
|
||||
virtual ~NetToolsBackend();
|
||||
|
||||
static BackendBase* createInstance( QDict<Interface>& interfaces );
|
||||
|
||||
void update();
|
||||
|
||||
private slots:
|
||||
void routeProcessExited( KProcess* process );
|
||||
void routeProcessStdout( KProcess* process, char* buffer, int buflen );
|
||||
void ifconfigProcessExited( KProcess* process );
|
||||
void ifconfigProcessStdout( KProcess* process, char* buffer, int buflen );
|
||||
void iwconfigProcessExited( KProcess* process );
|
||||
void iwconfigProcessStdout( KProcess* process, char* buffer, int buflen );
|
||||
|
||||
private:
|
||||
void parseRouteOutput();
|
||||
void parseIfconfigOutput();
|
||||
void updateInterfaceData( QString& config, InterfaceData& data, int type );
|
||||
void parseIwconfigOutput();
|
||||
void updateWirelessData( QString& config, WirelessData& data );
|
||||
|
||||
QString mRouteStdout;
|
||||
QString mIfconfigStdout;
|
||||
QString mIwconfigStdout;
|
||||
KProcess* mRouteProcess;
|
||||
KProcess* mIfconfigProcess;
|
||||
KProcess* mIwconfigProcess;
|
||||
};
|
||||
|
||||
#endif // NETTOOLSBACKEND_H
|
@ -0,0 +1,428 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <qmap.h>
|
||||
#include <qdir.h>
|
||||
#include <qregexp.h>
|
||||
#include <qstringlist.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kprocess.h>
|
||||
#include <kio/global.h>
|
||||
|
||||
#include "sysbackend.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBIW
|
||||
#include <iwlib.h>
|
||||
#else
|
||||
#include <net/if.h>
|
||||
#endif
|
||||
|
||||
#define RTF_GATEWAY 0x0002
|
||||
#define SYSPATH "/sys/class/net/"
|
||||
#define PROCROUTE "/proc/net/route"
|
||||
|
||||
SysBackend::SysBackend( QDict<Interface>& interfaces )
|
||||
: BackendBase( interfaces )
|
||||
{
|
||||
}
|
||||
|
||||
SysBackend::~SysBackend()
|
||||
{
|
||||
}
|
||||
|
||||
BackendBase* SysBackend::createInstance( QDict<Interface>& interfaces )
|
||||
{
|
||||
return new SysBackend( interfaces );
|
||||
}
|
||||
|
||||
void SysBackend::update()
|
||||
{
|
||||
QDir dir( SYSPATH );
|
||||
QStringList ifList = dir.entryList( QDir::Dirs );
|
||||
|
||||
QDictIterator<Interface> ifIt( mInterfaces );
|
||||
for ( ; ifIt.current(); ++ifIt )
|
||||
{
|
||||
QString key = ifIt.currentKey();
|
||||
Interface* interface = ifIt.current();
|
||||
|
||||
if ( ifList.find( key ) == ifList.end() )
|
||||
{
|
||||
// The interface does not exist. Meaning the driver
|
||||
// isn't loaded and/or the interface has not been created.
|
||||
interface->getData().existing = false;
|
||||
interface->getData().available = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( QFile::exists( SYSPATH + key + "/wireless" ) )
|
||||
{
|
||||
interface->getData().wirelessDevice = true;
|
||||
}
|
||||
|
||||
unsigned int carrier = 0;
|
||||
if ( !readNumberFromFile( SYSPATH + key + "/carrier", carrier ) ||
|
||||
carrier == 0 )
|
||||
{
|
||||
// The interface is there but not useable.
|
||||
interface->getData().existing = true;
|
||||
interface->getData().available = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ...determine the type of the interface
|
||||
unsigned int type = 0;
|
||||
if ( readNumberFromFile( SYSPATH + key + "/type", type ) &&
|
||||
type == 512 )
|
||||
{
|
||||
interface->setType( Interface::PPP );
|
||||
}
|
||||
else
|
||||
{
|
||||
interface->setType( Interface::ETHERNET );
|
||||
}
|
||||
|
||||
// Update the interface.
|
||||
interface->getData().existing = true;
|
||||
interface->getData().available = true;
|
||||
updateInterfaceData( key, interface->getData(), interface->getType() );
|
||||
|
||||
if ( interface->getData().wirelessDevice == true )
|
||||
{
|
||||
updateWirelessData( key, interface->getWirelessData() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
updateComplete();
|
||||
}
|
||||
|
||||
bool SysBackend::readNumberFromFile( const QString& fileName, unsigned int& value )
|
||||
{
|
||||
FILE* file = fopen( fileName.latin1(), "r" );
|
||||
if ( file != NULL )
|
||||
{
|
||||
if ( fscanf( file, "%ul", &value ) > 0 )
|
||||
{
|
||||
fclose( file );
|
||||
return true;
|
||||
}
|
||||
fclose( file );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SysBackend::readStringFromFile( const QString& fileName, QString& string )
|
||||
{
|
||||
char buffer[64];
|
||||
FILE* file = fopen( fileName.latin1(), "r" );
|
||||
if ( file != NULL )
|
||||
{
|
||||
if ( fscanf( file, "%s", buffer ) > 0 )
|
||||
{
|
||||
fclose( file );
|
||||
string = buffer;
|
||||
return true;
|
||||
}
|
||||
fclose( file );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void SysBackend::updateInterfaceData( const QString& ifName, InterfaceData& data, int type )
|
||||
{
|
||||
QString ifFolder = SYSPATH + ifName + "/";
|
||||
|
||||
unsigned int rxPackets = 0;
|
||||
if ( readNumberFromFile( ifFolder + "statistics/rx_packets", rxPackets ) )
|
||||
{
|
||||
data.rxPackets = rxPackets;
|
||||
}
|
||||
|
||||
unsigned int txPackets = 0;
|
||||
if ( readNumberFromFile( ifFolder + "statistics/tx_packets", txPackets ) )
|
||||
{
|
||||
data.txPackets = txPackets;
|
||||
}
|
||||
|
||||
unsigned int rxBytes = 0;
|
||||
if ( readNumberFromFile( ifFolder + "statistics/rx_bytes", rxBytes ) )
|
||||
{
|
||||
// We count the traffic on ourself to avoid an overflow after
|
||||
// 4GB of traffic.
|
||||
if ( rxBytes < data.prevRxBytes )
|
||||
{
|
||||
// there was an overflow
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
// This makes data counting more accurate but will not work
|
||||
// for interfaces that reset the transfered data to zero
|
||||
// when deactivated like ppp does.
|
||||
data.rxBytes += 0xFFFFFFFF - data.prevRxBytes;
|
||||
}
|
||||
data.prevRxBytes = 0L;
|
||||
}
|
||||
if ( data.rxBytes == 0L )
|
||||
{
|
||||
// on startup set to currently received bytes
|
||||
data.rxBytes = rxBytes;
|
||||
// this is new: KNemo only counts the traffic transfered
|
||||
// while it is running. Important to not falsify statistics!
|
||||
data.prevRxBytes = rxBytes;
|
||||
}
|
||||
else
|
||||
// afterwards only add difference to previous number of bytes
|
||||
data.rxBytes += rxBytes - data.prevRxBytes;
|
||||
|
||||
data.incomingBytes = rxBytes - data.prevRxBytes;
|
||||
data.prevRxBytes = rxBytes;
|
||||
data.rxString = KIO::convertSize( data.rxBytes );
|
||||
}
|
||||
|
||||
unsigned int txBytes = 0;
|
||||
if ( readNumberFromFile( ifFolder + "statistics/tx_bytes", txBytes ) )
|
||||
{
|
||||
// We count the traffic on ourself to avoid an overflow after
|
||||
// 4GB of traffic.
|
||||
if ( txBytes < data.prevTxBytes )
|
||||
{
|
||||
// there was an overflow
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
// This makes data counting more accurate but will not work
|
||||
// for interfaces that reset the transfered data to zero
|
||||
// when deactivated like ppp does.
|
||||
data.txBytes += 0xFFFFFFFF - data.prevTxBytes;
|
||||
}
|
||||
data.prevTxBytes = 0L;
|
||||
}
|
||||
if ( data.txBytes == 0L )
|
||||
{
|
||||
// on startup set to currently received bytes
|
||||
data.txBytes = txBytes;
|
||||
// this is new: KNemo only counts the traffic transfered
|
||||
// while it is running. Important to not falsify statistics!
|
||||
data.prevTxBytes = txBytes;
|
||||
}
|
||||
else
|
||||
// afterwards only add difference to previous number of bytes
|
||||
data.txBytes += txBytes - data.prevTxBytes;
|
||||
|
||||
data.outgoingBytes = txBytes - data.prevTxBytes;
|
||||
data.prevTxBytes = txBytes;
|
||||
data.txString = KIO::convertSize( data.txBytes );
|
||||
}
|
||||
|
||||
if ( type == Interface::ETHERNET )
|
||||
{
|
||||
QString hwAddress;
|
||||
if ( readStringFromFile( ifFolder + "address", hwAddress ) )
|
||||
{
|
||||
data.hwAddress = hwAddress;
|
||||
}
|
||||
|
||||
// for the default gateway we use the proc filesystem
|
||||
QFile routeFile( PROCROUTE );
|
||||
if ( routeFile.open( IO_ReadOnly ) )
|
||||
{
|
||||
QString routeData( routeFile.readAll().data() );
|
||||
QStringList routeEntries = QStringList::split( "\n", routeData );
|
||||
QStringList::Iterator it;
|
||||
for ( it = routeEntries.begin(); it != routeEntries.end(); ++it )
|
||||
{
|
||||
QRegExp regExp( ".*\\s+[\\w\\d]{8}\\s+([\\w\\d]{8})\\s+(\\d{4})" );
|
||||
if ( ( regExp.search( *it ) > -1 )
|
||||
&& ( regExp.cap( 2 ).toUInt() & RTF_GATEWAY ) )
|
||||
{
|
||||
bool ok;
|
||||
struct in_addr in;
|
||||
in.s_addr = regExp.cap( 1 ).toULong( &ok, 16 );
|
||||
data.defaultGateway = inet_ntoa( in );
|
||||
break;
|
||||
}
|
||||
}
|
||||
routeFile.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// use ioctls for the rest
|
||||
int fd;
|
||||
struct ifreq ifr;
|
||||
if ( ( fd = socket(AF_INET, SOCK_DGRAM, 0) ) > -1 )
|
||||
{
|
||||
strcpy( ifr.ifr_name, ifName.latin1() );
|
||||
ifr.ifr_addr.sa_family = AF_INET;
|
||||
if ( ioctl( fd, SIOCGIFADDR, &ifr ) > -1 )
|
||||
{
|
||||
data.ipAddress = inet_ntoa(((struct sockaddr_in*)&ifr.ifr_addr)->sin_addr);
|
||||
}
|
||||
if ( ioctl( fd, SIOCGIFDSTADDR, &ifr) > -1 )
|
||||
{
|
||||
data.ptpAddress = inet_ntoa(((struct sockaddr_in*)&ifr.ifr_dstaddr)->sin_addr);
|
||||
}
|
||||
|
||||
if ( ioctl( fd, SIOCGIFBRDADDR, &ifr ) > -1 )
|
||||
{
|
||||
data.broadcastAddress = inet_ntoa(((struct sockaddr_in*)&ifr.ifr_broadaddr)->sin_addr);
|
||||
}
|
||||
|
||||
if ( ioctl( fd, SIOCGIFNETMASK, &ifr ) > -1 )
|
||||
{
|
||||
data.subnetMask = inet_ntoa(((struct sockaddr_in*)&ifr.ifr_netmask)->sin_addr);
|
||||
}
|
||||
close( fd );
|
||||
}
|
||||
}
|
||||
|
||||
void SysBackend::updateWirelessData( const QString& ifName, WirelessData& data )
|
||||
{
|
||||
QString wirelessFolder = SYSPATH + ifName + "/wireless/";
|
||||
|
||||
unsigned int link = 0;
|
||||
if ( readNumberFromFile( wirelessFolder + "link", link ) )
|
||||
{
|
||||
data.linkQuality = QString::number( link );
|
||||
}
|
||||
|
||||
#ifdef HAVE_LIBIW
|
||||
// The following code was taken from iwconfig.c and iwlib.c.
|
||||
int fd;
|
||||
if ( ( fd = iw_sockets_open() ) > 0 )
|
||||
{
|
||||
struct iwreq wrq;
|
||||
char buffer[128];
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWFREQ, &wrq ) >= 0 )
|
||||
{
|
||||
int channel = -1;
|
||||
double freq = iw_freq2float( &( wrq.u.freq ) );
|
||||
struct iw_range range;
|
||||
if( iw_get_range_info( fd, ifName.latin1(), &range ) >= 0 )
|
||||
{
|
||||
if ( freq < KILO )
|
||||
{
|
||||
channel = iw_channel_to_freq( (int) freq, &freq, &range );
|
||||
}
|
||||
else
|
||||
{
|
||||
channel = iw_freq_to_channel( freq, &range );
|
||||
}
|
||||
iw_print_freq_value( buffer, sizeof( buffer ), freq );
|
||||
data.frequency = buffer;
|
||||
data.channel = QString::number( channel );
|
||||
}
|
||||
}
|
||||
|
||||
char essid[IW_ESSID_MAX_SIZE + 1];
|
||||
memset( essid, 0, IW_ESSID_MAX_SIZE + 1 );
|
||||
wrq.u.essid.pointer = (caddr_t) essid;
|
||||
wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
|
||||
wrq.u.essid.flags = 0;
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWESSID, &wrq ) >= 0 )
|
||||
{
|
||||
if ( wrq.u.data.flags > 0 )
|
||||
{
|
||||
data.essid = essid;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.essid = "any";
|
||||
}
|
||||
}
|
||||
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWAP, &wrq ) >= 0 )
|
||||
{
|
||||
char ap_addr[128];
|
||||
iw_ether_ntop( (const ether_addr*) wrq.u.ap_addr.sa_data, ap_addr);
|
||||
data.accessPoint = ap_addr;
|
||||
}
|
||||
|
||||
memset( essid, 0, IW_ESSID_MAX_SIZE + 1 );
|
||||
wrq.u.essid.pointer = (caddr_t) essid;
|
||||
wrq.u.essid.length = IW_ESSID_MAX_SIZE + 1;
|
||||
wrq.u.essid.flags = 0;
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWNICKN, &wrq ) >= 0 )
|
||||
{
|
||||
if ( wrq.u.data.length > 1 )
|
||||
{
|
||||
data.nickName = essid;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.nickName = QString::null;
|
||||
}
|
||||
}
|
||||
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWRATE, &wrq ) >= 0 )
|
||||
{
|
||||
iwparam bitrate;
|
||||
memcpy (&(bitrate), &(wrq.u.bitrate), sizeof (iwparam));
|
||||
iw_print_bitrate( buffer, sizeof( buffer ), wrq.u.bitrate.value );
|
||||
data.bitRate = buffer;
|
||||
}
|
||||
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWMODE, &wrq ) >= 0 )
|
||||
{
|
||||
int mode = wrq.u.mode;
|
||||
if ( mode < IW_NUM_OPER_MODE && mode >= 0 )
|
||||
{
|
||||
data.mode = iw_operation_mode[mode];
|
||||
}
|
||||
else
|
||||
{
|
||||
data.mode = QString::null;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char key[IW_ENCODING_TOKEN_MAX];
|
||||
wrq.u.data.pointer = (caddr_t) key;
|
||||
wrq.u.data.length = IW_ENCODING_TOKEN_MAX;
|
||||
wrq.u.data.flags = 0;
|
||||
if ( iw_get_ext( fd, ifName.latin1(), SIOCGIWENCODE, &wrq ) >= 0 )
|
||||
{
|
||||
if ( ( wrq.u.data.flags & IW_ENCODE_DISABLED ) || ( wrq.u.data.length == 0 ) )
|
||||
{
|
||||
data.encryption = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.encryption = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
data.encryption = false;
|
||||
}
|
||||
close( fd );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -0,0 +1,54 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef SYSBACKEND_H
|
||||
#define SYSBACKEND_H
|
||||
|
||||
#include "backendbase.h"
|
||||
|
||||
/**
|
||||
* The sys backend uses the sys filesystem available in 2.6
|
||||
* kernels. It reads all necessary information from the files
|
||||
* and folders located at /sys and parses their output.
|
||||
* It then triggers the interface monitor to look for changes
|
||||
* in the state of the interface.
|
||||
*
|
||||
* @short Update the information of the interfaces via sys filesystem
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class SysBackend : public BackendBase
|
||||
{
|
||||
public:
|
||||
SysBackend(QDict<Interface>& interfaces );
|
||||
virtual ~SysBackend();
|
||||
|
||||
static BackendBase* createInstance( QDict<Interface>& interfaces );
|
||||
|
||||
void update();
|
||||
|
||||
private:
|
||||
bool readNumberFromFile( const QString& fileName, unsigned int& value );
|
||||
bool readStringFromFile( const QString& fileName, QString& string );
|
||||
void updateWirelessData( const QString& ifName, WirelessData& data );
|
||||
void updateInterfaceData( const QString& ifName, InterfaceData& data, int type );
|
||||
|
||||
};
|
||||
|
||||
#endif // SYSBACKEND_H
|
@ -0,0 +1,130 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2005 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef GLOBAL_H
|
||||
#define GLOBAL_H
|
||||
|
||||
#include <qpair.h>
|
||||
#include <qcolor.h>
|
||||
#include <qstring.h>
|
||||
|
||||
/**
|
||||
* This file contains data structures and enums used in the knemo daemon.
|
||||
*
|
||||
* @short Daemon wide structures and enums
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
struct GeneralData
|
||||
{
|
||||
int toolTipContent;
|
||||
int pollInterval;
|
||||
int saveInterval;
|
||||
QString statisticsDir;
|
||||
};
|
||||
|
||||
struct InterfaceData
|
||||
{
|
||||
InterfaceData()
|
||||
: existing( false ),
|
||||
available( false ),
|
||||
wirelessDevice( false ),
|
||||
prevRxPackets( 0L ),
|
||||
prevTxPackets( 0L ),
|
||||
rxPackets( 0L ),
|
||||
txPackets( 0L ),
|
||||
prevRxBytes( 0L ),
|
||||
prevTxBytes( 0L ),
|
||||
incomingBytes( 0L ),
|
||||
outgoingBytes( 0L ),
|
||||
rxBytes( 0L ),
|
||||
txBytes( 0L )
|
||||
{}
|
||||
|
||||
bool existing;
|
||||
bool available;
|
||||
bool wirelessDevice;
|
||||
unsigned long prevRxPackets;
|
||||
unsigned long prevTxPackets;
|
||||
unsigned long rxPackets;
|
||||
unsigned long txPackets;
|
||||
unsigned long prevRxBytes;
|
||||
unsigned long prevTxBytes;
|
||||
unsigned long incomingBytes;
|
||||
unsigned long outgoingBytes;
|
||||
QString ipAddress;
|
||||
QString subnetMask;
|
||||
QString hwAddress;
|
||||
QString ptpAddress;
|
||||
QString broadcastAddress;
|
||||
QString defaultGateway;
|
||||
QString rxString;
|
||||
QString txString;
|
||||
Q_UINT64 rxBytes;
|
||||
Q_UINT64 txBytes;
|
||||
};
|
||||
|
||||
struct WirelessData
|
||||
{
|
||||
QString essid;
|
||||
QString mode;
|
||||
QString frequency;
|
||||
QString channel;
|
||||
QString bitRate;
|
||||
QString linkQuality;
|
||||
QString accessPoint;
|
||||
QString nickName;
|
||||
bool encryption;
|
||||
};
|
||||
|
||||
struct PlotterSettings
|
||||
{
|
||||
int pixel;
|
||||
int count;
|
||||
int distance;
|
||||
int fontSize;
|
||||
int minimumValue;
|
||||
int maximumValue;
|
||||
bool labels;
|
||||
bool topBar;
|
||||
bool showIncoming;
|
||||
bool showOutgoing;
|
||||
bool verticalLines;
|
||||
bool horizontalLines;
|
||||
bool automaticDetection;
|
||||
bool verticalLinesScroll;
|
||||
QColor colorVLines;
|
||||
QColor colorHLines;
|
||||
QColor colorIncoming;
|
||||
QColor colorOutgoing;
|
||||
QColor colorBackground;
|
||||
};
|
||||
|
||||
struct StatisticEntry
|
||||
{
|
||||
int day;
|
||||
int month;
|
||||
int year;
|
||||
Q_UINT64 rxBytes;
|
||||
Q_UINT64 txBytes;
|
||||
};
|
||||
|
||||
extern QPair<QString, int> ToolTips[];
|
||||
|
||||
#endif // GLOBAL_H
|
@ -0,0 +1,487 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <qtimer.h>
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <kwin.h>
|
||||
#include <kdebug.h>
|
||||
#include <klocale.h>
|
||||
#include <kwinmodule.h>
|
||||
#include <kiconloader.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "signalplotter.h"
|
||||
#include "interfacestatistics.h"
|
||||
#include "interfacestatusdialog.h"
|
||||
#include "interfacestatisticsdialog.h"
|
||||
|
||||
Interface::Interface( QString ifname,
|
||||
const GeneralData& generalData,
|
||||
const PlotterSettings& plotterSettings )
|
||||
: QObject(),
|
||||
mType( UNKNOWN_TYPE ),
|
||||
mState( UNKNOWN_STATE ),
|
||||
mOutgoingPos( 0 ),
|
||||
mIncomingPos( 0 ),
|
||||
mName( ifname ),
|
||||
mPlotterTimer( 0 ),
|
||||
mIcon( this ),
|
||||
mStatistics( 0 ),
|
||||
mStatusDialog( 0 ),
|
||||
mStatisticsDialog( 0 ),
|
||||
mPlotter( 0 ),
|
||||
mVisibleBeams( NONE ),
|
||||
mGeneralData( generalData ),
|
||||
mPlotterSettings( plotterSettings )
|
||||
{
|
||||
connect( &mMonitor, SIGNAL( statusChanged( int ) ),
|
||||
&mIcon, SLOT( updateStatus( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( available( int ) ),
|
||||
&mIcon, SLOT( updateTrayStatus( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( notAvailable( int ) ),
|
||||
&mIcon, SLOT( updateTrayStatus( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( notExisting( int ) ),
|
||||
&mIcon, SLOT( updateTrayStatus( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( available( int ) ),
|
||||
this, SLOT( setStartTime( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( statusChanged( int ) ),
|
||||
this, SLOT( resetData( int ) ) );
|
||||
connect( &mIcon, SIGNAL( statisticsSelected() ),
|
||||
this, SLOT( showStatisticsDialog() ) );
|
||||
}
|
||||
|
||||
Interface::~Interface()
|
||||
{
|
||||
if ( mStatusDialog != 0 )
|
||||
{
|
||||
delete mStatusDialog;
|
||||
}
|
||||
if ( mPlotter != 0 )
|
||||
{
|
||||
delete mPlotter;
|
||||
}
|
||||
if ( mPlotterTimer != 0 )
|
||||
{
|
||||
mPlotterTimer->stop();
|
||||
delete mPlotterTimer;
|
||||
}
|
||||
if ( mStatistics != 0 )
|
||||
{
|
||||
// this will also delete a possibly open statistics dialog
|
||||
stopStatistics();
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::configChanged()
|
||||
{
|
||||
// UNKNOWN_STATE to avoid notification
|
||||
mIcon.updateTrayStatus( UNKNOWN_STATE );
|
||||
// handle changed iconset by user
|
||||
mIcon.updateStatus( mState );
|
||||
mIcon.updateToolTip();
|
||||
mIcon.updateMenu();
|
||||
|
||||
if ( mPlotter != 0L )
|
||||
{
|
||||
configurePlotter();
|
||||
}
|
||||
|
||||
if ( mStatistics != 0 )
|
||||
{
|
||||
mStatistics->configChanged();
|
||||
}
|
||||
|
||||
if ( mSettings.activateStatistics && mStatistics == 0 )
|
||||
{
|
||||
// user turned on statistics
|
||||
startStatistics();
|
||||
}
|
||||
else if ( !mSettings.activateStatistics && mStatistics != 0 )
|
||||
{
|
||||
// user turned off statistics
|
||||
stopStatistics();
|
||||
}
|
||||
|
||||
if ( mStatusDialog )
|
||||
{
|
||||
mStatusDialog->setStatisticsGroupEnabled( mSettings.activateStatistics );
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::activateMonitor()
|
||||
{
|
||||
mMonitor.checkStatus( this );
|
||||
}
|
||||
|
||||
void Interface::setStartTime( int )
|
||||
{
|
||||
mStartTime.setDate( QDate::currentDate() );
|
||||
mStartTime.setTime( QTime::currentTime() );
|
||||
}
|
||||
|
||||
void Interface::showStatusDialog()
|
||||
{
|
||||
// Toggle the status dialog.
|
||||
// First click will show the status dialog, second will hide it.
|
||||
if ( mStatusDialog == 0L )
|
||||
{
|
||||
mStatusDialog = new InterfaceStatusDialog( this );
|
||||
connect( &mMonitor, SIGNAL( available( int ) ),
|
||||
mStatusDialog, SLOT( enableNetworkGroups( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( notAvailable( int ) ),
|
||||
mStatusDialog, SLOT( disableNetworkGroups( int ) ) );
|
||||
connect( &mMonitor, SIGNAL( notExisting( int ) ),
|
||||
mStatusDialog, SLOT( disableNetworkGroups( int ) ) );
|
||||
if ( mStatistics != 0 )
|
||||
{
|
||||
connect( mStatistics, SIGNAL( currentEntryChanged() ),
|
||||
mStatusDialog, SLOT( statisticsChanged() ) );
|
||||
mStatusDialog->statisticsChanged();
|
||||
}
|
||||
activateOrHide( mStatusDialog, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Toggle the status dialog.
|
||||
activateOrHide( mStatusDialog );
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::showSignalPlotter( bool wasMiddleButton )
|
||||
{
|
||||
// No plotter, create it.
|
||||
if ( mPlotter == 0L )
|
||||
{
|
||||
mPlotter = new SignalPlotter( 0L, mName.local8Bit() );
|
||||
mPlotter->setIcon( SmallIcon( "knemo" ) );
|
||||
mPlotter->setCaption( mName + " " + i18n( "Traffic" ) );
|
||||
mPlotter->setTitle( mName );
|
||||
configurePlotter();
|
||||
activateOrHide( mPlotter, true );
|
||||
|
||||
mPlotterTimer = new QTimer();
|
||||
connect( mPlotterTimer, SIGNAL( timeout() ),
|
||||
this, SLOT( updatePlotter() ) );
|
||||
mPlotterTimer->start( 1000 );
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( wasMiddleButton )
|
||||
{
|
||||
// Toggle the signal plotter.
|
||||
activateOrHide( mPlotter );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Called from the context menu, show the dialog.
|
||||
activateOrHide( mPlotter, true );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::showStatisticsDialog()
|
||||
{
|
||||
if ( mStatisticsDialog == 0 )
|
||||
{
|
||||
mStatisticsDialog = new InterfaceStatisticsDialog( this );
|
||||
if ( mStatistics == 0 )
|
||||
{
|
||||
// should never happen but you never know...
|
||||
startStatistics();
|
||||
}
|
||||
connect( mStatistics, SIGNAL( dayStatisticsChanged() ),
|
||||
mStatisticsDialog, SLOT( updateDays() ) );
|
||||
connect( mStatistics, SIGNAL( monthStatisticsChanged() ),
|
||||
mStatisticsDialog, SLOT( updateMonths() ) );
|
||||
connect( mStatistics, SIGNAL( yearStatisticsChanged() ),
|
||||
mStatisticsDialog, SLOT( updateYears() ) );
|
||||
connect( mStatistics, SIGNAL( currentEntryChanged() ),
|
||||
mStatisticsDialog, SLOT( updateCurrentEntry() ) );
|
||||
connect( mStatisticsDialog, SIGNAL( clearDailyStatisticsClicked() ),
|
||||
mStatistics, SLOT( clearDayStatistics() ) );
|
||||
connect( mStatisticsDialog, SIGNAL( clearMonthlyStatisticsClicked() ),
|
||||
mStatistics, SLOT( clearMonthStatistics() ) );
|
||||
connect( mStatisticsDialog, SIGNAL( clearYearlyStatisticsClicked() ),
|
||||
mStatistics, SLOT( clearYearStatistics() ) );
|
||||
|
||||
mStatisticsDialog->updateDays();
|
||||
mStatisticsDialog->updateMonths();
|
||||
mStatisticsDialog->updateYears();
|
||||
}
|
||||
mStatisticsDialog->show();
|
||||
}
|
||||
|
||||
void Interface::resetData( int state )
|
||||
{
|
||||
// For PPP interfaces we will reset all data to zero when the
|
||||
// interface gets disconnected. If the driver also resets its data
|
||||
// (like PPP seems to do) we will start from zero for every new
|
||||
// connection.
|
||||
if ( mType == PPP &&
|
||||
( state == NOT_AVAILABLE ||
|
||||
state == NOT_EXISTING ) )
|
||||
{
|
||||
mData.prevTxBytes = mData.txBytes = 0;
|
||||
mData.prevRxBytes = mData.rxBytes = 0;
|
||||
mData.prevTxPackets = mData.txPackets = 0;
|
||||
mData.prevRxPackets = mData.rxPackets = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::updatePlotter()
|
||||
{
|
||||
if ( mPlotter )
|
||||
{
|
||||
double outgoingBytes = mData.outgoingBytes / 1024.0 / (double) mGeneralData.pollInterval;
|
||||
double incomingBytes = mData.incomingBytes / 1024.0 / (double) mGeneralData.pollInterval;
|
||||
|
||||
QValueList<double> trafficList;
|
||||
switch ( mVisibleBeams )
|
||||
{
|
||||
case BOTH:
|
||||
if ( mIncomingPos == 1 )
|
||||
{
|
||||
trafficList.append( outgoingBytes );
|
||||
trafficList.append( incomingBytes );
|
||||
}
|
||||
else
|
||||
{
|
||||
trafficList.append( incomingBytes );
|
||||
trafficList.append( outgoingBytes );
|
||||
}
|
||||
mPlotter->addSample( trafficList );
|
||||
break;
|
||||
case INCOMING_TRAFFIC:
|
||||
trafficList.append( incomingBytes );
|
||||
mPlotter->addSample( trafficList );
|
||||
break;
|
||||
case OUTGOING_TRAFFIC:
|
||||
trafficList.append( outgoingBytes );
|
||||
mPlotter->addSample( trafficList );
|
||||
break;
|
||||
case NONE:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::configurePlotter()
|
||||
{
|
||||
mPlotter->setFontSize( mPlotterSettings.fontSize );
|
||||
if ( !mPlotterSettings.automaticDetection )
|
||||
{
|
||||
mPlotter->setMinValue( mPlotterSettings.minimumValue );
|
||||
mPlotter->setMaxValue( mPlotterSettings.maximumValue );
|
||||
}
|
||||
mPlotter->setHorizontalScale( mPlotterSettings.pixel );
|
||||
mPlotter->setHorizontalLinesCount( mPlotterSettings.count );
|
||||
mPlotter->setVerticalLinesDistance( mPlotterSettings.distance );
|
||||
mPlotter->setShowLabels( mPlotterSettings.labels );
|
||||
mPlotter->setShowTopBar( mPlotterSettings.topBar );
|
||||
mPlotter->setShowVerticalLines( mPlotterSettings.verticalLines );
|
||||
mPlotter->setShowHorizontalLines( mPlotterSettings.horizontalLines );
|
||||
mPlotter->setUseAutoRange( mPlotterSettings.automaticDetection );
|
||||
mPlotter->setVerticalLinesScroll( mPlotterSettings.verticalLinesScroll );
|
||||
mPlotter->setVerticalLinesColor( mPlotterSettings.colorVLines );
|
||||
mPlotter->setHorizontalLinesColor( mPlotterSettings.colorHLines );
|
||||
mPlotter->setBackgroundColor( mPlotterSettings.colorBackground );
|
||||
|
||||
// add or remove beams according to user settings
|
||||
VisibleBeams nextVisibleBeams = NONE;
|
||||
if ( mPlotterSettings.showOutgoing )
|
||||
nextVisibleBeams = (VisibleBeams) ( nextVisibleBeams | OUTGOING_TRAFFIC );
|
||||
if ( mPlotterSettings.showIncoming )
|
||||
nextVisibleBeams = (VisibleBeams) ( nextVisibleBeams | INCOMING_TRAFFIC );
|
||||
|
||||
QValueList<QColor>& colors = mPlotter->beamColors();
|
||||
switch( mVisibleBeams )
|
||||
{
|
||||
case NONE:
|
||||
if ( nextVisibleBeams == BOTH )
|
||||
{
|
||||
mOutgoingPos = 0;
|
||||
mPlotter->addBeam( mPlotterSettings.colorOutgoing );
|
||||
mIncomingPos = 1;
|
||||
mPlotter->addBeam( mPlotterSettings.colorIncoming );
|
||||
}
|
||||
else if ( nextVisibleBeams == OUTGOING_TRAFFIC )
|
||||
{
|
||||
mOutgoingPos = 0;
|
||||
mPlotter->addBeam( mPlotterSettings.colorOutgoing );
|
||||
}
|
||||
else if ( nextVisibleBeams == INCOMING_TRAFFIC )
|
||||
{
|
||||
mIncomingPos = 0;
|
||||
mPlotter->addBeam( mPlotterSettings.colorIncoming );
|
||||
}
|
||||
break;
|
||||
case INCOMING_TRAFFIC:
|
||||
if ( nextVisibleBeams == BOTH )
|
||||
{
|
||||
mOutgoingPos = 1;
|
||||
mPlotter->addBeam( mPlotterSettings.colorOutgoing );
|
||||
}
|
||||
else if ( nextVisibleBeams == OUTGOING_TRAFFIC )
|
||||
{
|
||||
mPlotter->removeBeam( mIncomingPos );
|
||||
mOutgoingPos = 0;
|
||||
mPlotter->addBeam( mPlotterSettings.colorOutgoing );
|
||||
}
|
||||
else if ( nextVisibleBeams == INCOMING_TRAFFIC )
|
||||
{
|
||||
colors[mIncomingPos] = ( mPlotterSettings.colorIncoming );
|
||||
}
|
||||
else if ( nextVisibleBeams == NONE )
|
||||
{
|
||||
mPlotter->removeBeam( mIncomingPos );
|
||||
}
|
||||
break;
|
||||
case OUTGOING_TRAFFIC:
|
||||
if ( nextVisibleBeams == BOTH )
|
||||
{
|
||||
mIncomingPos = 1;
|
||||
mPlotter->addBeam( mPlotterSettings.colorIncoming );
|
||||
}
|
||||
else if ( nextVisibleBeams == INCOMING_TRAFFIC )
|
||||
{
|
||||
mPlotter->removeBeam( mOutgoingPos );
|
||||
mIncomingPos = 0;
|
||||
mPlotter->addBeam( mPlotterSettings.colorIncoming );
|
||||
}
|
||||
else if ( nextVisibleBeams == OUTGOING_TRAFFIC )
|
||||
{
|
||||
colors[mOutgoingPos] = ( mPlotterSettings.colorOutgoing );
|
||||
}
|
||||
else if ( nextVisibleBeams == NONE )
|
||||
{
|
||||
mPlotter->removeBeam( mOutgoingPos );
|
||||
}
|
||||
break;
|
||||
case BOTH:
|
||||
if ( nextVisibleBeams == BOTH )
|
||||
{
|
||||
colors[mIncomingPos] = ( mPlotterSettings.colorIncoming );
|
||||
colors[mOutgoingPos] = ( mPlotterSettings.colorOutgoing );
|
||||
}
|
||||
else if ( nextVisibleBeams == OUTGOING_TRAFFIC )
|
||||
{
|
||||
mOutgoingPos = 0;
|
||||
mPlotter->removeBeam( mIncomingPos );
|
||||
}
|
||||
else if ( nextVisibleBeams == INCOMING_TRAFFIC )
|
||||
{
|
||||
mIncomingPos = 0;
|
||||
mPlotter->removeBeam( mOutgoingPos );
|
||||
}
|
||||
else if ( nextVisibleBeams == NONE )
|
||||
{
|
||||
mPlotter->removeBeam( 0 );
|
||||
mPlotter->removeBeam( 0 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
mVisibleBeams = nextVisibleBeams;
|
||||
mPlotter->repaint();
|
||||
}
|
||||
|
||||
void Interface::startStatistics()
|
||||
{
|
||||
mStatistics = new InterfaceStatistics( this );
|
||||
connect( &mMonitor, SIGNAL( incomingData( unsigned long ) ),
|
||||
mStatistics, SLOT( addIncomingData( unsigned long ) ) );
|
||||
connect( &mMonitor, SIGNAL( outgoingData( unsigned long ) ),
|
||||
mStatistics, SLOT( addOutgoingData( unsigned long ) ) );
|
||||
if ( mStatusDialog != 0 )
|
||||
{
|
||||
connect( mStatistics, SIGNAL( currentEntryChanged() ),
|
||||
mStatusDialog, SLOT( statisticsChanged() ) );
|
||||
mStatusDialog->statisticsChanged();
|
||||
}
|
||||
|
||||
mStatistics->loadStatistics();
|
||||
}
|
||||
|
||||
void Interface::stopStatistics()
|
||||
{
|
||||
if ( mStatisticsDialog != 0 )
|
||||
{
|
||||
// this will close an open statistics dialog
|
||||
delete mStatisticsDialog;
|
||||
mStatisticsDialog = 0;
|
||||
}
|
||||
|
||||
mStatistics->saveStatistics();
|
||||
|
||||
delete mStatistics;
|
||||
mStatistics = 0;
|
||||
}
|
||||
|
||||
// taken from ksystemtray.cpp
|
||||
void Interface::activateOrHide( QWidget* widget, bool onlyActivate )
|
||||
{
|
||||
if ( !widget )
|
||||
return;
|
||||
|
||||
KWin::WindowInfo info1 = KWin::windowInfo( widget->winId(), NET::XAWMState | NET::WMState );
|
||||
// mapped = visible (but possibly obscured)
|
||||
bool mapped = (info1.mappingState() == NET::Visible) && !info1.isMinimized();
|
||||
// - not mapped -> show, raise, focus
|
||||
// - mapped
|
||||
// - obscured -> raise, focus
|
||||
// - not obscured -> hide
|
||||
if( !mapped )
|
||||
{
|
||||
KWin::setOnDesktop( widget->winId(), KWin::currentDesktop() );
|
||||
widget->show();
|
||||
widget->raise();
|
||||
KWin::activateWindow( widget->winId() );
|
||||
}
|
||||
else
|
||||
{
|
||||
KWinModule module;
|
||||
for( QValueList< WId >::ConstIterator it = module.stackingOrder().fromLast();
|
||||
it != module.stackingOrder().end() && (*it) != widget->winId();
|
||||
--it )
|
||||
{
|
||||
KWin::WindowInfo info2 = KWin::windowInfo( *it, (unsigned long)
|
||||
NET::WMGeometry | NET::XAWMState | NET::WMState | NET::WMWindowType );
|
||||
if( info2.mappingState() != NET::Visible )
|
||||
continue; // not visible on current desktop -> ignore
|
||||
if( !info2.geometry().intersects( widget->geometry()))
|
||||
continue; // not obscuring the window -> ignore
|
||||
if( !info1.hasState( NET::KeepAbove ) && info2.hasState( NET::KeepAbove ))
|
||||
continue; // obscured by window kept above -> ignore
|
||||
NET::WindowType type = info2.windowType( NET::NormalMask | NET::DesktopMask
|
||||
| NET::DockMask | NET::ToolbarMask | NET::MenuMask | NET::DialogMask
|
||||
| NET::OverrideMask | NET::TopMenuMask | NET::UtilityMask | NET::SplashMask );
|
||||
if( type == NET::Dock || type == NET::TopMenu )
|
||||
continue; // obscured by dock or topmenu -> ignore
|
||||
widget->raise();
|
||||
KWin::activateWindow( widget->winId());
|
||||
return;
|
||||
}
|
||||
if ( !onlyActivate )
|
||||
{
|
||||
widget->hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "interface.moc"
|
@ -0,0 +1,243 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACE_H
|
||||
#define INTERFACE_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "global.h"
|
||||
#include "interfaceicon.h"
|
||||
#include "interfacemonitor.h"
|
||||
|
||||
class QTimer;
|
||||
class SignalPlotter;
|
||||
class InterfaceStatistics;
|
||||
class InterfaceStatusDialog;
|
||||
class InterfaceStatisticsDialog;
|
||||
|
||||
/**
|
||||
* This class is the central place for all things that belong to an
|
||||
* interface. It stores some information and knows about the interface
|
||||
* data, icon, monitor and settings.
|
||||
*
|
||||
* @short Central class for every interface
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
class Interface : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
Interface(QString ifname,
|
||||
const GeneralData& generalData,
|
||||
const PlotterSettings& plotterSettings );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~Interface();
|
||||
|
||||
void setType( int type )
|
||||
{
|
||||
mType = type;
|
||||
}
|
||||
|
||||
int getType()
|
||||
{
|
||||
return mType;
|
||||
}
|
||||
|
||||
void setState( int state )
|
||||
{
|
||||
mState = state;
|
||||
}
|
||||
|
||||
int getState()
|
||||
{
|
||||
return mState;
|
||||
}
|
||||
|
||||
const QDateTime& getStartTime() const
|
||||
{
|
||||
return mStartTime;
|
||||
}
|
||||
|
||||
const QString& getName() const
|
||||
{
|
||||
return mName;
|
||||
}
|
||||
|
||||
InterfaceData& getData()
|
||||
{
|
||||
return mData;
|
||||
}
|
||||
|
||||
InterfaceSettings& getSettings()
|
||||
{
|
||||
return mSettings;
|
||||
}
|
||||
|
||||
WirelessData& getWirelessData()
|
||||
{
|
||||
return mWirelessData;
|
||||
}
|
||||
|
||||
const GeneralData& getGeneralData() const
|
||||
{
|
||||
return mGeneralData;
|
||||
}
|
||||
|
||||
InterfaceStatistics* getStatistics()
|
||||
{
|
||||
return mStatistics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from reparseConfiguration() when the user changed
|
||||
* the settings.
|
||||
*/
|
||||
void configChanged();
|
||||
|
||||
/**
|
||||
* Called from the interface updater class after new data from
|
||||
* 'ifconfig' has been read. This will trigger the monitor to
|
||||
* to look for changes in interface data or interface state.
|
||||
*/
|
||||
void activateMonitor();
|
||||
|
||||
enum InterfaceState
|
||||
{
|
||||
UNKNOWN_STATE = -1,
|
||||
NOT_EXISTING = 0,
|
||||
NOT_AVAILABLE = 1,
|
||||
AVAILABLE = 2,
|
||||
RX_TRAFFIC = 4,
|
||||
TX_TRAFFIC = 8
|
||||
};
|
||||
|
||||
enum InterfaceType
|
||||
{
|
||||
UNKNOWN_TYPE,
|
||||
ETHERNET,
|
||||
PPP
|
||||
};
|
||||
|
||||
enum IconSet
|
||||
{
|
||||
MONITOR = 0,
|
||||
MODEM,
|
||||
NETWORK,
|
||||
WIRELESS
|
||||
};
|
||||
|
||||
public slots:
|
||||
/*
|
||||
* Called when the user left-clicks on the tray icon
|
||||
* Toggles the status dialog by showing it on the first click and
|
||||
* hiding it on the second click.
|
||||
*/
|
||||
void showStatusDialog();
|
||||
|
||||
/*
|
||||
* Called when the user middle-clicks on the tray icon
|
||||
* Toggles the signal plotter that displays the incoming and
|
||||
* outgoing traffic.
|
||||
*/
|
||||
void showSignalPlotter( bool wasMiddleButton );
|
||||
|
||||
/*
|
||||
* Called when the user selects the appropriate entry in the context menu.
|
||||
*/
|
||||
void showStatisticsDialog();
|
||||
|
||||
/*
|
||||
* Reset data when PPP interface is disconnected
|
||||
*/
|
||||
void resetData( int state );
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* Start the uptimer when the interface is connected
|
||||
*/
|
||||
void setStartTime( int );
|
||||
|
||||
/**
|
||||
* Update the signal plotter with new data
|
||||
*/
|
||||
void updatePlotter();
|
||||
|
||||
/**
|
||||
* Configure the signal plotter with user settings
|
||||
*/
|
||||
void configurePlotter();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Start the statistics and load previously saved ones
|
||||
*/
|
||||
void startStatistics();
|
||||
|
||||
/**
|
||||
* Store the statistics and stop collecting any further data
|
||||
*/
|
||||
void stopStatistics();
|
||||
|
||||
/**
|
||||
* The following function is taken from ksystemtray.cpp for
|
||||
* correct show, raise, focus and hide of status dialog and
|
||||
* signal plotter.
|
||||
*/
|
||||
void activateOrHide( QWidget* widget, bool onlyActivate = false );
|
||||
|
||||
enum VisibleBeams
|
||||
{
|
||||
NONE = 0,
|
||||
INCOMING_TRAFFIC = 1,
|
||||
OUTGOING_TRAFFIC = 2,
|
||||
BOTH = 3
|
||||
};
|
||||
|
||||
int mType;
|
||||
int mState;
|
||||
int mOutgoingPos;
|
||||
int mIncomingPos;
|
||||
QString mName;
|
||||
QTimer* mPlotterTimer;
|
||||
QDateTime mStartTime;
|
||||
InterfaceIcon mIcon;
|
||||
InterfaceData mData;
|
||||
InterfaceMonitor mMonitor;
|
||||
InterfaceSettings mSettings;
|
||||
InterfaceStatistics* mStatistics;
|
||||
WirelessData mWirelessData;
|
||||
InterfaceStatusDialog* mStatusDialog;
|
||||
InterfaceStatisticsDialog* mStatisticsDialog;
|
||||
SignalPlotter* mPlotter;
|
||||
VisibleBeams mVisibleBeams;
|
||||
const GeneralData& mGeneralData;
|
||||
const PlotterSettings& mPlotterSettings;
|
||||
};
|
||||
|
||||
#endif // INTERFACE_H
|
@ -0,0 +1,309 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2005 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <qpixmap.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kglobal.h>
|
||||
#include <klocale.h>
|
||||
#include <kprocess.h>
|
||||
#include <kpopupmenu.h>
|
||||
#include <kiconloader.h>
|
||||
#include <knotifyclient.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "interface.h"
|
||||
#include "knemodaemon.h"
|
||||
#include "interfaceicon.h"
|
||||
#include "interfacetray.h"
|
||||
#include "interfacemonitor.h"
|
||||
#include "interfacetooltip.h"
|
||||
|
||||
const QString InterfaceIcon::ICON_DISCONNECTED = "network_disconnected";
|
||||
const QString InterfaceIcon::ICON_CONNECTED = "network_connected";
|
||||
const QString InterfaceIcon::ICON_INCOMING = "network_incoming";
|
||||
const QString InterfaceIcon::ICON_OUTGOING = "network_outgoing";
|
||||
const QString InterfaceIcon::ICON_TRAFFIC = "network_traffic";
|
||||
const QString InterfaceIcon::SUFFIX_PPP = "_ppp";
|
||||
const QString InterfaceIcon::SUFFIX_LAN = "_lan";
|
||||
const QString InterfaceIcon::SUFFIX_WLAN = "_wlan";
|
||||
|
||||
InterfaceIcon::InterfaceIcon( Interface* interface )
|
||||
: QObject(),
|
||||
mInterface( interface ),
|
||||
mTray( 0L )
|
||||
{
|
||||
}
|
||||
|
||||
InterfaceIcon::~InterfaceIcon()
|
||||
{
|
||||
if ( mTray != 0L )
|
||||
delete mTray;
|
||||
}
|
||||
|
||||
void InterfaceIcon::updateStatus( int status )
|
||||
{
|
||||
if ( mTray == 0L )
|
||||
return;
|
||||
|
||||
// If the user wants something different than the default icons
|
||||
// append the correct suffix to the filename.
|
||||
QString suffix;
|
||||
if ( mInterface->getSettings().iconSet == Interface::NETWORK )
|
||||
{
|
||||
suffix = SUFFIX_LAN;
|
||||
}
|
||||
else if ( mInterface->getSettings().iconSet == Interface::WIRELESS )
|
||||
{
|
||||
suffix = SUFFIX_WLAN;
|
||||
}
|
||||
else if ( mInterface->getSettings().iconSet == Interface::MODEM )
|
||||
{
|
||||
suffix = SUFFIX_PPP;
|
||||
}
|
||||
else
|
||||
{
|
||||
suffix = ""; // use standard icons
|
||||
}
|
||||
|
||||
// Now set the correct icon depending on the status of the interface.
|
||||
if ( status == Interface::NOT_AVAILABLE ||
|
||||
status == Interface::NOT_EXISTING )
|
||||
{
|
||||
mTray->setPixmap( mTray->loadIcon( ICON_DISCONNECTED + suffix ) );
|
||||
}
|
||||
else if ( ( status & Interface::RX_TRAFFIC ) &&
|
||||
( status & Interface::TX_TRAFFIC ) )
|
||||
{
|
||||
mTray->setPixmap( mTray->loadIcon( ICON_TRAFFIC + suffix ) );
|
||||
}
|
||||
else if ( status & Interface::RX_TRAFFIC )
|
||||
{
|
||||
mTray->setPixmap( mTray->loadIcon( ICON_INCOMING + suffix ) );
|
||||
}
|
||||
else if ( status & Interface::TX_TRAFFIC )
|
||||
{
|
||||
mTray->setPixmap( mTray->loadIcon( ICON_OUTGOING + suffix ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mTray->setPixmap( mTray->loadIcon( ICON_CONNECTED + suffix ) );
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceIcon::updateToolTip()
|
||||
{
|
||||
if ( mTray == 0L )
|
||||
return;
|
||||
|
||||
QString toolTip = mInterface->getSettings().alias;
|
||||
if ( toolTip == QString::null )
|
||||
toolTip = mInterface->getName();
|
||||
new InterfaceToolTip( mInterface, mTray );
|
||||
}
|
||||
|
||||
void InterfaceIcon::updateMenu()
|
||||
{
|
||||
if ( mTray == 0L )
|
||||
return;
|
||||
|
||||
// Remove all old entries.
|
||||
KPopupMenu* menu = mTray->contextMenu();
|
||||
int count = menu->count();
|
||||
for ( int i = 0; i < count - 6; i++ )
|
||||
menu->removeItemAt( 6 );
|
||||
|
||||
InterfaceSettings& settings = mInterface->getSettings();
|
||||
|
||||
// If the user wants statistics, add an entry to show them.
|
||||
if ( settings.activateStatistics )
|
||||
{
|
||||
menu->insertItem( i18n( "Open &Statistics" ), this,
|
||||
SIGNAL( statisticsSelected() ) );
|
||||
}
|
||||
|
||||
// If the user wants custom commands, add them.
|
||||
if ( settings.customCommands )
|
||||
{
|
||||
menu->insertSeparator();
|
||||
QValueVector<InterfaceCommand>::iterator it;
|
||||
for ( it = settings.commands.begin(); it != settings.commands.end(); it++ )
|
||||
(*it).id = menu->insertItem( (*it).menuText );
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceIcon::updateTrayStatus( int previousState )
|
||||
{
|
||||
bool interfaceExists = mInterface->getData().existing;
|
||||
bool interfaceAvailable = mInterface->getData().available;
|
||||
bool hideWhenNotExisting = mInterface->getSettings().hideWhenNotExisting;
|
||||
bool hideWhenNotAvailable = mInterface->getSettings().hideWhenNotAvailable;
|
||||
|
||||
// notification 'interface not available'
|
||||
if ( !interfaceAvailable && mTray != 0L &&
|
||||
previousState == Interface::AVAILABLE )
|
||||
{
|
||||
/* When KNemo is starting we don't show the change in connection
|
||||
* status as this would be annoying when KDE starts.
|
||||
*/
|
||||
QString title;
|
||||
if ( mInterface->getSettings().alias != QString::null )
|
||||
title = mInterface->getSettings().alias;
|
||||
else
|
||||
title = mInterface->getName();
|
||||
|
||||
KNotifyClient::event( mTray->winId(), "knemo_disconnected",
|
||||
title + ":\n" + i18n( "Not connected." ) );
|
||||
/* Wait half a second before deleting the tray so that the call
|
||||
* to the notification daemon has a chance to run before the
|
||||
* winId gets invalid.
|
||||
*/
|
||||
usleep( 500000 );
|
||||
}
|
||||
|
||||
// notification 'interface not existing'
|
||||
if ( !interfaceExists && mTray != 0L &&
|
||||
previousState != Interface::UNKNOWN_STATE )
|
||||
{
|
||||
/* When KNemo is starting we don't show the change in connection
|
||||
* status as this would be annoying when KDE starts.
|
||||
*/
|
||||
QString title;
|
||||
if ( mInterface->getSettings().alias != QString::null )
|
||||
title = mInterface->getSettings().alias;
|
||||
else
|
||||
title = mInterface->getName();
|
||||
|
||||
KNotifyClient::event( mTray->winId(), "knemo_notexisting",
|
||||
title + ":\n" + i18n( "Not existing." ) );
|
||||
/* Wait half a second before deleting the tray so that the call
|
||||
* to the notification daemon has a chance to run before the
|
||||
* winId gets invalid.
|
||||
*/
|
||||
usleep( 500000 );
|
||||
}
|
||||
|
||||
/* Remove the icon if
|
||||
* - the interface is not available and the option to hide it is selected
|
||||
* - the interface does not exist, the option to hide it is selected
|
||||
* and the other option is not selected
|
||||
*/
|
||||
if ( mTray != 0L &&
|
||||
( ( !interfaceAvailable && hideWhenNotAvailable ) ||
|
||||
( !interfaceExists && hideWhenNotExisting && !hideWhenNotAvailable ) ) )
|
||||
{
|
||||
delete mTray;
|
||||
mTray = 0L;
|
||||
}
|
||||
/* Create the icon if
|
||||
* - the interface is available
|
||||
* - the interface is not available and the option to hide it is not
|
||||
* selected and the interface does exist
|
||||
* - the interface does not exist and the option to hide it is not selected
|
||||
* and the other option is not selected
|
||||
*/
|
||||
else if ( mTray == 0L &&
|
||||
( interfaceAvailable ||
|
||||
( !interfaceAvailable && !hideWhenNotAvailable && interfaceExists ) ||
|
||||
( !interfaceExists && !hideWhenNotExisting && !hideWhenNotAvailable ) ) )
|
||||
{
|
||||
mTray = new InterfaceTray( mInterface->getName() );
|
||||
QToolTip::add( mTray, mInterface->getName() );
|
||||
KPopupMenu* menu = mTray->contextMenu();
|
||||
connect( menu, SIGNAL( activated( int ) ),
|
||||
this, SLOT( menuActivated( int ) ) );
|
||||
connect( mTray, SIGNAL( leftClicked() ),
|
||||
mInterface, SLOT( showStatusDialog() ) );
|
||||
connect( mTray, SIGNAL( graphSelected( bool ) ),
|
||||
mInterface, SLOT( showSignalPlotter( bool ) ) );
|
||||
connect( mTray, SIGNAL( configSelected() ),
|
||||
this, SLOT( showConfigDialog() ) );
|
||||
|
||||
updateStatus( mInterface->getState() );
|
||||
updateToolTip();
|
||||
updateMenu();
|
||||
mTray->show();
|
||||
}
|
||||
|
||||
// notification 'interface available'
|
||||
if ( interfaceAvailable && mTray != 0L &&
|
||||
previousState != Interface::UNKNOWN_STATE )
|
||||
{
|
||||
/* When KNemo is starting we don't show the change in connection
|
||||
* status as this would be annoying when KDE starts.
|
||||
*/
|
||||
QString title;
|
||||
if ( mInterface->getSettings().alias != QString::null )
|
||||
title = mInterface->getSettings().alias;
|
||||
else
|
||||
title = mInterface->getName();
|
||||
|
||||
/* Wait half a second before calling the notification daemon
|
||||
* so that the winId of the tray is valid when used below.
|
||||
*/
|
||||
usleep( 500000 );
|
||||
if ( mInterface->getData().wirelessDevice )
|
||||
{
|
||||
KNotifyClient::event( mTray->winId(), "knemo_connected",
|
||||
title + ":\n" + i18n( "Connection established to\n" ) +
|
||||
mInterface->getWirelessData().essid );
|
||||
}
|
||||
else
|
||||
{
|
||||
KNotifyClient::event( mTray->winId(), "knemo_connected",
|
||||
title + ":\n" + i18n( "Connection established." ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceIcon::showConfigDialog()
|
||||
{
|
||||
KNemoDaemon::sSelectedInterface = mInterface->getName();
|
||||
|
||||
KProcess process;
|
||||
process << "kcmshell" << "kcm_knemo";
|
||||
process.start( KProcess::DontCare );
|
||||
}
|
||||
|
||||
void InterfaceIcon::menuActivated( int id )
|
||||
{
|
||||
InterfaceSettings& settings = mInterface->getSettings();
|
||||
QValueVector<InterfaceCommand>::iterator it;
|
||||
for ( it = settings.commands.begin(); it != settings.commands.end(); it++ )
|
||||
{
|
||||
if ( (*it).id == id )
|
||||
{
|
||||
KProcess process;
|
||||
if ( (*it).runAsRoot )
|
||||
{
|
||||
process << "kdesu";
|
||||
process << (*it).command;
|
||||
}
|
||||
else
|
||||
process << QStringList::split( ' ', (*it).command );
|
||||
|
||||
process.start( KProcess::DontCare );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "interfaceicon.moc"
|
@ -0,0 +1,105 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2005 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACEICON_H
|
||||
#define INTERFACEICON_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qstring.h>
|
||||
|
||||
class Interface;
|
||||
class InterfaceTray;
|
||||
|
||||
/**
|
||||
* This is the logical representation of the systemtray icon. It handles
|
||||
* creation and deletion of the real icon, setting the tooltip, setting
|
||||
* the correct icon image and displaying of the settings dialog.
|
||||
*
|
||||
* @short Logical representation of the systemtray icon
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class InterfaceIcon : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
InterfaceIcon( Interface* interface );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~InterfaceIcon();
|
||||
|
||||
/*
|
||||
* Change the tooltip according to the alias of the interface
|
||||
*/
|
||||
void updateToolTip();
|
||||
|
||||
/*
|
||||
* Fill the context menu with entries if the user configured
|
||||
* start and stop command
|
||||
*/
|
||||
void updateMenu();
|
||||
|
||||
signals:
|
||||
void statisticsSelected();
|
||||
|
||||
public slots:
|
||||
/*
|
||||
* Changes the icon image displayed in the tray
|
||||
*/
|
||||
void updateStatus( int status );
|
||||
|
||||
/*
|
||||
* Creates or deletes the tray icon
|
||||
*/
|
||||
void updateTrayStatus( int previousState );
|
||||
|
||||
private slots:
|
||||
/*
|
||||
* Called when the user selects 'Configure KNemo' from the context menu
|
||||
*/
|
||||
void showConfigDialog();
|
||||
|
||||
/*
|
||||
* Called when the user setup custom commands and selects one
|
||||
* in the context menu
|
||||
*/
|
||||
void menuActivated( int id );
|
||||
|
||||
private:
|
||||
// the interface this icon belongs to
|
||||
Interface* mInterface;
|
||||
// the real tray icon
|
||||
InterfaceTray* mTray;
|
||||
|
||||
static const QString ICON_DISCONNECTED;
|
||||
static const QString ICON_CONNECTED;
|
||||
static const QString ICON_INCOMING;
|
||||
static const QString ICON_OUTGOING;
|
||||
static const QString ICON_TRAFFIC;
|
||||
static const QString SUFFIX_PPP;
|
||||
static const QString SUFFIX_LAN;
|
||||
static const QString SUFFIX_WLAN;
|
||||
};
|
||||
|
||||
#endif // INTERFACEICON_H
|
@ -0,0 +1,100 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "interfacemonitor.h"
|
||||
|
||||
InterfaceMonitor::InterfaceMonitor( QObject* parent, const char* name )
|
||||
: QObject( parent, name )
|
||||
{
|
||||
}
|
||||
|
||||
InterfaceMonitor::~InterfaceMonitor()
|
||||
{
|
||||
}
|
||||
|
||||
void InterfaceMonitor::checkStatus( Interface* interface )
|
||||
{
|
||||
int currentState;
|
||||
int previousState = interface->getState();
|
||||
InterfaceData& data = interface->getData();
|
||||
int trafficThreshold = interface->getSettings().trafficThreshold;
|
||||
|
||||
if ( !data.existing )
|
||||
// the interface does not exist
|
||||
currentState = Interface::NOT_EXISTING;
|
||||
else if ( !data.available )
|
||||
// the interface exists but is not connected
|
||||
currentState = Interface::NOT_AVAILABLE;
|
||||
else
|
||||
{
|
||||
// the interface is connected, look for traffic
|
||||
currentState = Interface::AVAILABLE;
|
||||
if ( ( data.rxPackets - data.prevRxPackets ) > (unsigned int) trafficThreshold )
|
||||
currentState |= Interface::RX_TRAFFIC;
|
||||
if ( ( data.txPackets - data.prevTxPackets ) > (unsigned int) trafficThreshold )
|
||||
currentState |= Interface::TX_TRAFFIC;
|
||||
}
|
||||
|
||||
// update the statistics
|
||||
if ( data.incomingBytes > 0 )
|
||||
{
|
||||
emit incomingData( data.incomingBytes );
|
||||
}
|
||||
if ( data.outgoingBytes > 0 )
|
||||
{
|
||||
emit outgoingData( data.outgoingBytes );
|
||||
}
|
||||
|
||||
data.prevRxPackets = data.rxPackets;
|
||||
data.prevTxPackets = data.txPackets;
|
||||
|
||||
if ( ( previousState == Interface::NOT_EXISTING ||
|
||||
previousState == Interface::NOT_AVAILABLE ||
|
||||
previousState == Interface::UNKNOWN_STATE ) &&
|
||||
currentState & Interface::AVAILABLE )
|
||||
{
|
||||
emit available( previousState );
|
||||
}
|
||||
else if ( ( previousState == Interface::NOT_EXISTING ||
|
||||
previousState & Interface::AVAILABLE ||
|
||||
previousState == Interface::UNKNOWN_STATE ) &&
|
||||
currentState == Interface::NOT_AVAILABLE )
|
||||
{
|
||||
emit notAvailable( previousState );
|
||||
}
|
||||
else if ( ( previousState == Interface::NOT_AVAILABLE ||
|
||||
previousState & Interface::AVAILABLE ||
|
||||
previousState == Interface::UNKNOWN_STATE ) &&
|
||||
currentState == Interface::NOT_EXISTING )
|
||||
{
|
||||
emit notExisting( previousState );
|
||||
}
|
||||
|
||||
// make sure the icon fits the current state
|
||||
if ( previousState != currentState )
|
||||
{
|
||||
emit statusChanged( currentState );
|
||||
interface->setState( currentState );
|
||||
}
|
||||
}
|
||||
|
||||
#include "interfacemonitor.moc"
|
@ -0,0 +1,72 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACEMONITOR_H
|
||||
#define INTERFACEMONITOR_H
|
||||
|
||||
#include <qobject.h>
|
||||
|
||||
#include "data.h"
|
||||
|
||||
class Interface;
|
||||
|
||||
/**
|
||||
* This class monitors the interface for possible state changes and
|
||||
* for incoming and outgong traffic. If the state changed or traffic
|
||||
* was transmitted it sends an according signal.
|
||||
*
|
||||
* @short Monitor changes of the interface
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class InterfaceMonitor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
InterfaceMonitor(QObject* parent = 0L, const char* name = 0L);
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~InterfaceMonitor();
|
||||
|
||||
/**
|
||||
* Tell the monitor to check the status of the interface
|
||||
*/
|
||||
void checkStatus( Interface* interface );
|
||||
|
||||
signals:
|
||||
// the interface is now connected
|
||||
void available( int );
|
||||
// the interface is now disconnected
|
||||
void notAvailable( int );
|
||||
// the interface no longer exists
|
||||
void notExisting( int );
|
||||
// there was incoming and/or outgoing traffic
|
||||
void statusChanged( int );
|
||||
// the amount of incoming traffic (for statistics)
|
||||
void incomingData( unsigned long );
|
||||
// the amount of outgoing traffic (for statistics)
|
||||
void outgoingData( unsigned long );
|
||||
};
|
||||
|
||||
#endif // INTERFACEMONITOR_H
|
@ -0,0 +1,384 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2005, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <qdom.h>
|
||||
#include <qfile.h>
|
||||
#include <qtimer.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
|
||||
#include "interface.h"
|
||||
#include "interfacestatistics.h"
|
||||
|
||||
InterfaceStatistics::InterfaceStatistics( Interface* interface )
|
||||
: QObject(),
|
||||
mInterface( interface )
|
||||
{
|
||||
mDayStatistics.setAutoDelete( true );
|
||||
mMonthStatistics.setAutoDelete( true );
|
||||
mYearStatistics.setAutoDelete( true );
|
||||
initStatistics();
|
||||
|
||||
mSaveTimer = new QTimer();
|
||||
connect( mSaveTimer, SIGNAL( timeout() ), this, SLOT( saveStatistics() ) );
|
||||
mSaveTimer->start( mInterface->getGeneralData().saveInterval * 1000 );
|
||||
}
|
||||
|
||||
InterfaceStatistics::~InterfaceStatistics()
|
||||
{
|
||||
mSaveTimer->stop();
|
||||
delete mSaveTimer;
|
||||
|
||||
mDayStatistics.clear();
|
||||
mMonthStatistics.clear();
|
||||
mYearStatistics.clear();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::loadStatistics()
|
||||
{
|
||||
QDomDocument doc( "statistics" );
|
||||
QString dir = mInterface->getGeneralData().statisticsDir;
|
||||
QFile file( dir + "/statistics_" + mInterface->getName() );
|
||||
|
||||
if ( !file.open( IO_ReadOnly ) )
|
||||
return;
|
||||
if ( !doc.setContent( &file ) )
|
||||
{
|
||||
file.close();
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
|
||||
mDayStatistics.clear();
|
||||
mMonthStatistics.clear();
|
||||
mYearStatistics.clear();
|
||||
|
||||
QDomElement root = doc.documentElement();
|
||||
QDomNode n = root.namedItem( "days" );
|
||||
if ( !n.isNull() )
|
||||
{
|
||||
QDomNode dayNode = n.firstChild();
|
||||
while ( !dayNode.isNull() )
|
||||
{
|
||||
QDomElement day = dayNode.toElement();
|
||||
if ( !day.isNull() )
|
||||
{
|
||||
StatisticEntry* entry = new StatisticEntry();
|
||||
entry->day = day.attribute( "day" ).toInt();
|
||||
entry->month = day.attribute( "month" ).toInt();
|
||||
entry->year = day.attribute( "year" ).toInt();
|
||||
entry->rxBytes = (Q_UINT64) day.attribute( "rxBytes" ).toDouble();
|
||||
entry->txBytes = (Q_UINT64) day.attribute( "txBytes" ).toDouble();
|
||||
mDayStatistics.append( entry );
|
||||
}
|
||||
dayNode = dayNode.nextSibling();
|
||||
}
|
||||
mDayStatistics.sort();
|
||||
}
|
||||
|
||||
n = root.namedItem( "months" );
|
||||
if ( !n.isNull() )
|
||||
{
|
||||
QDomNode monthNode = n.firstChild();
|
||||
while ( !monthNode.isNull() )
|
||||
{
|
||||
QDomElement month = monthNode.toElement();
|
||||
if ( !month.isNull() )
|
||||
{
|
||||
StatisticEntry* entry = new StatisticEntry();
|
||||
entry->day = 0;
|
||||
entry->month = month.attribute( "month" ).toInt();
|
||||
entry->year = month.attribute( "year" ).toInt();
|
||||
entry->rxBytes = (Q_UINT64) month.attribute( "rxBytes" ).toDouble();
|
||||
entry->txBytes = (Q_UINT64) month.attribute( "txBytes" ).toDouble();
|
||||
mMonthStatistics.append( entry );
|
||||
}
|
||||
monthNode = monthNode.nextSibling();
|
||||
}
|
||||
mMonthStatistics.sort();
|
||||
}
|
||||
|
||||
n = root.namedItem( "years" );
|
||||
if ( !n.isNull() )
|
||||
{
|
||||
QDomNode yearNode = n.firstChild();
|
||||
while ( !yearNode.isNull() )
|
||||
{
|
||||
QDomElement year = yearNode.toElement();
|
||||
if ( !year.isNull() )
|
||||
{
|
||||
StatisticEntry* entry = new StatisticEntry();
|
||||
entry->day = 0;
|
||||
entry->month = 0;
|
||||
entry->year = year.attribute( "year" ).toInt();
|
||||
entry->rxBytes = (Q_UINT64) year.attribute( "rxBytes" ).toDouble();
|
||||
entry->txBytes = (Q_UINT64) year.attribute( "txBytes" ).toDouble();
|
||||
mYearStatistics.append( entry );
|
||||
}
|
||||
yearNode = yearNode.nextSibling();
|
||||
}
|
||||
mYearStatistics.sort();
|
||||
}
|
||||
initStatistics();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::saveStatistics()
|
||||
{
|
||||
QDomDocument doc( "statistics" );
|
||||
QDomElement root = doc.createElement( "statistics" );
|
||||
doc.appendChild( root );
|
||||
|
||||
QDomElement days = doc.createElement( "days" );
|
||||
StatisticEntry* iterator = mDayStatistics.first();
|
||||
while ( iterator )
|
||||
{
|
||||
QDomElement day = doc.createElement( "day" );
|
||||
day.setAttribute( "day", iterator->day );
|
||||
day.setAttribute( "month", iterator->month );
|
||||
day.setAttribute( "year", iterator->year );
|
||||
day.setAttribute( "rxBytes", (double) iterator->rxBytes );
|
||||
day.setAttribute( "txBytes", (double) iterator->txBytes );
|
||||
days.appendChild( day );
|
||||
iterator = mDayStatistics.next();
|
||||
}
|
||||
root.appendChild( days );
|
||||
|
||||
QDomElement months = doc.createElement( "months" );
|
||||
iterator = mMonthStatistics.first();
|
||||
while ( iterator )
|
||||
{
|
||||
QDomElement month = doc.createElement( "month" );
|
||||
month.setAttribute( "month", iterator->month );
|
||||
month.setAttribute( "year", iterator->year );
|
||||
month.setAttribute( "rxBytes", (double) iterator->rxBytes );
|
||||
month.setAttribute( "txBytes", (double) iterator->txBytes );
|
||||
months.appendChild( month );
|
||||
iterator = mMonthStatistics.next();
|
||||
}
|
||||
root.appendChild( months );
|
||||
|
||||
QDomElement years = doc.createElement( "years" );
|
||||
iterator = mYearStatistics.first();
|
||||
while ( iterator )
|
||||
{
|
||||
QDomElement year = doc.createElement( "year" );
|
||||
year.setAttribute( "year", iterator->year );
|
||||
year.setAttribute( "rxBytes", (double) iterator->rxBytes );
|
||||
year.setAttribute( "txBytes", (double) iterator->txBytes );
|
||||
years.appendChild( year );
|
||||
iterator = mYearStatistics.next();
|
||||
}
|
||||
root.appendChild( years );
|
||||
|
||||
QString dir = mInterface->getGeneralData().statisticsDir;
|
||||
QFile file( dir + "/statistics_" + mInterface->getName() );
|
||||
if ( !file.open( IO_WriteOnly ) )
|
||||
return;
|
||||
|
||||
QTextStream stream( &file );
|
||||
stream << doc.toString();
|
||||
file.close();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::configChanged()
|
||||
{
|
||||
// restart the timer with the new value
|
||||
mSaveTimer->changeInterval( mInterface->getGeneralData().saveInterval * 1000 );
|
||||
}
|
||||
|
||||
const StatisticEntry* InterfaceStatistics::getCurrentDay() const
|
||||
{
|
||||
return mCurrentDay;
|
||||
}
|
||||
|
||||
const StatisticEntry* InterfaceStatistics::getCurrentMonth() const
|
||||
{
|
||||
return mCurrentMonth;
|
||||
}
|
||||
|
||||
const StatisticEntry* InterfaceStatistics::getCurrentYear() const
|
||||
{
|
||||
return mCurrentYear;
|
||||
}
|
||||
|
||||
const StatisticsPtrList<StatisticEntry>& InterfaceStatistics::getDayStatistics() const
|
||||
{
|
||||
return mDayStatistics;
|
||||
}
|
||||
|
||||
const StatisticsPtrList<StatisticEntry>& InterfaceStatistics::getMonthStatistics() const
|
||||
{
|
||||
return mMonthStatistics;
|
||||
}
|
||||
|
||||
const StatisticsPtrList<StatisticEntry>& InterfaceStatistics::getYearStatistics() const
|
||||
{
|
||||
return mYearStatistics;
|
||||
}
|
||||
|
||||
void InterfaceStatistics::addIncomingData( unsigned long data )
|
||||
{
|
||||
checkCurrentEntry();
|
||||
|
||||
mCurrentDay->rxBytes += data;
|
||||
mCurrentMonth->rxBytes += data;
|
||||
mCurrentYear->rxBytes += data;
|
||||
|
||||
emit currentEntryChanged();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::addOutgoingData( unsigned long data )
|
||||
{
|
||||
checkCurrentEntry();
|
||||
|
||||
mCurrentDay->txBytes += data;
|
||||
mCurrentMonth->txBytes += data;
|
||||
mCurrentYear->txBytes += data;
|
||||
|
||||
emit currentEntryChanged();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::clearDayStatistics()
|
||||
{
|
||||
mDayStatistics.clear();
|
||||
updateCurrentDay();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::clearMonthStatistics()
|
||||
{
|
||||
mMonthStatistics.clear();
|
||||
updateCurrentMonth();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::clearYearStatistics()
|
||||
{
|
||||
mYearStatistics.clear();
|
||||
updateCurrentYear();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::checkCurrentEntry()
|
||||
{
|
||||
if ( mCurrentDay->day != QDate::currentDate().day() ||
|
||||
mCurrentDay->month != QDate::currentDate().month() ||
|
||||
mCurrentDay->year != QDate::currentDate().year() )
|
||||
{
|
||||
// current day has changed
|
||||
updateCurrentDay();
|
||||
|
||||
if ( mCurrentMonth->month != QDate::currentDate().month() ||
|
||||
mCurrentMonth->year != QDate::currentDate().year() )
|
||||
{
|
||||
// current month has also changed
|
||||
updateCurrentMonth();
|
||||
}
|
||||
|
||||
if ( mCurrentYear->year != QDate::currentDate().year() )
|
||||
{
|
||||
// current year has also changed
|
||||
updateCurrentYear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceStatistics::initStatistics()
|
||||
{
|
||||
updateCurrentDay();
|
||||
updateCurrentMonth();
|
||||
updateCurrentYear();
|
||||
|
||||
emit currentEntryChanged();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::updateCurrentDay()
|
||||
{
|
||||
mCurrentDay = mDayStatistics.first();
|
||||
while ( mCurrentDay )
|
||||
{
|
||||
if ( mCurrentDay->day == QDate::currentDate().day() &&
|
||||
mCurrentDay->month == QDate::currentDate().month() &&
|
||||
mCurrentDay->year == QDate::currentDate().year() )
|
||||
{
|
||||
// found current day in list
|
||||
return;
|
||||
}
|
||||
mCurrentDay = mDayStatistics.next();
|
||||
}
|
||||
|
||||
// the current day is not in the list
|
||||
mCurrentDay = new StatisticEntry();
|
||||
mCurrentDay->day = QDate::currentDate().day();
|
||||
mCurrentDay->month = QDate::currentDate().month();
|
||||
mCurrentDay->year = QDate::currentDate().year();
|
||||
mCurrentDay->rxBytes = 0;
|
||||
mCurrentDay->txBytes = 0;
|
||||
mDayStatistics.append( mCurrentDay ); // TODO: insert at correct position
|
||||
emit dayStatisticsChanged();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::updateCurrentMonth()
|
||||
{
|
||||
mCurrentMonth = mMonthStatistics.first();
|
||||
while ( mCurrentMonth )
|
||||
{
|
||||
if ( mCurrentMonth->month == QDate::currentDate().month() &&
|
||||
mCurrentMonth->year == QDate::currentDate().year() )
|
||||
{
|
||||
// found current month in list
|
||||
return;
|
||||
}
|
||||
mCurrentMonth = mMonthStatistics.next();
|
||||
}
|
||||
|
||||
// the current month is not in the list
|
||||
mCurrentMonth = new StatisticEntry();
|
||||
mCurrentMonth->day = 0;
|
||||
mCurrentMonth->month = QDate::currentDate().month();
|
||||
mCurrentMonth->year = QDate::currentDate().year();
|
||||
mCurrentMonth->rxBytes = 0;
|
||||
mCurrentMonth->txBytes = 0;
|
||||
mMonthStatistics.append( mCurrentMonth ); // TODO: insert at correct position
|
||||
emit monthStatisticsChanged();
|
||||
}
|
||||
|
||||
void InterfaceStatistics::updateCurrentYear()
|
||||
{
|
||||
mCurrentYear = mYearStatistics.first();
|
||||
while ( mCurrentYear )
|
||||
{
|
||||
if ( mCurrentYear->year == QDate::currentDate().year() )
|
||||
{
|
||||
// found current year in list
|
||||
return;
|
||||
}
|
||||
mCurrentYear = mYearStatistics.next();
|
||||
}
|
||||
|
||||
// the current year is not in the list
|
||||
mCurrentYear = new StatisticEntry();
|
||||
mCurrentYear->day = 0;
|
||||
mCurrentYear->month = 0;
|
||||
mCurrentYear->year = QDate::currentDate().year();
|
||||
mCurrentYear->rxBytes = 0;
|
||||
mCurrentYear->txBytes = 0;
|
||||
mYearStatistics.append( mCurrentYear ); // TODO: insert at correct position
|
||||
emit yearStatisticsChanged();
|
||||
}
|
||||
|
@ -0,0 +1,191 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2005, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACESTATISTICS_H
|
||||
#define INTERFACESTATISTICS_H
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qptrlist.h>
|
||||
|
||||
#include "global.h"
|
||||
|
||||
class QTimer;
|
||||
class Interface;
|
||||
|
||||
template<class type>
|
||||
class StatisticsPtrList : public QPtrList<type>
|
||||
{
|
||||
protected:
|
||||
virtual int compareItems ( QPtrCollection::Item item1, QPtrCollection::Item item2 )
|
||||
{
|
||||
StatisticEntry* entry1 = static_cast<StatisticEntry*>( item1 );
|
||||
StatisticEntry* entry2 = static_cast<StatisticEntry*>( item2 );
|
||||
|
||||
if ( entry1->year > entry2->year )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if ( entry2->year > entry1->year )
|
||||
{
|
||||
return -1;
|
||||
} // ...here we know that years are the same...
|
||||
else if ( entry1->month > entry2->month )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if ( entry2->month > entry1->month )
|
||||
{
|
||||
return -1;
|
||||
} // ...here we know that months are the same...
|
||||
else if ( entry1->day > entry2->day )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else if ( entry2->day > entry1->day )
|
||||
{
|
||||
return -1;
|
||||
} // ...here we know that dates are equal.
|
||||
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* This class is able to collect transfered data for an interface,
|
||||
* store it in a file and deliver it on request.
|
||||
*
|
||||
* @short Statistics of transfered data for an interface
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class InterfaceStatistics : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
InterfaceStatistics( Interface* interface );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~InterfaceStatistics();
|
||||
|
||||
/**
|
||||
* Load the statistics from a xml file
|
||||
*/
|
||||
void loadStatistics();
|
||||
|
||||
/**
|
||||
* Called from Interface::configChanged() when the user
|
||||
* changed the settings.
|
||||
*/
|
||||
void configChanged();
|
||||
|
||||
const StatisticEntry* getCurrentDay() const;
|
||||
const StatisticEntry* getCurrentMonth() const;
|
||||
const StatisticEntry* getCurrentYear() const;
|
||||
const StatisticsPtrList<StatisticEntry>& getDayStatistics() const;
|
||||
const StatisticsPtrList<StatisticEntry>& getMonthStatistics() const;
|
||||
const StatisticsPtrList<StatisticEntry>& getYearStatistics() const;
|
||||
|
||||
signals:
|
||||
/**
|
||||
* The current entry has changed. There is only one signal
|
||||
* for day, month and year because if the day changes,
|
||||
* month and year also change.
|
||||
*/
|
||||
void currentEntryChanged();
|
||||
/**
|
||||
* The list has changed i.e. there is a new day entry or the list was cleared
|
||||
*/
|
||||
void dayStatisticsChanged();
|
||||
/**
|
||||
* The list has changed i.e. there is a new month entry or the list was cleared
|
||||
*/
|
||||
void monthStatisticsChanged();
|
||||
/**
|
||||
* The list has changed i.e. there is a new year entry or the list was cleared
|
||||
*/
|
||||
void yearStatisticsChanged();
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Save the statistics to a xml file
|
||||
* (slot so it can be triggered by a timer signal)
|
||||
*/
|
||||
void saveStatistics();
|
||||
/**
|
||||
* Add incoming data to the current day, month and year
|
||||
*/
|
||||
void addIncomingData( unsigned long data );
|
||||
/**
|
||||
* Add outgoing data to the current day, month and year
|
||||
*/
|
||||
void addOutgoingData( unsigned long data );
|
||||
/**
|
||||
* Clear all entries of the day statistics
|
||||
*/
|
||||
void clearDayStatistics();
|
||||
/**
|
||||
* Clear all entries of the month statistics
|
||||
*/
|
||||
void clearMonthStatistics();
|
||||
/**
|
||||
* Clear all entries of the year statistics
|
||||
*/
|
||||
void clearYearStatistics();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Make sure the current entry corresponds with the current date
|
||||
*/
|
||||
void checkCurrentEntry();
|
||||
/**
|
||||
* Fill the statistics with a current entry
|
||||
*/
|
||||
void initStatistics();
|
||||
/**
|
||||
* Check if the current day is in the day statistics. If found set
|
||||
* mCurrentDay to the found entry else create a new one.
|
||||
*/
|
||||
void updateCurrentDay();
|
||||
/**
|
||||
* Check if the current month is in the month statistics. If found set
|
||||
* mCurrentMonth to the found entry else create a new one.
|
||||
*/
|
||||
void updateCurrentMonth();
|
||||
/**
|
||||
* Check if the current year is in the year statistics. If found set
|
||||
* mCurrentYear to the found entry else create a new one.
|
||||
*/
|
||||
void updateCurrentYear();
|
||||
|
||||
QTimer* mSaveTimer;
|
||||
Interface* mInterface;
|
||||
StatisticEntry* mCurrentDay;
|
||||
StatisticEntry* mCurrentMonth;
|
||||
StatisticEntry* mCurrentYear;
|
||||
StatisticsPtrList<StatisticEntry> mDayStatistics;
|
||||
StatisticsPtrList<StatisticEntry> mMonthStatistics;
|
||||
StatisticsPtrList<StatisticEntry> mYearStatistics;
|
||||
};
|
||||
|
||||
#endif // INTERFACESTATISTICS_H
|
@ -0,0 +1,139 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <qtable.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include <klocale.h>
|
||||
#include <kio/global.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kcalendarsystem.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "interface.h"
|
||||
#include "interfacestatistics.h"
|
||||
#include "interfacestatisticsdialog.h"
|
||||
|
||||
/*
|
||||
* I assume that the last entry in each table is also the current. This will fail
|
||||
* if we walk back in time, so better not play with the system date...
|
||||
*/
|
||||
|
||||
InterfaceStatisticsDialog::InterfaceStatisticsDialog( Interface* interface, QWidget* parent, const char* name )
|
||||
: InterfaceStatisticsDlg( parent, name ),
|
||||
mInterface( interface )
|
||||
{
|
||||
setIcon( SmallIcon( "knemo" ) );
|
||||
setCaption( interface->getName() + " " + i18n( "Statistics" ) );
|
||||
|
||||
connect( buttonClearDaily, SIGNAL( clicked() ), SIGNAL( clearDailyStatisticsClicked() ) );
|
||||
connect( buttonClearMonthly, SIGNAL( clicked() ), SIGNAL( clearMonthlyStatisticsClicked() ) );
|
||||
connect( buttonClearYearly, SIGNAL( clicked() ), SIGNAL( clearYearlyStatisticsClicked() ) );
|
||||
}
|
||||
|
||||
InterfaceStatisticsDialog::~InterfaceStatisticsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void InterfaceStatisticsDialog::updateDays()
|
||||
{
|
||||
QPtrList<StatisticEntry> dayStatistics = mInterface->getStatistics()->getDayStatistics();
|
||||
StatisticEntry* iterator = dayStatistics.first();
|
||||
tableDaily->setNumRows( dayStatistics.count() );
|
||||
int row = 0;
|
||||
while ( iterator )
|
||||
{
|
||||
QDate date( iterator->year, iterator->month, iterator->day );
|
||||
tableDaily->verticalHeader()->setLabel( row, KGlobal::locale()->formatDate( date, true ) );
|
||||
tableDaily->setText( row, 0, KIO::convertSize( iterator->txBytes ) );
|
||||
tableDaily->setText( row, 1, KIO::convertSize( iterator->rxBytes ) );
|
||||
tableDaily->setText( row, 2, KIO::convertSize( iterator->rxBytes + iterator->txBytes ) );
|
||||
row++;
|
||||
iterator = dayStatistics.next();
|
||||
}
|
||||
|
||||
tableDaily->setCurrentCell( row - 1, 2 );
|
||||
tableDaily->ensureCellVisible( row - 1, 2 );
|
||||
}
|
||||
|
||||
void InterfaceStatisticsDialog::updateMonths()
|
||||
{
|
||||
QPtrList<StatisticEntry> monthStatistics = mInterface->getStatistics()->getMonthStatistics();
|
||||
StatisticEntry* iterator = monthStatistics.first();
|
||||
tableMonthly->setNumRows( monthStatistics.count() );
|
||||
int row = 0;
|
||||
while ( iterator )
|
||||
{
|
||||
const KCalendarSystem* calendar = KGlobal::locale()->calendar();
|
||||
QString monthName = calendar->monthName( iterator->month, iterator->year ) + " " + QString::number( iterator->year );
|
||||
tableMonthly->verticalHeader()->setLabel( row, monthName );
|
||||
tableMonthly->setText( row, 0, KIO::convertSize( iterator->txBytes ) );
|
||||
tableMonthly->setText( row, 1, KIO::convertSize( iterator->rxBytes ) );
|
||||
tableMonthly->setText( row, 2, KIO::convertSize( iterator->rxBytes + iterator->txBytes ) );
|
||||
row++;
|
||||
iterator = monthStatistics.next();
|
||||
}
|
||||
|
||||
tableMonthly->setCurrentCell( row - 1, 2 );
|
||||
tableMonthly->ensureCellVisible( row - 1, 2 );
|
||||
}
|
||||
|
||||
void InterfaceStatisticsDialog::updateYears()
|
||||
{
|
||||
QPtrList<StatisticEntry> yearStatistics = mInterface->getStatistics()->getYearStatistics();
|
||||
StatisticEntry* iterator = yearStatistics.first();
|
||||
tableYearly->setNumRows( yearStatistics.count() );
|
||||
int row = 0;
|
||||
while ( iterator )
|
||||
{
|
||||
tableYearly->verticalHeader()->setLabel( row, QString::number( iterator->year ) );
|
||||
tableYearly->setText( row, 0, KIO::convertSize( iterator->txBytes ) );
|
||||
tableYearly->setText( row, 1, KIO::convertSize( iterator->rxBytes ) );
|
||||
tableYearly->setText( row, 2, KIO::convertSize( iterator->rxBytes + iterator->txBytes ) );
|
||||
row++;
|
||||
iterator = yearStatistics.next();
|
||||
}
|
||||
|
||||
tableYearly->setCurrentCell( row - 1, 2 );
|
||||
tableYearly->ensureCellVisible( row - 1, 2 );
|
||||
}
|
||||
|
||||
void InterfaceStatisticsDialog::updateCurrentEntry()
|
||||
{
|
||||
int lastRow = tableDaily->numRows() - 1;
|
||||
const StatisticEntry* currentEntry = mInterface->getStatistics()->getCurrentDay();
|
||||
tableDaily->setText( lastRow, 0, KIO::convertSize( currentEntry->txBytes ) );
|
||||
tableDaily->setText( lastRow, 1, KIO::convertSize( currentEntry->rxBytes ) );
|
||||
tableDaily->setText( lastRow, 2, KIO::convertSize( currentEntry->rxBytes + currentEntry->txBytes ) );
|
||||
|
||||
lastRow = tableMonthly->numRows() - 1;
|
||||
currentEntry = mInterface->getStatistics()->getCurrentMonth();
|
||||
tableMonthly->setText( lastRow, 0, KIO::convertSize( currentEntry->txBytes ) );
|
||||
tableMonthly->setText( lastRow, 1, KIO::convertSize( currentEntry->rxBytes ) );
|
||||
tableMonthly->setText( lastRow, 2, KIO::convertSize( currentEntry->rxBytes + currentEntry->txBytes ) );
|
||||
|
||||
lastRow = tableYearly->numRows() - 1;
|
||||
currentEntry = mInterface->getStatistics()->getCurrentYear();
|
||||
tableYearly->setText( lastRow, 0, KIO::convertSize( currentEntry->txBytes ) );
|
||||
tableYearly->setText( lastRow, 1, KIO::convertSize( currentEntry->rxBytes ) );
|
||||
tableYearly->setText( lastRow, 2, KIO::convertSize( currentEntry->rxBytes + currentEntry->txBytes ) );
|
||||
}
|
||||
|
||||
#include "interfacestatisticsdialog.moc"
|
@ -0,0 +1,68 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACESTATISTICSDIALOG_H
|
||||
#define INTERFACESTATISTICSDIALOG_H
|
||||
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "interfacestatisticsdlg.h"
|
||||
|
||||
class QTimer;
|
||||
class Interface;
|
||||
|
||||
/**
|
||||
* This class shows the statistics dialog. It contains the tables for the
|
||||
* different statistics.
|
||||
*
|
||||
* @short Statistics dialog
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class InterfaceStatisticsDialog : public InterfaceStatisticsDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
InterfaceStatisticsDialog( Interface* interface,
|
||||
QWidget* parent = 0L, const char* name = 0L );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~InterfaceStatisticsDialog();
|
||||
|
||||
signals:
|
||||
void clearDailyStatisticsClicked();
|
||||
void clearMonthlyStatisticsClicked();
|
||||
void clearYearlyStatisticsClicked();
|
||||
|
||||
public slots:
|
||||
void updateDays();
|
||||
void updateMonths();
|
||||
void updateYears();
|
||||
void updateCurrentEntry();
|
||||
|
||||
private:
|
||||
Interface* mInterface;
|
||||
};
|
||||
|
||||
#endif // INTERFACESTATISTICSDIALOG_H
|
@ -0,0 +1,230 @@
|
||||
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
|
||||
<class>InterfaceStatisticsDlg</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>InterfaceStatisticsDlg</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>490</width>
|
||||
<height>502</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Statistics</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QPushButton" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>buttonClose</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" row="0" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>tabWidget</cstring>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>daily</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Daily</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QTable">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Total</string>
|
||||
</property>
|
||||
</column>
|
||||
<property name="name">
|
||||
<cstring>tableDaily</cstring>
|
||||
</property>
|
||||
<property name="numRows">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="numCols">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonClearDaily</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear daily statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>monthy</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Monthly</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QTable">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Total</string>
|
||||
</property>
|
||||
</column>
|
||||
<property name="name">
|
||||
<cstring>tableMonthly</cstring>
|
||||
</property>
|
||||
<property name="numRows">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="numCols">
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonClearMonthly</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear monthly statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>yearly</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Yearly</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QTable">
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Total</string>
|
||||
</property>
|
||||
</column>
|
||||
<property name="name">
|
||||
<cstring>tableYearly</cstring>
|
||||
</property>
|
||||
<property name="numRows">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="numCols">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>buttonClearYearly</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear yearly statistics</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
</widget>
|
||||
<spacer row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>spacer28</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>211</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<spacer row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>spacer29</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>201</width>
|
||||
<height>31</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonClose</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>InterfaceStatisticsDlg</receiver>
|
||||
<slot>close()</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -0,0 +1,308 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include <qtimer.h>
|
||||
#include <qlabel.h>
|
||||
#include <qstring.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtabwidget.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kconfig.h>
|
||||
#include <klocale.h>
|
||||
#include <kglobal.h>
|
||||
#include <kiconloader.h>
|
||||
#include <kactivelabel.h>
|
||||
#include <kio/global.h>
|
||||
|
||||
#include "data.h"
|
||||
#include "interface.h"
|
||||
#include "interfacestatistics.h"
|
||||
#include "interfacestatusdialog.h"
|
||||
|
||||
InterfaceStatusDialog::InterfaceStatusDialog( Interface* interface, QWidget* parent, const char* name )
|
||||
: InterfaceStatusDlg( parent, name ),
|
||||
mPosInitialized( false ),
|
||||
mInterface( interface )
|
||||
{
|
||||
setIcon( SmallIcon( "knemo" ) );
|
||||
setCaption( interface->getName() + " " + i18n( "Interface Status" ) );
|
||||
updateDialog();
|
||||
if ( interface->getData().available )
|
||||
{
|
||||
enableNetworkGroups( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
disableNetworkGroups( 0 );
|
||||
}
|
||||
if ( !interface->getData().wirelessDevice )
|
||||
{
|
||||
QWidget* wirelessTab = tabWidget->page( 2 );
|
||||
tabWidget->removePage( wirelessTab );
|
||||
delete wirelessTab;
|
||||
}
|
||||
|
||||
if ( !interface->getSettings().activateStatistics )
|
||||
{
|
||||
setStatisticsGroupEnabled( false );
|
||||
}
|
||||
|
||||
// Restore window size and position.
|
||||
KConfig* config = new KConfig( "knemorc", false );
|
||||
if ( config->hasGroup( "Interface_" + mInterface->getName() ) )
|
||||
{
|
||||
config->setGroup( "Interface_" + mInterface->getName() );
|
||||
if ( config->hasKey( "StatusX" ) && config->hasKey( "StatusY" ) )
|
||||
{
|
||||
mPos.setX( config->readNumEntry( "StatusX" ) );
|
||||
mPos.setY( config->readNumEntry( "StatusY" ) );
|
||||
mPosInitialized = true;
|
||||
}
|
||||
if ( config->hasKey( "StatusWidth" ) && config->hasKey( "StatusHeight" ) )
|
||||
resize( config->readNumEntry( "StatusWidth" ),
|
||||
config->readNumEntry( "StatusHeight" ) );
|
||||
}
|
||||
delete config;
|
||||
|
||||
statisticsChanged();
|
||||
|
||||
mTimer = new QTimer();
|
||||
connect( mTimer, SIGNAL( timeout() ), this, SLOT( updateDialog() ) );
|
||||
mTimer->start( 1000 );
|
||||
}
|
||||
|
||||
InterfaceStatusDialog::~InterfaceStatusDialog()
|
||||
{
|
||||
mTimer->stop();
|
||||
delete mTimer;
|
||||
|
||||
// Store window size and position.
|
||||
KConfig* config = new KConfig( "knemorc", false );
|
||||
if ( config->hasGroup( "Interface_" + mInterface->getName() ) )
|
||||
{
|
||||
config->setGroup( "Interface_" + mInterface->getName() );
|
||||
config->writeEntry( "StatusX", x() );
|
||||
config->writeEntry( "StatusY", y() );
|
||||
config->writeEntry( "StatusWidth", width() );
|
||||
config->writeEntry( "StatusHeight", height() );
|
||||
config->sync();
|
||||
}
|
||||
delete config;
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::hide()
|
||||
{
|
||||
mPos = pos();
|
||||
mPosInitialized = true;
|
||||
QDialog::hide();
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::show()
|
||||
{
|
||||
QDialog::show();
|
||||
/**
|
||||
* mPosInitialized should always be true, except when
|
||||
* starting KNemo for the very first time.
|
||||
*/
|
||||
if ( mPosInitialized )
|
||||
move( mPos );
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::setStatisticsGroupEnabled( bool enabled )
|
||||
{
|
||||
groupBoxStatistics->setEnabled( enabled );
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::updateDialog()
|
||||
{
|
||||
InterfaceData& data = mInterface->getData();
|
||||
InterfaceSettings& settings = mInterface->getSettings();
|
||||
|
||||
// connection tab
|
||||
textLabelInterface->setText( mInterface->getName() );
|
||||
textLabelAlias->setText( settings.alias );
|
||||
if ( data.available )
|
||||
{
|
||||
textLabelStatus->setText( i18n( "Connection established." ) );
|
||||
int upsecs = mInterface->getStartTime().secsTo( QDateTime::currentDateTime() );
|
||||
int updays = upsecs / 86400; // don't use QDateTime::daysTo() because
|
||||
// we only want complete days
|
||||
|
||||
QString uptime;
|
||||
if ( updays == 1 )
|
||||
uptime = "1 day, ";
|
||||
else if ( updays > 1 )
|
||||
uptime = QString( "%1 days, " ).arg( updays );
|
||||
|
||||
upsecs -= 86400 * updays; // we only want the seconds of today
|
||||
int hrs = upsecs / 3600;
|
||||
int mins = ( upsecs - hrs * 3600 ) / 60;
|
||||
int secs = upsecs - hrs * 3600 - mins * 60;
|
||||
QString time;
|
||||
time.sprintf( "%02d:%02d:%02d", hrs, mins, secs );
|
||||
uptime += time;
|
||||
textLabelUptime->setText( uptime );
|
||||
}
|
||||
else if ( data.existing )
|
||||
{
|
||||
textLabelStatus->setText( i18n( "Not connected." ) );
|
||||
textLabelUptime->setText( "00:00:00" );
|
||||
}
|
||||
else
|
||||
{
|
||||
textLabelStatus->setText( i18n( "Not existing." ) );
|
||||
textLabelUptime->setText( "00:00:00" );
|
||||
}
|
||||
|
||||
if ( data.available )
|
||||
{
|
||||
// ip tab
|
||||
textLabelIP->setText( data.ipAddress );
|
||||
textLabelSubnet->setText( data.subnetMask );
|
||||
if ( mInterface->getType() == Interface::ETHERNET )
|
||||
{
|
||||
variableLabel1->setText( i18n( "Broadcast Address:" ) );
|
||||
variableText1->setText( data.broadcastAddress );
|
||||
variableLabel2->setText( i18n( "Default Gateway:" ) );
|
||||
variableText2->setText( data.defaultGateway );
|
||||
variableLabel3->setText( i18n( "HW-Address:" ) );
|
||||
variableText3->setText( data.hwAddress );
|
||||
}
|
||||
else if ( mInterface->getType() == Interface::PPP )
|
||||
{
|
||||
variableLabel1->setText( i18n( "PtP-Address:" ) );
|
||||
variableText1->setText( data.ptpAddress );
|
||||
variableLabel2->setText( QString::null );
|
||||
variableText2->setText( QString::null );
|
||||
variableLabel3->setText( QString::null );
|
||||
variableText3->setText( QString::null );
|
||||
}
|
||||
else
|
||||
{
|
||||
// shouldn't happen
|
||||
variableLabel1->setText( QString::null );
|
||||
variableText1->setText( QString::null );
|
||||
variableLabel2->setText( QString::null );
|
||||
variableText2->setText( QString::null );
|
||||
variableLabel3->setText( QString::null );
|
||||
variableText3->setText( QString::null );
|
||||
}
|
||||
|
||||
// traffic tab
|
||||
textLabelPacketsSend->setText( QString::number( data.txPackets ) );
|
||||
textLabelPacketsReceived->setText( QString::number( data.rxPackets ) );
|
||||
textLabelBytesSend->setText( data.txString );
|
||||
textLabelBytesReceived->setText( data.rxString );
|
||||
unsigned long bytesPerSecond = data.outgoingBytes / mInterface->getGeneralData().pollInterval;
|
||||
textLabelSpeedSend->setText( KIO::convertSize( bytesPerSecond ) + i18n( "/s" ) );
|
||||
bytesPerSecond = data.incomingBytes / mInterface->getGeneralData().pollInterval;
|
||||
textLabelSpeedReceived->setText( KIO::convertSize( bytesPerSecond ) + i18n( "/s" ) );
|
||||
|
||||
if ( data.wirelessDevice )
|
||||
{
|
||||
WirelessData& wdata = mInterface->getWirelessData();
|
||||
|
||||
// wireless tab
|
||||
textLabelESSID->setText( wdata.essid );
|
||||
textLabelAccessPoint->setText( wdata.accessPoint );
|
||||
textLabelNickName->setText( wdata.nickName );
|
||||
textLabelMode->setText( wdata.mode );
|
||||
textLabelFreqChannel->setText( wdata.frequency + " [" + wdata.channel + "]" );
|
||||
textLabelBitRate->setText( wdata.bitRate );
|
||||
textLabelLinkQuality->setText( wdata.linkQuality + "%" );
|
||||
if ( wdata.encryption == true )
|
||||
{
|
||||
textLabelEncryption->setText( i18n( "active" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
textLabelEncryption->setText( i18n( "off" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::enableNetworkGroups( int )
|
||||
{
|
||||
groupBoxIP->setEnabled( true );
|
||||
groupBoxCurrentConnection->setEnabled( true );
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::disableNetworkGroups( int )
|
||||
{
|
||||
groupBoxIP->setEnabled( false );
|
||||
groupBoxCurrentConnection->setEnabled( false );
|
||||
|
||||
// clear IP group
|
||||
textLabelIP->setText( QString::null );
|
||||
textLabelSubnet->setText( QString::null );
|
||||
variableText1->setText( QString::null );
|
||||
variableText2->setText( QString::null );
|
||||
variableText3->setText( QString::null );
|
||||
|
||||
// clear current connection group
|
||||
textLabelPacketsSend->setText( QString::null );
|
||||
textLabelPacketsReceived->setText( QString::null );
|
||||
textLabelBytesSend->setText( QString::null );
|
||||
textLabelBytesReceived->setText( QString::null );
|
||||
textLabelSpeedSend->setText( QString::null );
|
||||
textLabelSpeedReceived->setText( QString::null );
|
||||
|
||||
// clear wireless tab
|
||||
if ( mInterface->getData().wirelessDevice )
|
||||
{
|
||||
textLabelESSID->setText( QString::null );
|
||||
textLabelAccessPoint->setText( QString::null );
|
||||
textLabelNickName->setText( QString::null );
|
||||
textLabelMode->setText( QString::null );
|
||||
textLabelFreqChannel->setText( QString::null );
|
||||
textLabelBitRate->setText( QString::null );
|
||||
textLabelLinkQuality->setText( QString::null );
|
||||
textLabelEncryption->setText( QString::null );
|
||||
}
|
||||
}
|
||||
|
||||
void InterfaceStatusDialog::statisticsChanged()
|
||||
{
|
||||
InterfaceStatistics* statistics = mInterface->getStatistics();
|
||||
|
||||
if ( statistics == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
const StatisticEntry* entry = statistics->getCurrentDay();
|
||||
textLabelTodaySent->setText( KIO::convertSize( entry->txBytes ) );
|
||||
textLabelTodayReceived->setText( KIO::convertSize( entry->rxBytes ) );
|
||||
textLabelTodayTotal->setText( KIO::convertSize( entry->txBytes + entry->rxBytes ) );
|
||||
|
||||
entry = statistics->getCurrentMonth();
|
||||
textLabelMonthSent->setText( KIO::convertSize( entry->txBytes ) );
|
||||
textLabelMonthReceived->setText( KIO::convertSize( entry->rxBytes ) );
|
||||
textLabelMonthTotal->setText( KIO::convertSize( entry->txBytes + entry->rxBytes ) );
|
||||
|
||||
entry = statistics->getCurrentYear();
|
||||
textLabelYearSent->setText( KIO::convertSize( entry->txBytes ) );
|
||||
textLabelYearReceived->setText( KIO::convertSize( entry->rxBytes ) );
|
||||
textLabelYearTotal->setText( KIO::convertSize( entry->txBytes + entry->rxBytes ) );
|
||||
}
|
||||
|
||||
#include "interfacestatusdialog.moc"
|
@ -0,0 +1,89 @@
|
||||
/* This file is part of KNemo
|
||||
Copyright (C) 2004, 2006 Percy Leonhardt <percy@eris23.de>
|
||||
|
||||
KNemo is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
KNemo is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public License
|
||||
along with this library; see the file COPYING.LIB. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INTERFACESTATUSDIALOG_H
|
||||
#define INTERFACESTATUSDIALOG_H
|
||||
|
||||
#include <qwidget.h>
|
||||
|
||||
#include "interfacestatusdlg.h"
|
||||
|
||||
class QTimer;
|
||||
class Interface;
|
||||
|
||||
/**
|
||||
* This class serves as the main window for KNemo. It handles the
|
||||
* menus, toolbars, and status bars.
|
||||
*
|
||||
* @short Main window class
|
||||
* @author Percy Leonhardt <percy@eris23.de>
|
||||
*/
|
||||
|
||||
class InterfaceStatusDialog : public InterfaceStatusDlg
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Default Constructor
|
||||
*/
|
||||
InterfaceStatusDialog( Interface* interface,
|
||||
QWidget* parent = 0L, const char* name = 0L );
|
||||
|
||||
/**
|
||||
* Default Destructor
|
||||
*/
|
||||
virtual ~InterfaceStatusDialog();
|
||||
|
||||
/**
|
||||
* Implemented to store position.
|
||||
*/
|
||||
void hide();
|
||||
void show();
|
||||
|
||||
/**
|
||||
* Enable or disable the statistics group when the user turned statistics on or off.
|
||||
*/
|
||||
void setStatisticsGroupEnabled( bool enabled );
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Enable the network groups when the interface is connected
|
||||
*/
|
||||
void enableNetworkGroups( int );
|
||||
/**
|
||||
* Disable the network groups when the interface is not connected
|
||||
*/
|
||||
void disableNetworkGroups( int );
|
||||
/**
|
||||
* Update the statistics tab when data changed
|
||||
*/
|
||||
void statisticsChanged();
|
||||
|
||||
private slots:
|
||||
void updateDialog();
|
||||
|
||||
private:
|
||||
QPoint mPos;
|
||||
bool mPosInitialized;
|
||||
|
||||
QTimer* mTimer;
|
||||
Interface* mInterface;
|
||||
};
|
||||
|
||||
#endif // INTERFACESTATUSDIALOG_H
|
@ -0,0 +1,759 @@
|
||||
<!DOCTYPE UI><UI version="3.2" stdsetdef="1">
|
||||
<class>InterfaceStatusDlg</class>
|
||||
<widget class="QDialog">
|
||||
<property name="name">
|
||||
<cstring>InterfaceStatusDlg</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<height>328</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>Interface Status</string>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QTabWidget">
|
||||
<property name="name">
|
||||
<cstring>tabWidget</cstring>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>connection</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Connection</string>
|
||||
</attribute>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<spacer row="5" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>81</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QGroupBox" row="4" column="0" rowspan="1" colspan="2">
|
||||
<property name="name">
|
||||
<cstring>groupBoxIP</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>IP</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelIP</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelSubnet</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>variableText1</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>variableText2</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="1">
|
||||
<property name="name">
|
||||
<cstring>variableText3</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel4_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP-Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel5_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Subnet Mask:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>variableLabel1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Broadcast Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>variableLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Default Gateway:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="0">
|
||||
<property name="name">
|
||||
<cstring>variableLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>HW-Address:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelAlias</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelInterface</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelStatus</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelUptime</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel24</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Interface:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel14</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Alias:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Status:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Uptime:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>traffic</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Traffic</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>groupBoxCurrentConnection</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Current connection</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel8</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabel7</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelPacketsSend</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelPacketsReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel9</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Packets:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel10</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bytes:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel10_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelBytesSend</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelBytesReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelSpeedSend</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelSpeedReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>groupBoxStatistics</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Statistics</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel9_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Today:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel10_2_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>This year:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabel8_2_3</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Received</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="3">
|
||||
<property name="name">
|
||||
<cstring>textLabel8_2_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Total</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel10_3_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>This month:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelTodayReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelMonthReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>textLabelYearReceived</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="3">
|
||||
<property name="name">
|
||||
<cstring>textLabelTodayTotal</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="3">
|
||||
<property name="name">
|
||||
<cstring>textLabelMonthTotal</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="3">
|
||||
<property name="name">
|
||||
<cstring>textLabelYearTotal</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabel7_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sent</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelMonthSent</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelYearSent</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelTodaySent</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>spacer4_3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>81</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>wireless</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Wireless</string>
|
||||
</attribute>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connected to:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelESSID</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Access point:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="1" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelAccessPoint</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="5" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2_4</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bit Rate:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabelFC</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Frequency [Channel]:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Mode:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="5" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelBitRate</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="4" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelFreqChannel</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="3" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelMode</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="1">
|
||||
<property name="name">
|
||||
<cstring>textLabelNickName</cstring>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignVCenter|AlignRight</set>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="2" column="0">
|
||||
<property name="name">
|
||||
<cstring>textLabel3_2_5</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Nickname:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="8" column="0" rowspan="1" colspan="2">
|
||||