Browse Source

Added KDE3 version of kde-systemsettings

git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kde-systemsettings@1089234 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
tags/v3.5.13
tpearson 10 years ago
commit
686c40f4da
78 changed files with 30563 additions and 0 deletions
  1. +1
    -0
      AUTHOR
  2. +21
    -0
      CMakeLists.txt
  3. +22
    -0
      INDEX
  4. +167
    -0
      INSTALL
  5. +5
    -0
      Mainpage.dox
  6. +22
    -0
      Makefile.am
  7. +21
    -0
      Makefile.am.in
  8. +40
    -0
      README
  9. +23
    -0
      TODO
  10. +12420
    -0
      acinclude.m4
  11. +13293
    -0
      aclocal.m4
  12. +394
    -0
      config.h.in
  13. +2
    -0
      configure.files
  14. +146
    -0
      configure.in
  15. +30
    -0
      configure.in.in
  16. +0
    -0
      stamp-h.in
  17. +1
    -0
      subdirs
  18. +31
    -0
      systemsettings/HACKING
  19. +125
    -0
      systemsettings/LAYOUT.html
  20. +45
    -0
      systemsettings/Makefile.am
  21. BIN
      systemsettings/cr128-app-systemsettings.png
  22. BIN
      systemsettings/cr16-app-systemsettings.png
  23. BIN
      systemsettings/cr22-app-systemsettings.png
  24. BIN
      systemsettings/cr32-app-systemsettings.png
  25. BIN
      systemsettings/cr48-app-systemsettings.png
  26. BIN
      systemsettings/cr64-app-systemsettings.png
  27. +188
    -0
      systemsettings/kcmodulemenu.cpp
  28. +158
    -0
      systemsettings/kcmodulemenu.h
  29. +101
    -0
      systemsettings/kcmsearch.cpp
  30. +67
    -0
      systemsettings/kcmsearch.h
  31. +431
    -0
      systemsettings/kcmultiwidget.cpp
  32. +255
    -0
      systemsettings/kcmultiwidget.h
  33. +38
    -0
      systemsettings/kcscrollview.cpp
  34. +35
    -0
      systemsettings/kcscrollview.h
  35. +62
    -0
      systemsettings/main.cpp
  36. +362
    -0
      systemsettings/mainwindow.cpp
  37. +111
    -0
      systemsettings/mainwindow.h
  38. +36
    -0
      systemsettings/menu/Makefile.am
  39. +56
    -0
      systemsettings/menu/audioencoding.desktop
  40. +97
    -0
      systemsettings/menu/defaultapplication.desktop
  41. +62
    -0
      systemsettings/menu/kcm_knetworkconfmodule_ss.desktop
  42. +112
    -0
      systemsettings/menu/kcmfontinst.desktop
  43. +20
    -0
      systemsettings/menu/kde-settings-accessibility_ss.directory
  44. +19
    -0
      systemsettings/menu/kde-settings-advanced.directory
  45. +20
    -0
      systemsettings/menu/kde-settings-advancedusersettings.directory
  46. +36
    -0
      systemsettings/menu/kde-settings-appearance.directory
  47. +19
    -0
      systemsettings/menu/kde-settings-computeradministration.directory
  48. +67
    -0
      systemsettings/menu/kde-settings-defaultapplications.directory
  49. +18
    -0
      systemsettings/menu/kde-settings-general.directory
  50. +21
    -0
      systemsettings/menu/kde-settings-keyboardmouse.directory
  51. +21
    -0
      systemsettings/menu/kde-settings-laptops.directory
  52. +17
    -0
      systemsettings/menu/kde-settings-looknfeel2.directory
  53. +35
    -0
      systemsettings/menu/kde-settings-networkconnections.directory
  54. +19
    -0
      systemsettings/menu/kde-settings-networkconnectivity.directory
  55. +19
    -0
      systemsettings/menu/kde-settings-networksettings.directory
  56. +19
    -0
      systemsettings/menu/kde-settings-notifications.directory
  57. +26
    -0
      systemsettings/menu/kde-settings-panel.directory
  58. +18
    -0
      systemsettings/menu/kde-settings-personal.directory
  59. +32
    -0
      systemsettings/menu/kde-settings-power.directory
  60. +19
    -0
      systemsettings/menu/kde-settings-regional.directory
  61. +35
    -0
      systemsettings/menu/kde-settings-sharing.directory
  62. +19
    -0
      systemsettings/menu/kde-settings-splashscreen.directory
  63. +32
    -0
      systemsettings/menu/kde-settings-system.directory
  64. +19
    -0
      systemsettings/menu/kde-settings-useraccount.directory
  65. +19
    -0
      systemsettings/menu/kde-settings-windowbehavior.directory
  66. +43
    -0
      systemsettings/menu/laptoppowermanagement.desktop
  67. +57
    -0
      systemsettings/menu/medianotifications.desktop
  68. +11
    -0
      systemsettings/menu/system-settings-merge.menu
  69. +34
    -0
      systemsettings/menu/system-settings.directory
  70. +385
    -0
      systemsettings/menu/system-settings.menu
  71. +52
    -0
      systemsettings/moduleiconitem.cpp
  72. +57
    -0
      systemsettings/moduleiconitem.h
  73. +173
    -0
      systemsettings/modulesview.cpp
  74. +100
    -0
      systemsettings/modulesview.h
  75. +40
    -0
      systemsettings/systemsettings.desktop
  76. +3
    -0
      systemsettings/systemsettingsrc
  77. +32
    -0
      systemsettings/systemsettingsui.rc
  78. +27
    -0
      systemsettings/version.h

+ 1
- 0
AUTHOR View File

@@ -0,0 +1 @@
Benjamin Charles Meyer < ben + systempreferences at meyerhome dot net >

+ 21
- 0
CMakeLists.txt View File

@@ -0,0 +1,21 @@
project(playground-base)

find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include(MacroOptionalAddSubdirectory)

# search packages used by KDE
#find_package (KDE4)
#include(KDE4Defaults)
#include(MacroLibrary)

#add_subdirectory( qrdf )
#add_subdirectory( raptor )
# needs Qt 3.x
#add_subdirectory( kbfx_plasma )

#add_subdirectory( plasma )
macro_optional_add_subdirectory( plasmagik )
macro_optional_add_subdirectory( systemsettings )

