commit
47becbedc6
@ -0,0 +1,4 @@
|
|||||||
|
Author:
|
||||||
|
Juanjo Alvarez <juanjo@juanjoalvarez.net>
|
||||||
|
Mario Bensi <nef@ipsquad.net>
|
||||||
|
Pino Toscano <toscano.pino@tiscali.it>
|
@ -0,0 +1,78 @@
|
|||||||
|
0.12
|
||||||
|
[Mario]
|
||||||
|
|
||||||
|
* KCM Module
|
||||||
|
|
||||||
|
0.11
|
||||||
|
[Mario]
|
||||||
|
|
||||||
|
* Bugfix, modification of interface, add/remove alternatives, search the
|
||||||
|
description on rpm/deb package, show alternative's properties
|
||||||
|
|
||||||
|
0.10
|
||||||
|
[Juanjo]
|
||||||
|
|
||||||
|
* First C++ version for user convenience. No new features but a lot more lines
|
||||||
|
of code ;) Also the installation procedure will be not standart autotools.
|
||||||
|
|
||||||
|
0.9.1
|
||||||
|
[Juanjo]
|
||||||
|
|
||||||
|
* Desktop file and desktop file installation
|
||||||
|
|
||||||
|
0.9
|
||||||
|
[Juanjo]
|
||||||
|
|
||||||
|
* Started KDEification. Still lacking some things
|
||||||
|
|
||||||
|
0.8
|
||||||
|
[Juanjo]
|
||||||
|
|
||||||
|
* Mandrake support
|
||||||
|
|
||||||
|
0.7
|
||||||
|
[Juanjo]
|
||||||
|
* Added "Expand All" and "Collapse All" buttons
|
||||||
|
|
||||||
|
* Now all tree items are collapsed at program init
|
||||||
|
|
||||||
|
0.6
|
||||||
|
|
||||||
|
* Fixes
|
||||||
|
|
||||||
|
0.5
|
||||||
|
|
||||||
|
* Corrected some typos in the README (thanks Martin Atukunda)
|
||||||
|
|
||||||
|
* Corrected a bug where kalternatives didn't exited in some cases
|
||||||
|
where it should.
|
||||||
|
|
||||||
|
0.4
|
||||||
|
|
||||||
|
* Bug fixed.
|
||||||
|
|
||||||
|
* Unhadled exceptions should now be shown in a dialog to the user so he can
|
||||||
|
report them to me.
|
||||||
|
|
||||||
|
0.3
|
||||||
|
|
||||||
|
* Since the program is so simple, I've joined the two (small) source files in
|
||||||
|
one.
|
||||||
|
|
||||||
|
* Non-root user checking and warnings.
|
||||||
|
|
||||||
|
* Some documentation.
|
||||||
|
|
||||||
|
0.2
|
||||||
|
|
||||||
|
* Some method documentation
|
||||||
|
|
||||||
|
* Implemented Aaron's suggestions.
|
||||||
|
|
||||||
|
* Refactor of some code (now is a lot simpler)
|
||||||
|
|
||||||
|
0.1
|
||||||
|
|
||||||
|
* Now closing the window using the window "close" button will also ask for
|
||||||
|
confirmation if there are still changes pending.
|
||||||
|
* Some small fixes
|
@ -0,0 +1,248 @@
|
|||||||
|
# Doxyfile 1.3.5-KDevelop
|
||||||
|
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Project related configuration options
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
PROJECT_NAME = kalternatives
|
||||||
|
PROJECT_NUMBER = 0.12
|
||||||
|
OUTPUT_DIRECTORY =
|
||||||
|
OUTPUT_LANGUAGE = English
|
||||||
|
USE_WINDOWS_ENCODING = NO
|
||||||
|
BRIEF_MEMBER_DESC = YES
|
||||||
|
REPEAT_BRIEF = YES
|
||||||
|
ABBREVIATE_BRIEF = "The $name class" \
|
||||||
|
"The $name widget" \
|
||||||
|
"The $name file" \
|
||||||
|
is \
|
||||||
|
provides \
|
||||||
|
specifies \
|
||||||
|
contains \
|
||||||
|
represents \
|
||||||
|
a \
|
||||||
|
an \
|
||||||
|
the
|
||||||
|
ALWAYS_DETAILED_SEC = NO
|
||||||
|
INLINE_INHERITED_MEMB = NO
|
||||||
|
FULL_PATH_NAMES = NO
|
||||||
|
STRIP_FROM_PATH =
|
||||||
|
SHORT_NAMES = NO
|
||||||
|
JAVADOC_AUTOBRIEF = NO
|
||||||
|
MULTILINE_CPP_IS_BRIEF = NO
|
||||||
|
DETAILS_AT_TOP = NO
|
||||||
|
INHERIT_DOCS = YES
|
||||||
|
DISTRIBUTE_GROUP_DOC = NO
|
||||||
|
TAB_SIZE = 8
|
||||||
|
ALIASES =
|
||||||
|
OPTIMIZE_OUTPUT_FOR_C = NO
|
||||||
|
OPTIMIZE_OUTPUT_JAVA = NO
|
||||||
|
SUBGROUPING = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Build related configuration options
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
EXTRACT_ALL = NO
|
||||||
|
EXTRACT_PRIVATE = NO
|
||||||
|
EXTRACT_STATIC = NO
|
||||||
|
EXTRACT_LOCAL_CLASSES = YES
|
||||||
|
HIDE_UNDOC_MEMBERS = NO
|
||||||
|
HIDE_UNDOC_CLASSES = NO
|
||||||
|
HIDE_FRIEND_COMPOUNDS = NO
|
||||||
|
HIDE_IN_BODY_DOCS = NO
|
||||||
|
INTERNAL_DOCS = NO
|
||||||
|
CASE_SENSE_NAMES = YES
|
||||||
|
HIDE_SCOPE_NAMES = NO
|
||||||
|
SHOW_INCLUDE_FILES = YES
|
||||||
|
INLINE_INFO = YES
|
||||||
|
SORT_MEMBER_DOCS = YES
|
||||||
|
SORT_BRIEF_DOCS = NO
|
||||||
|
SORT_BY_SCOPE_NAME = NO
|
||||||
|
GENERATE_TODOLIST = YES
|
||||||
|
GENERATE_TESTLIST = YES
|
||||||
|
GENERATE_BUGLIST = YES
|
||||||
|
GENERATE_DEPRECATEDLIST= YES
|
||||||
|
ENABLED_SECTIONS =
|
||||||
|
MAX_INITIALIZER_LINES = 30
|
||||||
|
SHOW_USED_FILES = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to warning and progress messages
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
QUIET = NO
|
||||||
|
WARNINGS = YES
|
||||||
|
WARN_IF_UNDOCUMENTED = YES
|
||||||
|
WARN_IF_DOC_ERROR = YES
|
||||||
|
WARN_FORMAT = "$file:$line: $text"
|
||||||
|
WARN_LOGFILE =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the input files
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
INPUT =
|
||||||
|
FILE_PATTERNS = *.c \
|
||||||
|
*.cc \
|
||||||
|
*.cxx \
|
||||||
|
*.cpp \
|
||||||
|
*.c++ \
|
||||||
|
*.java \
|
||||||
|
*.ii \
|
||||||
|
*.ixx \
|
||||||
|
*.ipp \
|
||||||
|
*.i++ \
|
||||||
|
*.inl \
|
||||||
|
*.h \
|
||||||
|
*.hh \
|
||||||
|
*.hxx \
|
||||||
|
*.hpp \
|
||||||
|
*.h++ \
|
||||||
|
*.idl \
|
||||||
|
*.odl \
|
||||||
|
*.cs \
|
||||||
|
*.php \
|
||||||
|
*.php3 \
|
||||||
|
*.inc \
|
||||||
|
*.C \
|
||||||
|
*.H \
|
||||||
|
*.tlh \
|
||||||
|
*.diff \
|
||||||
|
*.patch \
|
||||||
|
*.moc \
|
||||||
|
*.xpm \
|
||||||
|
*.dox
|
||||||
|
RECURSIVE = yes
|
||||||
|
EXCLUDE =
|
||||||
|
EXCLUDE_SYMLINKS = NO
|
||||||
|
EXCLUDE_PATTERNS =
|
||||||
|
EXAMPLE_PATH =
|
||||||
|
EXAMPLE_PATTERNS = *
|
||||||
|
EXAMPLE_RECURSIVE = NO
|
||||||
|
IMAGE_PATH =
|
||||||
|
INPUT_FILTER =
|
||||||
|
FILTER_SOURCE_FILES = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to source browsing
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
SOURCE_BROWSER = NO
|
||||||
|
INLINE_SOURCES = NO
|
||||||
|
STRIP_CODE_COMMENTS = YES
|
||||||
|
REFERENCED_BY_RELATION = YES
|
||||||
|
REFERENCES_RELATION = YES
|
||||||
|
VERBATIM_HEADERS = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the alphabetical class index
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
ALPHABETICAL_INDEX = YES
|
||||||
|
COLS_IN_ALPHA_INDEX = 5
|
||||||
|
IGNORE_PREFIX =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the HTML output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_HTML = YES
|
||||||
|
HTML_OUTPUT = html
|
||||||
|
HTML_FILE_EXTENSION = .html
|
||||||
|
HTML_HEADER =
|
||||||
|
HTML_FOOTER =
|
||||||
|
HTML_STYLESHEET =
|
||||||
|
HTML_ALIGN_MEMBERS = YES
|
||||||
|
GENERATE_HTMLHELP = NO
|
||||||
|
CHM_FILE =
|
||||||
|
HHC_LOCATION =
|
||||||
|
GENERATE_CHI = NO
|
||||||
|
BINARY_TOC = NO
|
||||||
|
TOC_EXPAND = NO
|
||||||
|
DISABLE_INDEX = NO
|
||||||
|
ENUM_VALUES_PER_LINE = 4
|
||||||
|
GENERATE_TREEVIEW = NO
|
||||||
|
TREEVIEW_WIDTH = 250
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the LaTeX output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_LATEX = NO
|
||||||
|
LATEX_OUTPUT = latex
|
||||||
|
LATEX_CMD_NAME = latex
|
||||||
|
MAKEINDEX_CMD_NAME = makeindex
|
||||||
|
COMPACT_LATEX = NO
|
||||||
|
PAPER_TYPE = a4wide
|
||||||
|
EXTRA_PACKAGES =
|
||||||
|
LATEX_HEADER =
|
||||||
|
PDF_HYPERLINKS = NO
|
||||||
|
USE_PDFLATEX = NO
|
||||||
|
LATEX_BATCHMODE = NO
|
||||||
|
LATEX_HIDE_INDICES = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the RTF output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_RTF = NO
|
||||||
|
RTF_OUTPUT = rtf
|
||||||
|
COMPACT_RTF = NO
|
||||||
|
RTF_HYPERLINKS = NO
|
||||||
|
RTF_STYLESHEET_FILE =
|
||||||
|
RTF_EXTENSIONS_FILE =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the man page output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_MAN = NO
|
||||||
|
MAN_OUTPUT = man
|
||||||
|
MAN_EXTENSION = .3
|
||||||
|
MAN_LINKS = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the XML output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_XML = NO
|
||||||
|
XML_OUTPUT = xml
|
||||||
|
XML_SCHEMA =
|
||||||
|
XML_DTD =
|
||||||
|
XML_PROGRAMLISTING = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options for the AutoGen Definitions output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_AUTOGEN_DEF = NO
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# configuration options related to the Perl module output
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
GENERATE_PERLMOD = NO
|
||||||
|
PERLMOD_LATEX = NO
|
||||||
|
PERLMOD_PRETTY = YES
|
||||||
|
PERLMOD_MAKEVAR_PREFIX =
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration options related to the preprocessor
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
ENABLE_PREPROCESSING = YES
|
||||||
|
MACRO_EXPANSION = NO
|
||||||
|
EXPAND_ONLY_PREDEF = NO
|
||||||
|
SEARCH_INCLUDES = YES
|
||||||
|
INCLUDE_PATH =
|
||||||
|
INCLUDE_FILE_PATTERNS =
|
||||||
|
PREDEFINED =
|
||||||
|
EXPAND_AS_DEFINED =
|
||||||
|
SKIP_FUNCTION_MACROS = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration::additions related to external references
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
TAGFILES =
|
||||||
|
GENERATE_TAGFILE =
|
||||||
|
ALLEXTERNALS = NO
|
||||||
|
EXTERNAL_GROUPS = YES
|
||||||
|
PERL_PATH = /usr/bin/perl
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration options related to the dot tool
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
CLASS_DIAGRAMS = YES
|
||||||
|
HIDE_UNDOC_RELATIONS = YES
|
||||||
|
HAVE_DOT = YES
|
||||||
|
CLASS_GRAPH = YES
|
||||||
|
COLLABORATION_GRAPH = YES
|
||||||
|
UML_LOOK = NO
|
||||||
|
TEMPLATE_RELATIONS = NO
|
||||||
|
INCLUDE_GRAPH = YES
|
||||||
|
INCLUDED_BY_GRAPH = YES
|
||||||
|
CALL_GRAPH = NO
|
||||||
|
GRAPHICAL_HIERARCHY = YES
|
||||||
|
DOT_IMAGE_FORMAT = png
|
||||||
|
DOT_PATH =
|
||||||
|
DOTFILE_DIRS =
|
||||||
|
MAX_DOT_GRAPH_WIDTH = 1024
|
||||||
|
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||||
|
MAX_DOT_GRAPH_DEPTH = 1000
|
||||||
|
GENERATE_LEGEND = YES
|
||||||
|
DOT_CLEANUP = YES
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
# Configuration::additions related to the search engine
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
SEARCHENGINE = NO
|
@ -0,0 +1,16 @@
|
|||||||
|
What you need:
|
||||||
|
|
||||||
|
- KDE >= 3.2
|
||||||
|
- Qt
|
||||||
|
- All development packages for KDE (kdelibs & qt)
|
||||||
|
|
||||||
|
To install configure the program with the correct prefix for
|
||||||
|
your KDE installation (like /usr or /opt/kde3 or similar)
|
||||||
|
|
||||||
|
./configure --prefix=...
|
||||||
|
|
||||||
|
And finally:
|
||||||
|
|
||||||
|
make install
|
||||||
|
|
||||||
|
Now you should be able to run the "kalternatives" command.
|
@ -0,0 +1,22 @@
|
|||||||
|
SUBDIRS = src doc
|
||||||
|
|
||||||
|
$(top_srcdir)/configure.in: configure.in.in $(top_srcdir)/subdirs
|
||||||
|
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common configure.in ;
|
||||||
|
|
||||||
|
$(top_srcdir)/subdirs:
|
||||||
|
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common subdirs
|
||||||
|
|
||||||
|
$(top_srcdir)/acinclude.m4: $(top_srcdir)/admin/acinclude.m4.in $(top_srcdir)/admin/libtool.m4.in
|
||||||
|
@cd $(top_srcdir) && cat admin/acinclude.m4.in admin/libtool.m4.in > acinclude.m4
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = subdirs configure.in acinclude.m4 configure.files
|
||||||
|
|
||||||
|
package-messages:
|
||||||
|
cd $(top_srcdir) && $(MAKE) -f admin/Makefile.common package-messages
|
||||||
|
$(MAKE) -C po merge
|
||||||
|
|
||||||
|
EXTRA_DIST = admin COPYING configure.in.in
|
||||||
|
|
||||||
|
dist-hook:
|
||||||
|
cd $(top_distdir) && perl admin/am_edit -padmin
|
||||||
|
cd $(top_distdir) && $(MAKE) -f admin/Makefile.common subdirs
|
@ -0,0 +1,10 @@
|
|||||||
|
all:
|
||||||
|
@echo "This Makefile is only for the CVS repository"
|
||||||
|
@echo "This will be deleted before making the distribution"
|
||||||
|
@echo ""
|
||||||
|
$(MAKE) -f admin/Makefile.common cvs
|
||||||
|
|
||||||
|
dist:
|
||||||
|
$(MAKE) -f admin/Makefile.common dist
|
||||||
|
|
||||||
|
.SILENT:
|
@ -0,0 +1,64 @@
|
|||||||
|
README for Kalternatives
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
Kalternatives is a KDE program that a allows you to easily configure and
|
||||||
|
change your Mandrake/Debian alternatives system.
|
||||||
|
|
||||||
|
What is the Mandrake/Debian Alternatives System?
|
||||||
|
----------------------------------------
|
||||||
|
|
||||||
|
The Mandrake/Debian alternatives system is designed to allow the system administrator to
|
||||||
|
select an alternative when there are several options that provide the same file
|
||||||
|
or functionality. For example, there are several different packages on Mandrake/Debian
|
||||||
|
that provide the command "vi" (the standard POSIX text editor) and Mandrake/Debian (and
|
||||||
|
other distributions using this same system as Mandrake Linux) allows you to
|
||||||
|
have more than one option installed (for example, to satisfy the needs for
|
||||||
|
different users on a multiuser system). But, how does Mandrake/Debian knows which of the
|
||||||
|
installed programs must be run when "vi" is entered on a shell? The answer is:
|
||||||
|
using the alternatives system. This system keeps a database of provided
|
||||||
|
alternatives for every option on /var/lib/dpkg/alternatives and a collection of
|
||||||
|
links on /etc/alternatives that point to the real program. So, if your default
|
||||||
|
version of "vi" is "vim", the link /usr/bin/vi will point to
|
||||||
|
/etc/alternatives/vi that points to /usr/bin/vim. But if in the future you
|
||||||
|
would like to change /usr/bin/vi to point to the nvi executable you could:
|
||||||
|
|
||||||
|
1. Change the link on /etc/alternatives/vi by hand.
|
||||||
|
2. Use the Mandrake/Debian command update-alternatives --config vi
|
||||||
|
3. Use Kalternatives.
|
||||||
|
|
||||||
|
|
||||||
|
How is the program used?
|
||||||
|
------------------------
|
||||||
|
|
||||||
|
The program should be very simple to use; once executed (as root) you will be
|
||||||
|
presented with a window showing a list where there are entries with yellow
|
||||||
|
squares and subentries bellow them. The entries are "nodes", that is, programs
|
||||||
|
that can have one or more alternative packages providing them and the
|
||||||
|
subentries are the alternatives. You can select one alternative just by
|
||||||
|
clicking on the radiobutton to the left of his name and pushing the "Apply"
|
||||||
|
button. Then you will be presented with a dialog showing you the changes to be
|
||||||
|
made and allowing you to confirm them before really changing the alternatives.
|
||||||
|
|
||||||
|
Please note that some "nodes" only have one alternative because there are no
|
||||||
|
more packages installed providing it and some alternatives are disabled (you
|
||||||
|
will be unable to click on them). This last case is because the alternative
|
||||||
|
exists in the database but the link to it is broken. This sometimes happends
|
||||||
|
with unclean packages uninstallations and usually is not something to worry
|
||||||
|
about.
|
||||||
|
|
||||||
|
Who do I have to whine if the program fails for me?
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
To Juanjo Álvarez <juanjux@yahoo.es>
|
||||||
|
|
||||||
|
What is the KDE-Mandrake/Debian project?
|
||||||
|
-------------------------------
|
||||||
|
|
||||||
|
The KDE-Debian project is composed of some individuals, actively supported by
|
||||||
|
some companies, trying to provide Debian and Debian based distributions with a
|
||||||
|
collection of first-class, updated KDE desktop including some KDE applications
|
||||||
|
specifically designed for Debian. If you want to support the info by money or
|
||||||
|
by work (coding, translations, testing) you can have more info on the
|
||||||
|
kde-Debian mailing list:
|
||||||
|
|
||||||
|
https://mail.kde.org/mailman/listinfo/kde-Mandrake/Debian
|
@ -0,0 +1,5 @@
|
|||||||
|
* Help, documentation, whatsthis and tooltips
|
||||||
|
* Implement as a nice kcontrol/kadmin/kwhatever module
|
||||||
|
* .spec file for building Mandrake RPMS
|
||||||
|
* Decent debian/ subdir (I'm not using Debian anymore so I need help
|
||||||
|
with this one)
|
@ -0,0 +1,11 @@
|
|||||||
|
#MIN_CONFIG(3.0.0)
|
||||||
|
|
||||||
|
AM_INIT_AUTOMAKE(kalternatives, 0.10)
|
||||||
|
AC_C_BIGENDIAN
|
||||||
|
AC_CHECK_KDEMAXPATHLEN
|
||||||
|
|
||||||
|
AC_CHECK_FILE(/etc/debian_version, [AC_DEFINE([DEBIAN], [], [debian]) AC_MSG_NOTICE(it is a debian)],
|
||||||
|
[AC_CHECK_FILE(/etc/mandrakelinux-release,
|
||||||
|
[AC_DEFINE([MANDRAKE], [], [mandrake]) AC_MSG_NOTICE(it is a mandrake)],
|
||||||
|
[AC_MSG_NOTICE(it is an other distribution)])])
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
kalternatives (0.12-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Initial release.
|
||||||
|
|
||||||
|
-- <Mario Bensi <nef@ipsquad.net>> Tue, 14 Oct 2004 13:07:14 +0100
|
||||||
|
|
||||||
|
kalternatives (0.10-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Initial release.
|
||||||
|
|
||||||
|
-- <Juanjo Alvarez <juanjux@yahoo.es>> Tue, 30 Dec 2003 22:40:14 +0100
|
||||||
|
|
@ -0,0 +1,14 @@
|
|||||||
|
Source: kalternatives
|
||||||
|
Section: admin
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Mario Bensi <nef@ipsquad.net>
|
||||||
|
Build-Depends: automake1.7, debhelper (>> 4.0.18), gettext, kdelibs4-dev
|
||||||
|
Standards-Version: 3.2.1
|
||||||
|
|
||||||
|
Package: kalternatives
|
||||||
|
Architecture: any
|
||||||
|
Depends: ${shlibs:Depends}
|
||||||
|
Description: KDE GUI for configuring the Debian alternatives system
|
||||||
|
This program lets you configure the Debian/Mandrake alternatives system (a
|
||||||
|
system that allows you to select one alternative file for many in the
|
||||||
|
filesystem) using an easy KDE GUI.
|
@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||||
|
include /usr/share/cdbs/1/class/kde.mk
|
||||||
|
|
||||||
|
# These variables are used by debhelper.mk; we are telling it to
|
||||||
|
# 1. dh_compress not to compress any files with the below extensions.
|
||||||
|
# 2. dh_makeshlibs to create automatic conservative version dependencies
|
||||||
|
# 3. dh_shlibdeps which directories to look in to resolve internal dependencies
|
||||||
|
DEB_COMPRESS_EXCLUDE := .bz2 .css .dcl .docbook -license
|
||||||
|
DEB_DH_MAKESHLIBS_ARGS := -V
|
||||||
|
DEB_SHLIBDEPS_INCLUDE := debian/libartsc0/usr/lib debian/libarts1/usr/lib
|
@ -0,0 +1,6 @@
|
|||||||
|
# the SUBDIRS is filled automatically by am_edit. If files are
|
||||||
|
# in this directory they are installed into the english dir
|
||||||
|
|
||||||
|
KDE_LANG = en
|
||||||
|
KDE_DOCS = kalternatives
|
||||||
|
SUBDIRS = $(AUTODIRS)
|
@ -0,0 +1,2 @@
|
|||||||
|
KDE_DOCS = kalternatives
|
||||||
|
KDE_LANG = en
|
@ -0,0 +1,555 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<!DOCTYPE book PUBLIC "-//KDE//DTD DocBook XML V4.1.2-Based Variant V1.1//EN" "dtd/kdex.dtd" [
|
||||||
|
<!ENTITY kalternatives "<application>kalternatives 0.10</application>">
|
||||||
|
<!ENTITY kappname "&kalternatives;"><!-- Do *not* replace kappname-->
|
||||||
|
<!ENTITY package "kde-module"><!-- kdebase, kdeadmin, etc -->
|
||||||
|
<!ENTITY % addindex "IGNORE">
|
||||||
|
<!ENTITY % English "INCLUDE"><!-- change language only here -->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Do not define any other entities; instead, use the entities
|
||||||
|
from kde-genent.entities and $LANG/user.entities. -->
|
||||||
|
]>
|
||||||
|
<!-- kdoctemplate v0.8 October 1 1999
|
||||||
|
Minor update to "Credits and Licenses" section on August 24, 2000
|
||||||
|
Removed "Revision history" section on 22 January 2001
|
||||||
|
Changed to Installation/Help menu entities 18 October 2001
|
||||||
|
Other minor cleanup and changes 18 October 2001 -->
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This template was designed by: David Rugge davidrugge@mindspring.com
|
||||||
|
with lots of help from: Eric Bischoff ebisch@cybercable.tm.fr
|
||||||
|
and Frederik Fouvry fouvry@sfs.nphil.uni-tuebingen.de
|
||||||
|
of the KDE DocBook team.
|
||||||
|
|
||||||
|
You may freely use this template for writing any sort of KDE documentation.
|
||||||
|
If you have any changes or improvements, please let us know.
|
||||||
|
|
||||||
|
Remember:
|
||||||
|
- in XML, the case of the <tags> and attributes is relevant ;
|
||||||
|
- also, quote all attributes.
|
||||||
|
|
||||||
|
Please don't forget to remove all these comments in your final documentation,
|
||||||
|
thanks ;-).
|
||||||
|
-->
|
||||||
|
|
||||||
|
<!-- ................................................................ -->
|
||||||
|
|
||||||
|
<!-- The language must NOT be changed here. -->
|
||||||
|
|
||||||
|
<book lang="&language;">
|
||||||
|
|
||||||
|
<!-- This header contains all of the meta-information for the document such
|
||||||
|
as Authors, publish date, the abstract, and Keywords -->
|
||||||
|
|
||||||
|
<bookinfo>
|
||||||
|
<title>The &kalternatives; Handbook</title>
|
||||||
|
|
||||||
|
<authorgroup>
|
||||||
|
<author>
|
||||||
|
<firstname></firstname>
|
||||||
|
<othername></othername>
|
||||||
|
<surname>Juanjo</surname>
|
||||||
|
<affiliation>
|
||||||
|
<address><email>juanjux@yahoo.es</email></address>
|
||||||
|
</affiliation>
|
||||||
|
</author>
|
||||||
|
</authorgroup>
|
||||||
|
|
||||||
|
<!-- TRANS:ROLES_OF_TRANSLATORS -->
|
||||||
|
|
||||||
|
<copyright>
|
||||||
|
<year>1999</year>
|
||||||
|
<year>2004</year>
|
||||||
|
<holder>Juanjo</holder>
|
||||||
|
</copyright>
|
||||||
|
<!-- Translators: put here the copyright notice of the translation -->
|
||||||
|
<!-- Put here the FDL notice. Read the explanation in fdl-notice.docbook
|
||||||
|
and in the FDL itself on how to use it. -->
|
||||||
|
<legalnotice>&FDLNotice;</legalnotice>
|
||||||
|
|
||||||
|
<!-- Date and version information of the documentation
|
||||||
|
Don't forget to include this last date and this last revision number, we
|
||||||
|
need them for translation coordination !
|
||||||
|
Please respect the format of the date (YYYY-MM-DD) and of the version
|
||||||
|
(V.MM.LL), it could be used by automation scripts.
|
||||||
|
Do NOT change these in the translation. -->
|
||||||
|
|
||||||
|
<date>2001-10-18</date>
|
||||||
|
<releaseinfo>0.10</releaseinfo>
|
||||||
|
|
||||||
|
<!-- Abstract about this handbook -->
|
||||||
|
|
||||||
|
<abstract>
|
||||||
|
<para>
|
||||||
|
&kalternatives; is an application specially designed to do nothing you would
|
||||||
|
ever want.
|
||||||
|
</para>
|
||||||
|
</abstract>
|
||||||
|
|
||||||
|
<!-- This is a set of Keywords for indexing by search engines.
|
||||||
|
Please at least include KDE, the KDE package it is in, the name
|
||||||
|
of your application, and a few relevant keywords. -->
|
||||||
|
|
||||||
|
<keywordset>
|
||||||
|
<keyword>KDE</keyword>
|
||||||
|
<keyword>kalternatives</keyword>
|
||||||
|
<keyword>nothing</keyword>
|
||||||
|
<keyword>nothing else</keyword>
|
||||||
|
</keywordset>
|
||||||
|
|
||||||
|
</bookinfo>
|
||||||
|
|
||||||
|
<!-- The contents of the documentation begin here. Label
|
||||||
|
each chapter so with the id attribute. This is necessary for two reasons: it
|
||||||
|
allows you to easily reference the chapter from other chapters of your
|
||||||
|
document, and if there is no ID, the name of the generated HTML files will vary
|
||||||
|
from time to time making it hard to manage for maintainers and for the CVS
|
||||||
|
system. Any chapter labelled (OPTIONAL) may be left out at the author's
|
||||||
|
discretion. Other chapters should not be left out in order to maintain a
|
||||||
|
consistent documentation style across all KDE apps. -->
|
||||||
|
|
||||||
|
<chapter id="introduction">
|
||||||
|
<title>Introduction</title>
|
||||||
|
|
||||||
|
<!-- The introduction chapter contains a brief introduction for the
|
||||||
|
application that explains what it does and where to report
|
||||||
|
problems. Basically a long version of the abstract. Don't include a
|
||||||
|
revision history. (see installation appendix comment) -->
|
||||||
|
|
||||||
|
<para>
|
||||||
|
&kalternatives; is a program that lets you do absolutely nothing. Please report
|
||||||
|
any problems or feature requests to the &kde; mailing lists.
|
||||||
|
</para>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="using-kalternatives">
|
||||||
|
<title>Using &kalternatives;</title>
|
||||||
|
|
||||||
|
<!-- This chapter should tell the user how to use your app. You should use as
|
||||||
|
many sections (Chapter, Sect1, Sect3, etc...) as is necessary to fully document
|
||||||
|
your application. -->
|
||||||
|
|
||||||
|
<para>
|
||||||
|
|
||||||
|
<!-- Note that all graphics should be in .png format. Use no gifs because of
|
||||||
|
patent issues. -->
|
||||||
|
|
||||||
|
<screenshot>
|
||||||
|
<screeninfo>Here's a screenshot of &kalternatives;</screeninfo>
|
||||||
|
<mediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="screenshot.png" format="PNG"/>
|
||||||
|
</imageobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="screenshot.eps" format="EPS"/>
|
||||||
|
</imageobject>
|
||||||
|
<textobject>
|
||||||
|
<phrase>Screenshot</phrase>
|
||||||
|
</textobject>
|
||||||
|
</mediaobject>
|
||||||
|
</screenshot>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
|
||||||
|
<sect1 id="kalternatives-features">
|
||||||
|
<title>More &kalternatives; features</title>
|
||||||
|
|
||||||
|
<para>It slices! It dices! and it comes with a free toaster!</para>
|
||||||
|
<para>
|
||||||
|
The Squiggle Tool <guiicon><inlinemediaobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="squiggle.png" format="PNG"/>
|
||||||
|
</imageobject>
|
||||||
|
<imageobject>
|
||||||
|
<imagedata fileref="squiggle.eps" format="EPS"/>
|
||||||
|
</imageobject>
|
||||||
|
<textobject>
|
||||||
|
<phrase>Squiggle</phrase>
|
||||||
|
</textobject>
|
||||||
|
</inlinemediaobject></guiicon> is used to draw squiggly lines all over
|
||||||
|
the &kalternatives; main window. It's not a bug, it's a feature!
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="commands">
|
||||||
|
<title>Command Reference</title>
|
||||||
|
|
||||||
|
<!-- (OPTIONAL, BUT RECOMMENDED) This chapter should list all of the
|
||||||
|
application windows and their menubar and toolbar commands for easy reference.
|
||||||
|
Also include any keys that have a special function but have no equivalent in the
|
||||||
|
menus or toolbars. This may not be necessary for small apps or apps with no tool
|
||||||
|
or menu bars. -->
|
||||||
|
|
||||||
|
<sect1 id="kalternatives-mainwindow">
|
||||||
|
<title>The main &kalternatives; window</title>
|
||||||
|
|
||||||
|
<sect2>
|
||||||
|
<title>The File Menu</title>
|
||||||
|
<para>
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><menuchoice>
|
||||||
|
<shortcut>
|
||||||
|
<keycombo action="simul">&Ctrl;<keycap>N</keycap></keycombo>
|
||||||
|
</shortcut>
|
||||||
|
<guimenu>File</guimenu>
|
||||||
|
<guimenuitem>New</guimenuitem>
|
||||||
|
</menuchoice></term>
|
||||||
|
<listitem><para><action>Creates a new document</action></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><menuchoice>
|
||||||
|
<shortcut>
|
||||||
|
<keycombo action="simul">&Ctrl;<keycap>S</keycap></keycombo>
|
||||||
|
</shortcut>
|
||||||
|
<guimenu>File</guimenu>
|
||||||
|
<guimenuitem>Save</guimenuitem>
|
||||||
|
</menuchoice></term>
|
||||||
|
<listitem><para><action>Saves the document</action></para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><menuchoice>
|
||||||
|
<shortcut>
|
||||||
|
<keycombo action="simul">&Ctrl;<keycap>Q</keycap></keycombo>
|
||||||
|
</shortcut>
|
||||||
|
<guimenu>File</guimenu>
|
||||||
|
<guimenuitem>Quit</guimenuitem>
|
||||||
|
</menuchoice></term>
|
||||||
|
<listitem><para><action>Quits</action> &kalternatives;</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
<sect2>
|
||||||
|
<title>The <guimenu>Help</guimenu> Menu</title>
|
||||||
|
|
||||||
|
<!-- Assuming you have a standard help menu (help, what's this, about -->
|
||||||
|
<!-- &kalternatives;, about KDE) then the documentation is already written. -->
|
||||||
|
<!-- The following entity is valid anywhere that a variablelist is -->
|
||||||
|
<!-- valid. -->
|
||||||
|
|
||||||
|
&help.menu.documentation;
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="developers">
|
||||||
|
<title>Developer's Guide to &kalternatives;</title>
|
||||||
|
|
||||||
|
<!-- (OPTIONAL) A Programming/Scripting reference chapter should be
|
||||||
|
used for apps that use plugins or that provide their own scripting hooks
|
||||||
|
and/or development libraries. -->
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Programming &kalternatives; plugins is a joy to behold. Just read through the next
|
||||||
|
66 pages of API's to learn how!
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<!-- Use refentries to describe APIs. Refentries are fairly complicated and you
|
||||||
|
should consult the docbook reference for further details. The example below was
|
||||||
|
taken from that reference and shortened a bit for readability. -->
|
||||||
|
|
||||||
|
<refentry id="re-1007-unmanagechildren-1">
|
||||||
|
<refmeta>
|
||||||
|
<refentrytitle>XtUnmanageChildren</refentrytitle>
|
||||||
|
<refmiscinfo>Xt - Geometry Management</refmiscinfo>
|
||||||
|
</refmeta>
|
||||||
|
<refnamediv>
|
||||||
|
<refname>XtUnmanageChildren
|
||||||
|
</refname>
|
||||||
|
<refpurpose>remove a list of children from a parent widget's managed
|
||||||
|
list.
|
||||||
|
<indexterm id="ix-1007-unmanagechildren-1"><primary>widgets</primary><secondary>removing</secondary></indexterm>
|
||||||
|
<indexterm id="ix-1007-unmanagechildren-2"><primary>XtUnmanageChildren</primary></indexterm>
|
||||||
|
</refpurpose>
|
||||||
|
|
||||||
|
</refnamediv>
|
||||||
|
<refsynopsisdiv>
|
||||||
|
<refsynopsisdivinfo>
|
||||||
|
<date>4 March 1996</date>
|
||||||
|
</refsynopsisdivinfo>
|
||||||
|
<synopsis>
|
||||||
|
void XtUnmanageChildren(<replaceable class="parameter">children</replaceable>, <replaceable class="parameter">num_children</replaceable>)
|
||||||
|
WidgetList <replaceable class="parameter">children</replaceable>;
|
||||||
|
Cardinal <replaceable class="parameter">num_children</replaceable>;
|
||||||
|
</synopsis>
|
||||||
|
|
||||||
|
<refsect2 id="r2-1007-unmanagechildren-1">
|
||||||
|
<title>Inputs</title>
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term><replaceable class="parameter">children</replaceable>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Specifies an array of child widgets. Each child must be of
|
||||||
|
class RectObj or any subclass thereof.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term><replaceable class="parameter">num_children</replaceable>
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Specifies the number of elements in <replaceable class="parameter">children</replaceable>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
</refsect2></refsynopsisdiv>
|
||||||
|
|
||||||
|
<refsect1 id="r1-1007-unmanagechildren-1">
|
||||||
|
<title>Description
|
||||||
|
</title>
|
||||||
|
<para><function>XtUnmanageChildren()</function> unmaps the specified widgets
|
||||||
|
and removes them from their parent's geometry management.
|
||||||
|
The widgets will disappear from the screen, and (depending
|
||||||
|
on its parent) may no longer have screen space allocated for
|
||||||
|
them.
|
||||||
|
</para>
|
||||||
|
<para>Each of the widgets in the <replaceable class="parameter">children</replaceable> array must have
|
||||||
|
the same parent.
|
||||||
|
</para>
|
||||||
|
<para>See the “Algorithm” section below for full details of the
|
||||||
|
widget unmanagement procedure.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 id="r1-1007-unmanagechildren-2">
|
||||||
|
<title>Usage</title>
|
||||||
|
<para>Unmanaging widgets is the usual method for temporarily
|
||||||
|
making them invisible. They can be re-managed with
|
||||||
|
<function>XtManageChildren()</function>.
|
||||||
|
</para>
|
||||||
|
<para>You can unmap a widget, but leave it under geometry
|
||||||
|
management by calling <function>XtUnmapWidget()</function>. You can
|
||||||
|
destroy a widget's window without destroying the widget by
|
||||||
|
calling <function>XtUnrealizeWidget()</function>. You can destroy a
|
||||||
|
widget completely with <function>XtDestroyWidget()</function>.
|
||||||
|
</para>
|
||||||
|
<para>If you are only going to unmanage a single widget, it is
|
||||||
|
more convenient to call <function>XtUnmanageChild()</function>. It is
|
||||||
|
often more convenient to call <function>XtUnmanageChild()</function>
|
||||||
|
several times than it is to declare and initialize an array
|
||||||
|
of widgets to pass to <function>XtUnmanageChildren()</function>. Calling
|
||||||
|
<function>XtUnmanageChildren()</function> is more efficient, however,
|
||||||
|
because it only calls the parent's <function>change_managed()</function>
|
||||||
|
method once.
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 id="r1-1007-unmanagechildren-3">
|
||||||
|
<title>Algorithm
|
||||||
|
</title>
|
||||||
|
<para><function>XtUnmanageChildren()</function> performs the following:
|
||||||
|
</para>
|
||||||
|
<variablelist>
|
||||||
|
<varlistentry>
|
||||||
|
<term>-
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Ignores the child if it already is unmanaged or is being
|
||||||
|
destroyed.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>-
|
||||||
|
</term>
|
||||||
|
<listitem>
|
||||||
|
<para>Otherwise, if the child is realized, it makes it nonvisible
|
||||||
|
by unmapping it.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
</variablelist>
|
||||||
|
<para>
|
||||||
|
</para>
|
||||||
|
</refsect1>
|
||||||
|
|
||||||
|
<refsect1 id="r1-1007-unmanagechildren-4">
|
||||||
|
<title>Structures</title>
|
||||||
|
<para>The <type>WidgetList</type> type is simply an array of widgets:
|
||||||
|
</para>
|
||||||
|
<screen id="sc-1007-unmanagechildren-1">typedef Widget *WidgetList;
|
||||||
|
</screen>
|
||||||
|
</refsect1>
|
||||||
|
</refentry>
|
||||||
|
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="faq">
|
||||||
|
<title>Questions and Answers</title>
|
||||||
|
|
||||||
|
<!-- (OPTIONAL but recommended) This chapter should include all of the silly
|
||||||
|
(and not-so-silly) newbie questions that fill up your mailbox. This chapter
|
||||||
|
should be reserved for BRIEF questions and answers! If one question uses more
|
||||||
|
than a page or so then it should probably be part of the
|
||||||
|
"Using this Application" chapter instead. You should use links to
|
||||||
|
cross-reference questions to the parts of your documentation that answer them.
|
||||||
|
This is also a great place to provide pointers to other FAQ's if your users
|
||||||
|
must do some complicated configuration on other programs in order for your
|
||||||
|
application work. -->
|
||||||
|
|
||||||
|
&reporting.bugs;
|
||||||
|
&updating.documentation;
|
||||||
|
|
||||||
|
<qandaset id="faqlist">
|
||||||
|
<qandaentry>
|
||||||
|
<question>
|
||||||
|
<para>My Mouse doesn't work. How do I quit &kalternatives;?</para>
|
||||||
|
</question>
|
||||||
|
<answer>
|
||||||
|
<para>You silly goose! Check out the <link linkend="commands">Commands
|
||||||
|
Section</link> for the answer.</para>
|
||||||
|
</answer>
|
||||||
|
</qandaentry>
|
||||||
|
<qandaentry>
|
||||||
|
<question>
|
||||||
|
<para>Why can't I twiddle my documents?</para>
|
||||||
|
</question>
|
||||||
|
<answer>
|
||||||
|
<para>You can only twiddle your documents if you have the foobar.lib
|
||||||
|
installed.</para>
|
||||||
|
</answer>
|
||||||
|
</qandaentry>
|
||||||
|
</qandaset>
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<chapter id="credits">
|
||||||
|
|
||||||
|
<!-- Include credits for the programmers, documentation writers, and
|
||||||
|
contributors here. The license for your software should then be included below
|
||||||
|
the credits with a reference to the appropriate license file included in the KDE
|
||||||
|
distribution. -->
|
||||||
|
|
||||||
|
<title>Credits and License</title>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
&kalternatives;
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Program copyright 2004 Juanjo <email>juanjux@yahoo.es</email>
|
||||||
|
</para>
|
||||||
|
<para>
|
||||||
|
Contributors:
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem><para>Konqui the KDE Dragon <email>konqui@kde.org</email></para>
|
||||||
|
</listitem>
|
||||||
|
<listitem><para>Tux the Linux Penguin <email>tux@linux.org</email></para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
Documentation copyright 2004 Juanjo <email>juanjux@yahoo.es</email>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<!-- TRANS:CREDIT_FOR_TRANSLATORS -->
|
||||||
|
|
||||||
|
&underFDL; <!-- FDL: do not remove -->
|
||||||
|
|
||||||
|
<!-- Determine which license your application is licensed under,
|
||||||
|
and delete all the remaining licenses below:
|
||||||
|
|
||||||
|
(NOTE: All documentation are licensed under the FDL,
|
||||||
|
regardless of what license the application uses) -->
|
||||||
|
|
||||||
|
&underGPL; <!-- GPL License -->
|
||||||
|
&underBSDLicense; <!-- BSD License -->
|
||||||
|
&underArtisticLicense; <!-- BSD Artistic License -->
|
||||||
|
&underX11License; <!-- X11 License -->
|
||||||
|
|
||||||
|
</chapter>
|
||||||
|
|
||||||
|
<appendix id="installation">
|
||||||
|
<title>Installation</title>
|
||||||
|
|
||||||
|
<sect1 id="getting-kalternatives">
|
||||||
|
<title>How to obtain &kalternatives;</title>
|
||||||
|
|
||||||
|
<!-- This first entity contains boiler plate for applications that are
|
||||||
|
part of KDE CVS. You should remove it if you are releasing your
|
||||||
|
application -->
|
||||||
|
|
||||||
|
&install.intro.documentation;
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
<sect1 id="requirements">
|
||||||
|
<title>Requirements</title>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
List any special requirements for your application here. This should include:
|
||||||
|
.Libraries or other software that is not included in kdesupport,
|
||||||
|
kdelibs, or kdebase.
|
||||||
|
.Hardware requirements like amount of RAM, disk space, graphics card
|
||||||
|
capabilities, screen resolution, special expansion cards, etc.
|
||||||
|
.Operating systems the app will run on. If your app is designed only for a
|
||||||
|
specific OS, (you wrote a graphical LILO configurator for example) put this
|
||||||
|
information here.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<para>
|
||||||
|
In order to successfully use &kalternatives;, you need &kde; 1.1. Foobar.lib is
|
||||||
|
required in order to support the advanced &kalternatives; features. &kalternatives; uses
|
||||||
|
about 5 megs of memory to run, but this may vary depending on your
|
||||||
|
platform and configuration.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
All required libraries as well as &kalternatives; itself can be found
|
||||||
|
on <ulink url="ftp://ftp.kalternatives.org">The &kalternatives; home page</ulink>.
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<!-- For a list of updates, you may refer to the application web site
|
||||||
|
or the ChangeLog file, or ... -->
|
||||||
|
<para>
|
||||||
|
You can find a list of changes at <ulink
|
||||||
|
url="http://apps.kde.org/kalternatives">http://apps.kde.org/kalternatives</ulink>.
|
||||||
|
</para>
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
<sect1 id="compilation">
|
||||||
|
<title>Compilation and Installation</title>
|
||||||
|
|
||||||
|
<!-- This entity contains the boilerplate text for standard -->
|
||||||
|
<!-- compilation instructions. If your application requires any -->
|
||||||
|
<!-- special handling, remove it, and replace with your own text. -->
|
||||||
|
|
||||||
|
&install.compile.documentation;
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
<sect1 id="configuration">
|
||||||
|
<title>Configuration</title>
|
||||||
|
|
||||||
|
<para>Don't forget to tell your system to start the <filename>dtd</filename>
|
||||||
|
dicer-toaster daemon first, or &kalternatives; won't work !</para>
|
||||||
|
|
||||||
|
</sect1>
|
||||||
|
|
||||||
|
</appendix>
|
||||||
|
|
||||||
|
&documentation.index;
|
||||||
|
</book>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Local Variables:
|
||||||
|
mode: sgml
|
||||||
|
sgml-minimize-attributes:nil
|
||||||
|
sgml-general-insert-case:lower
|
||||||
|
sgml-indent-step:0
|
||||||
|
sgml-indent-data:nil
|
||||||
|
End:
|
||||||
|
|
||||||
|
vim:tabstop=2:shiftwidth=2:expandtab
|
||||||
|
-->
|
||||||
|
|
@ -0,0 +1,152 @@
|
|||||||
|
<?xml version = '1.0'?>
|
||||||
|
<kdevelop>
|
||||||
|
<general>
|
||||||
|
<author>Juanjo</author>
|
||||||
|
<email>juanjux@yahoo.es</email>
|
||||||
|
<version>0.10</version>
|
||||||
|
<projectmanagement>KDevKDEAutoProject</projectmanagement>
|
||||||
|
<primarylanguage>C++</primarylanguage>
|
||||||
|
<keywords>
|
||||||
|
<keyword>C++</keyword>
|
||||||
|
<keyword>Code</keyword>
|
||||||
|
<keyword>Qt</keyword>
|
||||||
|
<keyword>KDE</keyword>
|
||||||
|
</keywords>
|
||||||
|
</general>
|
||||||
|
<kdevautoproject>
|
||||||
|
<general>
|
||||||
|
<activetarget>src/kalternatives</activetarget>
|
||||||
|
<useconfiguration>debug</useconfiguration>
|
||||||
|
</general>
|
||||||
|
<run>
|
||||||
|
<mainprogram>src/kalternatives</mainprogram>
|
||||||
|
<directoryradio>executable</directoryradio>
|
||||||
|
</run>
|
||||||
|
<configurations>
|
||||||
|
<optimized>
|
||||||
|
<builddir>optimized</builddir>
|
||||||
|
<ccompiler>kdevgccoptions</ccompiler>
|
||||||
|
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||||
|
<f77compiler>kdevg77options</f77compiler>
|
||||||
|
<cxxflags>-O2 -g0</cxxflags>
|
||||||
|
</optimized>
|
||||||
|
<debug>
|
||||||
|
<configargs>--enable-debug=full</configargs>
|
||||||
|
<builddir>debug</builddir>
|
||||||
|
<ccompiler>kdevgccoptions</ccompiler>
|
||||||
|
<cxxcompiler>kdevgppoptions</cxxcompiler>
|
||||||
|
<f77compiler>kdevg77options</f77compiler>
|
||||||
|
<cxxflags>-O0 -g3</cxxflags>
|
||||||
|
</debug>
|
||||||
|
</configurations>
|
||||||
|
<make>
|
||||||
|
<envvars>
|
||||||
|
<envvar value="1" name="WANT_AUTOCONF_2_5" />
|
||||||
|
<envvar value="1" name="WANT_AUTOMAKE_1_6" />
|
||||||
|
</envvars>
|
||||||
|
</make>
|
||||||
|
</kdevautoproject>
|
||||||
|
<kdevfileview>
|
||||||
|
<groups>
|
||||||
|
<group pattern="*.cpp;*.cxx;*.h" name="Sources" />
|
||||||
|
<group pattern="*.ui" name="User Interface" />
|
||||||
|
<group pattern="*.png" name="Icons" />
|
||||||
|
<group pattern="*.po;*.ts" name="Translations" />
|
||||||
|
<group pattern="*" name="Others" />
|
||||||
|
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||||
|
<hidenonlocation>false</hidenonlocation>
|
||||||
|
</groups>
|
||||||
|
<tree>
|
||||||
|
<hidepatterns>*.o,*.lo,CVS</hidepatterns>
|
||||||
|
<hidenonprojectfiles>false</hidenonprojectfiles>
|
||||||
|
</tree>
|
||||||
|
</kdevfileview>
|
||||||
|
<kdevdoctreeview>
|
||||||
|
<ignoretocs>
|
||||||
|
<toc>ada</toc>
|
||||||
|
<toc>ada_bugs_gcc</toc>
|
||||||
|
<toc>bash</toc>
|
||||||
|
<toc>bash_bugs</toc>
|
||||||
|
<toc>clanlib</toc>
|
||||||
|
<toc>w3c-dom-level2-html</toc>
|
||||||
|
<toc>fortran_bugs_gcc</toc>
|
||||||
|
<toc>gnome1</toc>
|
||||||
|
<toc>gnustep</toc>
|
||||||
|
<toc>gtk</toc>
|
||||||
|
<toc>gtk_bugs</toc>
|
||||||
|
<toc>haskell</toc>
|
||||||
|
<toc>haskell_bugs_ghc</toc>
|
||||||
|
<toc>java_bugs_gcc</toc>
|
||||||
|
<toc>java_bugs_sun</toc>
|
||||||
|
<toc>pascal_bugs_fp</toc>
|
||||||
|
<toc>php</toc>
|
||||||
|
<toc>php_bugs</toc>
|
||||||
|
<toc>perl</toc>
|
||||||
|
<toc>perl_bugs</toc>
|
||||||
|
<toc>python</toc>
|
||||||
|
<toc>python_bugs</toc>
|
||||||
|
<toc>ruby</toc>
|
||||||
|
<toc>ruby_bugs</toc>
|
||||||
|
<toc>sdl</toc>
|
||||||
|
<toc>w3c-svg</toc>
|
||||||
|
<toc>sw</toc>
|
||||||
|
<toc>w3c-uaag10</toc>
|
||||||
|
<toc>wxwindows_bugs</toc>
|
||||||
|
</ignoretocs>
|
||||||
|
<ignoreqt_xml>
|
||||||
|
<toc>qmake User Guide</toc>
|
||||||
|
</ignoreqt_xml>
|
||||||
|
</kdevdoctreeview>
|
||||||
|
<kdevdebugger>
|
||||||
|
<general>
|
||||||
|
<dbgshell>libtool</dbgshell>
|
||||||
|
</general>
|
||||||
|
</kdevdebugger>
|
||||||
|
<kdevfilecreate>
|
||||||
|
<filetypes/>
|
||||||
|
<useglobaltypes>
|
||||||
|
<type ext="ui" />
|
||||||
|
<type ext="cpp" />
|
||||||
|
<type ext="h" />
|
||||||
|
</useglobaltypes>
|
||||||
|
</kdevfilecreate>
|
||||||
|
<dist>
|
||||||
|
<custom>false</custom>
|
||||||
|
<bzip>false</bzip>
|
||||||
|
<archname/>
|
||||||
|
<appname/>
|
||||||
|
<version>0.10</version>
|
||||||
|
<release/>
|
||||||
|
<vendor/>
|
||||||
|
<licence/>
|
||||||
|
<summary/>
|
||||||
|
<group/>
|
||||||
|
<packager/>
|
||||||
|
<description/>
|
||||||
|
<changelog/>
|
||||||
|
<devpackage>false</devpackage>
|
||||||
|
<docspackage>false</docspackage>
|
||||||
|
<appicon>false</appicon>
|
||||||
|
<arch>0</arch>
|
||||||
|
<genHTML>false</genHTML>
|
||||||
|
<useRPM>false</useRPM>
|
||||||
|
<ftpkde>false</ftpkde>
|
||||||
|
<appskde>false</appskde>
|
||||||
|
<url/>
|
||||||
|
</dist>
|
||||||
|
<kdevcppsupport>
|
||||||
|
<references/>
|
||||||
|
<codecompletion>
|
||||||
|
<includeGlobalFunctions>true</includeGlobalFunctions>
|
||||||
|
<includeTypes>true</includeTypes>
|
||||||
|
<includeEnums>true</includeEnums>
|
||||||
|
<includeTypedefs>false</includeTypedefs>
|
||||||
|
<automaticCodeCompletion>true</automaticCodeCompletion>
|
||||||
|
<automaticArgumentsHint>true</automaticArgumentsHint>
|
||||||
|
<automaticHeaderCompletion>true</automaticHeaderCompletion>
|
||||||
|
<codeCompletionDelay>250</codeCompletionDelay>
|
||||||
|
<argumentsHintDelay>400</argumentsHintDelay>
|
||||||
|
<headerCompletionDelay>250</headerCompletionDelay>
|
||||||
|
</codecompletion>
|
||||||
|
</kdevcppsupport>
|
||||||
|
</kdevelop>
|
Binary file not shown.
@ -0,0 +1,39 @@
|
|||||||
|
<?xml version = '1.0' encoding = 'UTF-8'?>
|
||||||
|
<!DOCTYPE KDevPrjSession>
|
||||||
|
<KDevPrjSession>
|
||||||
|
<DocsAndViews NumberOfDocuments="5" >
|
||||||
|
<Doc0 NumberOfViews="1" URL="file:/home/juanjux/sync/kalternatives/src/kalternatives.cpp" >
|
||||||
|
<View0 line="297" Type="Source" />
|
||||||
|
</Doc0>
|
||||||
|
<Doc1 NumberOfViews="1" URL="file:/home/juanjux/sync/kalternatives/src/kalternatives.h" >
|
||||||
|
<View0 line="35" Type="Source" />
|
||||||
|
</Doc1>
|
||||||
|
<Doc2 NumberOfViews="1" URL="file:/home/juanjux/sync/kalternatives/src/altparser.cpp" >
|
||||||
|
<View0 line="111" Type="Source" />
|
||||||
|
</Doc2>
|
||||||
|
<Doc3 NumberOfViews="1" URL="file:/home/juanjux/sync/kalternatives/src/altparser.h" >
|
||||||
|
<View0 line="72" Type="Source" />
|
||||||
|
</Doc3>
|
||||||
|
<Doc4 NumberOfViews="1" URL="file:/home/juanjux/sync/kalternatives/src/main.cpp" >
|
||||||
|
<View0 line="74" Type="Source" />
|
||||||
|
</Doc4>
|
||||||
|
</DocsAndViews>
|
||||||
|
<pluginList>
|
||||||
|
<kdevbookmarks>
|
||||||
|
<bookmarks>
|
||||||
|
<bookmark url="/home/juanjux/sync/kalternatives/src/kalternatives.cpp" >
|
||||||
|
<mark line="276" />
|
||||||
|
</bookmark>
|
||||||
|
<bookmark url="/home/juanjux/sync/work/kalternatives/kalternatives" >
|
||||||
|
<mark line="548" />
|
||||||
|
</bookmark>
|
||||||
|
</bookmarks>
|
||||||
|
</kdevbookmarks>
|
||||||
|
<kdevsubversion>
|
||||||
|
<subversion recurseresolve="1" recurserelocate="1" recursemerge="1" recursecommit="1" base="" recursepropget="1" recurseswitch="1" recurseupdate="1" recursepropset="1" recursediff="1" recurserevert="1" forcemove="1" recursecheckout="1" forceremove="1" recurseadd="1" recurseproplist="1" forcemerge="1" />
|
||||||
|
</kdevsubversion>
|
||||||
|
<kdevdebugger>
|
||||||
|
<breakpointList/>
|
||||||
|
</kdevdebugger>
|
||||||
|
</pluginList>
|
||||||
|
</KDevPrjSession>
|
@ -0,0 +1,11 @@
|
|||||||
|
######################################################################
|
||||||
|
# Automatically generated by qmake (1.06c) Sat Feb 28 20:13:05 2004
|
||||||
|
######################################################################
|
||||||
|
|
||||||
|
TEMPLATE = app
|
||||||
|
DEPENDPATH += src
|
||||||
|
INCLUDEPATH += . src
|
||||||
|
|
||||||
|
# Input
|
||||||
|
HEADERS += src/altparser.h src/kalternatives.h
|
||||||
|
SOURCES += src/altparser.cpp src/kalternatives.cpp src/main.cpp
|
@ -0,0 +1,21 @@
|
|||||||
|
INCLUDES = $(all_includes)
|
||||||
|
|
||||||
|
noinst_HEADERS = kalternatives.h altparser.h altcontroller.h altitemelement.h treeitemelement.h addslaves.h addalternatives.h
|
||||||
|
|
||||||
|
KDE_ICON = kalternatives
|
||||||
|
|
||||||
|
# Install this plugin in the KDE modules directory
|
||||||
|
kde_module_LTLIBRARIES = kcm_kalternatives.la
|
||||||
|
|
||||||
|
kcm_kalternatives_la_SOURCES = addslavesui.ui propertieswindow.ui addalternativesui.ui mainwindow.ui altcontroller.cpp kalternatives.cpp altparser.cpp altitemelement.cpp treeitemelement.cpp addslaves.cpp addalternatives.cpp
|
||||||
|
|
||||||
|
kcm_kalternatives_la_LIBADD = $(LIB_KDEUI) $(LIB_KIO)
|
||||||
|
kcm_kalternatives_la_LDFLAGS = $(all_libraries) -module -avoid-version -no-undefined
|
||||||
|
|
||||||
|
|
||||||
|
kcm_kalternatives_la_METASOURCES = AUTO
|
||||||
|
|
||||||
|
messages: rc.cpp
|
||||||
|
$(XGETTEXT) *.cpp -o $(podir)/kalternatives.pot
|
||||||
|
|
||||||
|
xdg_apps_DATA = kalternatives.desktop
|
@ -0,0 +1,121 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "addalternatives.h"
|
||||||
|
#include "addslaves.h"
|
||||||
|
#include "treeitemelement.h"
|
||||||
|
#include "kalternatives.h"
|
||||||
|
#include "altcontroller.h"
|
||||||
|
#include "altitemelement.h"
|
||||||
|
#include "altparser.h"
|
||||||
|
|
||||||
|
#include <qregexp.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kmessagebox.h>
|
||||||
|
#include <knuminput.h>
|
||||||
|
#include <kstdguiitem.h>
|
||||||
|
#include <kurlrequester.h>
|
||||||
|
|
||||||
|
AddAlternatives::AddAlternatives(TreeItemElement *treeItem, Kalternatives *kalt, int countSlaves):
|
||||||
|
AddAlternativesUi(kalt),m_treeItem(treeItem), m_kalt(kalt), m_countSlave(countSlaves)
|
||||||
|
{
|
||||||
|
m_bOk->setGuiItem(KStdGuiItem::ok());
|
||||||
|
m_bCancel->setGuiItem(KStdGuiItem::cancel());
|
||||||
|
m_bAddSlave->setGuiItem(KGuiItem(i18n("&Add Slave"), "edit_add"));
|
||||||
|
|
||||||
|
m_Path->setCaption( i18n( "Choose Alternative" ) );
|
||||||
|
m_Path->setFilter( i18n( "*|All Files" ) );
|
||||||
|
m_Path->setMode( KFile::File | KFile::LocalOnly );
|
||||||
|
}
|
||||||
|
|
||||||
|
AddAlternatives::~AddAlternatives()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddAlternatives::slotAddSlaveClicked()
|
||||||
|
{
|
||||||
|
AddSlaves *addSlaves = new AddSlaves(this);
|
||||||
|
addSlaves->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddAlternatives::slotOkClicked()
|
||||||
|
{
|
||||||
|
if(!m_Path->url().isEmpty())
|
||||||
|
{
|
||||||
|
|
||||||
|
Item *item = m_treeItem->getItem();
|
||||||
|
Alternative *a = new Alternative(item);
|
||||||
|
|
||||||
|
a->setPath(m_Path->url());
|
||||||
|
a->setPriority(m_Priority->value());
|
||||||
|
|
||||||
|
int countSlave = 0;
|
||||||
|
|
||||||
|
if (!m_textSlave->text().isEmpty())
|
||||||
|
{
|
||||||
|
QRegExp reg("\n");
|
||||||
|
QStringList slaveList = QStringList::split(reg, m_textSlave->text());
|
||||||
|
QStringList::Iterator it = slaveList.begin();
|
||||||
|
for ( ; it != slaveList.end(); ++it )
|
||||||
|
{
|
||||||
|
a->addSlave(*it);
|
||||||
|
countSlave++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (countSlave == m_countSlave)
|
||||||
|
{
|
||||||
|
item->addAlternative(a);
|
||||||
|
|
||||||
|
|
||||||
|
AltItemElement *altItem = new AltItemElement(m_kalt->optionsList(), a);
|
||||||
|
|
||||||
|
m_treeItem->getAltController()->addAltItem(altItem);
|
||||||
|
|
||||||
|
|
||||||
|
QString priority;
|
||||||
|
priority.setNum(a->getPriority());
|
||||||
|
|
||||||
|
altItem->setText( 1, priority);
|
||||||
|
altItem->setText( 2, a->getPath());
|
||||||
|
QString m_small_desc = altItem->getDescription();
|
||||||
|
|
||||||
|
if (!m_small_desc.isEmpty())
|
||||||
|
{
|
||||||
|
altItem->setText( 3, m_small_desc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
altItem->searchDescription();
|
||||||
|
}
|
||||||
|
m_treeItem->setNbrAltChanged(TRUE);
|
||||||
|
emit m_kalt->configChanged();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KMessageBox::sorry(this, i18n("The number of slaves is not good."), i18n("Number Of Slaves"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "addalternatives.moc"
|
@ -0,0 +1,50 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _ADDALTERNATIVES_H_
|
||||||
|
#define _ADDALTERNATIVES_H_
|
||||||
|
|
||||||
|
#include "addalternativesui.h"
|
||||||
|
|
||||||
|
#include <ktextedit.h>
|
||||||
|
|
||||||
|
class TreeItemElement;
|
||||||
|
class Kalternatives;
|
||||||
|
|
||||||
|
class AddAlternatives : public AddAlternativesUi
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
TreeItemElement *m_treeItem;
|
||||||
|
Kalternatives *m_kalt;
|
||||||
|
int m_countSlave;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AddAlternatives(TreeItemElement *treeItem, Kalternatives *kalt, int countSlaves);
|
||||||
|
virtual ~AddAlternatives();
|
||||||
|
|
||||||
|
void addSlave(const QString& text){m_textSlave->append(text);}
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void slotOkClicked();
|
||||||
|
void slotAddSlaveClicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //ADDALTERNATIVES_H_
|
@ -0,0 +1,259 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||||
|
<class>AddAlternativesUi</class>
|
||||||
|
<widget class="QDialog">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>AddAlternatives</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>440</width>
|
||||||
|
<height>200</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>7</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="caption">
|
||||||
|
<string>Add Alternative</string>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout6</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout7</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textLabel1</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KURLRequester">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_Path</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout11</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textLabel2</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Priority:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KIntSpinBox">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_Priority</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="maxValue">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="minValue">
|
||||||
|
<number>-1000</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer8</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer5</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>16</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="KTextEdit">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_textSlave</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>line1</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>HLine</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout13</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bAddSlave</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Add Slave</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer6</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>170</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bOk</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>1</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bCancel</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
</customwidgets>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>m_bCancel</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>AddAlternatives</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_bAddSlave</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>AddAlternatives</receiver>
|
||||||
|
<slot>slotAddSlaveClicked()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_bOk</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>AddAlternatives</receiver>
|
||||||
|
<slot>slotOkClicked()</slot>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot access="protected">slotOkClicked()</slot>
|
||||||
|
<slot access="protected">slotAddSlaveClicked()</slot>
|
||||||
|
</slots>
|
||||||
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
<includehints>
|
||||||
|
<includehint>kurlrequester.h</includehint>
|
||||||
|
<includehint>knuminput.h</includehint>
|
||||||
|
<includehint>ktextedit.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
</includehints>
|
||||||
|
</UI>
|
@ -0,0 +1,55 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "addslaves.h"
|
||||||
|
#include "addalternatives.h"
|
||||||
|
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kstdguiitem.h>
|
||||||
|
#include <kurlrequester.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
AddSlaves::AddSlaves(AddAlternatives *addAlternatives):
|
||||||
|
AddSlavesUi(addAlternatives), m_addAlternatives(addAlternatives)
|
||||||
|
{
|
||||||
|
m_bOk->setGuiItem(KStdGuiItem::ok());
|
||||||
|
m_bCancel->setGuiItem(KStdGuiItem::cancel());
|
||||||
|
|
||||||
|
m_Path->setCaption( i18n( "Choose Slave" ) );
|
||||||
|
m_Path->setFilter( i18n( "*|All Files" ) );
|
||||||
|
m_Path->setMode( KFile::File | KFile::LocalOnly );
|
||||||
|
}
|
||||||
|
|
||||||
|
AddSlaves::~AddSlaves()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddSlaves::slotOkClicked()
|
||||||
|
{
|
||||||
|
if(!m_Path->url().isEmpty())
|
||||||
|
{
|
||||||
|
m_addAlternatives->addSlave(m_Path->url());
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "addslaves.moc"
|
@ -0,0 +1,43 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _ADDSLAVES_H_
|
||||||
|
#define _ADDSLAVES_H_
|
||||||
|
|
||||||
|
#include "addslavesui.h"
|
||||||
|
|
||||||
|
class AddAlternatives;
|
||||||
|
|
||||||
|
class AddSlaves : public AddSlavesUi
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
AddAlternatives *m_addAlternatives;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AddSlaves(AddAlternatives *addAlternatives);
|
||||||
|
virtual ~AddSlaves();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
void slotOkClicked();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //ADDSLAVES_H_
|
@ -0,0 +1,167 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||||
|
<class>AddSlavesUi</class>
|
||||||
|
<widget class="QDialog">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>AddSlaves</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>439</width>
|
||||||
|
<height>83</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>7</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="caption">
|
||||||
|
<string>Add Slave</string>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>Minimum</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout13</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="margin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout12</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textLabel1</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Path:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KURLRequester">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_Path</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>line2</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>HLine</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout13</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer6</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>170</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bOk</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>1</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&OK</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bCancel</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
</customwidgets>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>m_bCancel</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>AddSlaves</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>m_bOk</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>AddSlaves</receiver>
|
||||||
|
<slot>slotOkClicked()</slot>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<slots>
|
||||||
|
<slot access="protected">slotOkClicked()</slot>
|
||||||
|
</slots>
|
||||||
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
<includehints>
|
||||||
|
<includehint>kurlrequester.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
</includehints>
|
||||||
|
</UI>
|
@ -0,0 +1,53 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "altcontroller.h"
|
||||||
|
#include "altitemelement.h"
|
||||||
|
#include "treeitemelement.h"
|
||||||
|
|
||||||
|
AltController::AltController()
|
||||||
|
{
|
||||||
|
m_altItemslist = new AltItemList;
|
||||||
|
}
|
||||||
|
|
||||||
|
AltController::~AltController()
|
||||||
|
{
|
||||||
|
if(m_altItemslist) delete m_altItemslist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AltController::setBoutonOnOff(KListView *list, AltItemElement *altItem)
|
||||||
|
{
|
||||||
|
QListViewItemIterator it( list );
|
||||||
|
AltItemElement *alt;
|
||||||
|
while ( it.current() )
|
||||||
|
{
|
||||||
|
if((alt = dynamic_cast<AltItemElement *>(it.current())))
|
||||||
|
{
|
||||||
|
if((alt!=altItem) && alt->isOn())
|
||||||
|
{
|
||||||
|
alt->setState(QCheckListItem::Off);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++it;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//#include "altcontroller.moc"
|
@ -0,0 +1,44 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _ALTCONTROLLER_H_
|
||||||
|
#define _ALTCONTROLLER_H_
|
||||||
|
|
||||||
|
#include <klistview.h>
|
||||||
|
#include <qptrlist.h>
|
||||||
|
|
||||||
|
class AltItemElement;
|
||||||
|
|
||||||
|
typedef QPtrList<AltItemElement> AltItemList;
|
||||||
|
|
||||||
|
|
||||||
|
class AltController
|
||||||
|
{
|
||||||
|
AltItemList *m_altItemslist;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AltController();
|
||||||
|
~AltController();
|
||||||
|
|
||||||
|
void setBoutonOnOff(KListView *list, AltItemElement *altItem);
|
||||||
|
void addAltItem(AltItemElement *altItem) {m_altItemslist->append(altItem);}
|
||||||
|
AltItemList *getAltItemList() {return m_altItemslist;}
|
||||||
|
};
|
||||||
|
#endif // _ALTCONTROLLER_H_
|
@ -0,0 +1,118 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include "altitemelement.h"
|
||||||
|
#include "altcontroller.h"
|
||||||
|
#include "altparser.h"
|
||||||
|
|
||||||
|
#include <qtimer.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
/******************************* AltItemElement ********************/
|
||||||
|
|
||||||
|
AltItemElement::AltItemElement(KListView *parent, Alternative *alternative)
|
||||||
|
: QCheckListItem(parent, "", QCheckListItem::RadioButton),
|
||||||
|
m_alt(alternative),
|
||||||
|
m_parent(parent),
|
||||||
|
m_bisBroken(alternative->isBroken()),
|
||||||
|
m_path(alternative->getPath())
|
||||||
|
{
|
||||||
|
setOn(alternative->isSelected());
|
||||||
|
setEnabled(!m_bisBroken);
|
||||||
|
m_desc = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
AltItemElement::~AltItemElement()
|
||||||
|
{
|
||||||
|
delete m_alt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AltItemElement::searchDescription()
|
||||||
|
{
|
||||||
|
QString exec = m_path;
|
||||||
|
int posSlash = exec.findRev("/");
|
||||||
|
|
||||||
|
if (posSlash != -1)
|
||||||
|
{
|
||||||
|
exec.remove(0, posSlash+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!exec.isEmpty())
|
||||||
|
{
|
||||||
|
KProcess *procdesc = new KProcess();
|
||||||
|
*procdesc << "whatis";
|
||||||
|
*procdesc << exec;
|
||||||
|
|
||||||
|
connect(procdesc, SIGNAL(receivedStdout(KProcess *, char *, int)), this,
|
||||||
|
SLOT(slotGetDescription(KProcess *, char *, int)));
|
||||||
|
//connect(procdesc, SIGNAL( receivedStderr(KProcess *, char *, int) ), this,
|
||||||
|
// SLOT(slotGetDescription(KProcess *, char *, int)));
|
||||||
|
connect(procdesc, SIGNAL( processExited(KProcess *)), this,
|
||||||
|
SLOT(slotDescriptionTermined(KProcess *)));
|
||||||
|
procdesc->start(KProcess::NotifyOnExit,/*KProcess::Block,*/ KProcess::AllOutput);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void AltItemElement::slotDescriptionTermined(KProcess *proc)
|
||||||
|
{
|
||||||
|
if (!proc->exitStatus())
|
||||||
|
{
|
||||||
|
int pos = m_desc.find("\n");
|
||||||
|
if (pos != -1)
|
||||||
|
{
|
||||||
|
m_desc.truncate(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = m_desc.find("]");
|
||||||
|
if (pos != -1)
|
||||||
|
{
|
||||||
|
m_desc.remove(0, pos+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = m_desc.find(")");
|
||||||
|
if (pos != -1)
|
||||||
|
{
|
||||||
|
m_desc.remove(0, pos+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
pos = m_desc.find("-");
|
||||||
|
if (pos != -1)
|
||||||
|
{
|
||||||
|
m_desc.remove(0, pos+2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_desc = i18n( "no description" );
|
||||||
|
}
|
||||||
|
setText( 3, m_desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AltItemElement::slotGetDescription(KProcess *, char *buffer, int buflen)
|
||||||
|
{
|
||||||
|
m_desc += QString::fromLatin1(buffer, buflen);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "altitemelement.moc"
|
@ -0,0 +1,58 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _ALTITEMELEMENT_H_
|
||||||
|
#define _ALTITEMELEMENT_H_
|
||||||
|
|
||||||
|
#include <qlistview.h>
|
||||||
|
#include <klistview.h>
|
||||||
|
#include <qstring.h>
|
||||||
|
#include <kprocess.h>
|
||||||
|
|
||||||
|
class Alternative;
|
||||||
|
class AltController;
|
||||||
|
|
||||||
|
class AltItemElement : public QObject, public QCheckListItem
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Alternative *m_alt;
|
||||||
|
KListView *m_parent;
|
||||||
|
bool m_bisBroken;
|
||||||
|
QString m_path;
|
||||||
|
QString m_desc;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AltItemElement(KListView *parent, Alternative *alternative );
|
||||||
|
~AltItemElement();
|
||||||
|
|
||||||
|
bool isBroken() const { return m_bisBroken; }
|
||||||
|
KListView *getParent() const { return m_parent; }
|
||||||
|
Alternative *getAlternative() { return m_alt; }
|
||||||
|
QString getPath() const {return m_path; }
|
||||||
|
QString getDescription() const {return m_desc;}
|
||||||
|
void searchDescription();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slotDescriptionTermined(KProcess *);
|
||||||
|
void slotGetDescription(KProcess *proc, char *buffer, int buflen);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_ALTITEMELEMENT_H_
|
@ -0,0 +1,609 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo Álvarez *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* 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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "altparser.h"
|
||||||
|
#include <qfileinfo.h>
|
||||||
|
#include <qfile.h>
|
||||||
|
#include <qdir.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
Alternative::Alternative(Item *parentarg) : m_parent(parentarg)
|
||||||
|
{
|
||||||
|
m_priority = 1;
|
||||||
|
m_altSlaves = new QStringList;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy constructor
|
||||||
|
Alternative::Alternative(const Alternative &alt) :
|
||||||
|
m_altPath(alt.getPath()),
|
||||||
|
m_priority(alt.getPriority()),
|
||||||
|
m_parent(alt.getParent())
|
||||||
|
{
|
||||||
|
m_altSlaves = new QStringList( *(alt.m_altSlaves) );
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative::~Alternative()
|
||||||
|
{
|
||||||
|
if(m_altSlaves)delete m_altSlaves;
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative& Alternative::operator=(const Alternative &alt)
|
||||||
|
{
|
||||||
|
if(this != &alt)
|
||||||
|
{
|
||||||
|
if(m_altSlaves)delete m_altSlaves;
|
||||||
|
m_altPath = alt.getPath();
|
||||||
|
m_priority = alt.getPriority();
|
||||||
|
m_parent = alt.getParent();
|
||||||
|
m_altSlaves = new QStringList( *(alt.m_altSlaves) );
|
||||||
|
}
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Alternative::setSlaves(QStringList *slaves)
|
||||||
|
{
|
||||||
|
if(m_altSlaves) delete m_altSlaves;
|
||||||
|
m_altSlaves = slaves;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Alternative::isSelected() const
|
||||||
|
{
|
||||||
|
if(m_parent->isBroken()) return false;
|
||||||
|
QFileInfo file("/etc/alternatives/"+m_parent->getName());
|
||||||
|
if(!file.isSymLink()) return false;
|
||||||
|
if(file.readLink() == m_altPath) return 1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Alternative::isBroken() const
|
||||||
|
{
|
||||||
|
return !QFile::exists(m_altPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Alternative::select()
|
||||||
|
{
|
||||||
|
// This method was 19 lines in Python in the original kalternatives :-D
|
||||||
|
if(isSelected()) return true;
|
||||||
|
if(isBroken())
|
||||||
|
{
|
||||||
|
m_selectError = QString("Broken alternative: Unexisting path %1").arg(m_altPath);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove the current link:
|
||||||
|
QString parentPath = QString("/etc/alternatives/%1").arg(m_parent->getName());
|
||||||
|
QFile origlink(parentPath);
|
||||||
|
if(!origlink.remove())
|
||||||
|
{
|
||||||
|
m_selectError = QString("Could not delete alternative link %1: %2").arg(parentPath).arg(origlink.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then we do the main link:
|
||||||
|
if(symlink(m_altPath.ascii(), parentPath.ascii()) == -1)
|
||||||
|
{
|
||||||
|
m_selectError = QString(strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// And finally the slaves
|
||||||
|
SlaveList *parslaves = m_parent->getSlaves();
|
||||||
|
parslaves->setAutoDelete(1);
|
||||||
|
if(parslaves->count() == 0 || m_altSlaves->count() == 0) return true;
|
||||||
|
int count = 0;
|
||||||
|
QStringList::iterator sl;
|
||||||
|
Slave *parsl;
|
||||||
|
for( sl = m_altSlaves->begin(); sl != m_altSlaves->end(); ++sl)
|
||||||
|
{
|
||||||
|
parsl = parslaves->at(count);
|
||||||
|
QString parstr = QString("/etc/alternatives/%1").arg(parsl->slname);
|
||||||
|
QFile parlink(parstr);
|
||||||
|
if(!parlink.remove())
|
||||||
|
{
|
||||||
|
m_selectError = QString("Could not delete slave alternative link %1: %2").arg(parstr).arg(parlink.errorString());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(symlink( (*sl).ascii(), parstr.ascii()) == -1)
|
||||||
|
{
|
||||||
|
m_selectError = QString(strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
++count;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//*************************************** Item
|
||||||
|
|
||||||
|
Item::Item()
|
||||||
|
{
|
||||||
|
m_mode = "auto";
|
||||||
|
m_itemSlaves = new SlaveList;
|
||||||
|
m_itemAlts = new AltsPtrList;
|
||||||
|
m_itemSlaves->setAutoDelete(1);
|
||||||
|
m_itemAlts->setAutoDelete(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deep copy
|
||||||
|
Item::Item(const Item &item) :
|
||||||
|
m_name(item.m_name),
|
||||||
|
m_mode(item.m_mode),
|
||||||
|
m_path(item.m_path)
|
||||||
|
{
|
||||||
|
m_itemSlaves = new SlaveList;
|
||||||
|
m_itemAlts = new AltsPtrList;
|
||||||
|
m_itemSlaves->setAutoDelete(1);
|
||||||
|
m_itemAlts->setAutoDelete(1);
|
||||||
|
Slave *slave;
|
||||||
|
Slave *slavecopy;
|
||||||
|
for(slave = item.m_itemSlaves->first(); slave; slave = item.m_itemSlaves->next())
|
||||||
|
{
|
||||||
|
slavecopy = new Slave;
|
||||||
|
slavecopy->slname = slave->slname;
|
||||||
|
slavecopy->slpath = slave->slpath;
|
||||||
|
m_itemSlaves->append(slavecopy);
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative *alt;
|
||||||
|
Alternative *altcopy;
|
||||||
|
for(alt = item.m_itemAlts->first(); alt; alt = item.m_itemAlts->next())
|
||||||
|
{
|
||||||
|
// The Alternative class already has a deep copy constructor:
|
||||||
|
altcopy = new Alternative( (*alt) );
|
||||||
|
m_itemAlts->append(altcopy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item& Item::operator=(const Item &item)
|
||||||
|
{
|
||||||
|
if(this != &item)
|
||||||
|
{
|
||||||
|
if(m_itemSlaves)delete m_itemSlaves;
|
||||||
|
if(m_itemAlts)delete m_itemAlts;
|
||||||
|
m_name = item.m_name;
|
||||||
|
m_mode = item.m_mode;
|
||||||
|
m_path = item.m_path;
|
||||||
|
m_itemSlaves = new SlaveList;
|
||||||
|
m_itemAlts = new AltsPtrList;
|
||||||
|
m_itemSlaves->setAutoDelete(1);
|
||||||
|
m_itemAlts->setAutoDelete(1);
|
||||||
|
Slave *slave;
|
||||||
|
Slave *slavecopy;
|
||||||
|
for(slave = item.m_itemSlaves->first(); slave; slave = item.m_itemSlaves->next())
|
||||||
|
{
|
||||||
|
slavecopy = new Slave;
|
||||||
|
slavecopy->slname = slave->slname;
|
||||||
|
slavecopy->slpath = slave->slpath;
|
||||||
|
m_itemSlaves->append(slavecopy);
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative *alt;
|
||||||
|
Alternative *altcopy;
|
||||||
|
for(alt = item.m_itemAlts->first(); alt; alt = item.m_itemAlts->next())
|
||||||
|
{
|
||||||
|
altcopy = new Alternative( (*alt) );
|
||||||
|
m_itemAlts->append(altcopy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return (*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Item::~Item()
|
||||||
|
{
|
||||||
|
if(m_itemSlaves)delete m_itemSlaves;
|
||||||
|
if(m_itemAlts)delete m_itemAlts;
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative *Item::getSelected() const
|
||||||
|
{
|
||||||
|
Alternative *a;
|
||||||
|
for(a = m_itemAlts->first(); a; a = m_itemAlts->next())
|
||||||
|
{
|
||||||
|
if(a->isSelected())
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::setSlaves(SlaveList *slaves)
|
||||||
|
{
|
||||||
|
if(this->m_itemSlaves)delete this->m_itemSlaves;
|
||||||
|
this->m_itemSlaves = slaves;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::addSlave(const QString &namearg, const QString &patharg)
|
||||||
|
{
|
||||||
|
Slave *s = new Slave;
|
||||||
|
s->slname = namearg;
|
||||||
|
s->slpath = patharg;
|
||||||
|
m_itemSlaves->append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::delSlave(const QString &namearg)
|
||||||
|
{
|
||||||
|
QPtrListIterator<Slave> it(*m_itemSlaves);
|
||||||
|
|
||||||
|
Slave *s;
|
||||||
|
while( (s = it.current()) != 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if(s->slname == namearg)
|
||||||
|
{
|
||||||
|
m_itemSlaves->remove(s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Item::delSlaveByPath(const QString &patharg)
|
||||||
|
{
|
||||||
|
QPtrListIterator<Slave> it(*m_itemSlaves);
|
||||||
|
|
||||||
|
Slave *s;
|
||||||
|
while( (s = it.current()) != 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if(s->slpath == patharg)
|
||||||
|
{
|
||||||
|
m_itemSlaves->remove(s);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Alternative *Item::getAlternative(const QString &altpath)
|
||||||
|
{
|
||||||
|
Alternative *a;
|
||||||
|
for(a = m_itemAlts->first(); a; a = m_itemAlts->next())
|
||||||
|
{
|
||||||
|
if(a->getPath() == altpath)
|
||||||
|
{
|
||||||
|
return a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::setAlternatives(AltsPtrList &alts)
|
||||||
|
{
|
||||||
|
if(this->m_itemAlts)delete this->m_itemAlts;
|
||||||
|
this->m_itemAlts = &alts;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::delAlternativeByPath(const QString &patharg)
|
||||||
|
{
|
||||||
|
QPtrListIterator<Alternative> it(*m_itemAlts);
|
||||||
|
|
||||||
|
Alternative *a;
|
||||||
|
while( (a = it.current()) != 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if(a->getPath() == patharg)
|
||||||
|
{
|
||||||
|
m_itemAlts->remove(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Item::delAlternativeByPriority(int priorityarg)
|
||||||
|
{
|
||||||
|
QPtrListIterator<Alternative> it(*m_itemAlts);
|
||||||
|
|
||||||
|
Alternative *a;
|
||||||
|
while( (a = it.current()) != 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if(a->getPriority() == priorityarg)
|
||||||
|
{
|
||||||
|
m_itemAlts->remove(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Item::isBroken() const
|
||||||
|
{
|
||||||
|
return !QFile::exists(m_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
/********************** AltFIlesManager ************/
|
||||||
|
|
||||||
|
AltFilesManager::AltFilesManager(const QString &altdirarg) :
|
||||||
|
m_altdir(altdirarg)
|
||||||
|
{
|
||||||
|
m_itemlist = new ItemPtrList;
|
||||||
|
m_itemlist->setAutoDelete(1);
|
||||||
|
m_parseOk = true;
|
||||||
|
m_errorMsg = "";
|
||||||
|
if(!parseAltFiles(m_errorMsg))
|
||||||
|
{
|
||||||
|
m_parseOk = false;
|
||||||
|
}
|
||||||
|
//debugPrintAlts();
|
||||||
|
}
|
||||||
|
|
||||||
|
AltFilesManager::~AltFilesManager()
|
||||||
|
{
|
||||||
|
//delete m_itemlist;
|
||||||
|
/*
|
||||||
|
Item *item;
|
||||||
|
for(item = m_itemlist->first(); item; item = m_itemlist->next())
|
||||||
|
{
|
||||||
|
delete item;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete m_itemlist;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
Item* AltFilesManager::getItem(const QString &name) const
|
||||||
|
{
|
||||||
|
QPtrListIterator<Item> it(*m_itemlist);
|
||||||
|
Item *i;
|
||||||
|
while( (i = it.current()) != 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if(i->getName() == name)
|
||||||
|
{
|
||||||
|
return i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AltFilesManager::parseAltFiles(QString &errorstr)
|
||||||
|
{
|
||||||
|
QDir d(m_altdir);
|
||||||
|
QStringList fileList = d.entryList();
|
||||||
|
QStringList lines;
|
||||||
|
QFile altFile;
|
||||||
|
QString line, tmp;
|
||||||
|
int nslaves;
|
||||||
|
unsigned int index, slavesend;
|
||||||
|
|
||||||
|
for( QStringList::Iterator it = fileList.begin(); it != fileList.end(); ++it)
|
||||||
|
{
|
||||||
|
Item *item = new Item;
|
||||||
|
if(*it == "." || *it == "..") {
|
||||||
|
delete item;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setName(*it);
|
||||||
|
altFile.setName(m_altdir+"/"+*it);
|
||||||
|
|
||||||
|
if(!altFile.open( IO_ReadOnly ))
|
||||||
|
{
|
||||||
|
errorstr = altFile.errorString();
|
||||||
|
delete item;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
lines.clear();
|
||||||
|
while ( !altFile.atEnd() )
|
||||||
|
{
|
||||||
|
if(!altFile.readLine(line, 9999))
|
||||||
|
{
|
||||||
|
errorstr = altFile.errorString();
|
||||||
|
delete item;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
lines.append(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
line = lines[0];
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
item->setMode(tmp);
|
||||||
|
|
||||||
|
line = lines[1];
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
item->setPath(tmp);
|
||||||
|
|
||||||
|
index = 2;
|
||||||
|
line = lines[index];
|
||||||
|
nslaves = 0;
|
||||||
|
SlaveList *slaves = new SlaveList;
|
||||||
|
slaves->setAutoDelete(1);
|
||||||
|
|
||||||
|
while(line != "\n")
|
||||||
|
{
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
Slave *slave = new Slave;
|
||||||
|
nslaves++;
|
||||||
|
slave->slname = tmp;
|
||||||
|
|
||||||
|
line = lines[++index];
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
slave->slpath = tmp;
|
||||||
|
|
||||||
|
slaves->append(slave);
|
||||||
|
line = lines[++index];
|
||||||
|
}
|
||||||
|
|
||||||
|
item->setSlaves(slaves);
|
||||||
|
|
||||||
|
++index;
|
||||||
|
while(index < lines.count()-1)
|
||||||
|
{
|
||||||
|
line = lines[index];
|
||||||
|
Alternative *a = new Alternative(item);
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
a->setPath(tmp);
|
||||||
|
|
||||||
|
if(line=="\n") {
|
||||||
|
//File end (with a \n)
|
||||||
|
delete a;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(++index == lines.count())
|
||||||
|
{
|
||||||
|
item->addAlternative(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
line = lines[index];
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
a->setPriority(tmp.toInt());
|
||||||
|
|
||||||
|
if(++index == lines.count())
|
||||||
|
{
|
||||||
|
item->addAlternative(a);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
line = lines[index];
|
||||||
|
if(line != "\n" and nslaves > 0)
|
||||||
|
{
|
||||||
|
slavesend = index+nslaves;
|
||||||
|
while(index < slavesend)
|
||||||
|
{
|
||||||
|
line = lines[index];
|
||||||
|
tmp = line.left(line.length()-1);
|
||||||
|
a->addSlave(tmp);
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (nslaves >0)
|
||||||
|
{
|
||||||
|
++index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item->addAlternative(a);
|
||||||
|
}
|
||||||
|
m_itemlist->append(item);
|
||||||
|
altFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//FIXME: This must be in a son of qptrlist!
|
||||||
|
/*
|
||||||
|
int AltFilesManager::compareItems(Item i1, Item i2)
|
||||||
|
{
|
||||||
|
return i1.getPath().compare(i2.getPath());
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
void AltFilesManager::debugPrintAlts() const
|
||||||
|
{
|
||||||
|
printf("----------------------------------\n");
|
||||||
|
Item *item;
|
||||||
|
for(item = m_itemlist->first(); item; item = m_itemlist->next())
|
||||||
|
{
|
||||||
|
printf("\nItem: %s\n", item->getName().ascii());
|
||||||
|
printf("\tMode: %s\n", item->getMode().ascii());
|
||||||
|
printf("\tPath: %s\n", item->getPath().ascii());
|
||||||
|
if(item->getSlaves()->count() == 0)
|
||||||
|
printf("\tNo slaves\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Slave *slave;
|
||||||
|
SlaveList *slaves = item->getSlaves();
|
||||||
|
for(slave = slaves->first(); slave; slave = slaves->next())
|
||||||
|
{
|
||||||
|
printf("\tSlave name: %s\n", slave->name.ascii());
|
||||||
|
printf("\tSlave path: %s\n", slave->path.ascii());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\tAlternatives:\n");
|
||||||
|
if(item->getAlternatives()->count() == 0)
|
||||||
|
printf("\t\tNO ALTERNATIVES!");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Alternative *a;
|
||||||
|
AltsPtrList *alts = item->getAlternatives();
|
||||||
|
for(a = alts->first(); a; a = alts->next())
|
||||||
|
{
|
||||||
|
printf("\t\tPath: %s\n", a->getPath().ascii());
|
||||||
|
printf("\t\tPriority: %d\n", a->getPriority());
|
||||||
|
printf("\t\tSlaves:\n");
|
||||||
|
if(a->getSlaves()->count() == 0)
|
||||||
|
printf("\t\t\tNo slaves\n");
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QStringList altslaves = *(a->getSlaves());
|
||||||
|
QStringList::iterator sl;
|
||||||
|
for( sl = altslaves.begin(); sl != altslaves.end(); ++sl)
|
||||||
|
{
|
||||||
|
printf("\t\t\t%s\n", (*sl).ascii());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
// ************************************** Test
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
AltFilesManager a("/var/lib/rpm/alternatives");
|
||||||
|
if(!a.parsingOk())
|
||||||
|
printf("ERROR PARSING ALT FILES: %s\n", a.getErrorMsg().ascii());
|
||||||
|
else
|
||||||
|
printf("\nOK, Finished parsing\n");
|
||||||
|
|
||||||
|
Item *item= a.getItem("vi");
|
||||||
|
if(item == NULL) return 0;
|
||||||
|
printf("Nombre item: %s\n", item->getName().ascii());
|
||||||
|
printf("Path item: %s\n", item->getPath().ascii());
|
||||||
|
Alternative *alt = item->getSelected();
|
||||||
|
if(alt == NULL) return 0;
|
||||||
|
printf("Selected alt: %s\n", alt->getPath().ascii());
|
||||||
|
|
||||||
|
Alternative *vimminimal = item->getAlternative("/bin/vim-minimal");
|
||||||
|
if(vimminimal == NULL) { printf("NULL!\n"); return 0; }
|
||||||
|
printf("Not selected alt: %s\n", vimminimal->getPath().ascii());
|
||||||
|
|
||||||
|
printf("Selecting vim-minimal instead of vim-enhanced as vi\n");
|
||||||
|
if(!vimminimal->select())
|
||||||
|
{
|
||||||
|
printf("ERROR: %s\n", vimminimal->getSelectError().ascii());
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Now selecting vim-enhanced...\n");
|
||||||
|
Alternative *vimen = item->getAlternative("/usr/bin/vim-enhanced");
|
||||||
|
if(vimen == NULL) { printf("NULL!\n"); return 0; }
|
||||||
|
if(!vimen->select())
|
||||||
|
{
|
||||||
|
printf("ERROR: %s\n", alt->getSelectError().ascii());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*/
|
@ -0,0 +1,140 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo Álvarez *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* 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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _ALTPARSER_H_
|
||||||
|
#define _ALTPARSER_H_
|
||||||
|
|
||||||
|
|
||||||
|
//FIXME: Cosas pa mirar:
|
||||||
|
//Comprobar entradas NULL y demás (sobre todo antes de los delete)
|
||||||
|
//
|
||||||
|
//Quitar el stdio.h
|
||||||
|
|
||||||
|
#include <qstring.h>
|
||||||
|
#include <qobject.h>
|
||||||
|
#include <qptrlist.h>
|
||||||
|
#include <qstringlist.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class Item;
|
||||||
|
|
||||||
|
struct Slave
|
||||||
|
{
|
||||||
|
QString slname;
|
||||||
|
QString slpath;
|
||||||
|
};
|
||||||
|
|
||||||
|
class Alternative
|
||||||
|
{
|
||||||
|
QString m_altPath;
|
||||||
|
QString m_selectError;
|
||||||
|
int m_priority;
|
||||||
|
Item *m_parent;
|
||||||
|
QStringList *m_altSlaves;
|
||||||
|
public:
|
||||||
|
Alternative(Item *parentarg);
|
||||||
|
Alternative(const Alternative &alt);
|
||||||
|
~Alternative();
|
||||||
|
Alternative& operator=(const Alternative &alt);
|
||||||
|
|
||||||
|
Item* getParent() const { return m_parent; }
|
||||||
|
QString getPath() const { return m_altPath; }
|
||||||
|
void setPath(const QString &patharg) { m_altPath = patharg; }
|
||||||
|
int getPriority() const { return m_priority; }
|
||||||
|
void setPriority(int priorityarg) { m_priority = priorityarg; }
|
||||||
|
QStringList* getSlaves() const { return m_altSlaves; }
|
||||||
|
void setSlaves(QStringList *m_altSlaves);
|
||||||
|
void addSlave(const QString &slave) { m_altSlaves->append(slave); }
|
||||||
|
uint countSlaves() const { return m_altSlaves->count(); }
|
||||||
|
QString getSlave(int pos) const { return *(m_altSlaves->at(pos)); }
|
||||||
|
bool isSelected() const;
|
||||||
|
bool isBroken() const;
|
||||||
|
bool select();
|
||||||
|
QString getSelectError() const { return m_selectError; }
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QPtrList<Slave> SlaveList;
|
||||||
|
typedef QPtrList<Alternative> AltsPtrList;
|
||||||
|
|
||||||
|
class Item
|
||||||
|
{
|
||||||
|
QString m_name;
|
||||||
|
QString m_mode;
|
||||||
|
QString m_path;
|
||||||
|
SlaveList *m_itemSlaves;
|
||||||
|
AltsPtrList *m_itemAlts;
|
||||||
|
public:
|
||||||
|
Item();
|
||||||
|
// Deep copy constructor:
|
||||||
|
Item(const Item &item);
|
||||||
|
~Item();
|
||||||
|
Item& operator=(const Item &item);
|
||||||
|
|
||||||
|
Alternative* getSelected() const;
|
||||||
|
QString getName() const { return m_name; }
|
||||||
|
void setName(const QString &namearg) { m_name = namearg; }
|
||||||
|
QString getMode() const { return m_mode; }
|
||||||
|
//Check the input (FIXME)
|
||||||
|
void setMode(const QString &modearg) { m_mode = modearg; }
|
||||||
|
QString getPath() const { return m_path; }
|
||||||
|
void setPath(const QString &patharg) { m_path = patharg; }
|
||||||
|
SlaveList *getSlaves() const { return m_itemSlaves; }
|
||||||
|
void setSlaves(SlaveList *slaves);
|
||||||
|
void addSlave(const QString &namearg, const QString &patharg);
|
||||||
|
void delSlave(const QString &namearg);
|
||||||
|
void delSlaveByPath(const QString &patharg);
|
||||||
|
AltsPtrList *getAlternatives() const { return m_itemAlts; }
|
||||||
|
Alternative *getAlternative(const QString &altpath);
|
||||||
|
void setAlternatives(AltsPtrList &alts);
|
||||||
|
int countAlternatives() const { return m_itemAlts->count(); }
|
||||||
|
void delAlternativeByPath(const QString &patharg);
|
||||||
|
void delAlternativeByPriority(int priorityarg);
|
||||||
|
void addAlternative(Alternative *altarg) { m_itemAlts->append(altarg); }
|
||||||
|
bool isBroken() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef QPtrList<Item> ItemPtrList;
|
||||||
|
|
||||||
|
class AltFilesManager
|
||||||
|
{
|
||||||
|
ItemPtrList *m_itemlist;
|
||||||
|
QString m_altdir;
|
||||||
|
QString m_errorMsg;
|
||||||
|
bool m_parseOk;
|
||||||
|
|
||||||
|
bool parseAltFiles(QString &errorstr);
|
||||||
|
public:
|
||||||
|
AltFilesManager(const QString &altdir);
|
||||||
|
~AltFilesManager();
|
||||||
|
|
||||||
|
ItemPtrList* getGlobalAlternativeList() const { return this->m_itemlist; }
|
||||||
|
bool parsingOk() const { return m_parseOk; }
|
||||||
|
QString getErrorMsg() const { return m_errorMsg; }
|
||||||
|
Item* getItem (const QString &name) const;
|
||||||
|
//FIXME: Put in a #ifdef
|
||||||
|
void debugPrintAlts() const;
|
||||||
|
QString getAltDir() { return m_altdir ;}
|
||||||
|
//protected:
|
||||||
|
//virtual int compareItems(Item i1, Item i2);
|
||||||
|
};
|
||||||
|
#endif // _KALTERNATIVES_H_
|
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
@ -0,0 +1,457 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "kalternatives.h"
|
||||||
|
#include "altparser.h"
|
||||||
|
#include "propertieswindow.h"
|
||||||
|
#include "altcontroller.h"
|
||||||
|
#include "altitemelement.h"
|
||||||
|
#include "treeitemelement.h"
|
||||||
|
#include "addalternatives.h"
|
||||||
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <qtimer.h>
|
||||||
|
|
||||||
|
#include <kmessagebox.h>
|
||||||
|
#include <kaboutdialog.h>
|
||||||
|
#include <ktextedit.h>
|
||||||
|
#include <kdebug.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <qlayout.h>
|
||||||
|
#include <qfile.h>
|
||||||
|
#include <qtextstream.h>
|
||||||
|
#include <kgenericfactory.h>
|
||||||
|
#include <kstdguiitem.h>
|
||||||
|
#include <kdeversion.h>
|
||||||
|
|
||||||
|
typedef KGenericFactory<Kalternatives, QWidget> KalternativesFactory;
|
||||||
|
K_EXPORT_COMPONENT_FACTORY( kcm_kalternatives, KalternativesFactory("kcmkalternatives"))
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
KCModule *create_kalternatives(QWidget *parent, const char *name)
|
||||||
|
{
|
||||||
|
return new Kalternatives(parent, name);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Kalternatives::Kalternatives(QWidget *parent, const char *name, const QStringList&)
|
||||||
|
:KCModule(/*KalternativesFactory::instance(), */parent, name), myAboutData(0)
|
||||||
|
{
|
||||||
|
setUseRootOnlyMsg(false);
|
||||||
|
|
||||||
|
int user = getuid();
|
||||||
|
|
||||||
|
if (user == 0)
|
||||||
|
{
|
||||||
|
m_bisRoot = true;
|
||||||
|
setButtons(KCModule::Help|KCModule::Apply);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bisRoot = false;
|
||||||
|
setButtons(Help);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MANDRAKE
|
||||||
|
m_mgr = new AltFilesManager("/var/lib/rpm/alternatives");
|
||||||
|
#else
|
||||||
|
#ifdef DEBIAN
|
||||||
|
m_mgr = new AltFilesManager("/var/lib/dpkg/alternatives");
|
||||||
|
#else
|
||||||
|
KMessageBox::sorry(this, i18n("Kalternatives only work on Debian- or Mandrake-based systems"), i18n("Wrong System Type"));
|
||||||
|
QTimer::singleShot(0, this, SLOT(die()));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
MainWindow *mainwindow = new MainWindow(this);
|
||||||
|
QBoxLayout *layout = new QVBoxLayout(this, 0, KDialog::spacingHint());
|
||||||
|
layout->addWidget( mainwindow );
|
||||||
|
layout->activate();
|
||||||
|
|
||||||
|
mainwindow->m_altList->setShowToolTips(1);
|
||||||
|
|
||||||
|
connect(mainwindow->m_hideAlt, SIGNAL(clicked()), this,
|
||||||
|
SLOT(slotHideAlternativesClicked()));
|
||||||
|
|
||||||
|
connect(mainwindow->m_altList, SIGNAL(selectionChanged( QListViewItem* )), this,
|
||||||
|
SLOT(slotSelectAlternativesClicked(QListViewItem *)));
|
||||||
|
|
||||||
|
connect(mainwindow->m_optionsList, SIGNAL(clicked(QListViewItem *)),
|
||||||
|
this, SLOT(slotOptionClicked(QListViewItem *)));
|
||||||
|
connect(mainwindow->m_bAdd, SIGNAL(clicked()), this,
|
||||||
|
SLOT(slotAddClicked()));
|
||||||
|
connect(mainwindow->m_bDelete, SIGNAL(clicked()), this,
|
||||||
|
SLOT(slotDeleteClicked()));
|
||||||
|
connect(mainwindow->m_bProperties, SIGNAL(clicked()), this,
|
||||||
|
SLOT(slotPropertiesClicked()));
|
||||||
|
|
||||||
|
m_altList = mainwindow->m_altList;
|
||||||
|
m_optionsList = mainwindow->m_optionsList;
|
||||||
|
m_altTilte = mainwindow->m_altTilte;
|
||||||
|
m_statusCombo = mainwindow->m_statusCombo;
|
||||||
|
m_hideAlt = mainwindow->m_hideAlt;
|
||||||
|
|
||||||
|
mainwindow->m_bDelete->setGuiItem(KStdGuiItem::del());
|
||||||
|
mainwindow->m_bAdd->setGuiItem(KGuiItem(i18n("&Add"), "edit_add"));
|
||||||
|
mainwindow->m_bProperties->setGuiItem(KGuiItem( i18n( "&Properties" ), "configure"));
|
||||||
|
|
||||||
|
if(!m_bisRoot)
|
||||||
|
{
|
||||||
|
mainwindow->m_bDelete->setEnabled(false);
|
||||||
|
mainwindow->m_bAdd->setEnabled(false);
|
||||||
|
mainwindow->m_bProperties->setEnabled(false);
|
||||||
|
m_statusCombo->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
myAboutData = new KAboutData("kcmkalternatives", I18N_NOOP("Kalternatives"),
|
||||||
|
KALT_VERSION, I18N_NOOP("KDE Mandrake/Debian alternatives-system manager"),
|
||||||
|
KAboutData::License_GPL, I18N_NOOP("(c) 2004 Juanjo Alvarez Martinez\n"
|
||||||
|
"(c) 2004 Mario Bensi"));
|
||||||
|
|
||||||
|
myAboutData->addAuthor("Juanjo Alvarez Martinez", 0, "juanjo@juanjoalvarez.net",
|
||||||
|
"http://juanjoalvarez.net");
|
||||||
|
myAboutData->addAuthor("Mario Bensi", 0, "nef@ipsquad.net", "http://ipsquad.net");
|
||||||
|
myAboutData->addAuthor("Pino Toscano", 0, "toscano.pino@tiscali.it");
|
||||||
|
|
||||||
|
#if KDE_IS_VERSION(3,2,90)
|
||||||
|
setAboutData( myAboutData );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
load();
|
||||||
|
m_hideAlt->setChecked(true);
|
||||||
|
slotHideAlternativesClicked();
|
||||||
|
}
|
||||||
|
|
||||||
|
Kalternatives::~Kalternatives()
|
||||||
|
{
|
||||||
|
if(m_mgr) delete m_mgr;
|
||||||
|
if(m_altList) delete m_altList;
|
||||||
|
if(m_optionsList) delete m_optionsList;
|
||||||
|
if(m_altTilte) delete m_altTilte;
|
||||||
|
if(m_statusCombo) delete m_statusCombo;
|
||||||
|
if(m_hideAlt) delete m_hideAlt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Kalternatives::die()
|
||||||
|
{
|
||||||
|
delete this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Kalternatives::load()
|
||||||
|
{
|
||||||
|
clearList(m_altList);
|
||||||
|
QPtrList<Item> *itemslist = m_mgr->getGlobalAlternativeList();
|
||||||
|
Item *i;
|
||||||
|
TreeItemElement *treeit;
|
||||||
|
for(i = itemslist->first(); i; i = itemslist->next())
|
||||||
|
{
|
||||||
|
AltController *altcontroller = new AltController();
|
||||||
|
treeit = new TreeItemElement(m_altList, i, altcontroller);
|
||||||
|
|
||||||
|
AltsPtrList *altList = i->getAlternatives();
|
||||||
|
Alternative *a = altList->first();
|
||||||
|
|
||||||
|
AltItemElement *ael;
|
||||||
|
|
||||||
|
for(; a; a=altList->next())
|
||||||
|
{
|
||||||
|
ael = new AltItemElement(m_optionsList, a);
|
||||||
|
if(!m_bisRoot) ael->setEnabled(false);
|
||||||
|
treeit->getAltController()->addAltItem(ael);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::clearList(KListView* list)
|
||||||
|
{
|
||||||
|
QListViewItemIterator it( list );
|
||||||
|
QListViewItem *tmp;
|
||||||
|
while( (tmp=it.current()) )
|
||||||
|
{
|
||||||
|
it++;
|
||||||
|
list->takeItem(tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::slotSelectAlternativesClicked(QListViewItem *alternative)
|
||||||
|
{
|
||||||
|
clearList(m_optionsList);
|
||||||
|
TreeItemElement *treeItem;
|
||||||
|
if((treeItem = dynamic_cast<TreeItemElement *>(alternative)))
|
||||||
|
{
|
||||||
|
Item *item = treeItem->getItem();
|
||||||
|
|
||||||
|
m_altTilte->setText(treeItem->getName());
|
||||||
|
m_statusCombo->setCurrentItem(item->getMode());
|
||||||
|
|
||||||
|
AltItemList *altItemList = treeItem->getAltController()->getAltItemList();
|
||||||
|
|
||||||
|
for( AltItemElement *altItem= altItemList->first(); altItem ; altItem = altItemList->next())
|
||||||
|
{
|
||||||
|
Alternative *a = altItem->getAlternative();
|
||||||
|
|
||||||
|
QString priority;
|
||||||
|
priority.setNum(a->getPriority());
|
||||||
|
|
||||||
|
m_optionsList->insertItem(altItem);
|
||||||
|
|
||||||
|
altItem->setText( 1, priority);
|
||||||
|
altItem->setText( 2, a->getPath());
|
||||||
|
QString m_small_desc = altItem->getDescription();
|
||||||
|
|
||||||
|
if (!m_small_desc.isEmpty())
|
||||||
|
{
|
||||||
|
altItem->setText( 3, m_small_desc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
altItem->searchDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_optionsList->setSelected(m_optionsList->firstChild(), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::slotHideAlternativesClicked()
|
||||||
|
{
|
||||||
|
if (m_hideAlt->isChecked ())
|
||||||
|
{
|
||||||
|
QListViewItemIterator it( m_altList );
|
||||||
|
TreeItemElement *i;
|
||||||
|
QListViewItem *tmp;
|
||||||
|
while ( it.current() )
|
||||||
|
{
|
||||||
|
if((i = dynamic_cast<TreeItemElement *>(it.current())))
|
||||||
|
{
|
||||||
|
if ((i->getItem()->getAlternatives()->count()) <= 1)
|
||||||
|
{
|
||||||
|
tmp = it.current();
|
||||||
|
it++;
|
||||||
|
m_altList->takeItem(tmp);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
m_altList->setSelected(m_altList->firstChild (), 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::slotOptionClicked(QListViewItem *option)
|
||||||
|
{
|
||||||
|
AltItemElement *altItem;
|
||||||
|
if((altItem = dynamic_cast<AltItemElement *>(option)))
|
||||||
|
{
|
||||||
|
if( !altItem->isOn())
|
||||||
|
return;
|
||||||
|
TreeItemElement *treeItem;
|
||||||
|
if((treeItem = dynamic_cast<TreeItemElement *>(m_altList->selectedItem())))
|
||||||
|
{
|
||||||
|
treeItem->getAltController()->setBoutonOnOff(m_optionsList, altItem);
|
||||||
|
treeItem->setChanged(TRUE);
|
||||||
|
emit changed(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Kalternatives::slotAddClicked()
|
||||||
|
{
|
||||||
|
TreeItemElement *treeItem;
|
||||||
|
if((treeItem = dynamic_cast<TreeItemElement *>(m_altList->selectedItem())))
|
||||||
|
{
|
||||||
|
m_optionsList->setSelected(m_optionsList->firstChild(), 1);
|
||||||
|
|
||||||
|
AltItemElement *altItem;
|
||||||
|
if((altItem = dynamic_cast<AltItemElement *>(m_optionsList->selectedItem())))
|
||||||
|
{
|
||||||
|
int countSlave = altItem->getAlternative()->countSlaves();
|
||||||
|
AddAlternatives *addAlternatives = new AddAlternatives(treeItem, this, countSlave);
|
||||||
|
addAlternatives->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void Kalternatives::slotDeleteClicked()
|
||||||
|
{
|
||||||
|
TreeItemElement *treeItem;
|
||||||
|
if((treeItem = dynamic_cast<TreeItemElement *>(m_altList->selectedItem())))
|
||||||
|
{
|
||||||
|
AltItemElement *altItem;
|
||||||
|
if((altItem = dynamic_cast<AltItemElement *>(m_optionsList->selectedItem())))
|
||||||
|
{
|
||||||
|
treeItem->getItem()->delAlternativeByPath(altItem->getPath());
|
||||||
|
|
||||||
|
AltItemList *altItemList = treeItem->getAltController()->getAltItemList();
|
||||||
|
|
||||||
|
altItemList->remove(altItem);
|
||||||
|
m_optionsList->takeItem(altItem);
|
||||||
|
|
||||||
|
treeItem->setNbrAltChanged(TRUE);
|
||||||
|
emit changed( TRUE );
|
||||||
|
m_optionsList->setSelected(m_optionsList->firstChild (), 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Kalternatives::slotPropertiesClicked()
|
||||||
|
{
|
||||||
|
AltItemElement *altItem;
|
||||||
|
|
||||||
|
if((altItem = dynamic_cast<AltItemElement *>(m_optionsList->selectedItem())))
|
||||||
|
{
|
||||||
|
QString text;
|
||||||
|
PropertiesWindow *prop = new PropertiesWindow(this);
|
||||||
|
prop->bClose->setGuiItem(KStdGuiItem::close());
|
||||||
|
|
||||||
|
Alternative *a = altItem->getAlternative();
|
||||||
|
|
||||||
|
|
||||||
|
text += i18n( "Description :\n%1\n" ).arg( altItem->getDescription() );
|
||||||
|
text += i18n( "Path : %1\n" ).arg( a->getPath() );
|
||||||
|
text += i18n( "Priority : %1\n" ).arg( a->getPriority() );
|
||||||
|
|
||||||
|
QStringList* slavesList = a->getSlaves();
|
||||||
|
text += i18n( "Slave :", "Slaves :", slavesList->count() );
|
||||||
|
|
||||||
|
for ( QStringList::Iterator it = slavesList->begin(); it != slavesList->end(); ++it )
|
||||||
|
{
|
||||||
|
text += "\n\t";
|
||||||
|
text += *it;
|
||||||
|
}
|
||||||
|
prop->m_text->setText(text);
|
||||||
|
prop->show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::save()
|
||||||
|
{
|
||||||
|
QListViewItemIterator it( m_altList );
|
||||||
|
TreeItemElement *treeItem;
|
||||||
|
|
||||||
|
while ( it.current() )
|
||||||
|
{
|
||||||
|
if((treeItem = dynamic_cast<TreeItemElement *>(it.current())))
|
||||||
|
{
|
||||||
|
if(treeItem->isNbrAltChanged())
|
||||||
|
{
|
||||||
|
QString parentPath = QString("%1/%2")
|
||||||
|
.arg(m_mgr->getAltDir())
|
||||||
|
.arg(treeItem->getName());
|
||||||
|
|
||||||
|
QFile origFile(parentPath);
|
||||||
|
if(origFile.exists())
|
||||||
|
{
|
||||||
|
origFile.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if( origFile.open( IO_WriteOnly ))
|
||||||
|
{
|
||||||
|
QTextStream stream( &origFile );
|
||||||
|
|
||||||
|
|
||||||
|
Item *item = treeItem->getItem();
|
||||||
|
|
||||||
|
stream << item->getMode() << endl;
|
||||||
|
stream << item->getPath() << endl;
|
||||||
|
|
||||||
|
SlaveList *slaveList = item->getSlaves();
|
||||||
|
Slave *slave = slaveList->first();
|
||||||
|
for(; slave; slave = slaveList->next())
|
||||||
|
{
|
||||||
|
stream << slave->slname << endl;
|
||||||
|
stream << slave->slpath << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
stream << endl;
|
||||||
|
|
||||||
|
AltItemList *altItemList = treeItem->getAltController()->getAltItemList();
|
||||||
|
AltItemElement *altItem= altItemList->first();
|
||||||
|
for( ; altItem ; altItem = altItemList->next())
|
||||||
|
{
|
||||||
|
Alternative *a = altItem->getAlternative();
|
||||||
|
|
||||||
|
stream << a->getPath() << endl;
|
||||||
|
stream << a->getPriority() << endl;
|
||||||
|
|
||||||
|
QStringList *slaveList = a->getSlaves();
|
||||||
|
QStringList::Iterator it = slaveList->begin();
|
||||||
|
for ( ; it != slaveList->end(); ++it )
|
||||||
|
{
|
||||||
|
stream << *it << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
origFile.close();
|
||||||
|
}
|
||||||
|
treeItem->setNbrAltChanged(FALSE);
|
||||||
|
}
|
||||||
|
if(treeItem->isChanged())
|
||||||
|
{
|
||||||
|
AltItemList *altItemList = treeItem->getAltController()->getAltItemList();
|
||||||
|
AltItemElement *altItem= altItemList->first();
|
||||||
|
for( ; altItem ; altItem = altItemList->next())
|
||||||
|
{
|
||||||
|
if( altItem->isOn() )
|
||||||
|
{
|
||||||
|
Alternative *a = altItem->getAlternative();
|
||||||
|
if(!a->select())
|
||||||
|
{
|
||||||
|
kdDebug() << a->getSelectError() << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
treeItem->setChanged(FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
it++;
|
||||||
|
}
|
||||||
|
emit changed( false );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Kalternatives::configChanged()
|
||||||
|
{
|
||||||
|
emit changed(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString Kalternatives::quickHelp() const
|
||||||
|
{
|
||||||
|
return i18n("<h1>Kalternatives</h1>\n"
|
||||||
|
"A Mandrake/Debian alternatives-system manager.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include "kalternatives.moc"
|
@ -0,0 +1,83 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _KALTERNATIVES_H_
|
||||||
|
#define _KALTERNATIVES_H_
|
||||||
|
|
||||||
|
//#ifdef HAVE_CONFIG_H
|
||||||
|
//#include <config.h>
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
#include <klistview.h>
|
||||||
|
#include <kpushbutton.h>
|
||||||
|
#include <kcombobox.h>
|
||||||
|
#include <qwidget.h>
|
||||||
|
#include <qlabel.h>
|
||||||
|
#include <qcheckbox.h>
|
||||||
|
#include <kcmodule.h>
|
||||||
|
#include <kaboutdata.h>
|
||||||
|
|
||||||
|
#define KALT_VERSION "0.12"
|
||||||
|
|
||||||
|
class AltFilesManager;
|
||||||
|
|
||||||
|
class Kalternatives : public KCModule
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
bool m_bisRoot;
|
||||||
|
AltFilesManager *m_mgr;
|
||||||
|
KListView* m_optionsList;
|
||||||
|
KListView* m_altList;
|
||||||
|
KComboBox* m_statusCombo;
|
||||||
|
QLabel* m_altTilte;
|
||||||
|
QCheckBox* m_hideAlt;
|
||||||
|
KAboutData *myAboutData;
|
||||||
|
|
||||||
|
void clearList(KListView* list);
|
||||||
|
|
||||||
|
public:
|
||||||
|
Kalternatives(QWidget *parent=0, const char *name=0, const QStringList& = QStringList() );
|
||||||
|
virtual ~Kalternatives();
|
||||||
|
KListView *optionsList() const {return m_optionsList;}
|
||||||
|
bool isBisRoot() const {return m_bisRoot;}
|
||||||
|
|
||||||
|
virtual void load();
|
||||||
|
virtual void save();
|
||||||
|
virtual QString quickHelp() const;
|
||||||
|
virtual const KAboutData *aboutData()const { return myAboutData; };
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void configChanged();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void slotSelectAlternativesClicked(QListViewItem *);
|
||||||
|
void slotHideAlternativesClicked();
|
||||||
|
void die();
|
||||||
|
void slotOptionClicked(QListViewItem *option);
|
||||||
|
void slotAddClicked();
|
||||||
|
void slotDeleteClicked();
|
||||||
|
void slotPropertiesClicked();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _KALTERNATIVES_H_
|
@ -0,0 +1,16 @@
|
|||||||
|
Begin3
|
||||||
|
Title: kalternatives -- Some description
|
||||||
|
Version: 0.12
|
||||||
|
Entered-date:
|
||||||
|
Description:
|
||||||
|
Keywords: KDE Qt
|
||||||
|
Author: Juanjo <juanjux@yahoo.es>
|
||||||
|
Maintained-by: Juanjo <juanjux@yahoo.es>
|
||||||
|
Home-page:
|
||||||
|
Alternate-site:
|
||||||
|
Primary-site: ftp://ftp.kde.org/pub/kde/unstable/apps/utils
|
||||||
|
xxxxxx kalternatives-0.12.tar.gz
|
||||||
|
xxx kalternatives-0.12.lsm
|
||||||
|
Platform: Linux. Needs KDE
|
||||||
|
Copying-policy: GPL
|
||||||
|
End
|
@ -0,0 +1,8 @@
|
|||||||
|
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
|
||||||
|
<kpartgui name="kalternatives" version="1">
|
||||||
|
<MenuBar>
|
||||||
|
<Menu name="custom"><text>C&ustom</text>
|
||||||
|
<Action name="custom_action" />
|
||||||
|
</Menu>
|
||||||
|
</MenuBar>
|
||||||
|
</kpartgui>
|
@ -0,0 +1,77 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "main.h"
|
||||||
|
#include "kalternatives.h"
|
||||||
|
#include <kuniqueapplication.h>
|
||||||
|
#include <kaboutdata.h>
|
||||||
|
#include <kcmdlineargs.h>
|
||||||
|
#include <klocale.h>
|
||||||
|
#include <kmessagebox.h>
|
||||||
|
|
||||||
|
KUniqueApplication *app = 0; // Global
|
||||||
|
|
||||||
|
static const char description[] =
|
||||||
|
I18N_NOOP("A KDE Manager for the Debian/Mandrake alternatives system");
|
||||||
|
|
||||||
|
static const char version[] = "0.10";
|
||||||
|
|
||||||
|
static KCmdLineOptions options[] =
|
||||||
|
{
|
||||||
|
// { "+[URL]", I18N_NOOP( "Document to open." ), 0 },
|
||||||
|
KCmdLineLastOption
|
||||||
|
};
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
KAboutData about("kalternatives", I18N_NOOP("kalternatives"), version, description,
|
||||||
|
KAboutData::License_GPL, "(C) 2004 Juanjo Alvarez Martinez and Mario Bensi", 0, 0, "juanjux@yahoo.es, nef@ipsquad.net");
|
||||||
|
about.addAuthor( "Juanjo Alvarez Martinez and Mario Bensi", 0, "juanjux@yahoo.es, nef@ipsquad.net" );
|
||||||
|
|
||||||
|
KCmdLineArgs::init(argc, argv, &about);
|
||||||
|
KCmdLineArgs::addCmdLineOptions( options );
|
||||||
|
KUniqueApplication rapp;
|
||||||
|
app = &rapp;
|
||||||
|
Kalternatives *mainWin = 0;
|
||||||
|
|
||||||
|
if (app->isRestored())
|
||||||
|
{
|
||||||
|
//RESTORE(kalternatives);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// no session.. just start up normally
|
||||||
|
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
|
||||||
|
|
||||||
|
/// @todo do something with the command line args here
|
||||||
|
|
||||||
|
mainWin = new Kalternatives();
|
||||||
|
app->setMainWidget( mainWin );
|
||||||
|
mainWin->show();
|
||||||
|
|
||||||
|
|
||||||
|
args->clear();
|
||||||
|
}
|
||||||
|
return app->exec();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef _MAIN_H_
|
||||||
|
#define _MAIN_H_
|
||||||
|
|
||||||
|
#include <kuniqueapplication.h>
|
||||||
|
|
||||||
|
extern KUniqueApplication *app;
|
||||||
|
|
||||||
|
#endif //_MAIN_H_
|
@ -0,0 +1,392 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>Kalternatives</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>615</width>
|
||||||
|
<height>490</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>7</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>0</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="caption">
|
||||||
|
<string>Alternatives Manager</string>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QSplitter" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>splitter2</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout6</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="KListView">
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Alternatives</string>
|
||||||
|
</property>
|
||||||
|
<property name="clickable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_altList</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>LastColumn</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QGroupBox">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>groupBox3</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>1</hsizetype>
|
||||||
|
<vsizetype>1</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>GroupBoxPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="title">
|
||||||
|
<string></string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>AlignAuto</set>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QCheckBox" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_hideAlt</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>1</hsizetype>
|
||||||
|
<vsizetype>1</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="acceptDrops">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Hide useless alternatives</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout24</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout22</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout5_2</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>textLabel1</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<bold>1</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>status :</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>manual</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_statusCombo</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>0</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer6</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="QLabel">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_altTilte</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy>
|
||||||
|
<hsizetype>7</hsizetype>
|
||||||
|
<vsizetype>0</vsizetype>
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
<bold>1</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Automake</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer5</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>88</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
<widget class="KListView">
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Choice</string>
|
||||||
|
</property>
|
||||||
|
<property name="clickable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Priority</string>
|
||||||
|
</property>
|
||||||
|
<property name="clickable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Option</string>
|
||||||
|
</property>
|
||||||
|
<property name="clickable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Description</string>
|
||||||
|
</property>
|
||||||
|
<property name="clickable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_optionsList</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="resizePolicy">
|
||||||
|
<enum>AutoOneFit</enum>
|
||||||
|
</property>
|
||||||
|
<property name="hScrollBarMode">
|
||||||
|
<enum>Auto</enum>
|
||||||
|
</property>
|
||||||
|
<property name="allColumnsShowFocus">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="resizeMode">
|
||||||
|
<enum>LastColumn</enum>
|
||||||
|
</property>
|
||||||
|
<property name="fullWidth">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout7</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer3</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bAdd</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Add</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bProperties</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Properties</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_bDelete</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Delete</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
</customwidgets>
|
||||||
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
<includehints>
|
||||||
|
<includehint>klistview.h</includehint>
|
||||||
|
<includehint>kcombobox.h</includehint>
|
||||||
|
<includehint>klistview.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
</includehints>
|
||||||
|
</UI>
|
@ -0,0 +1,106 @@
|
|||||||
|
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
|
||||||
|
<class>PropertiesWindow</class>
|
||||||
|
<widget class="QDialog">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>PropertiesWindow</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>532</width>
|
||||||
|
<height>407</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="caption">
|
||||||
|
<string>Alternative Properties</string>
|
||||||
|
</property>
|
||||||
|
<grid>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="QLayoutWidget" row="0" column="0">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout17</cstring>
|
||||||
|
</property>
|
||||||
|
<vbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<widget class="KTextEdit">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>m_text</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="Line">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>line3</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>HLine</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLayoutWidget">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>layout7</cstring>
|
||||||
|
</property>
|
||||||
|
<hbox>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>unnamed</cstring>
|
||||||
|
</property>
|
||||||
|
<spacer>
|
||||||
|
<property name="name">
|
||||||
|
<cstring>spacer5</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>Expanding</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
<widget class="KPushButton">
|
||||||
|
<property name="name">
|
||||||
|
<cstring>bClose</cstring>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Close</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</hbox>
|
||||||
|
</widget>
|
||||||
|
</vbox>
|
||||||
|
</widget>
|
||||||
|
</grid>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
</customwidgets>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>bClose</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>PropertiesWindow</receiver>
|
||||||
|
<slot>close()</slot>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<layoutdefaults spacing="6" margin="11"/>
|
||||||
|
<includehints>
|
||||||
|
<includehint>ktextedit.h</includehint>
|
||||||
|
<includehint>kpushbutton.h</includehint>
|
||||||
|
</includehints>
|
||||||
|
</UI>
|
@ -0,0 +1,70 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "treeitemelement.h"
|
||||||
|
#include "altparser.h"
|
||||||
|
#include "altcontroller.h"
|
||||||
|
#include <qfont.h>
|
||||||
|
#include <qpainter.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
TreeItemElement::TreeItemElement(KListView *parent, Item *itemarg, AltController *altControl )
|
||||||
|
: QListViewItem(parent, itemarg->getName()),
|
||||||
|
m_item(itemarg),
|
||||||
|
m_name(itemarg->getName()),
|
||||||
|
m_changed(FALSE),
|
||||||
|
m_nbrAltChanged(FALSE),
|
||||||
|
m_altControl(altControl)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TreeItemElement::~TreeItemElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void TreeItemElement::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
|
||||||
|
{
|
||||||
|
QColor color;
|
||||||
|
|
||||||
|
if (m_changed || m_nbrAltChanged)
|
||||||
|
{
|
||||||
|
color=QColor("red");
|
||||||
|
QFont f = p->font();
|
||||||
|
f.setBold(true);
|
||||||
|
p->setFont(f);
|
||||||
|
}
|
||||||
|
|
||||||
|
// the pallet of colors is saved
|
||||||
|
QColorGroup _cg( cg );
|
||||||
|
QColor oldText=_cg.text();
|
||||||
|
|
||||||
|
// modification of the pallet of colors by defining
|
||||||
|
//our new color as color of text
|
||||||
|
_cg.setColor( QColorGroup::Text, color );
|
||||||
|
|
||||||
|
QListViewItem::paintCell( p, _cg, column, width, align );
|
||||||
|
|
||||||
|
// restoration of the pallet of "standard" colors
|
||||||
|
_cg.setColor( QColorGroup::Text, oldText );
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Mario Bensi *
|
||||||
|
* nef@ipsquad.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 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _TREEITEMELEMENT_H_
|
||||||
|
#define _TREEITEMELEMENT_H_
|
||||||
|
|
||||||
|
#include <qstring.h>
|
||||||
|
#include <qptrlist.h>
|
||||||
|
#include <qlistview.h>
|
||||||
|
#include <klistview.h>
|
||||||
|
|
||||||
|
class AltController;
|
||||||
|
class Item;
|
||||||
|
|
||||||
|
|
||||||
|
class TreeItemElement : public QListViewItem
|
||||||
|
{
|
||||||
|
Item *m_item;
|
||||||
|
QString m_name;
|
||||||
|
bool m_changed;
|
||||||
|
bool m_nbrAltChanged;
|
||||||
|
AltController *m_altControl;
|
||||||
|
|
||||||
|
public:
|
||||||
|
TreeItemElement(KListView *parent, Item *itemarg, AltController *altControl);
|
||||||
|
~TreeItemElement();
|
||||||
|
|
||||||
|
QString getName() const { return m_name; }
|
||||||
|
Item *getItem() const { return m_item; }
|
||||||
|
void setChanged(bool c) { m_changed = c; }
|
||||||
|
bool isChanged() const { return m_changed; }
|
||||||
|
void setNbrAltChanged(bool c) { m_nbrAltChanged = c; }
|
||||||
|
bool isNbrAltChanged() const { return m_nbrAltChanged; }
|
||||||
|
AltController *getAltController() {return m_altControl;}
|
||||||
|
|
||||||
|
virtual void paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //_TREEITEMELEMENT_H_
|
@ -0,0 +1,19 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
@ -0,0 +1,19 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* Copyright (C) 2004 by Juanjo *
|
||||||
|
* juanjux@yahoo.es *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the *
|
||||||
|
* Free Software Foundation, Inc., *
|
||||||
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||||
|
***************************************************************************/
|
Loading…
Reference in New Issue