#add_subdirectory( strigiplasmoid )

+ 22
- 0
INDEX View File

@@ -0,0 +1,22 @@
Index of software in kdeplayground-base
=======================================

Please add software to this index. Each entry should include the
following entries:
* Name:, which is the directory name
* Synopsis:, which is a short description of what it does
* Notes:, for key usage / applicability information (optional)
* See also:, for cross references to other KDE apps/modules (optional)
* URL:, for web links to required software or a home page (optional)

Entries should be entirely objective.

Name: datasources
Synopsis: ODBC configuration tool.
Notes: Requires unixODBC libraries

Name: sessionapplet
Synopsis: A kicker applet for management of X sessions.

Name: raptor
Synopsis: Raptor is a Application Utility Menu for KDE4

+ 167
- 0
INSTALL View File

@@ -0,0 +1,167 @@
Basic Installation
==================

These are generic installation instructions.

The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').

If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.

The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.

The simplest way to compile this package is:

1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.

Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.

2. Type `make' to compile the package.

3. Type `make install' to install the programs and any data files and
documentation.

4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.

Compilers and Options
=====================

Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure

Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure

Compiling For Multiple Architectures
====================================

You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.

If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.

Installation Names
==================

By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.

You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.

If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.

Optional Features
=================

Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.

For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.

Specifying the System Type
==========================

There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM

See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.

If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.

Sharing Defaults
================

If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.

Operation Controls
==================

`configure' recognizes the following options to control how it
operates.

`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.

`--help'
Print a summary of the options to `configure', and exit.

`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.

`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.

`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.

`configure' also accepts some other, not widely useful, options.


+ 5
- 0
Mainpage.dox View File

@@ -0,0 +1,5 @@
/** @mainpage Playground
*
* The playground is a place to put new and immature and
* flaky apps, to develop them to maturity.
*/

+ 22
- 0
Makefile.am View File

@@ -0,0 +1,22 @@
## (C) 1997 Stephan Kulow

AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES = inst-apps

install-data-local:
@echo ""
@echo ""
@echo "*************** Important *************************"
@echo ""
@echo "This module contains unreleased software."
@echo ""
@echo "The software may compile and work, but it may just"
@echo "as well neither compile nor work."
@echo ""
@echo "****************************************************"
@echo ""

include admin/deps.am
include admin/Doxyfile.am

SUBDIRS=$(TOPSUBDIRS)

+ 21
- 0
Makefile.am.in View File

@@ -0,0 +1,21 @@
## (C) 1997 Stephan Kulow

AUTOMAKE_OPTIONS = foreign
DISTCLEANFILES = inst-apps

install-data-local:
@echo ""
@echo ""
@echo "*************** Important *************************"
@echo ""
@echo "This module contains unreleased software."
@echo ""
@echo "The software may compile and work, but it may just"
@echo "as well neither compile nor work."
@echo ""
@echo "****************************************************"
@echo ""

include admin/deps.am
include admin/Doxyfile.am


+ 40
- 0
README View File

@@ -0,0 +1,40 @@
What is kdeplayground?
----------------------

The kdeplayground modules contain software that is under development but
that has not reached a stable state. Some software present has only been
developed as a proof of concept and will not see further development.
Due to the experimental nature of the software, most of the software in
the kdeplayground packages has not received the same level of scrutiny
as the software in other modules.

Although the software in the kdeplayground modules is publicly available
for the purpose of its ongoing development, it should not be considered
released, supported in any way or fit for any purpose.

THIS SOFTWARE IS PROVIDED BY THE AUTHORS `AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Package contents
----------------

Read the INDEX file to find out about the description and status of each
module.


Using kdeplayground
-------------------

The modules use the standard autoconf/automake based KDE build system. To
add a new module to the build, create a subdirectory with your code and then
say "make -f Makefile.cvs".

Don't forget to add your new subdirectory to the INDEX file.

+ 23
- 0
TODO View File

@@ -0,0 +1,23 @@
Save to real config files.
Module Help link
Module Default/Reset link
Use tabs
View Menu should list of all modules
Remove "module" string
Fix connection

config icon sizes
command line option to open in new window

Modules
-lilo _has_ to be spead up
-Date & Time icon should have a Clock
-Samba needs a new icon
-Remote needs a new icon

Search
-Make search smaller and on the right
-Grep docs?
-Tie into kconfigXT somehow?
-Look at Spotlight
-Task oriented?

+ 12420
- 0
acinclude.m4
File diff suppressed because it is too large
View File


+ 13293
- 0
aclocal.m4
File diff suppressed because it is too large
View File


+ 394
- 0
config.h.in View File

@@ -0,0 +1,394 @@
/* 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 if you have dlfcn */
#undef HAVE_DLFCN

/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H

/* Define to 1 if you have the <dl.h> header file. */
#undef HAVE_DL_H

/* Define to 1 if you have the `fabsl' function. */
#undef HAVE_FABSL

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H

/* Define to 1 if you have the `flock' function. */
#undef HAVE_FLOCK

/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H

/* Define if you have getdomainname */
#undef HAVE_GETDOMAINNAME

/* Define if you have the getdomainname prototype */
#undef HAVE_GETDOMAINNAME_PROTO

/* Define if you have gethostname */
#undef HAVE_GETHOSTNAME

/* Define if you have the gethostname prototype */
#undef HAVE_GETHOSTNAME_PROTO

/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H

/* 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 <linux/tcp.h> header file. */
#undef HAVE_LINUX_TCP_H

/* Define to 1 if the type `long double' works and has more range or precision
than `double'. */
#undef HAVE_LONG_DOUBLE

/* Define to 1 if the type `long double' works and has more range or precision
than `double'. */
#undef HAVE_LONG_DOUBLE_WIDER

/* 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 to 1 if you have the `re_comp' function. */
#undef HAVE_RE_COMP

/* Define if you have setenv */
#undef HAVE_SETENV

/* Define if you have the setenv prototype */
#undef HAVE_SETENV_PROTO

/* Define if you have a STL implementation by SGI */
#undef HAVE_SGI_STL

/* Define if you have shload */
#undef HAVE_SHLOAD

/* Define to 1 if you have the `snprintf' function. */
#undef HAVE_SNPRINTF

/* Define to 1 if you have the `socket' function. */
#undef HAVE_SOCKET

/* 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 `strdup' function. */
#undef HAVE_STRDUP

/* 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 <sysent.h> header file. */
#undef HAVE_SYSENT_H

/* 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/cdefs.h> header file. */
#undef HAVE_SYS_CDEFS_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/param.h> header file. */
#undef HAVE_SYS_PARAM_H

/* Define to 1 if you have the <sys/proc.h> header file. */
#undef HAVE_SYS_PROC_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 if you have unsetenv */
#undef HAVE_UNSETENV

/* Define if you have the unsetenv prototype */
#undef HAVE_UNSETENV_PROTO

/* Define to 1 if you have the <utmp.h> header file. */
#undef HAVE_UTMP_H

/* 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

/* 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

/* Version number of package */
#undef VERSION

/* Defined if compiling without arts */
#undef WITHOUT_ARTS

/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER

/*
* 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_GETDOMAINNAME_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
int getdomainname (char *, size_t);
#ifdef __cplusplus
}
#endif
#endif



#if !defined(HAVE_GETHOSTNAME_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int gethostname (char *, unsigned int);
#ifdef __cplusplus
}
#endif
#endif



#if !defined(HAVE_RES_INIT_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int res_init(void);
#ifdef __cplusplus
}
#endif
#endif



#if !defined(HAVE_SETENV_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
int setenv (const char *, const char *, int);
#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



#if !defined(HAVE_UNSETENV_PROTO)
#ifdef __cplusplus
extern "C" {
#endif
void unsetenv (const char *);
#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

+ 2
- 0
configure.files View File

@@ -0,0 +1,2 @@
./admin/configure.in.min
configure.in.in

+ 146
- 0
configure.in View File

@@ -0,0 +1,146 @@
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(kde-systemsettings-0.0svn20070312, "3.5.4") 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.3)
AC_PATH_KDE
dnl =======================================================
dnl FILE: configure.in.in
dnl =======================================================

#MIN_CONFIG(3.3)
# Define a symbol, to know that we're compiling WITH kde. (for apps that
# can compile without KDE, optionally)
AM_CONDITIONAL(KDE_INSTALLED, test "$have_kde" = "yes")

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h sys/stat.h stdint.h)
AC_CHECK_HEADERS(sys/cdefs.h fnmatch.h sysent.h strings.h paths.h)
AC_CHECK_HEADERS(utmp.h sys/param.h linux/tcp.h sys/proc.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

AC_C_LONG_DOUBLE

dnl Checks for library functions.
KDE_CHECK_DLOPEN
AC_CHECK_FUNCS(socket fabsl strdup vsnprintf re_comp flock)
AC_CHECK_SETENV
AC_CHECK_UNSETENV
AC_CHECK_GETDOMAINNAME
AC_CHECK_GETHOSTNAME
AM_PROG_LEX
LFLAGS="-o${LEX_OUTPUT_ROOT}.c"
AC_SUBST(LFLAGS)

KDE_INIT_DOXYGEN([KDE Playground - Base], [Version $VERSION])

KDE_CREATE_SUBDIRSLIST
AM_CONDITIONAL(systemsettings_SUBDIR_included, test "x$systemsettings_SUBDIR_included" = xyes)
AC_CONFIG_FILES([ Makefile ])
AC_CONFIG_FILES([ systemsettings/Makefile ])
AC_CONFIG_FILES([ systemsettings/menu/Makefile ])
AC_OUTPUT
# 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

+ 30
- 0
configure.in.in View File

@@ -0,0 +1,30 @@
#MIN_CONFIG(3.3)
# Define a symbol, to know that we're compiling WITH kde. (for apps that
# can compile without KDE, optionally)
AM_CONDITIONAL(KDE_INSTALLED, test "$have_kde" = "yes")

dnl Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/time.h sys/stat.h stdint.h)
AC_CHECK_HEADERS(sys/cdefs.h fnmatch.h sysent.h strings.h paths.h)
AC_CHECK_HEADERS(utmp.h sys/param.h linux/tcp.h sys/proc.h)

dnl Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_TIME

AC_C_LONG_DOUBLE

dnl Checks for library functions.
KDE_CHECK_DLOPEN
AC_CHECK_FUNCS(socket fabsl strdup vsnprintf re_comp flock)
AC_CHECK_SETENV
AC_CHECK_UNSETENV
AC_CHECK_GETDOMAINNAME
AC_CHECK_GETHOSTNAME
AM_PROG_LEX
LFLAGS="-o${LEX_OUTPUT_ROOT}.c"
AC_SUBST(LFLAGS)

KDE_INIT_DOXYGEN([KDE Playground - Base], [Version $VERSION])


+ 0
- 0
stamp-h.in View File


+ 1
- 0
subdirs View File

@@ -0,0 +1 @@
systemsettings

+ 31
- 0
systemsettings/HACKING View File

@@ -0,0 +1,31 @@
This is an overview of how the code is situated and a very brief overview of what the classes do. See the header files for a more indepth overview of what the classes do.

-- System Settings classes --

mainwindow - The KMainWindow contains KActions, the stack of the iconlist and the current module(s) view.

modulesview - The widget that is the icon view that users see when the first enter the app.
kcmsearch - Search widget that can search ModulesView and enable/disable items.

modulesiconitem - The individual modules items. Used for loading enabled/disabled images and storing the list of modules acosiated with the item.

kcmodulemenu - Class that reads in a freedesktop.org .menu file into a QValueList.

kcmultiwidget - A basterdized kcmultidialog from kdelibs/kutil that provides info about the current shown dialog so the about dialog and caption can be updated and prompts for unsaved changes.

-- INSTALL --

To install a new menu you have to install three files.

(if you have debian, if you have another system use locate to determine where kde-system.* is installed and install in the same place.

-/etc/xdg/menus/system-settings.menu
-/etc/xdg/menus/applications-merged/system-settings-merge.menu
-/usr/share/desktop-directories/system-settings.directory

Also don't forget to install the ui file.
-/share/apps/systemsettings/systempreferencesui.rc
And the desktop file.
-share/applications/kde/systemsettings.desktop

When you change (or install) any of the first three files make sure to run kbuildsycoca to re-generate the cache files or log out and back in.

+ 125
- 0
systemsettings/LAYOUT.html View File

@@ -0,0 +1,125 @@

<h1>KDE System Settings</h1>

<p>
This document describes how the System Settings is layed out.

<p>
This document was inspired partially by the TODO file located at kdebase/kcontrol/TODO. Most of the changed are the exact same and were planned to be done for KDE4. This document is simply a little bit more fleshed out version. I recomend checking out that document if you havn't already.

<p>
The reason for this document is:
<p>
1) To categorize the settings together in a user friendly manor.<br>
2) To explain why a setting is where it is and to determine where new settings should go.<br>
3) Because of #2 stop the constant reorganization of KControl at every release confusing users and developers because there isn't a documented location for where thing go with explanations of why.
<p>
The System Settings Center is divided into four sections.
<ul>
<li><a href="#personal">Personal</a></li>
<li><a href="#hardware">Hardware</a></li>
<li><a href="#system">System</a></li>
<li><a href="#other">Other</a></li>
</ul>

Within KDE there are over 50 kcm modules designed for the Control Center and many more for konquror and other applications. With so many modules there is no way for a users to find what they are looking for by scanning. To solve this there are three levels, the last one isn't normally visable to the user and groups very similar items.
<p>
Modules in the System Settings should configure things not do things. Some examples include the theme manager. It sets/saves themes. Although it configures settings it is a seperate application because it does actions rather then just setting/getting values. Items that
<p>
Modules that exists within multiple applications configuration menu such as spell check and cddb should not be in the menu.

<hr>
<a name="personal"><h1>Personal</h1></a>
Personal is made up of two parts. The simplest differece between the two are theme settings will be shared amung friends while users settings wont be.
<ul>
<li><a href="#personal_theme">Theme Goodies</a></li>
<li><a href="#personal_user">User Settings</a></li>
</ul>

<h3><a name="personal_theme">Theme Goodies</a></h3> which can be changed without affecting productivity and often doesn't directly apply to a specific user, but to a user base (Theme of the month crowd).

These deal with how applications are presented to users and how users interact with them. These don't deal with anything that isn't directly seen/heard or interacted with.
<p>
Every setting in this category must be able to be locked for example in an government enviornment where they determine exactly how a desktop is to look for every user. It may look ugly, but users should still be able to acomplish tasks no matter what these settings are set to.
<p>
A separate application (Theme Manager) can set the items in this category on mass to give an overall theme for the user. This application can also save the current settings.

<h3><a name="personal_user">User Settings</a></h3>
Such as that apply to this computer such as language and personal choice for default web browser. These settings determine how a user interacts with a computer, but is personal to that user and typically isn't shared like a theme or icons set is.

<h2>Appearance</h2>
The Appearance deals with the look of the applications and desktop. These settings typically will be settings that can be replaced by alternatives created outside of KDE. These settings will most likely be also set/used by other Unix desktop enviornments so that all the applications can integration together (and look consistant to the user). It contains the following items:<br>
Colors, Fonts, Icons, Style, Window Decorations

<h2>Desktop</h2>
These items discus how the desktop behaves. How the windows interact with each other, the very bottom of the screen (desktop), the very top (screensaver), and loading of the desktop. These are all separate setting from KDE (or Gnome) applications and the applications shouldn't need to access them or know about them.
It contains the following items:<br>
Background, Screensaver, Behavior, Window Behavior, Window-Specific Settings, Login Screen
<p>
Panel.
These settings all deal with when users perform actions dealing with or originating from the panel. It contains the following items:<br>
Panels, Taskbar, Launch Feedback, Multiple Desktops

<h2>KDE Components</h2>
Specific actuall KDE components which users will probably never actually touch.

<h2>Accessibility</h2>
- International
- KHotKeys etc

<h2>Security</h2>
-kdewallet

<h2>Sound</h2>
Sounds, flashes, logs or other events that happen when KDE applications.
System Bell
System Notifications

<h2>User Account</h2>
- Password changer, paths, Default Applications, Session Manager

<hr>
<a name="hardware"><h1>Hardware</h1></a>
Hardware deals with physical hardware configuration. Configuration is not only for the hardware, but the required supporting systems that use the hardware.

<h2>Network</h2>
File Sharing
Local Network Browsing
Preferences / Proxy
Wireless
Firewall
<h2>Display</h2>
It contains the following items:<br>
Size & Orientation, Gamma
<h2>Power</h2>
Display power control
laptop battery, cpu temp etc
<h2>Keyboard & Mouse</h2>
Keyboard, Keyboard Layout, Keyboard Shortcuts, Mouse, KHotKeys
<h2>Printer</h2>
<h2>Joystick</h2>
<h2>Audio</h2>
Mixer, SoundSystem (arts)

<hr>
<a name="system"><h1>System</h1></a>
System deals with settings relating to this computer.

<h2>Date & Time</h2>
Date, Time, Time zone

<h2>Fonts</h2>

<h2>Book Disk</h2>
Lilo, Grub

<h2>Packages</h2>
System update / rpm manager etc

<h2>Login Manager</h2>
Login Manger

<hr>
<a name="other"><h1>Other</h1></a>
A default KDE install should contain nothing here. If there is something here than this document has failed and needs to be revised. Until that can happen its temporary home is here. A user should never see this catagory.


+ 45
- 0
systemsettings/Makefile.am View File

@@ -0,0 +1,45 @@
#
# Copyright (c) 2005 Benjamin Meyer <ben+systempreferences@meyerhome.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Steet, Fifth Floor, Boston, MA 02110-1301, USA.
#

AM_CPPFLAGS= $(all_includes)
METASOURCES = AUTO

SUBDIRS = . menu

bin_PROGRAMS = systemsettings

systemsettings_SOURCES = kcmodulemenu.cpp kcmsearch.cpp kcmultiwidget.cpp main.cpp mainwindow.cpp moduleiconitem.cpp modulesview.cpp kcscrollview.cpp

EXTRA_DIST = kcmodulemenu.h kcmultiwidget.h moduleiconitem.h version.h kcmsearch.h mainwindow.h modulesview.h kcscrollview.h

systemsettings_LDADD = $(LIB_KDEUI) $(LIB_KUTILS)
systemsettings_LDFLAGS = $(all_libraries) -module -avoid-version

appdata_DATA = systemsettingsui.rc
appdatadir = $(kde_datadir)/systemsettings

xdg_apps_DATA = systemsettings.desktop

KDE_ICON=AUTO

# KDE4 will have this by default
conf_DATA = systemsettingsrc
confdir = $(kde_confdir)

messages: rc.cpp
$(XGETTEXT) *.cpp -o $(podir)/systemsettings.pot

BIN
systemsettings/cr128-app-systemsettings.png View File


BIN
systemsettings/cr16-app-systemsettings.png View File


BIN
systemsettings/cr22-app-systemsettings.png View File


BIN
systemsettings/cr32-app-systemsettings.png View File


BIN
systemsettings/cr48-app-systemsettings.png View File


BIN
systemsettings/cr64-app-systemsettings.png View File


+ 188
- 0
systemsettings/kcmodulemenu.cpp View File

@@ -0,0 +1,188 @@
/**
* Copyright (C) 2005 Benjamin C Meyer (ben+kcmodulemenu at meyerhome dot net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#include "kcmodulemenu.h"

#include <kapplication.h>
#include <kservicegroup.h>
#include <kdebug.h>
#include <qdict.h>

class KCModuleMenuPrivate {
public:
KCModuleMenuPrivate(){
}
QMap<QString, QValueList<MenuItem> > menus;
QString basePath;
};

KCModuleMenu::KCModuleMenu( const QString &menuName ) :
d( new KCModuleMenuPrivate )
{
kdDebug() << "MenuName: \"" << menuName << "\"." << endl;
// Make sure we can find the menu
KServiceGroup::Ptr serviceGroup = KServiceGroup::baseGroup( menuName );
if( !serviceGroup ){
kdDebug() << "Unable to load menu \"" << menuName <<
"\" from KServiceGroup." << endl;
return;
}
d->basePath = serviceGroup->relPath();
readMenu( d->basePath );
}

KCModuleMenu::~KCModuleMenu()
{
delete d;
}

void KCModuleMenu::readMenu( const QString &pathName )
{
KServiceGroup::Ptr group = KServiceGroup::group( pathName );
if ( !group || !group->isValid() )
return;

KServiceGroup::List list = group->entries( true, true );
if( list.isEmpty() )
return;

caption = group->caption();
QValueList<MenuItem> currentMenu;
for( KServiceGroup::List::ConstIterator it = list.begin();
it != list.end(); it++)
{
KSycocaEntry *entry = (*it);
if( addEntry(entry) ) {
KCModuleInfo module((KService*)entry);
append(module);
MenuItem infoItem(false);
infoItem.caption = this->deriveCaptionFromPath(entry->name());
infoItem.item = module;
currentMenu.append( infoItem );
}

if ( entry->isType(KST_KServiceGroup) ){
MenuItem menuItem(true);
menuItem.caption = this->deriveCaptionFromPath(entry->name());
menuItem.subMenu = entry->entryPath();
currentMenu.append( menuItem );

readMenu( entry->entryPath() );
}
}

d->menus.insert( pathName, currentMenu );
}

bool KCModuleMenu::addEntry( KSycocaEntry *entry ){
if( !entry->isType(KST_KService) )
return false;
KService *service = static_cast<KService*>( entry );
if ( !kapp->authorizeControlModule( service->menuId()) )
return false;

KCModuleInfo module( service );
if ( module.library().isEmpty() )
return false;

return true;
}


QValueList<KCModuleInfo> KCModuleMenu::modules( const QString &menuPath )
{
QValueList<KCModuleInfo> list;

QValueList<MenuItem> subMenu = menuList(menuPath);
QValueList<MenuItem>::iterator it;
for ( it = subMenu.begin(); it != subMenu.end(); ++it ){
if ( !(*it).menu )
list.append( (*it).item );
}

return list;
}

QStringList KCModuleMenu::submenus( const QString &menuPath )
{
QStringList list;

QValueList<MenuItem> subMenu = menuList(menuPath);
QValueList<MenuItem>::iterator it;
for ( it = subMenu.begin(); it != subMenu.end(); ++it ){
if ( (*it).menu )
list.append( (*it).subMenu );
}

return list;
}

QValueList<MenuItem> KCModuleMenu::menuList( const QString &menuPath )
{
if( menuPath.isEmpty() ) {
if( d->basePath.isEmpty())
return QValueList<MenuItem>();
else
return menuList( d->basePath );
}
return d->menus[menuPath];
}

/*
* Okay, I think there could be a much more elegant way of doing
* this... but I'm having a hell fo a time figuring it out.
*
* The purpose of this function is to take a menu path and turn it
* into a caption that we can put in a tab. Why do it this way? I
* don't know, you tell me. Before I started hacking this we used a
* radio control with two buttons (or so it seemed, I could be wrong)
* with General and Advanced in a ui.rc file.
*
* Now that we're using tabs, we no longer have that UI file giving us
* the names for the tabs, and since I didn't want to hard-code
* anything, and since KSycocaEntry stuff doesn't give you a nice way
* (that I noticed anyway) to figure out what your caption should be,
* I decided that cleverness is lost on this problem. So screw it,
* I'll just parse the stupid path and be done with it.
*
* This function is certainly nothing short of dull and boring and
* routine, but I figured that this might require a bit of explanation
* since it just seems kinda silly to do it this way to me. I guess I
* never know... I could be doing it the best way.
*
* "Michael D. Stemle, Jr." <manchicken@notsosoft.net>
*/
QString KCModuleMenu::deriveCaptionFromPath( const QString &menuPath )
{
QStringList parts(QStringList::split("/",menuPath));
QString result("");

QStringList::Iterator it = parts.end(); // Start at the end

// Find the last non-empty string in the split.
for (; it != parts.begin(); --it) {
if (!((*it).isNull()) && !((*it).isEmpty())) {
result += *it;
return result;
}
}
}

+ 158
- 0
systemsettings/kcmodulemenu.h View File

@@ -0,0 +1,158 @@
/**
* Copyright (C) 2005 Benjamin C Meyer (ben+kcmodulemenu at meyerhome dot net)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#ifndef KCMMODULEMENU_H
#define KCMMODULEMENU_H

#include <kcmoduleinfo.h>

class KCModuleMenuPrivate;

/**
* List of all KCM modules inside a FreeDesktop.org menu
* The menu spec is located at: http://www.freedesktop.org/Standards/menu-spec
*
* For a menu to show up in KDE three files need to be installed in the system.
*
* example-merge.menu
* example.directory
* example.menu
*
* example-merge.menu should be installed in xdg/menus/applications-merged/
* so that ksyscoco will find it.
*
* \code
* <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"
* "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
*
* <Menu>
* <!-- The following menus are hidden by default -->
* <Menu>
* <Name>Example Menu</Name>
* <Directory>example.directory</Directory>
* <MergeFile>../example.menu</MergeFile>
* </Menu>
* </Menu>
* \endcode
*
* example.directory should be installed in share/desktop-directories/ where files
* such as kde-system.directory reside. It is important that it have X-KDE-BaseGroup
* as this value is the class constructor argument.
*
* \code
* [Desktop Entry]
* Encoding=UTF-8
* Name=Example Menu
* NoDisplay=true
* Icon=package_settings
* X-KDE-BaseGroup=examplemenu
* \endcode
*
* example.menu should be installed in xdg/menus/ so that ksyscoco will find
* it. See the above url for example menus. After changing the menu you need
* to run "kbuildsycoca" to regenerate the cache as ksyscoco will cache the
* menu and is a file that doesn't change on users.
*/

/**
* A menu consists of menu items. An item is either another menu or a module.
*/
class MenuItem {
public:
MenuItem( bool isMenu=false ){ menu = isMenu; };
bool menu;
QString subMenu;
QString caption;
KCModuleInfo item;
};


class KCModuleMenu : public QValueList<KCModuleInfo>
{

public:
QString caption;

/**
* @param the X-KDE-BaseGroup item from the directory file
* that should be loaded.
*
* Example:
* In example.directory
* X-KDE-BaseGroup=examplemenu
* so menuName should be "systemsettings"
*/
KCModuleMenu( const QString &menuName );

/**
* Deconstructor
*/
virtual ~KCModuleMenu();

/**
* Returns item of a menu path. An empty string is the top level.
* Item order is maintained from the menu file.
* @param path to return submenus from.
* @return all items in menuPath.
*/
QValueList<MenuItem> menuList( const QString &menuPath=QString::null );

/**
* Returns the modules in a menu path. An empty string is the top level.
* @param menu to return modules from.
* @returns only the top level modules of menuPath
*/
QValueList<KCModuleInfo> modules( const QString &menuPath=QString::null );

/**
* Returns the sub menus of a menu path. An empty string is the top level.
* @param path to return submenus from.
* @return only the submenus of menuPath.
*/
QStringList submenus( const QString &menuPath=QString::null );


protected:
/**
* Reads all the desktop files from the pathName and saves/loads
* all of the kcm's into the list.
* This is the <Name> from the merge.menu file
* @param pathName the base path name of the menu.
*/
virtual void readMenu( const QString &pathName );

/**
* Function that determines if the entry from readMenu
* should be added to the list or not. It checks
* to see if it is an authorized kcm module that has a library.
*
* Overload to filter out kcm modules
*
* @entry to test
* @return true if it should be included
*/
virtual bool addEntry( KSycocaEntry *entry );

private:
KCModuleMenuPrivate *d;
QString deriveCaptionFromPath( const QString &menuPath );
};

#endif // KCMMODULEMENU_H


+ 101
- 0
systemsettings/kcmsearch.cpp View File

@@ -0,0 +1,101 @@
/**
* This file is part of the System Settings package
* Copyright (C) 2005 Benjamin C Meyer
* <ben+systempreferences at meyerhome dot net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#include "kcmsearch.h"

#include <qregexp.h>
#include <kdebug.h>

#include "modulesview.h"
#include "moduleiconitem.h"

KcmSearch::KcmSearch( QPtrList<ModulesView> *moduleViewList, QWidget *parent, const char *name )
: KIconViewSearchLine(parent, moduleViewList->at(0)->groups[0], name){
this->moduleViewList = moduleViewList;
}

void KcmSearch::updateSearch( const QString &search ) {
QValueList<RowIconView*>::iterator it;
QPtrListIterator<ModulesView> moduleViewListIt(*moduleViewList);

ModulesView *mainView;
int page = 0;
int *hitArray = new int[moduleViewList->count()];

for ( ; moduleViewListIt.current(); ++moduleViewListIt) {
mainView = moduleViewListIt.current();

int count = 0;
for ( it = mainView->groups.begin(); it != mainView->groups.end(); ++it ){
QIconViewItem *item = (*it)->firstItem();
while( item ) {
bool hit = itemMatches(item, search);
((ModuleIconItem*)item)->loadIcon(hit);
count += hit ? 1 : 0;
item = item->nextItem();
}

}
hitArray[page] = count;
page++;
}

emit searchHits(search, hitArray, moduleViewList->count());
delete[] hitArray;
}

bool KcmSearch::itemMatches( const KCModuleInfo &module, const QString &search ) const
{
// Look in keywords
QStringList kw = module.keywords();
for(QStringList::ConstIterator it = kw.begin(); it != kw.end(); ++it) {
QString name = (*it).lower();
if ( QRegExp(search+"*", false, true).search(name) >= 0){
//kdDebug() << "MATCH:" << module.moduleName().latin1()
// << "keyword:" << name.latin1() << endl;
return true;
}
}

// Don't forget to check the name :)
if ( QRegExp(search+"*", false, true).search(module.moduleName()) >= 0)
return true;

//kdDebug() << "No MATCH:" << module.moduleName().latin1() << endl;
return false;
}

bool KcmSearch::itemMatches( const QIconViewItem *item, const QString & search ) const
{
if( !item )
return false;

ModuleIconItem *mItem = (ModuleIconItem*)item;
QValueList<KCModuleInfo>::iterator it;
for ( it = mItem->modules.begin(); it != mItem->modules.end(); ++it ){
if( itemMatches( (*it), search ) )
return true;
}
return false;
}


#include "kcmsearch.moc"

+ 67
- 0
systemsettings/kcmsearch.h View File

@@ -0,0 +1,67 @@
/**
* This file is part of the System Settings package
* Copyright (C) 2005 Benjamin C Meyer
* <ben+systempreferences at meyerhome dot net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/

#ifndef KCMSEARCH_H
#define KCMSEARCH_H

#include <kiconviewsearchline.h>
#include "kcmodulemenu.h"

class ModulesView;

/**
* Searches all the ModuleIconItem's in MainWindow and "disables" the ones
* whos keywords don't match the current search.
*/
class KcmSearch : public KIconViewSearchLine
{
Q_OBJECT

public:
KcmSearch( QPtrList<ModulesView> *moduleViewList, QWidget *parent = 0, const char *name = 0 );

public slots:
/**
* Go through all of the iconView groups in mainView and update
*/
virtual void updateSearch( const QString &search = QString::null );
/**
* Check module associated with item or if a group check all modules of that group.
* @return true if search is in the module(s) keywords
*/
virtual bool itemMatches ( const QIconViewItem *item, const QString &search ) const;

signals:
void searchHits(const QString &query, int *hitList, int length);

private:
/**
* Determine if module matches the search
* @return true if search is in module's keywords
*/
bool itemMatches ( const KCModuleInfo &module, const QString &search ) const;

// Friend class whos groups parsed,
QPtrList<ModulesView> *moduleViewList;
};

#endif // KCMSEARCH_H


+ 431
- 0
systemsettings/kcmultiwidget.cpp View File

@@ -0,0 +1,431 @@
/*
Copyright (c) 2000 Matthias Elter <elter@kde.org>
Copyright (c) 2003 Daniel Molkentin <molkentin@kde.org>
Copyright (c) 2003 Matthias Kretz <kretz@kde.org>
Copyright (c) 2004 Frans Englich <frans.erglich.com>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
Boston, MA 02110-1301, USA.

*/

#include <qcursor.h>
#include <qhbox.h>
#include <qlayout.h>
#include <qpushbutton.h>

#include <kaboutdata.h>
#include <kapplication.h>
#include <kdebug.h>
#include <kiconloader.h>
#include <klibloader.h>
#include <klocale.h>
#include <kmessagebox.h>
#include <kprocess.h>
#include <krun.h>
#include <kstdguiitem.h>
#include <kuser.h>

#include "kcmoduleloader.h"
#include "kcmoduleproxy.h"
#include "kcmultiwidget.h"

/*
Button usage:

User1 => Reset
User2 => Close
User3 => Admin
*/

class KCMultiWidget::KCMultiWidgetPrivate
{
public:
KCMultiWidgetPrivate()
: hasRootKCM( false ), currentModule( 0 )
{}

bool hasRootKCM;
KCModuleProxy* currentModule;
};

KCMultiWidget::KCMultiWidget(QWidget *parent, const char *name, bool modal)
: KDialogBase(IconList, i18n("Configure"), Help | Default |Cancel | Apply |
Ok | User1 | User2 | User3, Ok, parent, name, modal, true,
KStdGuiItem::reset(), KStdGuiItem::close(), KStdGuiItem::adminMode())
, dialogface( IconList ), d( new KCMultiWidgetPrivate )
{
init();
}

KCMultiWidget::KCMultiWidget( int dialogFace, QWidget * parent, const char * name, bool modal )
: KDialogBase( dialogFace, "Caption", Help | Default | Cancel | Apply | Ok |
User1 | User2 | User3, Ok, parent, name, modal, true,
KStdGuiItem::reset(), KStdGuiItem::close(), KStdGuiItem::adminMode())
, dialogface( dialogFace ), d( new KCMultiWidgetPrivate )
{
init();
}

inline void KCMultiWidget::init()
{
connect( this, SIGNAL( finished()), SLOT( dialogClosed()));
showButton( Ok, false );
showButton( Cancel, false );
showButton( User1, true ); // Reset button
showButton( User2, true ); // Close button.
showButton( User3, true); // Admin button.

enableButton(Apply, false);
enableButton(User1, false);

connect(this, SIGNAL(aboutToShowPage(QWidget *)), this, SLOT(slotAboutToShow(QWidget *)));
setInitialSize(QSize(640,480));
moduleParentComponents.setAutoDelete( true );
}
#include <kmessagebox.h>

KCMultiWidget::~KCMultiWidget()
{
OrphanMap::Iterator end2 = m_orphanModules.end();
for( OrphanMap::Iterator it = m_orphanModules.begin(); it != end2; ++it )
delete ( *it );
}

void KCMultiWidget::slotDefault()
{
int curPageIndex = activePageIndex();

ModuleList::Iterator end = m_modules.end();
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
if( pageIndex( ( QWidget * )( *it ).kcm->parent() ) == curPageIndex )
{
( *it ).kcm->defaults();
clientChanged( true );
return;
}
}

// Reset button.
void KCMultiWidget::slotUser1()
{
int curPageIndex = activePageIndex();

ModuleList::Iterator end = m_modules.end();
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
if( pageIndex( ( QWidget * )( *it ).kcm->parent() ) == curPageIndex )
{
( *it ).kcm->load();
clientChanged( false );
return;
}
}

void KCMultiWidget::apply()
{
QStringList updatedModules;
ModuleList::Iterator end = m_modules.end();
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
{
KCModuleProxy * m = ( *it ).kcm;
if( m && m->changed() )
{
m->save();
QStringList * names = moduleParentComponents[ m ];
kdDebug() << k_funcinfo << *names << " saved and added to the list" << endl;
for( QStringList::ConstIterator it = names->begin(); it != names->end(); ++it )
if( updatedModules.find( *it ) == updatedModules.end() )
updatedModules.append( *it );
}
}
for( QStringList::const_iterator it = updatedModules.begin(); it != updatedModules.end(); ++it )
{
kdDebug() << k_funcinfo << *it << " " << ( *it ).latin1() << endl;
emit configCommitted( ( *it ).latin1() );
}
emit configCommitted();
}

void KCMultiWidget::slotApply()
{
QPushButton *button = actionButton(Apply);
if (button)
button->setFocus();
emit applyClicked();
apply();
}


void KCMultiWidget::slotOk()
{
QPushButton *button = actionButton(Ok);
if (button)
button->setFocus();
emit okClicked();
apply();
accept();
}

void KCMultiWidget::slotHelp()
{
QString docPath;

int curPageIndex = activePageIndex();
ModuleList::Iterator end = m_modules.end();
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
if( pageIndex( ( QWidget * )( *it ).kcm->parent() ) == curPageIndex )
{
docPath = ( *it ).kcm->moduleInfo().docPath();
break;
}

KURL url( KURL("help:/"), docPath );

if (url.protocol() == "help" || url.protocol() == "man" || url.protocol() == "info") {
KProcess process;
process << "khelpcenter"
<< url.url();
process.start(KProcess::DontCare);
process.detach();
} else {
new KRun(url);
}
}

// Close button
void KCMultiWidget::slotUser2() {
emit close();
}

void KCMultiWidget::clientChanged(bool state)
{
kdDebug( 710 ) << k_funcinfo << state << endl;
ModuleList::Iterator end = m_modules.end();
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it )
if( ( *it ).kcm->changed() ) {
enableButton( Apply, true );
enableButton( User1, true);
return;
}
enableButton( Apply, false );
enableButton( User1, false);
}

void KCMultiWidget::addModule(const QString& path, bool withfallback)
{
QString complete = path;

if( !path.endsWith( ".desktop" ))
complete += ".desktop";

KService::Ptr service = KService::serviceByStorageId( complete );

addModule( KCModuleInfo( service ), QStringList(), withfallback);
}

void KCMultiWidget::addModule(const KCModuleInfo& moduleinfo,
QStringList parentmodulenames, bool withfallback)
{
if( !moduleinfo.service() )
return;

if ( !kapp->authorizeControlModule( moduleinfo.service()->menuId() ))
return;

if( !KCModuleLoader::testModule( moduleinfo ))
return;

QFrame* page = 0;
if (!moduleinfo.service()->noDisplay())
switch( dialogface )
{
case TreeList:
parentmodulenames += moduleinfo.moduleName();
page = addHBoxPage( parentmodulenames, moduleinfo.comment(),
SmallIcon( moduleinfo.icon(),
IconSize( KIcon::Small ) ) );
break;
case Tabbed:
case IconList:
page = addHBoxPage( moduleinfo.moduleName(),
moduleinfo.comment(), DesktopIcon( moduleinfo.icon(),
KIcon::SizeMedium ) );
break;
case Plain:
page = plainPage();
( new QHBoxLayout( page ) )->setAutoAdd( true );
break;
default:
kdError( 710 ) << "unsupported dialog face for KCMultiWidget"
<< endl;
break;
}
if(!page) {
KCModuleLoader::unloadModule(moduleinfo);
return;
}
KCModuleProxy * module;
if( m_orphanModules.contains( moduleinfo.service() ) )
{
// the KCModule already exists - it was removed from the dialog in
// removeAllModules
module = m_orphanModules[ moduleinfo.service() ];
m_orphanModules.remove( moduleinfo.service() );
kdDebug( 710 ) << "Use KCModule from the list of orphans for " <<
moduleinfo.moduleName() << ": " << module << endl;

module->reparent( page, 0, QPoint( 0, 0 ), true );

if( module->changed() )
clientChanged( true );

if( activePageIndex() == -1 ) {
showPage( pageIndex( page ) );
}
}
else
{
module = new KCModuleProxy( moduleinfo, withfallback, page );

QStringList parentComponents = moduleinfo.service()->property(
"X-KDE-ParentComponents" ).toStringList();
moduleParentComponents.insert( module,
new QStringList( parentComponents ) );

connect(module, SIGNAL(changed(bool)), this, SLOT(clientChanged(bool)));

}

CreatedModule cm;
cm.kcm = module;
cm.service = moduleinfo.service();
cm.adminmode = false;
cm.buttons = module->buttons();
if ( moduleinfo.needsRootPrivileges() &&
!KUser().isSuperUser() ) {/* If we're embedded, it's true */
d->hasRootKCM = true;
cm.adminmode = true;
m_modules.append( cm );
if( dialogface==Plain ) {
slotAboutToShow( page ); // Won't be called otherwise, necessary for adminMode button
}
} else {
m_modules.append( cm );
}

if( m_modules.count() == 1 ) {
slotAboutToShow( page );
}
}

KCModuleProxy * KCMultiWidget::currentModule() {
if(d) {
return d->currentModule;
}
return NULL;
}

void KCMultiWidget::applyOrRevert(KCModuleProxy * module){
if( !module || !module->changed() )
return;
int res = KMessageBox::warningYesNo(this,
i18n("There are unsaved changes in the active module.\n"
"Do you want to apply the changes or discard them?"),
i18n("Unsaved Changes"),
KStdGuiItem::apply(),
KStdGuiItem::discard());
if (res == KMessageBox::Yes) {
slotApply();
} else {
module->load();
clientChanged( false );
}
}


void KCMultiWidget::slotAboutToShow(QWidget *page)
{
QObject * obj = page->child( 0, "KCModuleProxy" );
if( ! obj )
return;

KCModuleProxy *module = ( KCModuleProxy* )obj->qt_cast( "KCModuleProxy" );
if( ! module )
return;

if( d && d->currentModule )
applyOrRevert( d->currentModule );
d->currentModule = module;
emit ( aboutToShow( d->currentModule ) );

ModuleList::Iterator end = m_modules.end();
int buttons = 0;
for( ModuleList::Iterator it = m_modules.begin(); it != end; ++it ) {
if( ( *it ).kcm==d->currentModule) {
showButton(User3, ( *it ).adminmode);
buttons = ( *it ).buttons;
}
}

showButton(Apply, buttons & KCModule::Apply);
showButton(User1, buttons & KCModule::Apply); // Reset button.

// Close button. No Apply button implies a Close button.
showButton(User2, (buttons & KCModule::Apply)==0);

enableButton( KDialogBase::Help, buttons & KCModule::Help );
enableButton( KDialogBase::Default, buttons & KCModule::Default );

disconnect( this, SIGNAL(user3Clicked()), 0, 0 );

if (d->currentModule->moduleInfo().needsRootPrivileges() &&
!d->currentModule->rootMode() )
{ /* Enable the Admin Mode button */
enableButton( User3, true );
connect( this, SIGNAL(user3Clicked()), d->currentModule, SLOT( runAsRoot() ));
connect( this, SIGNAL(user3Clicked()), SLOT( disableRModeButton() ));
} else {
enableButton( User3, false );
}
}

void KCMultiWidget::rootExit()
{
enableButton( User3, true);
}

void KCMultiWidget::disableRModeButton()
{
enableButton( User3, false );
connect ( d->currentModule, SIGNAL( childClosed() ), SLOT( rootExit() ) );
}

void KCMultiWidget::slotCancel() {
dialogClosed();
KDialogBase::slotCancel();
}