diff options
Diffstat (limited to 'kpersonalizer')
39 files changed, 5497 insertions, 0 deletions
diff --git a/kpersonalizer/CMakeLists.txt b/kpersonalizer/CMakeLists.txt new file mode 100644 index 000000000..313ff48a5 --- /dev/null +++ b/kpersonalizer/CMakeLists.txt @@ -0,0 +1,45 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +add_subdirectory( pics ) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_SOURCE_DIR} # for libkonq/konq_defaults.h + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +tde_install_icons( ) +install( FILES kpersonalizer.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} ) +install( FILES uninstall.desktop DESTINATION ${APPS_INSTALL_DIR}/System RENAME kpersonalizer.desktop ) + + +##### kpersonalizer (executable) ################ + +tde_add_executable( kpersonalizer AUTOMOC + SOURCES + stylepreview.ui krefinepage.cpp tdestylepage.cpp + keyecandypage.cpp kospage.cpp kcountrypage.cpp + kpersonalizer.cpp main.cpp kfindlanguage.cpp + kcountrypagedlg.ui kospagedlg.ui keyecandypagedlg.ui + tdestylepagedlg.ui krefinepagedlg.ui ksysinfo.cpp + LINK tdeio-shared + DESTINATION ${BIN_INSTALL_DIR} +) diff --git a/kpersonalizer/Makefile.am b/kpersonalizer/Makefile.am new file mode 100644 index 000000000..304d5503b --- /dev/null +++ b/kpersonalizer/Makefile.am @@ -0,0 +1,53 @@ +bin_PROGRAMS = kpersonalizer +kpersonalizer_SOURCES = stylepreview.ui krefinepage.cpp \ + tdestylepage.cpp keyecandypage.cpp kospage.cpp kcountrypage.cpp kpersonalizer.cpp \ + main.cpp kfindlanguage.cpp \ + kcountrypagedlg.ui kospagedlg.ui keyecandypagedlg.ui tdestylepagedlg.ui \ + krefinepagedlg.ui ksysinfo.cpp + +kpersonalizer_LDADD = $(LIB_TDEIO) + +EXTRA_DIST = main.cpp kpersonalizer.cpp kpersonalizer.h kpersonalizer.desktop kcountrypage.cpp kcountrypage.h kospage.cpp kospage.h keyecandypage.cpp keyecandypage.h tdestylepage.cpp tdestylepage.h krefinepage.cpp krefinepage.h cr16-app-kpersonalizer.png cr32-app-kpersonalizer.png README kcountrypagedlg.ui kospage.ui keyecandypagedlg.ui tdestylepagedlg.ui krefinepagedlg.ui kfindlanguage.cpp kfindlanguage.h + +xdg_apps_DATA = kpersonalizer.desktop + +install-data-local: uninstall.desktop + $(mkinstalldirs) $(DESTDIR)$(kde_appsdir)/System + $(INSTALL_DATA) $(srcdir)/uninstall.desktop $(DESTDIR)$(kde_appsdir)/System/kpersonalizer.desktop + +####### tdevelop will overwrite this part!!! (end)############ +SUBDIRS = pics + +# this 10 paths are KDE specific. Use them: +# kde_htmldir Where your docs should go to. (contains lang subdirs) +# kde_appsdir Where your application file (.kdelnk) should go to. +# kde_icondir Where your icon should go to. +# kde_minidir Where your mini icon should go to. +# kde_datadir Where you install application data. (Use a subdir) +# kde_locale Where translation files should go to.(contains lang subdirs) +# kde_cgidir Where cgi-bin executables should go to. +# kde_confdir Where config files should go to. +# kde_mimedir Where mimetypes should go to. +# kde_toolbardir Where general toolbar icons should go to. +# kde_wallpaperdir Where general wallpapers should go to. + +# set the include path for X, qt and KDE +INCLUDES= $(all_includes) -I$(top_srcdir) + +METASOURCES = AUTO + +KDE_ICON= AUTO +# the library search path. +kpersonalizer_LDFLAGS = $(all_libraries) $(KDE_RPATH) $(LIB_QT) -lDCOP $(LIB_TDECORE) $(LIB_TDEUI) -ltdefx $(LIB_TDEIO) -ltdetexteditor + +# Uncomment the following two lines if you add a ui.rc file for your application to make use of +# KDE�s XML GUI builing +#rcdir = $(kde_datadir)/kpersonalizer +#rc_DATA = kpersonalizerui.rc + +messages: rc.cpp + LIST=`find . -name \*.h -o -name \*.hh -o -name \*.H -o -name \*.hxx -o -name \*.hpp -o -name \*.cpp -o -name \*.cc -o -name \*.cxx -o -name \*.ecpp -o -name \*.C`; \ + if test -n "$$LIST"; then \ + $(XGETTEXT) $$LIST -o $(podir)/kpersonalizer.pot; \ + fi + diff --git a/kpersonalizer/README b/kpersonalizer/README new file mode 100644 index 000000000..b93d9d15d --- /dev/null +++ b/kpersonalizer/README @@ -0,0 +1,230 @@ +KPersonalizer - Whitepaper +=================== + +Questions & Answers: + +Torsten Rahn <[email protected]> +Carsten Wolff <[email protected]> +Ralf Nolden <[email protected]> +Daniel Molkentin <[email protected]> + + +Aim: +----- +When the user starts KDE for the very first time the very first impression is + critical and will decide whether the user likes or dislikes KDE. While this + might not sound very"fair" or "logical" it's the way people think and perceive + their environment. + +The aim of KPersonalizer is to provide the pleasant look & feel the user expects + on the very first startup. To determine which look and feel the user prefers he + is guided through a minimal set of steps. + +What Kpersonalizer is _not_ about: +-------------------------------------------- + +Kpersonalizer is not a wizard which configures your hardware, mount-points or +any other distribution-related stuff. KPersonalizer is only meant to deal with +the Look & Feel KDE provides. As soon as we would touch distribution-related +stuff we risk that distributions might disable KPersonalizer. To encourage +distributions to make use of it it should easily be possible to extend or change +the behaviour of KPersonalizer. + +KPersonalizer is not meant to be part of KControl +KControl is rather a graphical registry where you can change every little +detail in a hierarchically arranged order. One really has to know about the +details when changing stuff and one only changes things one by one. +KPersonalizer on the other hand asks the user very basic questions +that don't require much background-knowledge and tries to guess a set +of configuration-settings which fit the users needs best. + +Layout: KPersonalizer consists of a window which is not set fullscreen. +This has the advantage that the user sees on the fly which settings he has +changed and can step back as he sees that something doesn't fit. +On the left of each dialog there is a decorative 170x430-pixel-bitmap which +sort of describes the step in a graphical manner. + +Step 1: +===== +Introduction: +The Introduction should give the user a warm welcome. It should explain +what KPersonalizer will do during the next step and that the user will be able +to refine the settings afterwards in the last step using kcontrol. + +Most distributions I am aware of generally set one language for all users as a +first default. In certain situations the user might not speak the language +of the default installation which was done by the Sysadmin. +Therefore it makes sense to prompt the user for "his" country. +Judging from the country Kpersonalizer will make all settings according to that +country (language, currency, etc.). +As distributions might take care of this step it should stay easy to disable +that part of the dialog. + +Step 2: +===== +Here the user is asked for the way his computer should act like in the future. +Once again this step only deals with the way the computer works - not with the +look. + +Depending on the radiobutton which is enabled you get a description which +lists the feautres of each setting: + +KDE (default): + +The default-setting which you would get if you would disable +KPersonalizer. + +Microsoft Windows (TM): + +- Double Click +- Busy Cursor +- Windows keyboard scheme +- use 2 clipboards for c&p (keyboard/mouse) (default) +- Window-Behavior -> Focus on click +- Titlebar doubleclick -> Maximize +- WindowList-menu on MMB +- Walk trough windows mode: KDE +- NOT underline IconText +- NOT change pointer shape over an icon + +UNIX (TM): +- Single Click +- No busy-cursor +- UNIX -keyboard-scheme. +- synchronize clipboards +- Window-Behavior -> Focus follows mouse +- Titlebar doubleclick -> Shade +- Application-menu on MMB like in FVWM +- Walk trough windows mode: CDE +- NOT underline IconText +- NOT change pointer shape over an icon + +MacOS: +- Single Click +- No Busy Cursor +- Mac- Keyboard-Scheme +- use 2 clipboards for c&p (keyboard/mouse) (default) +- Window-Behavior -> Focus on click +- Titlebar doubleclick -> Shade (for now. MacOS X has Minimize but this isn't offered by twin yet) +- Menubar on top +- WindowList-menu on MMB +- Walk trough windows mode: KDE +- NOT underline IconText +- change pointer shape over an icon + +Step 3: Eyecandy-O-Meter +=================== +The most prominent part the user should see is a big slider. Using this slider +he can easily choose the level of eyecandy. Some people prefer to have a Fast & +Lean environment with small desktop-items and other prefer a Big, Beautiful and +resource-wasting behaviour. + +To give the advanced user still some control over what is being changed all +items affected are being displayed in a small listview below. In front of each +listview-item there is a checkbox. +These items are being checked or unchecked depending on the position of the +slider. "Big & Beautiful" means that all items are checked, Fast and Lean means +that all items are unchecked. +As soon as the user touches the checkbox of one of the items directly the +state of that particular checkbox is not being changed by the position of the +slider anymore. Pressing a "Reset"-button will put all items back into the +position/state where the dialog started from. + +Features which are affected by the slider are being mentioned in the +following list of Levels: + + +Level 0 (No Eyecandy): + +- No animations, no eyecandy, nothing :) + +Level 1: + +- Show Wallpaper +- Animate Shading, Minimize & Restore (window effects) +- Display content in moving/resizing windows + +Level 2: + +- Show Konqueror/Kicker-backgrounds + +Level 3: + +- Show Iconeffects (Highlightning) +- Icon Zooming (ONLY MAC) + +Level 4 (Default for slow machines): + +- Icon Animations (mng) +- Desktop-Iconsize = 48 (if Resolution >= 1024x768) (ONLY MAC/CDE) +- Panel- Iconsize = 56 (if Resolution >= 1280x1024) (ONLY MAC/CDE) + +Level 5: + +- Enable Image-Previews + +Level 6: + +- Enable Animated Combo boxes + +Level 7 (default for fast machines): + +- Enable Antialiased Fonts +- Enable Fade tool tips +- Enable Fade menus + +Level 8: + +- Enable Text-Previews +- Icon Zooming (ALL SELECTIONS) +- Desktop-Iconsize = 48 (if Resolution >= 1024x768) (ALL SELECTIONS) +- Panel- Iconsize = 56 (if Resolution >= 1280x1024) (ALL SELECTIONS) + +Level 9 (Maximum Eyecandy): + +- Enable Icons on PushButtons +- Enable all kinds of File-Previews +- Enable Sound + +(The number of events which offer a sound corresponds directly to the +"eyecandy-level".) + +Idea for the future: The default-position of the slider might depend on the +measured performance/resources of the computer. + +Step 4: Theme-Selection +================= +The user can choose from 4-5 themes each of them representing a look and feel +which is very different from each other and might correspond with the choice +made in Step 2 a bit :-) +Basically this changes Icons, the widgetstyle, the WM-decoration, the +Colourscheme, tiles and Wallpapers. + +There is a preview for each theme. + +Step 5: Refinement +============== +The user is told how he can start KPersonalizer again if the user changes his +mind on a certain setting later and the advanced user may launch kcontrol to +refine certain settings. + + +EOF + + + + + + + + + + + + + + + + + + diff --git a/kpersonalizer/TODO b/kpersonalizer/TODO new file mode 100644 index 000000000..0a1bab85f --- /dev/null +++ b/kpersonalizer/TODO @@ -0,0 +1,28 @@ +TODO +==== +o general: + - code-cleanups + - open Wishlist-Items +o kospage: + - differnt clipboards for mouse c&p and keyboard c&p: enable in windows,kde,mac ; disable in unix + - kicker-schemes + +DONE for 3.1 +============ +o general: + - center kpersonalizer on the screen (Bug #38182) + - Layout-Bug on all pages if the content gets to long. Yippie! Finally! +o kospage: + - make keyscheme-saving behave exactly like kcmkeys + - Desktop Icons are arranged after dcop-call, but we just want to align them +o krefinepage: + - quit kpersonalizer, if user starts kcontrol +o tdestylepage: + - don't hardcode the styles + - style preview +o keyecandypage: + - add a switch for mng - animated icons (level 3) + - rescue users' soundscheme-settings + - take desktop-selection from ospage into account + - set a nice font for AA + - guess the machines' speed and set the slider-default-position according to it
\ No newline at end of file diff --git a/kpersonalizer/cr16-app-kpersonalizer.png b/kpersonalizer/cr16-app-kpersonalizer.png Binary files differnew file mode 100644 index 000000000..86186d795 --- /dev/null +++ b/kpersonalizer/cr16-app-kpersonalizer.png diff --git a/kpersonalizer/cr32-app-kpersonalizer.png b/kpersonalizer/cr32-app-kpersonalizer.png Binary files differnew file mode 100644 index 000000000..cc3e98698 --- /dev/null +++ b/kpersonalizer/cr32-app-kpersonalizer.png diff --git a/kpersonalizer/kcountrypage.cpp b/kpersonalizer/kcountrypage.cpp new file mode 100644 index 000000000..cec71bae8 --- /dev/null +++ b/kpersonalizer/kcountrypage.cpp @@ -0,0 +1,209 @@ +/*************************************************************************** + kcountrypage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <tqstringlist.h> +#include <tqlabel.h> +#include <tqmap.h> + +#include <tdeapplication.h> +#include <ksimpleconfig.h> +#include <tdelocale.h> +#include <kdebug.h> +#include <kstandarddirs.h> +#include <kiconloader.h> +#include <dcopclient.h> +#include <kprocess.h> +#include <klanguagebutton.h> + +#include "kfindlanguage.h" + +#include "kcountrypage.h" + +KCountryPage::KCountryPage(TQWidget *parent, const char *name ) : KCountryPageDlg(parent,name) { + + px_introSidebar->setPixmap(UserIcon("step1.png")); + + connect(cb_country, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(setLangForCountry(const TQString &))); + connect(cb_language, TQT_SIGNAL(activated(const TQString &)), TQT_SLOT(setLanguageChanged())); + + // naturally, the language is not changed on startup + b_savedLanguageChanged = false; + b_startedLanguageChanged = false; + + // set appropriate Trinity version (tdeapplication.h) + txt_welcome->setText(i18n("<h3>Welcome to Trinity %1</h3>").arg(KDE::versionString())); + + flang = new KFindLanguage(); + + // need this ones for decision over restarts of kp, kicker, etc + s_oldlocale = TDEGlobal::locale()->language(); + + // load the Menus and guess the selection + loadCountryList(cb_country); + fillLanguageMenu(cb_language); + cb_language->setCurrentItem(flang->getBestLang()); + cb_country->setCurrentItem("C"); + + // Highlight the users's country + for(int i = 0; i < cb_country->count(); i++) { + if(cb_country->id(i) == flang->getCountry()) { + cb_country->setCurrentItem(cb_country->id(i)); + break; + } + } + + setLanguageChanged(); +} + +KCountryPage::~KCountryPage(){ + delete flang; +} + + +void KCountryPage::loadCountryList(KLanguageButton *combo) { + + TQString sub = TQString::fromLatin1("l10n/"); + + // clear the list + combo->clear(); + + TQStringList regionfiles = TDEGlobal::dirs()->findAllResources("locale", sub + "*.desktop"); + TQMap<TQString,TQString> regionnames; + + for ( TQStringList::ConstIterator it = regionfiles.begin(); it != regionfiles.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup(TQString::fromLatin1("KCM Locale")); + TQString name = entry.readEntry(TQString::fromLatin1("Name"), i18n("without name")); + + TQString tag = *it; + int index; + + index = tag.findRev('/'); + if (index != -1) + tag = tag.mid(index + 1); + + index = tag.findRev('.'); + if (index != -1) + tag.truncate(index); + + regionnames.insert(name, tag); + } + + for ( TQMap<TQString,TQString>::ConstIterator mit = regionnames.begin(); mit != regionnames.end(); ++mit ) { + combo->insertSubmenu( mit.key(), '-' + mit.data(), sub ); + } + + // add all languages to the list + TQStringList countrylist = TDEGlobal::dirs()->findAllResources("locale", sub + "*/entry.desktop"); + countrylist.sort(); + + for ( TQStringList::ConstIterator it = countrylist.begin(); it != countrylist.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup(TQString::fromLatin1("KCM Locale")); + TQString name = entry.readEntry(TQString::fromLatin1("Name"), i18n("without name")); + TQString submenu = '-' + entry.readEntry("Region"); + + TQString tag = *it; + int index = tag.findRev('/'); + tag.truncate(index); + index = tag.findRev('/'); + tag = tag.mid(index+1); + + TQPixmap flag( locate( "locale", TQString::fromLatin1("l10n/%1/flag.png").arg(tag) ) ); + TQIconSet icon( flag ); + combo->insertItem( icon, name, tag, submenu ); + } +} + +void KCountryPage::fillLanguageMenu(KLanguageButton *combo) { + combo->clear(); + TQString submenu; // we are working on this menu + TQStringList langlist = flang->getLangList(); + TQMap<TQString,TQString> langmap = flang->getLangMap(); + TQStringList::ConstIterator it; + for ( it = langlist.begin(); it != langlist.end(); ++it ) { + if ((*it).isNull()) { + combo->insertSeparator(); + submenu = TQString::fromLatin1("all"); + combo->insertSubmenu(i18n("All"), submenu, TQString::null); + continue; + } + combo->insertItem(langmap[(*it)], (*it), submenu ); + } +} + +/** No descriptions */ +bool KCountryPage::save(KLanguageButton *comboCountry, KLanguageButton *comboLang) { + kdDebug() << "KCountryPage::save()" << endl; + TDEConfigBase *config = TDEGlobal::config(); + + config->setGroup(TQString::fromLatin1("Locale")); + config->writeEntry(TQString::fromLatin1("Country"), comboCountry->current(), true, true); + config->writeEntry(TQString::fromLatin1("Language"), comboLang->current(), true, true); + config->sync(); + + // only make the system reload the language, if the selected one deferes from the old saved one. + if (b_savedLanguageChanged) { + // Tell kdesktop about the new language + TQCString replyType; TQByteArray replyData; + TQByteArray data, da; + TQDataStream stream( data, IO_WriteOnly ); + stream << comboLang->current(); + if ( !kapp->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + // tdesycoca needs to be rebuilt + TDEProcess proc; + proc << TQString::fromLatin1("tdebuildsycoca"); + proc.start(TDEProcess::DontCare); + kdDebug() << "TDELocaleConfig::save : sending signal to kdesktop" << endl; + // inform kicker and kdeskop about the new language + kapp->dcopClient()->send( "kicker", "Panel", "restart()", TQString::null); + // call, not send, so that we know it's done before coming back + // (we both access kdeglobals...) + kapp->dcopClient()->call( "kdesktop", "KDesktopIface", "languageChanged(TQString)", data, replyType, replyData ); + } + // KPersonalizer::next() probably waits for a return-value + return true; +} + +void KCountryPage::setLangForCountry(const TQString &country) { + KSimpleConfig ent(locate("locale", "l10n/" + country + "/entry.desktop"), true); + ent.setGroup(TQString::fromLatin1("KCM Locale")); + langs = ent.readListEntry(TQString::fromLatin1("Languages")); + + TQString lang = TQString::fromLatin1("en_US"); + // use the first INSTALLED langauge in the list, or default to C + for ( TQStringList::Iterator it = langs.begin(); it != langs.end(); ++it ) { + if (cb_language->contains(*it)) { + lang = *it; + break; + } + } + + cb_language->setCurrentItem(lang); + setLanguageChanged(); +} + +void KCountryPage::setLanguageChanged() { + // is the selcted language the same like the one in kdeglobals from before the start? + b_savedLanguageChanged = (flang->getOldLang() != cb_language->current().lower()); + // is the selected language the same like the one we started kp with from main.cpp? + b_startedLanguageChanged = (s_oldlocale != cb_language->current()); +} + + +#include "kcountrypage.moc" diff --git a/kpersonalizer/kcountrypage.h b/kpersonalizer/kcountrypage.h new file mode 100644 index 000000000..758decbb3 --- /dev/null +++ b/kpersonalizer/kcountrypage.h @@ -0,0 +1,57 @@ +/*************************************************************************** + kcountrypage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KCOUNTRYPAGE_H +#define KCOUNTRYPAGE_H + +#include "kcountrypagedlg.h" + +class TQStringList; +class KLanguageButton; +class KFindLanguage; + +/**Abstract class for the first wizard page. Sets the according selection on save() + *@author Ralf Nolden + */ + +class KCountryPage : public KCountryPageDlg { + Q_OBJECT +public: + KCountryPage(TQWidget *parent=0, const char *name=0); + ~KCountryPage(); + + void loadCountryList(KLanguageButton *combo); + void fillLanguageMenu(KLanguageButton *combo); + /** No descriptions */ + bool save(KLanguageButton *comboCountry, KLanguageButton *comboLang); + + /** we need this to decide, if we need to restart kp */ + bool b_savedLanguageChanged; + bool b_startedLanguageChanged; + +private: + TQStringList langs; + TQString s_oldlocale; + KFindLanguage *flang; + +private slots: // Private slots + void setLangForCountry(const TQString &); + void setLanguageChanged(); + +}; + +#endif diff --git a/kpersonalizer/kcountrypagedlg.ui b/kpersonalizer/kcountrypagedlg.ui new file mode 100644 index 000000000..ddab51247 --- /dev/null +++ b/kpersonalizer/kcountrypagedlg.ui @@ -0,0 +1,242 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KCountryPageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KCountryPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>678</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLayoutWidget" row="6" column="1"> + <property name="name"> + <cstring>Layout6</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLanguageButton"> + <property name="name"> + <cstring>cb_language</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6_2_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + </spacer> + </hbox> + </widget> + <widget class="TQLabel" row="5" column="1"> + <property name="name"> + <cstring>TextLabel10_2</cstring> + </property> + <property name="text"> + <string>Please choose your language:</string> + </property> + </widget> + <widget class="TQLabel" row="1" column="1"> + <property name="name"> + <cstring>TextLabel6</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><p>This Personalizer will help you configure the basic setup of your Trinity desktop in five quick, easy steps. You can set things like your country (for date and time formats, etc.), language, desktop behavior and more.</p> +<p>You will be able to change all the settings later using the Trinity Control Center. You may choose to postpone your personalization until later by clicking on <b>Skip Wizard</b>. Any changes made so far, will then be reversed, except for the country and language settings. However, new users are encouraged to use this simple method.</p> +<p>If you already like your Trinity configuration and wish to quit the Wizard, click <b>Skip Wizard</b>, then <b>Quit</b>.</p></string> + </property> + <property name="textFormat"> + <enum>RichText</enum> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + <property name="vAlign" stdset="0"> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>txt_welcome</cstring> + </property> + <property name="text"> + <string><h3>Welcome to Trinity %VERSION%!</h3></string> + </property> + </widget> + <widget class="TQLayoutWidget" row="4" column="1"> + <property name="name"> + <cstring>Layout6_2</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="KLanguageButton"> + <property name="name"> + <cstring>cb_country</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>150</width> + <height>0</height> + </size> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer6_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Preferred</enum> + </property> + </spacer> + </hbox> + </widget> + <widget class="TQLabel" row="3" column="1"> + <property name="name"> + <cstring>TextLabel10</cstring> + </property> + <property name="text"> + <string>Please choose your country:</string> + </property> + </widget> + <widget class="TQLabel" row="0" column="0" rowspan="9" colspan="1"> + <property name="name"> + <cstring>px_introSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <spacer row="2" column="1"> + <property name="name"> + <cstring>Spacer6</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>30</height> + </size> + </property> + </spacer> + <spacer row="7" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>KLanguageButton</class> + <header location="local">klanguagebutton.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>1</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + <signal>activated(int)</signal> + <signal>highlighted(int)</signal> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="646">789c6dd2c10ac2300c00d07bbf2234b7229d1be245fc04c5a3201e4615f430059d0711ff5ddb2e6bb236ec90eed134cb5a19d8ef36602af5ecdbfeeac05dda0798d3abebde87e3faa374d3807fa0d633a52d38d8de6f679fe33fc776e196f53cd010188256a3600a292882096246517815ca99884606e18044a3a40d91824820924265a7923a2e8bcd05f33db1173e002913175f2a6be6d3294871a2d95fa00e8a94ee017b69d339d90df1e77c57ea072ede6758</data> + </image> +</images> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/keyecandypage.cpp b/kpersonalizer/keyecandypage.cpp new file mode 100644 index 000000000..fb0f446d7 --- /dev/null +++ b/kpersonalizer/keyecandypage.cpp @@ -0,0 +1,855 @@ +/*************************************************************************** + keyecandypage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include <tqpushbutton.h> +#include <tqbuttongroup.h> +#include <tqlabel.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqslider.h> +#include <tqcolor.h> +#include <tqsettings.h> +#include <tqfont.h> + +#include <ksimpleconfig.h> +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <tdelocale.h> +#include <dcopclient.h> +#include <kipc.h> +#include <tdeapplication.h> +#include <tdelistview.h> +#include <krun.h> +#include <tdemessagebox.h> +#include <kiconloader.h> +#include <ktrader.h> +#include <tdeglobalsettings.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "ksysinfo.h" +#include "keyecandypage.h" + +#define DEFAULT_WALLPAPER "Trinity-lineart.svg" + +KEyeCandyPage::KEyeCandyPage(TQWidget *parent, const char *name ) : KEyeCandyPageDlg(parent,name) { + + twinconf = new TDEConfig("twinrc", false, true); + twineventconf = new TDEConfig("twin.eventsrc", false, false); + kickerconf = new TDEConfig("kickerrc",false, false); + konquerorconf = new TDEConfig("konquerorrc",false, false); + konqiconconf = new TDEConfig("konqiconviewrc",false,false); + kdesktopconf = new TDEConfig("kdesktoprc", false, false); + + sys = new KSysInfo(); + + prevImage=false; + prevText=false; + prevOther=false; + + osStyle=""; + + px_eyecandySidebar->setPixmap(UserIcon("step3.png")); + + klv_features->addColumn(i18n("Features")); + klv_features->setFullWidth (true); + + // Level 1 + desktop_wallpaper = new TQCheckListItem(klv_features, i18n("Desktop Wallpaper"), + TQCheckListItem::CheckBox); + desktop_window_effects= new TQCheckListItem(klv_features, i18n("Window Moving/Resizing Effects"), + TQCheckListItem::CheckBox); + desktop_window_moving_contents= new TQCheckListItem(klv_features, i18n("Display Contents in Moving/Resizing Windows"), + TQCheckListItem::CheckBox); + // Level 2 + backgrounds_konqueror= new TQCheckListItem(klv_features, i18n("File Manager Background Picture"), + TQCheckListItem::CheckBox); + backgrounds_panel= new TQCheckListItem(klv_features, i18n("Panel Background Picture"), + TQCheckListItem::CheckBox); + // Level 3 + icon_zooming_panel = new TQCheckListItem(klv_features, i18n("Panel Icon Popups"), + TQCheckListItem::CheckBox); + icon_effect_gamma = new TQCheckListItem(klv_features, i18n("Icon Highlighting"), + TQCheckListItem::CheckBox); + icon_mng_animation = new TQCheckListItem(klv_features, i18n("File Manager Icon Animation"), + TQCheckListItem::CheckBox); + + sound_scheme = new TQCheckListItem(klv_features, i18n("Sound Theme"), + TQCheckListItem::CheckBox); + + // Level 4 + /////////////////////////////////////////////////////////////////////////////////// + /// DEPENDEND ON RESOLUTION; DEFAULT: DON`T USE IN LEVELS + icon_effect_size_desktop = new TQCheckListItem(klv_features, i18n("Large Desktop Icons"), + TQCheckListItem::CheckBox); + icon_effect_size_panel = new TQCheckListItem(klv_features, i18n("Large Panel Icons"), + TQCheckListItem::CheckBox); + /// DEPENDEND ON RESOLUTION; DEFAULT: DON`T USE IN LEVELS + /////////////////////////////////////////////////////////////////////////////////// + antialiasing_fonts = new TQCheckListItem(klv_features, i18n("Smoothed Fonts " + "(Antialiasing)"), TQCheckListItem::CheckBox); + + // Level 5 + preview_images = new TQCheckListItem(klv_features, i18n("Preview Images"), + TQCheckListItem::CheckBox); + pushbutton_icons = new TQCheckListItem(klv_features, i18n("Icons on Buttons"), + TQCheckListItem::CheckBox); + + // Level 6 + animated_combo = new TQCheckListItem(klv_features, i18n("Animated Combo Boxes"), + TQCheckListItem::CheckBox); + + // Level 7 + fading_tooltips = new TQCheckListItem(klv_features, i18n("Fading Tooltips"), TQCheckListItem::CheckBox); + + // Level 8 + preview_text = new TQCheckListItem(klv_features, i18n("Preview Text Files"), + TQCheckListItem::CheckBox); + // Level 9 + fading_menus= new TQCheckListItem(klv_features, i18n("Fading Menus"), + TQCheckListItem::CheckBox); + preview_other = new TQCheckListItem(klv_features, i18n("Preview Other Files"), + TQCheckListItem::CheckBox); + + getUserDefaults(); // get user's current settings + setDefaults(); // set the initial level on the slider and checkboxes +} + +KEyeCandyPage::~KEyeCandyPage(){ + delete twinconf; + delete twineventconf; + delete kickerconf; + delete konquerorconf; + delete konqiconconf; + delete kdesktopconf; + delete sys; +} + +/** enables/disables the QCheckListItems in the klv_features +according to the level the slider moved. */ +void KEyeCandyPage::slotEyeCandySliderMoved(int value){ + // Level 1 + desktop_wallpaper->setOn(false); + desktop_window_effects->setOn(false); + desktop_window_moving_contents->setOn(false); + // Level 2 + backgrounds_konqueror->setOn(false); + backgrounds_panel->setOn(false); + // Level 3 + icon_effect_gamma->setOn(false); + icon_zooming_panel->setOn(false); + icon_mng_animation->setOn(false); + // Level 4 + icon_effect_size_desktop->setOn(false); + icon_effect_size_panel->setOn(false); + antialiasing_fonts->setOn(false); + // Level 5 + preview_images->setOn(false); + // Level 6 + animated_combo->setOn(false); + // Level 7 + fading_tooltips->setOn(false); + // Level 8 + preview_text->setOn(false); + // Level 9 + fading_menus->setOn(false); + preview_other->setOn(false); + sound_scheme->setOn(false); + pushbutton_icons->setOn(false); + + if( value >= 1){ + // Level 1 + desktop_wallpaper->setOn(true); + desktop_window_effects->setOn(true); + desktop_window_moving_contents->setOn(true); + } + if( value >= 2){ + // Level 2 + backgrounds_konqueror->setOn(true); + backgrounds_panel->setOn(true); + } + if( value >= 3){ + // Level 3 + icon_effect_gamma->setOn(true); + if(!(sys->isXfromXFreeInc() && sys->getXRelease()==40100000) ) + icon_zooming_panel->setOn(true); + } + if( value >= 4){ + // Level 4 + icon_mng_animation->setOn(true); + if(osStyle=="mac" || osStyle=="CDE"){ + for (int i = 0; i < TQApplication::desktop()->numScreens(); i++) { + if(TQApplication::desktop()->screenGeometry(i).width() >= 1024) + icon_effect_size_desktop->setOn(true); // enable 48x48 icons by default if a screen size is wider than 1024 + if(TQApplication::desktop()->screenGeometry(i).width() >= 1280) + icon_effect_size_panel->setOn(true); + } + } + antialiasing_fonts->setOn(true); + } + if( value >= 5){ + // Level 5 + preview_images->setOn(true); + } + if( value >= 6){ + // Level 6 + animated_combo->setOn(true); + } + if( value >= 7){ + // Level 7 + fading_tooltips->setOn(true); + fading_menus->setOn(true); + } + if( value >= 8){ + // Level 8 + preview_text->setOn(true); + // icon-size (now for all selections) + for (int i = 0; i < TQApplication::desktop()->numScreens(); i++) { + if(TQApplication::desktop()->screenGeometry(i).width() >= 1024) + icon_effect_size_desktop->setOn(true); + if(TQApplication::desktop()->screenGeometry(i).width() >= 1280) + icon_effect_size_panel->setOn(true); + } + } + if( value >= 9){ + // Level 9 + preview_other->setOn(true); + sound_scheme->setOn(true); + pushbutton_icons->setOn(true); + } +} + + +//---------------------------DESKTOP-------------------------------------------------- +/** This should be self-explanatory, enabling/disabling the default desktop wallpaper. Level 0 disables, +Level 1 enables this (and all levels above). */ +void KEyeCandyPage::enableDesktopWallpaper(bool enable, bool user){ + kdesktopconf->setGroup("Desktop0"); + + if( st_UserWallpaper.WallpaperMode == "NoWallpaper") + deskbgimage=DEFAULT_WALLPAPER; + + if(enable && !user){ + // if the user has a different mode than the default of NoMulti, we don't change anyting on that. + if( st_UserWallpaper.MultiWallpaperMode == "NoMulti" ) + kdesktopconf->writeEntry("MultiWallpaperMode", "NoMulti"); + // if the wallpaper is the new default one, set mode to scaled to leave user settings untouched + if( deskbgimage == DEFAULT_WALLPAPER){ + kdesktopconf->writeEntry("WallpaperMode", "Scaled"); + //here we change the kdesktop font color to white as it fits better + // to the KDE34png.png gray background + kdesktopconf->setGroup("FMSettings"); + kdesktopconf->writeEntry("NormalTextColor", TQColor("#FFFFFF") ); + kdesktopconf->setGroup("Desktop0"); + } + else{ + kdesktopconf->writeEntry("WallpaperMode", st_UserWallpaper.WallpaperMode ); + } + // write the bg image name, this is the user's image if he already set that on desktop0 + kdesktopconf->writePathEntry("Wallpaper", deskbgimage); + kdesktopconf->setGroup("Background Common"); + // when the user set his desktop to *not* use common desktop and no wallpaper = he can have set + // different color schemes for his desktops, we set the common desktop again to set the new + // default wallpaper on *all* desktops. + if(!st_UserWallpaper.CommonDesktop && (st_UserWallpaper.WallpaperMode == "NoWallpaper") ) + kdesktopconf->writeEntry("CommonDesktop", true); + // the user set his desktop *not* to use common desktop, but *has* set a wallpaper = multiple + // desktops with different wallpapers. + if(!st_UserWallpaper.CommonDesktop && (!(st_UserWallpaper.WallpaperMode == "NoWallpaper")) ) + kdesktopconf->writeEntry("CommonDesktop", false); + } + else{ + kdesktopconf->setGroup("Desktop0"); + kdesktopconf->writeEntry("WallpaperMode", "NoWallpaper"); + kdesktopconf->setGroup("FMSettings"); + kdesktopconf->writeEntry("NormalTextColor", desktopTextColor); //restore the user's color + kdesktopconf->setGroup("Background Common"); + // only set this to the user's setting. the default is true anyway + if(st_UserWallpaper.WallpaperMode == "NoWallpaper") + kdesktopconf->writeEntry("CommonDesktop", st_UserWallpaper.CommonDesktop); + else + kdesktopconf->writeEntry("CommonDesktop", true); + } + if(user){ + // reset everything + kdesktopconf->setGroup("Desktop0"); + kdesktopconf->writeEntry("MultiWallpaperMode", st_UserWallpaper.MultiWallpaperMode); + kdesktopconf->writeEntry("WallpaperMode", st_UserWallpaper.WallpaperMode); + kdesktopconf->writePathEntry("Wallpaper", st_UserWallpaper.Wallpaper); + kdesktopconf->setGroup("Background Common"); + kdesktopconf->writeEntry("CommonDesktop", st_UserWallpaper.CommonDesktop); + kdesktopconf->setGroup("FMSettings"); + kdesktopconf->writeEntry("NormalTextColor", desktopTextColor); //restore the user's color + } +} + +/** this function enables/disables the window effects for Shading, Minimize and Restore. The contents in moving/resized windows is set in enableWindowContens(bool ) */ +void KEyeCandyPage::enableDesktopWindowEffects(bool enable,bool restore){ +// see /tdebase/kcontrol/kwm module, KAdvancedConfig class. Used are: +// -Animate minimize and restore +// -Animate shade +// -Enable Hover +//-Enable move/resize on maximised windows + twinconf->setGroup( "Windows" ); + if(!restore){ + twinconf->writeEntry("AnimateMinimize", enable ); + twinconf->writeEntry("AnimateShade", enable ); + twinconf->writeEntry("MoveResizeMaximizedWindows",enable); + twinconf->writeEntry("ShadeHover", enable ); + } else { + twinconf->writeEntry("AnimateMinimize", b_AnimateMinimize ); + twinconf->writeEntry("AnimateShade", b_AnimateShade ); + twinconf->writeEntry("MoveResizeMaximizedWindows",b_MoveResizeMaximizedWindows); + twinconf->writeEntry("ShadeHover", b_ShadeHover); + } +} + +/** enable/disable window moving with contents shown */ +void KEyeCandyPage::enableDesktopWindowMovingContents(bool enable, bool restore){ +// see /tdebase/kcontrol/kwm module, KAdvancedConfig class. Used are: +// -Display content in moving window +// -Display content in resizing window +// And TDEGlobalSettings::opaqueResize() for QSplitters + + twinconf->setGroup( "Windows" ); + TDEGlobal::config()->setGroup("KDE"); + if (enable){ + twinconf->writeEntry("ResizeMode","Opaque"); + twinconf->writeEntry("MoveMode","Opaque"); + TDEGlobal::config()->writeEntry("OpaqueResize", true, true, true); + } else { + twinconf->writeEntry("ResizeMode","Transparent"); + twinconf->writeEntry("MoveMode","Transparent"); + TDEGlobal::config()->writeEntry("OpaqueResize", false, true, true); + } + if(restore){ + twinconf->writeEntry("ResizeMode",s_ResizeMode); + twinconf->writeEntry("MoveMode",s_MoveMode); + TDEGlobal::config()->writeEntry("OpaqueResize", b_OpaqueResize, true, true); + } +} + +//---------------------------DESKTOP-------------------------------------------------- + +//---------------------------BACKGROUNDS-------------------------------------------------- +/** Here, the background tiles/wallpapers for Konqueror and Kicker are set to the default values. Enabled in Level 2. */ +void KEyeCandyPage::enableBackgroundsPanel(bool enable){ + kickerconf->setGroup("General"); + kickerconf->writeEntry("UseBackgroundTheme", enable); +} + +/** Here, the background tiles/wallpapers for Konqueror and Kicker are set to the default values. Enabled in Level 2. */ +void KEyeCandyPage::enableBackgroundsKonqueror(bool enable){ + konquerorconf->setGroup("Settings"); + if(enable){ + if(konqbgimage.isEmpty()) + konqbgimage="noise.png"; + konquerorconf->writePathEntry("BgImage", konqbgimage); + } else + konquerorconf->writePathEntry("BgImage", TQString::null); +} +//----------------------------BACKGROUNDS------------------------------------------------- + + +//----------------------------ICON STUFF------------------------------------------------- + +/** Level 0-2 disable this, Level 3 and above enable this. */ +void KEyeCandyPage::enableIconZoomingPanel(bool enable){ + // Kicker Icon zooming feature. See /tdebase/kcontrol/kicker, LookAndFeelTab + kickerconf->setGroup("buttons"); + kickerconf->writeEntry("EnableIconZoom", enable); +} + +/** enable Icon highlighting, Level 3 */ +void KEyeCandyPage::enableIconEffectGamma(bool enable, bool user){ + if(enable){ + TDEGlobal::config()->setGroup("DesktopIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", "togamma", true, true); + TDEGlobal::config()->writeEntry("ActiveValue", "0.7", true, true); + TDEGlobal::config()->setGroup("PanelIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", "togamma", true, true); + TDEGlobal::config()->writeEntry("ActiveValue", "0.7", true, true); + } else { + if(user){ + TDEGlobal::config()->setGroup("DesktopIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", st_UserGamma.EffectDesktop, true, true); + TDEGlobal::config()->writeEntry("ActiveValue", st_UserGamma.ValueDesktop, true, true); + TDEGlobal::config()->setGroup("PanelIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", st_UserGamma.EffectPanel, true, true); + TDEGlobal::config()->writeEntry("ActiveValue", st_UserGamma.ValuePanel, true, true); + } else { + TDEGlobal::config()->setGroup("DesktopIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", "none", true, true); + TDEGlobal::config()->setGroup("PanelIcons"); + TDEGlobal::config()->writeEntry("ActiveEffect", "none", true, true); + } + } +} + +void KEyeCandyPage::enableIconMngAnimation(bool enable) { + TDEGlobal::config()->setGroup("DesktopIcons"); + TDEGlobal::config()->writeEntry("Animated", enable, true, true); +} + +/** No descriptions */ +void KEyeCandyPage::enableIconEffectSizePanel(bool enable){ + TQByteArray data; + TQDataStream stream( data, IO_WriteOnly ); + + if(enable) + stream << 56; + else + stream << panelsize; + + kapp->dcopClient()->send( "kicker", "Panel", "setPanelSize(int)",data); +} + +/** No descriptions */ +void KEyeCandyPage::enableIconEffectSizeDesktop(bool enable){ + TDEGlobal::config()->setGroup("DesktopIcons"); + if( enable ) { // use 48x48 icons + TDEGlobal::config()->writeEntry("Size", 48, true, true); + } else { + TDEGlobal::config()->writeEntry("Size", desktopiconsize, true, true); + } +} +//----------------------------ICON STUFF------------------------------------------------- + + +//----------------------------STYLE EFFECTS------------------------------------------------- + +/** Enable fading tooltips in Level 7 */ +void KEyeCandyPage::enableFadingToolTips(bool enable){ + TDEGlobal::config()->setGroup("KDE"); + TDEGlobal::config()->writeEntry( "EffectFadeTooltip", enable, true, true); +} + +/** enables/disables fading menus which are off by default in KDE. Enable this in Level 9 */ +void KEyeCandyPage::enableFadingMenus(bool enable){ + TDEGlobal::config()->setGroup("KDE"); + TDEGlobal::config()->writeEntry("EffectFadeMenu", enable,true, true); +} + +/** enables/disables icons on pushbuttons, which are off by default in KDE. Enable this in Level 5 */ +void KEyeCandyPage::enablePushButtonIcons(bool enable){ + TDEGlobal::config()->setGroup("KDE"); + TDEGlobal::config()->writeEntry("ShowIconsOnPushButtons", enable,true, true); +} + +/** Enable animated combo boxes, see styles kcontrol module. Enable in Level 6 (disabled by default anyway, so doesn't need to be +disabled in levels below 4) */ +void KEyeCandyPage::enableAnimatedCombo(bool enable){ + TDEGlobal::config()->setGroup("KDE"); + TDEGlobal::config()->writeEntry("EffectAnimateCombo", enable, true, true); +} + +/** generally enable/disable style-Effects, depending on if one of the three is enabled. */ +void KEyeCandyPage::enableEffects(bool enable){ + TDEGlobal::config()->setGroup("KDE"); + TDEGlobal::config()->writeEntry("EffectsEnabled", enable, true, true); +} +//----------------------------STYLE EFFECTS------------------------------------------------- + + +//----------------------------PREVIEWS------------------------------------------------- +/** enables desktop/konqueror image previews, level 5 */ +void KEyeCandyPage::enablePreviewImages(bool enable){ + prevImage=enable; +} + +/** enables text preview in konq/kdesktop. Enable in Level 8 */ +void KEyeCandyPage::enablePreviewText(bool enable){ + prevText=enable; +} + +/** enables all other file previews that are available besides text and image preview. Enable in Level 9. */ +void KEyeCandyPage::enablePreviewOther(bool enable){ + prevOther=enable; +} + +/** as the preview entries in the rc files (konqiconviewrc and kdesktoprc) are a string list and +this list would be overwritten by the three different possibilities, we just set bool values +and ask them here, set the according string list here. +kdesktoprc's stringlist holds the preview-types wich are supposed to be shown, while konquiconviewrc's +one holds the types, wich are NOT supposed to be shown. We need to take care of that here, too.*/ +void KEyeCandyPage::enablePreview(bool currSettings){ + TQStringList desktopPreviews; + TQStringList konquerorNoPreviews; + TDETrader::OfferList plugins = TDETrader::self()->query("ThumbCreator"); + for (TDETrader::OfferList::ConstIterator it = plugins.begin(); it != plugins.end(); ++it) { + if(prevOther){ + desktopPreviews.append((*it)->desktopEntryName()); + kdDebug() << "Adding Preview:" << (*it)->desktopEntryName() << endl; + } else { + konquerorNoPreviews.append((*it)->desktopEntryName()); + } + } + if(prevImage) { + desktopPreviews.append("imagethumbnail"); + konquerorNoPreviews.remove("imagethumbnail"); + } + + if(prevText) { + desktopPreviews.append("textthumbnail"); + konquerorNoPreviews.remove("textthumbnail"); + } + + if(prevOther){ // remove text/image if not checked + if(!prevImage) { + desktopPreviews.remove("imagethumbnail"); + konquerorNoPreviews.append("imagethumbnail"); + } + if(!prevText) { + desktopPreviews.remove("textthumbnail"); + konquerorNoPreviews.append("textthumbnail"); + } + } +#if 0 + if(prevOther) + desktopPreviews.append("audio/"); +#endif + kdesktopconf->setGroup("Desktop Icons"); + kdesktopconf->writeEntry("Preview", currSettings ? desktopPreviews : kdesktop_prev); + + konqiconconf->setGroup("Settings"); + if (prevOther || prevImage || prevText) { + konqiconconf->writeEntry("DontPreview", currSettings ? konquerorNoPreviews : konq_dont_prev); + konqiconconf->writeEntry("PreviewsEnabled", currSettings ? true : b_konq_prev_enable); + } else { + if(!currSettings) + konqiconconf->writeEntry("DontPreview", konq_dont_prev); + konqiconconf->writeEntry("PreviewsEnabled", currSettings ? false : b_konq_prev_enable); + } +#if 0 + if(prevOther) + konqiconconf->writeEntry("EnableSoundPreviews", currSettings ? true : b_konq_prev_sound); +#endif +} +//----------------------------PREVIEWS------------------------------------------------- + + + +//----------------------------OTHER STUFF------------------------------------------------- +/** Enables the default KDE sound scheme in Level 3 */ +void KEyeCandyPage::enableSoundScheme(bool enable, bool user) { + twineventconf->setGroup("desktop1"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop1 : 0) ); + twineventconf->setGroup("desktop2"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop2 : 0) ); + twineventconf->setGroup("desktop3"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop3 : 0) ); + twineventconf->setGroup("desktop4"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop4 : 0) ); + twineventconf->setGroup("desktop5"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop5 : 0) ); + twineventconf->setGroup("desktop6"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop6 : 0) ); + twineventconf->setGroup("desktop7"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop7 : 0) ); + twineventconf->setGroup("desktop8"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.desktop8 : 0) ); + + twineventconf->setGroup("new"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.notold : 0) ); + twineventconf->setGroup("close"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.close : 0) ); + + twineventconf->setGroup("transnew"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.transnew : 0) ); + twineventconf->setGroup("transdelete"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.transdelete : 0) ); + + twineventconf->setGroup("iconify"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.iconify : 0) ); + twineventconf->setGroup("deiconify"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.deiconify : 0) ); + twineventconf->setGroup("maximize"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.maximize : 0) ); + twineventconf->setGroup("unmaximize"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.unmaximize : 0) ); + twineventconf->setGroup("shadeup"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.shadeup : 0) ); + twineventconf->setGroup("shadedown"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.shadedown : 0) ); + twineventconf->setGroup("sticky"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.sticky : 0) ); + twineventconf->setGroup("unsticky"); + twineventconf->writeEntry("presentation", enable ? 1 : (user ? st_UserSnd.unsticky : 0) ); +} + +/** Enable Antialiased fonts. Enable in Level 7. */ +void KEyeCandyPage::enableAntialiasingFonts(bool enable, bool reset){ + if (!reset){ + if ( ( (sys->isXfromXFreeInc() && (sys->getXRelease() > 40000000)) || sys->isXfromXOrg() ) + && sys->getRenderSupport()) { + TQSettings().writeEntry("/qt/useXft", enable); + TQSettings().writeEntry("/qt/enableXft", enable); + } + } else { + TQSettings().writeEntry("/qt/useXft", b_useXft); + TQSettings().writeEntry("/qt/enableXft", b_enableXft); + } +} +//----------------------------OTHER STUFF------------------------------------------------- + + +/** save function to enable/disable the according settings that are made in the + QCheckListItems of the Eyecandy page. */ +void KEyeCandyPage::save(bool currSettings){ + kdDebug() << "KEyeCandyPage::save()" << endl; + // currSettings==true: save selections. currSettings==false: save user-def. + saveCheckState(currSettings); + // save all the TDEConfig-objects to their respective files + twinconf->sync(); + twineventconf->sync(); + konquerorconf->sync(); + konqiconconf->sync(); + kickerconf->sync(); + kdesktopconf->sync(); + TDEGlobal::config()->sync(); + // restart twin for window effects + kapp->dcopClient()->send("knotify", "Notify", "reconfigure()", TQString("")); + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + // set the display options (style effects) + KIPC::sendMessageAll(KIPC::SettingsChanged); + TQApplication::syncX(); + // kicker stuff: Iconzooming etc. + kapp->dcopClient()->send( "kicker", "Panel", "configure()", TQString("") ); + // Icon stuff + for (int i=0; i<TDEIcon::LastGroup; i++) { + KIPC::sendMessageAll(KIPC::IconChanged, i); + } + // font stuff + KIPC::sendMessageAll(KIPC::FontChanged); + // unfortunately, the konqiconview does not re-read the configuration to restructure the previews and the background picture + kapp->dcopClient()->send( "konqueror*", "KonquerorIface", "reparseConfiguration()", TQString("") ); + kapp->dcopClient()->send( "kdesktop", "KDesktopIface", "configure()", TQString("") ); + kapp->dcopClient()->send( "kdesktop", "KBackgroundIface", "configure()", TQString("") ); + kapp->dcopClient()->send( "kdesktop", "KDesktopIface", "lineupIcons()", TQString("") ); +} + +void KEyeCandyPage::slotEyeCandyShowDetails(bool details){ + if(details){ + klv_features->show(); + } else { + klv_features->hide(); + } +} + +/** sets the slider to the value, we think of as sane for this machine */ +void KEyeCandyPage::setDefaults(){ + int speed = sys->getCpuSpeed(); + int level = 4; + if(speed){ +// Enable those higher settings, when we solved the problem with checking, if AA can be done + if (sys->getRenderSupport()){ + if (speed > 450) level = 7; + else if (speed > 400) level = 6; + else if (speed > 350) level = 5; + } else { + if (speed > 300) level = 4; + else if (speed > 250) level = 3; + else if (speed > 200) level = 2; + else level = 1; + } + } + // apply the chosen level (this call emits also the moved-signal) + sld_effects->setValue(level); +} + +/** retrieves the user's local values. In case he doesn't have these set, use the default values of KDE, level 4. */ +void KEyeCandyPage::getUserDefaults(){ + TQByteArray replydata; + TQByteArray data; + TQCString replytype; + kapp->dcopClient()->call( "kicker", "Panel", "panelSize()",data, replytype, replydata); + TQDataStream stream( replydata, IO_ReadOnly ); + stream >> panelsize; + + // Wallpaper-User-Defaults + kdesktopconf->setGroup("FMSettings"); + TQColor tempcolor=TDEGlobalSettings::textColor(); + desktopTextColor = kdesktopconf->readColorEntry("NormalTextColor", &tempcolor ); + kdesktopconf->setGroup("Background Common"); + st_UserWallpaper.CommonDesktop = kdesktopconf->readBoolEntry("CommonDesktop", true); + kdesktopconf->setGroup("Desktop0"); // we only need to set one desktop + st_UserWallpaper.MultiWallpaperMode = kdesktopconf->readEntry("MultiWallpaperMode", "NoMulti"); + st_UserWallpaper.WallpaperMode = kdesktopconf->readEntry("WallpaperMode", "Scaled"); + st_UserWallpaper.Wallpaper = kdesktopconf->readPathEntry("Wallpaper", "NoWallpaper"); + deskbgimage = kdesktopconf->readPathEntry("Wallpaper", DEFAULT_WALLPAPER); + // Wallpaper-User-Defaults (END) + + TDEGlobal::config()->setGroup("KDE"); + + // Font-User-Defaults + b_useXft=TQSettings().readBoolEntry("/qt/useXft"); + b_enableXft=TQSettings().readBoolEntry("/qt/enableXft"); + + TDEGlobal::config()->setGroup("PanelIcons"); + st_UserGamma.EffectPanel=TDEGlobal::config()->readEntry("ActiveEffect", "none"); + st_UserGamma.ValuePanel=TDEGlobal::config()->readEntry("ActiveValue", "0.7"); + + TDEGlobal::config()->setGroup("DesktopIcons"); + st_UserGamma.EffectDesktop=TDEGlobal::config()->readEntry("ActiveEffect", "none"); + st_UserGamma.ValueDesktop=TDEGlobal::config()->readEntry("ActiveValue", "0.7"); + desktopiconsize=TDEGlobal::config()->readNumEntry("Size", 32); + b_iconMngAnim = TDEGlobal::config()->readBoolEntry( "Animated", true ); + + TDEGlobal::config()->setGroup("KDE"); + b_EffectFadeTooltip=TDEGlobal::config()->readBoolEntry( "EffectFadeTooltip", false ); + b_PushButtonIcons=TDEGlobal::config()->readBoolEntry("ShowIconsOnPushButtons", false); + b_EffectFadeMenu=TDEGlobal::config()->readBoolEntry("EffectFadeMenu", false); + b_EffectAnimateCombo=TDEGlobal::config()->readBoolEntry("EffectAnimateCombo", false); + b_EffectsEnabled=TDEGlobal::config()->readBoolEntry("EffectsEnabled", false); + b_OpaqueResize=TDEGlobal::config()->readBoolEntry("OpaqueResize", true); + + kickerconf->setGroup("buttons"); + b_EnableIconZoom=kickerconf->readBoolEntry("EnableIconZoom", true); + + konquerorconf->setGroup("Settings"); + konqbgimage=konquerorconf->readPathEntry("BgImage", ""); + + kdesktopconf->setGroup("Desktop Icons"); + kdesktop_prev=kdesktopconf->readListEntry("Preview"); + konqiconconf->setGroup("Settings"); + konq_dont_prev=konqiconconf->readListEntry("DontPreview"); + b_konq_prev_sound=konqiconconf->readBoolEntry("EnableSoundPreviews", false); + b_konq_prev_enable=konqiconconf->readBoolEntry("PreviewsEnabled", true); + twinconf->setGroup( "Windows" ); + s_ResizeMode=twinconf->readEntry("ResizeMode", "Transparent"); + s_MoveMode=twinconf->readEntry("MoveMode", "Opaque"); + + b_AnimateMinimize=twinconf->readBoolEntry("AnimateMinimize", true ); + b_AnimateShade=twinconf->readBoolEntry("AnimateShade", true ); + b_MoveResizeMaximizedWindows=twinconf->readBoolEntry("MoveResizeMaximizedWindows",true); + b_ShadeHover = twinconf->readBoolEntry("ShadeHover", false); + + getUserSoundScheme(); +} + +/** gets the users sound-settings */ +void KEyeCandyPage::getUserSoundScheme() { + twineventconf->setGroup("desktop1"); + st_UserSnd.desktop1 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop2"); + st_UserSnd.desktop2 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop3"); + st_UserSnd.desktop3 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop4"); + st_UserSnd.desktop4 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop5"); + st_UserSnd.desktop5 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop6"); + st_UserSnd.desktop6 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop7"); + st_UserSnd.desktop7 = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("desktop8"); + st_UserSnd.desktop8 = twineventconf->readNumEntry("presentation", 0); + + twineventconf->setGroup("new"); + st_UserSnd.notold = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("close"); + st_UserSnd.close = twineventconf->readNumEntry("presentation", 0); + + twineventconf->setGroup("transnew"); + st_UserSnd.transnew = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("transdelete"); + st_UserSnd.transdelete = twineventconf->readNumEntry("presentation", 0); + + twineventconf->setGroup("iconify"); + st_UserSnd.iconify = twineventconf->readNumEntry("presentation", 0 ); + twineventconf->setGroup("deiconify"); + st_UserSnd.deiconify = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("maximize"); + st_UserSnd.maximize = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("unmaximize"); + st_UserSnd.unmaximize = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("shadeup"); + st_UserSnd.shadeup = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("shadedown"); + st_UserSnd.shadedown = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("sticky"); + st_UserSnd.sticky = twineventconf->readNumEntry("presentation", 0); + twineventconf->setGroup("unsticky"); + st_UserSnd.unsticky = twineventconf->readNumEntry("presentation", 0); +} + +/** calls all enable functions with the state of the checkboxes. This is needed for save() only, +as in case the user quits, we have to set these states again in saveUserDefaults to what they were +prior to running kpersonalizer */ +void KEyeCandyPage::saveCheckState(bool currSettings){ // currSettings= true -> take the checkboxes, otherwise take user values set + if(currSettings){ + enableDesktopWallpaper(desktop_wallpaper->isOn()); + enableDesktopWindowEffects(desktop_window_effects->isOn(), false); + enableDesktopWindowMovingContents(desktop_window_moving_contents->isOn(), false); + + enableBackgroundsPanel(backgrounds_panel->isOn()); + enableBackgroundsKonqueror(backgrounds_konqueror->isOn()); + + enableIconZoomingPanel(icon_zooming_panel->isOn()); + enableIconEffectGamma(icon_effect_gamma->isOn(), false); + enableIconEffectSizePanel(icon_effect_size_panel->isOn()); + enableIconEffectSizeDesktop(icon_effect_size_desktop->isOn()); + enableIconMngAnimation(icon_mng_animation->isOn()); + + enableFadingToolTips(fading_tooltips->isOn()); + enableFadingMenus(fading_menus->isOn()); + enableAnimatedCombo(animated_combo->isOn()); + enableEffects( (fading_tooltips->isOn() || fading_menus->isOn() || animated_combo->isOn()) ); + + enablePushButtonIcons(pushbutton_icons->isOn()); + + enablePreviewImages(preview_images->isOn()); + enablePreviewText(preview_text->isOn()); + enablePreviewOther(preview_other->isOn()); + enablePreview(true); + + enableSoundScheme(sound_scheme->isOn(), false); + + enableAntialiasingFonts(antialiasing_fonts->isOn(),false); + } else { // user's settings + // restore functions + enableDesktopWallpaper(false, true); + enableBackgroundsKonqueror(konqbgimage.isEmpty()); // if empty + enableIconZoomingPanel(b_EnableIconZoom); + enableFadingToolTips(b_EffectFadeTooltip); + enableFadingMenus(b_EffectFadeMenu); + enableAnimatedCombo(b_EffectAnimateCombo); + enableEffects(b_EffectsEnabled); + enablePushButtonIcons(b_PushButtonIcons); + enablePreview(false); + enableAntialiasingFonts(b_useXft,true); + enableDesktopWindowMovingContents(false, true); // the first parameter is equal to this call + enableDesktopWindowEffects(false, true); + enableIconEffectSizePanel(false); + enableIconEffectSizeDesktop(false); + enableIconEffectGamma(false, true); + enableIconMngAnimation(b_iconMngAnim); + enableSoundScheme(false, true); + enableBackgroundsPanel(false); + } +} + +/** to be connected to the OS page. changes default values of features according + to the desktop selection*/ +void KEyeCandyPage::slotPresetSlider(const TQString& style){ + osStyle=style; + slotEyeCandySliderMoved( sld_effects-> value()); //apply changes (slider is not moved) +} + +#include "keyecandypage.moc" diff --git a/kpersonalizer/keyecandypage.h b/kpersonalizer/keyecandypage.h new file mode 100644 index 000000000..63889a67c --- /dev/null +++ b/kpersonalizer/keyecandypage.h @@ -0,0 +1,227 @@ +/*************************************************************************** + keyecandypage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KEYECANDYPAGE_H +#define KEYECANDYPAGE_H + +#include "keyecandypagedlg.h" + +class TQCheckListItem; +class TQColor; +class KSysInfo; + +/**Abstract class for the eyecandy page. Applies the accoring eyecandy settings + *@author Ralf Nolden + */ + +class KEyeCandyPage : public KEyeCandyPageDlg { + Q_OBJECT +public: + KEyeCandyPage(TQWidget *parent=0, const char *name=0); + ~KEyeCandyPage(); + +//--------------------------------------------------------------------------------------------------------- + /** This should be self-explanatory, enabling/disabling the default desktop wallpaper. Level 0 disables, + Level 1 enables this (and all levels above). */ + void enableDesktopWallpaper(bool enable, bool user=false); + /** this function enables/disables the window effects for Shading, Minimize and Restore. The contents in moving/resized windows is set in enableWindowContens(bool ) */ + void enableDesktopWindowEffects(bool enable, bool restore= false); + /** enable/disable window moving with contents shown */ + void enableDesktopWindowMovingContents( bool enable,bool restore= false); +//--------------------------------------------------------------------------------------------------------- + + +//--------------------------------------------------------------------------------------------------------- + /** Level 0-2 disable this, Level 3 and above enable this. */ + void enableIconZoomingPanel(bool enable); + /** enable Icon highlighting, Level 3 */ + void enableIconEffectGamma(bool enable, bool user); + /** No descriptions */ + void enableIconEffectSizeDesktop(bool enable); + /** No descriptions */ + void enableIconEffectSizePanel(bool enable); + /** No descriptions */ + void enableIconMngAnimation(bool enable); +//--------------------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------------------- + /** Here, the background tiles/wallpapers for Kicker are set to the default values. Enabled in Level 2. */ + void enableBackgroundsPanel(bool enable); + /** Here, the background tiles/wallpapers for Konqueror are set to the default values. Enabled in Level 2. */ + void enableBackgroundsKonqueror(bool enable); +//--------------------------------------------------------------------------------------------------------- + + +//--------------------------------------------------------------------------------------------------------- + /** enables all other file previews that are available besides text and image preview. Enable in Level 9. */ + void enablePreviewOther(bool enable); + /** enables text preview in konq/kdesktop. Enable in Level 8 */ + void enablePreviewText(bool enable); + /** enables desktop/konqueror image previews, level 5 */ + void enablePreviewImages(bool enable); +//--------------------------------------------------------------------------------------------------------- + + +//--------------------------------------------------------------------------------------------------------- + /** Enable fading tooltips in Level 7 */ + void enableFadingToolTips(bool enable); + /** enables/disables fading menus which are off by default in TDE. Enable this in Level 9 */ + void enableFadingMenus(bool enable); + /** Enable animated combo boxes, see styles kcontrol module. Enable in Level 4 (disabled by default anyway, so doesn't need to be + disabled in levels below 4) */ + void enableAnimatedCombo(bool enable); + /** Enable icons on pushbuttons in level 5 and up */ + void enablePushButtonIcons(bool enable); + /** generally enable/disable style-Effects, depending on if one of the three is enabled. */ + void enableEffects(bool enable); +//--------------------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------------------- + /** Enable Antialiased fonts. Maybe a check if the chard can do this with xdpyinfo | grep RENDER here would bring up if + the user can do this or not. Enable in Level 7. */ + void enableAntialiasingFonts(bool enable, bool reset); + /** Enables the default TDE sound scheme in Level 3 */ + void enableSoundScheme(bool enable, bool user); +//--------------------------------------------------------------------------------------------------------- + + + /** save function to enable/disable the according settings that are made in the QCheckListItems of the + Eyecandy page by default. If currSettings is false, the user's default settings will be restored*/ + void save(bool currSettings=true); + /** sets the slider to the default value of Level 4 (TDE Default) and the checklistboxes on + that belong to this level */ + void setDefaults(); + /** as the preview entries in the rc files (konqiconviewrc and kdesktoprc) are a string list and + this list would be overwritten by the three different possibilities, we just set bool values + and ask them here, set the according string list here. If currSettings is true, take the chosen ones, else take the user's ones*/ + void enablePreview(bool currSettings); + /** calls all enable functions with the state of the checkboxes. This is needed for save() only, + as in case the user quits, we have to set these states again in saveUserDefaults to what they were + prior to running kpersonalizer */ + void saveCheckState(bool currSettings); + /** retrieves the user's local values. In case he doesn't have these set, use the default values of TDE, level 4. */ + void getUserDefaults(); + void getUserSoundScheme(); + +public slots: + /** enables/disables the QCheckListItems in the klv_features + according to the level the slider moved. */ + void slotEyeCandySliderMoved(int value); + /** show the details-box */ + void slotEyeCandyShowDetails(bool details); + /** to be connected to the OS page. changes default values of features according + to the desktop selection*/ + void slotPresetSlider(const TQString& style); + +private: + // DEFAULT VALUES SET BY USER + int panelsize; // kicker panelsize 0,1,2,3 before the big icons are set to reset that + int desktopiconsize; + TQString osStyle; //stores OS-Style selection (page 2) + bool b_EffectFadeMenu, b_EffectAnimateCombo, b_EffectFadeTooltip, b_EnableIconZoom, + b_AnimateMinimize, b_AnimateShade, b_MoveResizeMaximizedWindows, + b_ShadeHover, b_useXft, b_enableXft, b_PushButtonIcons, b_EffectsEnabled, + b_iconMngAnim, b_konq_prev_sound, b_konq_prev_enable, b_OpaqueResize; + + TQString konqbgimage, s_ResizeMode, s_MoveMode, deskbgimage; + TQStringList konq_dont_prev, kdesktop_prev; + TQColor desktopTextColor; + + struct st_Gamma{ + TQString EffectDesktop; + TQString EffectPanel; + TQString ValueDesktop; + TQString ValuePanel; + } st_UserGamma; + + struct st_Wallpaper{ + bool CommonDesktop; + TQString MultiWallpaperMode; + TQString WallpaperMode; + TQString Wallpaper; + } st_UserWallpaper; + + struct st_Sound { + int desktop1; + int desktop2; + int desktop3; + int desktop4; + int desktop5; + int desktop6; + int desktop7; + int desktop8; + int notold; + int close; + int transnew; + int transdelete; + int iconify; + int deiconify; + int maximize; + int unmaximize; + int shadeup; + int shadedown; + int sticky; + int unsticky; + } st_UserSnd; + // DEFAULT VALLUES SET BY USER (END) + + TDEConfig* twinconf; + TDEConfig* twineventconf; + TDEConfig* kickerconf; + TDEConfig* konquerorconf; + TDEConfig* konqiconconf; + TDEConfig* kdesktopconf; + TDEConfig* kdeglobals; + + KSysInfo* sys; + + bool prevImage, prevText, prevOther; + + TQCheckListItem* alpha_blending_desktop; + TQCheckListItem* alpha_blending_panel; + + TQCheckListItem* animated_combo; + + TQCheckListItem* antialiasing_fonts; + + TQCheckListItem* backgrounds_konqueror; + TQCheckListItem* backgrounds_panel; + + TQCheckListItem* desktop_wallpaper; + TQCheckListItem* desktop_window_effects; + TQCheckListItem* desktop_window_moving_contents; + + TQCheckListItem* icon_effect_gamma; + TQCheckListItem* icon_effect_size_desktop; + TQCheckListItem* icon_effect_size_panel; + + TQCheckListItem* icon_zooming_panel; + TQCheckListItem* icon_mng_animation; + + TQCheckListItem* fading_menus; + TQCheckListItem* fading_tooltips; + + TQCheckListItem* pushbutton_icons; + + TQCheckListItem* preview_text; + TQCheckListItem* preview_images; + TQCheckListItem* preview_other; + + TQCheckListItem* sound_scheme; +}; + +#endif diff --git a/kpersonalizer/keyecandypagedlg.ui b/kpersonalizer/keyecandypagedlg.ui new file mode 100644 index 000000000..c6da0a6ac --- /dev/null +++ b/kpersonalizer/keyecandypagedlg.ui @@ -0,0 +1,263 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KEyeCandyPageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KEyeCandyPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>598</width> + <height>475</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="0" rowspan="6" colspan="1"> + <property name="name"> + <cstring>px_eyecandySidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel8</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><P>Trinity offers many visually appealing special effects, such as smoothed fonts, previews in the file manager and animated menus. All this beauty, however, comes at a small performance cost. </P> +If you have a fast, new processor, you might want to turn them all on, but for those of us with slower processors, starting off with less eye candy helps to keep your desktop more responsive.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + <property name="vAlign" stdset="0"> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="TQLayoutWidget" row="1" column="1"> + <property name="name"> + <cstring>Layout8</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel3_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Slow Processor +(fewer effects)</string> + </property> + <property name="textFormat"> + <enum>PlainText</enum> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + <property name="hAlign" stdset="0"> + </property> + <property name="toolTip" stdset="0"> + <string>Slow processors perform poorly with effects</string> + </property> + <property name="vAlign" stdset="0"> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer13</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + <widget class="TQLabel"> + <property name="name"> + <cstring>Fast_2</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Fast Processor +(more effects)</string> + </property> + <property name="alignment"> + <set>AlignCenter</set> + </property> + <property name="hAlign" stdset="0"> + </property> + <property name="toolTip" stdset="0"> + <string>Fast processors can support all effects</string> + </property> + </widget> + </hbox> + </widget> + <widget class="TQSlider" row="2" column="1"> + <property name="name"> + <cstring>sld_effects</cstring> + </property> + <property name="maxValue"> + <number>9</number> + </property> + <property name="pageStep"> + <number>1</number> + </property> + <property name="value"> + <number>4</number> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="tickmarks"> + <enum>Right</enum> + </property> + </widget> + <widget class="TQLayoutWidget" row="3" column="1"> + <property name="name"> + <cstring>Layout7</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQPushButton"> + <property name="name"> + <cstring>btn_detail</cstring> + </property> + <property name="text"> + <string>Show &Details >></string> + </property> + <property name="toggleButton"> + <bool>true</bool> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer12</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + </spacer> + </hbox> + </widget> + <spacer row="4" column="1"> + <property name="name"> + <cstring>spacer_details</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Minimum</enum> + </property> + </spacer> + <widget class="TDEListView" row="5" column="1"> + <property name="name"> + <cstring>klv_features</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>7</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>0</width> + <height>120</height> + </size> + </property> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>btn_detail</sender> + <signal>toggled(bool)</signal> + <receiver>KEyeCandyPageDlg</receiver> + <slot>slotEyeCandyShowDetails(bool)</slot> + </connection> + <connection> + <sender>sld_effects</sender> + <signal>valueChanged(int)</signal> + <receiver>KEyeCandyPageDlg</receiver> + <slot>slotEyeCandySliderMoved(int)</slot> + </connection> + <connection> + <sender>sld_effects</sender> + <signal>valueChanged(int)</signal> + <receiver>KEyeCandyPageDlg</receiver> + <slot>slotEyeCandySliderMoved(int)</slot> + </connection> +</connections> +<Q_SLOTS> + <slot>slotEyeCandyShowDetails(bool)</slot> + <slot>slotEyeCandySliderMoved(int)</slot> +</Q_SLOTS> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/kfindlanguage.cpp b/kpersonalizer/kfindlanguage.cpp new file mode 100644 index 000000000..150c67b28 --- /dev/null +++ b/kpersonalizer/kfindlanguage.cpp @@ -0,0 +1,151 @@ +/*************************************************************************** + kfindlanguage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2002 by Carsten Wolff + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <stdlib.h> + +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqmap.h> + +#include <ksimpleconfig.h> +#include <tdeglobal.h> +#include <kstandarddirs.h> +#include <tdelocale.h> + +#include "kfindlanguage.h" + +KFindLanguage::KFindLanguage() { + TDEConfig *config = TDEGlobal::config(); + config->setGroup("Locale"); + + m_oldlang = config->readEntry("Language"); + m_oldlang = m_oldlang.lower(); + m_oldlang = m_oldlang.left(m_oldlang.find(':')); // only use the first lang + + m_country = config->readEntry("Country", "C"); + if (m_country == "C") { + m_country = TQString::fromLatin1(getenv("LANG")); + if(m_country.left(5) == "nn_NO") // glibc's nn_NO is KDE's no_NY + m_country = "no"; + if(m_country.contains("_")) + m_country = m_country.mid(m_country.find("_")+1); + if(m_country.contains(".")) + m_country = m_country.left(m_country.find(".")); + if(m_country.contains("@")) + m_country = m_country.left(m_country.find("@")); + if(m_country != "C") + m_country = m_country.lower(); + if(m_country == "en") // special-case "en" - should be "en_GB" or "en_US", but plain "en" is in use quite often + m_country = "C"; + } + + // get the users primary Languages + KSimpleConfig ent(locate("locale", TQString::fromLatin1("l10n/%1/entry.desktop").arg(m_country)), true); + ent.setGroup("KCM Locale"); + TQStringList langs = ent.readListEntry("Languages"); + if (langs.isEmpty()) + langs.append("en_US"); + + // add the primary languages for the country to the list + TQStringList prilang; + for ( TQStringList::ConstIterator it = langs.begin(); it != langs.end(); ++it ) { + TQString str = locate("locale", *it + "/entry.desktop"); + if (!str.isNull()) + prilang << str; + } + + // add all languages to the list + TQStringList alllang = TDEGlobal::dirs()->findAllResources("locale", "*/entry.desktop", false, true); + alllang.sort(); + TQStringList langlist = prilang; + if (langlist.count() > 0) + langlist << TQString::null; // separator + langlist += alllang; + + for ( TQStringList::ConstIterator it = langlist.begin(); it != langlist.end(); ++it ) { + KSimpleConfig entry(*it); + entry.setGroup("KCM Locale"); + TQString name = entry.readEntry("Name", i18n("without name")); + + TQString tag = *it; + int index = tag.findRev('/'); + tag = tag.left(index); + index = tag.findRev('/'); + tag = tag.mid(index+1); + + m_langlist << tag; + m_langmap.insert(tag, name); + } + + // now find the best language for the user + TQString compare = m_oldlang; + if (m_oldlang.isEmpty()) { + compare = langs.first(); + for(TQStringList::Iterator it = langs.begin(); it != langs.end(); ++it) { + if (*it == TQString::fromLatin1(getenv("LANG")).mid(3, 2).lower()) + compare = *it; + } + } + if(compare == "c") + compare = "C"; + + // Find the users's language + int bestmatch = -1; + + TQStringList::ConstIterator it; + for( it = m_langlist.begin(); it != m_langlist.end(); ++it) { + int match=0; + TQString l = (*it).left((*it).find(";")); + if (l == "C") + match++; + if(l.contains(compare)) + match+=2; + if(l.left(compare.length()) == compare) + match+=10; + if(compare == "en_US" && l == "C") + match+=50; + if (l == compare) + match+=100; + if(match > bestmatch) { + bestmatch=match; + m_bestlang=l; + } + } +} + +KFindLanguage::~KFindLanguage() { +} + +TQStringList KFindLanguage::getLangList() const { + return m_langlist; +} + +TQMap<TQString,TQString> KFindLanguage::getLangMap() const { + return m_langmap; +} + +TQString KFindLanguage::getBestLang() const { + return m_bestlang; +} + +TQString KFindLanguage::getOldLang() const { + return m_oldlang; +} + +TQString KFindLanguage::getCountry() const { + return m_country; +} diff --git a/kpersonalizer/kfindlanguage.h b/kpersonalizer/kfindlanguage.h new file mode 100644 index 000000000..961c14092 --- /dev/null +++ b/kpersonalizer/kfindlanguage.h @@ -0,0 +1,38 @@ +/*************************************************************************** + kfindlanguage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2002 by Carsten Wolff + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KFINDLANGUAGE_H +#define KFINDLANGUAGE_H + +class KFindLanguage { +public: + KFindLanguage(); + ~KFindLanguage(); + TQStringList getLangList() const; + TQMap<TQString,TQString> getLangMap() const; + TQString getBestLang() const; + TQString getOldLang() const; + TQString getCountry() const; +private: + TQStringList m_langlist; // stores tags like "en_US" + TQMap<TQString,TQString> m_langmap; // stores tag -> name pairs + TQString m_country; + TQString m_oldlang; + TQString m_bestlang; +}; + +#endif diff --git a/kpersonalizer/kospage.cpp b/kpersonalizer/kospage.cpp new file mode 100644 index 000000000..017b95fe7 --- /dev/null +++ b/kpersonalizer/kospage.cpp @@ -0,0 +1,508 @@ +/*************************************************************************** + kospage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <tqlabel.h> +#include <tqcheckbox.h> +#include <tqradiobutton.h> +#include <tqtextview.h> +#include <tqmap.h> + +#include <ksimpleconfig.h> +#include <kstandarddirs.h> +#include <tdeapplication.h> +#include <tdelocale.h> +#include <dcopclient.h> +#include <kipc.h> +#include <krun.h> +#include <kkeynative.h> +#include <kdebug.h> +#include <kiconloader.h> + +#include "libkonq/konq_defaults.h" + +#include "kospage.h" + +KOSPage::KOSPage(TQWidget *parent, const char *name ) : KOSPageDlg(parent,name) { + px_osSidebar->setPixmap(UserIcon("step2.png")); + // initialize the textview with the default description - Trinity of course + slotKDEDescription(); + // Set the configfiles + cglobal = new TDEConfig("kdeglobals"); + claunch = new TDEConfig("tdelaunchrc", false, false); + cwin = new TDEConfig("twinrc"); + cdesktop = new TDEConfig("kdesktoprc"); + ckcminput = new TDEConfig("kcminputrc"); + ckcmdisplay = new TDEConfig("kcmdisplayrc"); + ckonqueror = new TDEConfig("konquerorrc"); + cklipper = new TDEConfig("klipperrc", false, false); + ckaccess = new TDEConfig("kaccessrc"); + // Save the current user defaults + getUserDefaults(); + // set default-selections for this page + setDefaults(); +} + +KOSPage::~KOSPage(){ + delete cglobal; + delete claunch; + delete cwin; + delete cdesktop; + delete ckcmdisplay; + delete ckcminput; + delete ckonqueror; + delete cklipper; + delete ckaccess; +} + + +void KOSPage::save(bool currSettings){ + kdDebug() << "KOSPage::save()" << endl; + // save like we want. Just set the Radiobutton to either how it is set in the dialog (currSettings=true, default) + // or, if false, take the settings we got in getUserDefaults() + saveCheckState(currSettings); + // sync all configs + cglobal->sync(); + claunch->sync(); + cwin->sync(); + cdesktop->sync(); + ckcmdisplay->sync(); + ckcminput->sync(); + ckonqueror->sync(); + cklipper->sync(); + ckaccess->sync(); + /////////////////////////////////////////// + // kcmdisplay changes + KIPC::sendMessageAll(KIPC::SettingsChanged); + TQApplication::syncX(); + // enable/disable the mac menu, call dcop + // Tell kdesktop about the new config file + kapp->dcopClient()->send("kdesktop", "KDesktopIface", "configure()", TQByteArray()); + /////////////////////////////////////////// + /// restart twin for window effects + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + /////////////////////////////////////////// + + // Make the kaccess daemon read the changed config file + kapp->startServiceByDesktopName("kaccess"); +} + + + /** called by save() -- currSettings= true -> take the radiobutton, otherwise take user values set */ +void KOSPage::saveCheckState(bool currSettings){ + if(currSettings){ + // Set the path for the keysscheme resource files + TDEGlobal::dirs()->addResourceType("keys", TDEStandardDirs::kde_default("data")+"kcmkeys"); + // write the settings to the configfiles, depending on wich radiobutton is checked + if(rb_kde->isChecked()){ + writeKDE(); + emit selectedOS("KDE"); // send a signal to be caught by the TDEStylePage to set the according style by default depending on the OS selection + } + else if(rb_unix->isChecked()){ + writeUNIX(); + emit selectedOS("CDE"); // send a signal to be caught by the TDEStylePage to set the according style by default depending on the OS selection + } + else if(rb_windows->isChecked()){ + writeWindows(); + emit selectedOS("win"); // send a signal to be caught by the TDEStylePage to set the according style by default depending on the OS selection + } + else if(rb_mac->isChecked()){ + writeMacOS(); + emit selectedOS("mac"); // send a signal to be caught by the TDEStylePage to set the according style by default depending on the OS selection + } + + ckaccess->setGroup("Keyboard"); + ckaccess->writeEntry("Gestures", cb_gestures->isChecked(), true, true); + + } + else { // User has pressed "cancel & dismiss", so his old settings are written back + writeUserDefaults(); + } +} + + + /** write the settings for KDE-Behavior (called by saveCheckStatus) */ +void KOSPage::writeKDE(){ + kdDebug() << "KOSPage::writeKDE()" << endl; + + ckcmdisplay->setGroup("KDE"); + ckcmdisplay->writeEntry("macStyle", false, true, true); + + cglobal->setGroup("KDE"); + cglobal->writeEntry("SingleClick", false, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", false); + + cwin->setGroup("Windows"); + cwin->writeEntry("TitlebarDoubleClickCommand", "Shade"); + cwin->writeEntry("FocusPolicy", "ClickToFocus"); + cwin->writeEntry("AltTabStyle", "KDE"); + cwin->setGroup( "MouseBindings"); + cwin->writeEntry("CommandActiveTitlebar2", "Lower"); + cwin->writeEntry("CommandActiveTitlebar3", "Operations menu"); + + cdesktop->setGroup( "Menubar" ); + cdesktop->writeEntry("ShowMenubar", false); + cdesktop->setGroup( "Mouse Buttons" ); + cdesktop->writeEntry("Middle", "WindowListMenu"); + cdesktop->setGroup( "FMSettings" ); + cdesktop->writeEntry("UnderlineLinks", false); + + ckonqueror->setGroup( "FMSettings" ); + ckonqueror->writeEntry("UnderlineLinks", false); + + ckcminput->setGroup("KDE"); + ckcminput->writeEntry("ChangeCursor", true, true, true ); + + cklipper->setGroup("General"); + cklipper->writeEntry("Synchronize", false); + + writeKeyEntrys(locate("keys", "trinity.kksrc")); +} + + + /** write the settings for fvwm-like-behavior (called by saveCheckStatus) */ +void KOSPage::writeUNIX(){ + kdDebug() << "KOSPage::writeUNIX()" << endl; + + ckcmdisplay->setGroup("KDE"); + ckcmdisplay->writeEntry("macStyle", false, true, true); + + cglobal->setGroup("KDE"); + cglobal->writeEntry("SingleClick", true, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", false); + + cwin->setGroup("Windows"); + cwin->writeEntry("TitlebarDoubleClickCommand", "Shade"); + cwin->writeEntry("FocusPolicy", "FocusStrictlyUnderMouse"); + cwin->writeEntry("AltTabStyle", "CDE"); + cwin->setGroup( "MouseBindings"); + cwin->writeEntry("CommandActiveTitlebar2", "Operations menu"); + cwin->writeEntry("CommandActiveTitlebar3", "Lower"); + + cdesktop->setGroup( "Menubar" ); + cdesktop->writeEntry("ShowMenubar", false); + cdesktop->setGroup( "Mouse Buttons" ); + cdesktop->writeEntry("Middle", "AppMenu"); + cdesktop->setGroup( "FMSettings" ); + cdesktop->writeEntry("UnderlineLinks", false); + + ckonqueror->setGroup( "FMSettings" ); + ckonqueror->writeEntry("UnderlineLinks", false); + + ckcminput->setGroup("KDE"); + ckcminput->writeEntry("ChangeCursor", false, true, true ); + + cklipper->setGroup("General"); + cklipper->writeEntry("Synchronize", true); + + writeKeyEntrys(locate("keys", "unix3.kksrc")); +} + + + /** write the settings for windows-like-behavior (called by saveCheckStatus) */ +void KOSPage::writeWindows(){ + kdDebug() << "KOSPage::writeWindows()" << endl; + + ckcmdisplay->setGroup("KDE"); + ckcmdisplay->writeEntry("macStyle", false, true, true); + + cglobal->setGroup("KDE"); + cglobal->writeEntry("SingleClick", false, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", false); + + cwin->setGroup("Windows"); + cwin->writeEntry("TitlebarDoubleClickCommand", "Maximize"); + cwin->writeEntry("FocusPolicy", "ClickToFocus"); + cwin->writeEntry("AltTabStyle", "KDE"); + cwin->setGroup( "MouseBindings"); + cwin->writeEntry("CommandActiveTitlebar2", "Lower"); + cwin->writeEntry("CommandActiveTitlebar3", "Operations menu"); + + cdesktop->setGroup( "Menubar" ); + cdesktop->writeEntry("ShowMenubar", false); + cdesktop->setGroup( "Mouse Buttons" ); + cdesktop->writeEntry("Middle", "WindowListMenu"); + cdesktop->setGroup( "FMSettings" ); + cdesktop->writeEntry("UnderlineLinks", false); + + ckonqueror->setGroup( "FMSettings" ); + ckonqueror->writeEntry("UnderlineLinks", false); + + ckcminput->setGroup("KDE"); + ckcminput->writeEntry("ChangeCursor", false, true, true ); + + cklipper->setGroup("General"); + cklipper->writeEntry("Synchronize", false); + + // set the schemefile depending on whether or not the keyboard has got Metakeys. + if( KKeyNative::keyboardHasWinKey() ) { + writeKeyEntrys(locate("keys", "win4.kksrc")); + } + else { + writeKeyEntrys(locate("keys", "win3.kksrc")); + } +} + + + /** write the settings for MacOS-like-behavior (called by saveCheckStatus) */ +void KOSPage::writeMacOS(){ + kdDebug() << "KOSPage::writeMacOS()" << endl; + + ckcmdisplay->setGroup("KDE"); + ckcmdisplay->writeEntry("macStyle", true, true, true); + + cglobal->setGroup("KDE"); + cglobal->writeEntry("SingleClick", true, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", false); + + cwin->setGroup("Windows"); + cwin->writeEntry("TitlebarDoubleClickCommand", "Shade"); + cwin->writeEntry("FocusPolicy", "ClickToFocus"); + cwin->writeEntry("AltTabStyle", "KDE"); + cwin->setGroup( "MouseBindings"); + cwin->writeEntry("CommandActiveTitlebar2", "Lower"); + cwin->writeEntry("CommandActiveTitlebar3", "Operations menu"); + + cdesktop->setGroup( "Menubar" ); + cdesktop->writeEntry("ShowMenubar", true); + cdesktop->setGroup( "Mouse Buttons" ); + cdesktop->writeEntry("Middle", "WindowListMenu"); + cdesktop->setGroup( "FMSettings" ); + cdesktop->writeEntry("UnderlineLinks", false); + + ckonqueror->setGroup( "FMSettings" ); + ckonqueror->writeEntry("UnderlineLinks", false); + + ckcminput->setGroup("KDE"); + ckcminput->writeEntry("ChangeCursor", true, true, true ); + + cklipper->setGroup("General"); + cklipper->writeEntry("Synchronize", false); + + writeKeyEntrys(locate("keys", "mac4.kksrc")); +} + + + /** write Keyscheme to kdeglobals (called by saveCheckState) */ +void KOSPage::writeKeyEntrys(TQString keyfile){ + kdDebug() << "KOSPage::writeKeyEntrys()" << endl; + + // load the given .kksrc - file + KSimpleConfig* scheme = new KSimpleConfig(keyfile, true); + // load the default .kksrc - file + KSimpleConfig* defScheme = new KSimpleConfig(locate("keys", "trinity.kksrc"), true); + + // we need the entries from the default - file, so we can compare with them + TQMap<TQString, TQString> defMap = defScheme->entryMap("Global Shortcuts"); + // first delete the group in kdeglobals, then write the non-default entries from the global .kksrc - file + cglobal->deleteGroup("Global Shortcuts", true, true); + // get the Global - Shortcuts and write them to kdeglobals + cglobal->setGroup("Global Shortcuts"); + TQMap<TQString, TQString> givenMap = scheme->entryMap("Global Shortcuts"); + for ( TQMap<TQString, TQString>::Iterator it = givenMap.begin(); it != givenMap.end(); ++it ) { + if ( (defMap[it.key()] == it.data()) && (it.data() != "none") ) { + cglobal->writeEntry(it.key(), "default("+it.data()+")", true, true); + } else { + cglobal->writeEntry(it.key(), it.data(), true, true); + } + } + + // we need the entries from the default - file, so we can compare with them + defMap = defScheme->entryMap("Shortcuts"); + // first delete the group in kdeglobals, then write the non-default entries from the global .kksrc - file + cglobal->deleteGroup("Shortcuts", true, true); + cglobal->setGroup("Shortcuts"); + givenMap = scheme->entryMap("Shortcuts"); + for ( TQMap<TQString, TQString>::Iterator it = givenMap.begin(); it != givenMap.end(); ++it ) { + // only write the entry, if it defers from trinity.kksrc + if ( defMap[it.key()] != it.data() ) { + cglobal->writeEntry(it.key(), it.data(), true, true); + } + } + + delete scheme; + delete defScheme; +} + +void KOSPage::slotKDEDescription(){ + kdDebug() << "slotKDEDescription()" << endl; + textview_ospage->setText(""); + textview_ospage->setText(i18n( + "<b>Window activation:</b> <i>Focus on click</i><br>" + "<b>Titlebar double-click:</b> <i>Shade window</i><br>" + "<b>Mouse selection:</b> <i>Double click</i><br>" + "<b>Application startup notification:</b> <i>none</i><br>" + "<b>Keyboard scheme:</b> <i>Trinity default</i><br>" + )); +} + +void KOSPage::slotUnixDescription(){ + kdDebug() << "slotUnixDescription()" << endl; + textview_ospage->setText("" ); + textview_ospage->setText(i18n( + "<b>Window activation:</b> <i>Focus follows mouse</i><br>" + "<b>Titlebar double-click:</b> <i>Shade window</i><br>" + "<b>Mouse selection:</b> <i>Single click</i><br>" + "<b>Application startup notification:</b> <i>none</i><br>" + "<b>Keyboard scheme:</b> <i>UNIX</i><br>" + )); +} + +void KOSPage::slotWindowsDescription(){ + kdDebug() << "slotWindowsDescription()" << endl; + textview_ospage->setText(""); + textview_ospage->setText(i18n( + "<b>Window activation:</b> <i>Focus on click</i><br>" + "<b>Titlebar double-click:</b> <i>Maximize window</i><br>" + "<b>Mouse selection:</b> <i>Double click</i><br>" + "<b>Application startup notification:</b> <i>none</i><br>" + "<b>Keyboard scheme:</b> <i>Windows</i><br>" + )); +} + +void KOSPage::slotMacDescription(){ + kdDebug() << "slotMacDescription()" << endl; + textview_ospage->setText(""); + textview_ospage->setText(i18n( + "<b>Window activation:</b> <i>Focus on click</i><br>" + "<b>Titlebar double-click:</b> <i>Shade window</i><br>" + "<b>Mouse selection:</b> <i>Single click</i><br>" + "<b>Application startup notification:</b> <i>none</i><br>" + "<b>Keyboard scheme:</b> <i>Mac</i><br>" + )); +} + + +/** retrieves the user's local values. In case he doesn't have these set, use the default values of Trinity */ +void KOSPage::getUserDefaults(){ + ckcmdisplay->setGroup("KDE"); + b_MacMenuBar = ckcmdisplay->readBoolEntry("macStyle", false); + + cglobal->setGroup("KDE"); + b_SingleClick = cglobal->readBoolEntry("SingleClick", false); + + claunch->setGroup("FeedbackStyle"); + b_BusyCursor = claunch->readBoolEntry("BusyCursor", false); + + cwin->setGroup("Windows"); + s_TitlebarDCC = cwin->readEntry("TitlebarDoubleClickCommand", "Shade"); + s_FocusPolicy = cwin->readEntry("FocusPolicy", "ClickToFocus"); + s_AltTabStyle = cwin->readEntry("AltTabStyle", "KDE"); + cwin->setGroup( "MouseBindings"); + s_TitlebarMMB = cwin->readEntry("CommandActiveTitlebar2", "Lower"); + s_TitlebarRMB = cwin->readEntry("CommandActiveTitlebar3", "Operations menu"); + + cdesktop->setGroup( "Menubar" ); + b_ShowMenuBar = cdesktop->readBoolEntry("ShowMenubar", false); + cdesktop->setGroup( "Mouse Buttons" ); + s_MMB = cdesktop->readEntry("Middle", "WindowListMenu"); + cdesktop->setGroup( "FMSettings" ); + b_DesktopUnderline = cdesktop->readBoolEntry("UnderlineLinks", DEFAULT_UNDERLINELINKS); + + ckonqueror->setGroup( "FMSettings" ); + b_KonqUnderline = ckonqueror->readBoolEntry("UnderlineLinks", DEFAULT_UNDERLINELINKS); + + ckcminput->setGroup("KDE"); + b_ChangeCursor = ckcminput->readBoolEntry("ChangeCursor", true); + + cklipper->setGroup("General"); + b_syncClipboards = cklipper->readBoolEntry("Synchronize", false); + + map_GlobalUserKeys = cglobal->entryMap("Global Shortcuts"); + map_AppUserKeys = cglobal->entryMap("Shortcuts"); + + ckaccess->setGroup("Keyboard"); + b_Gestures = ckaccess->readBoolEntry("Gestures", true); +} + + + /** writes the user-defaults back */ +void KOSPage::writeUserDefaults(){ + kdDebug() << "KOSPage::writeUserDefaults()" << endl; + + ckcmdisplay->setGroup("KDE"); + ckcmdisplay->writeEntry("macStyle", b_MacMenuBar, true, true); + + cglobal->setGroup("KDE"); + cglobal->writeEntry("SingleClick", b_SingleClick, true, true); + + claunch->setGroup("FeedbackStyle"); + claunch->writeEntry("BusyCursor", b_BusyCursor); + + cwin->setGroup("Windows"); + cwin->writeEntry("TitlebarDoubleClickCommand", s_TitlebarDCC); + cwin->writeEntry("FocusPolicy", s_FocusPolicy); + cwin->writeEntry("AltTabStyle", s_AltTabStyle); + cwin->setGroup( "MouseBindings"); + cwin->writeEntry("CommandActiveTitlebar2", s_TitlebarMMB); + cwin->writeEntry("CommandActiveTitlebar3", s_TitlebarRMB); + + cdesktop->setGroup( "Menubar" ); + cdesktop->writeEntry("ShowMenubar", b_ShowMenuBar); + cdesktop->setGroup( "Mouse Buttons" ); + cdesktop->writeEntry("Middle", s_MMB); + cdesktop->setGroup( "FMSettings" ); + cdesktop->writeEntry("UnderlineLinks", b_DesktopUnderline); + + ckonqueror->setGroup( "FMSettings" ); + ckonqueror->writeEntry("UnderlineLinks", b_KonqUnderline); + + ckcminput->setGroup("KDE"); + ckcminput->writeEntry("ChangeCursor", b_ChangeCursor, true, true ); + + cklipper->setGroup("General"); + cklipper->writeEntry("Synchronize", b_syncClipboards); + + ckaccess->setGroup("Keyboard"); + ckaccess->writeEntry("Gestures", b_Gestures, true, true); + + writeUserKeys(); +} + + /** called by writeUserDefaults() */ +void KOSPage::writeUserKeys(){ + kdDebug() << "KOSPage::writeUserKeys()" << endl; + + cglobal->setGroup("Global Shortcuts"); + TQMap<TQString, TQString>::Iterator it; + for ( it = map_GlobalUserKeys.begin(); it != map_GlobalUserKeys.end(); ++it ) { + cglobal->writeEntry(it.key(), it.data(), true, true); + } + + cglobal->deleteGroup("Shortcuts", true, true); + cglobal->setGroup("Shortcuts"); + for ( it = map_AppUserKeys.begin(); it != map_AppUserKeys.end(); ++it ) { + cglobal->writeEntry(it.key(), it.data(), true, true); + } +} + + + /** resets the radio button selected to kde */ +void KOSPage::setDefaults(){ + rb_kde->setChecked(true); + cb_gestures->setChecked(false); +} + +#include "kospage.moc" + diff --git a/kpersonalizer/kospage.h b/kpersonalizer/kospage.h new file mode 100644 index 000000000..2797f4572 --- /dev/null +++ b/kpersonalizer/kospage.h @@ -0,0 +1,72 @@ +/*************************************************************************** + kospage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KOSPAGE_H +#define KOSPAGE_H + + +#include"kospagedlg.h" + +/**Abstract class for the second page. Uses save() to change the according settings and applies them. + *@author Ralf Nolden + */ + +class KOSPage : public KOSPageDlg { + Q_OBJECT +public: + KOSPage(TQWidget *parent=0, const char *name=0); + ~KOSPage(); + void save(bool currSettings=true); + void saveCheckState(bool currSettings); + void writeKDE(); + void writeUNIX(); + void writeWindows(); + void writeMacOS(); + void writeKeyEntrys(TQString keyfile); + void writeUserKeys(); + void writeUserDefaults(); + /** retrieve the user's local values */ + void getUserDefaults(); + void slotMacDescription(); + void slotWindowsDescription(); + void slotUnixDescription(); + void slotKDEDescription(); + /** resets the radio button selected to kde */ + void setDefaults(); +signals: // Signals + /** emits either of: KDE, CDE, win or mac in save() depending + on the selection made by the user. */ + void selectedOS(const TQString&); +private: + TDEConfig* cglobal; + TDEConfig* claunch; + TDEConfig* cwin; + TDEConfig* cdesktop; + TDEConfig* ckcminput; + TDEConfig* ckcmdisplay; + TDEConfig* ckonqueror; + TDEConfig* cklipper; + TDEConfig* ckaccess; + // DEFAULT VALUES SET BY USER + bool b_Gestures, b_MacMenuBar, b_SingleClick, b_BusyCursor, b_ShowMenuBar, + b_DesktopUnderline, b_KonqUnderline, b_ChangeCursor, b_syncClipboards; + TQString s_TitlebarDCC, s_FocusPolicy, s_AltTabStyle, s_MMB, + s_TitlebarMMB, s_TitlebarRMB; + TQMap<TQString, TQString> map_AppUserKeys, map_GlobalUserKeys; + // DEFAULT VALLUES SET BY USER (END) +}; +#endif diff --git a/kpersonalizer/kospagedlg.ui b/kpersonalizer/kospagedlg.ui new file mode 100644 index 000000000..30edfeea9 --- /dev/null +++ b/kpersonalizer/kospagedlg.ui @@ -0,0 +1,221 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>KOSPageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KOSPageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>561</width> + <height>460</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQTextView" row="4" column="1"> + <property name="name"> + <cstring>textview_ospage</cstring> + </property> + </widget> + <widget class="TQLabel" row="0" column="0" rowspan="8" colspan="1"> + <property name="name"> + <cstring>px_osSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="3" column="1"> + <property name="name"> + <cstring>TextLabel9</cstring> + </property> + <property name="text"> + <string>Description:</string> + </property> + </widget> + <widget class="TQButtonGroup" row="2" column="1"> + <property name="name"> + <cstring>bg_ospage</cstring> + </property> + <property name="title"> + <string>Select Preferred System Behavior</string> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton" row="0" column="0"> + <property name="name"> + <cstring>rb_kde</cstring> + </property> + <property name="text"> + <string>TDE (TM)</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton" row="1" column="0"> + <property name="name"> + <cstring>rb_unix</cstring> + </property> + <property name="text"> + <string>UNIX (R)</string> + </property> + </widget> + <widget class="TQRadioButton" row="0" column="1"> + <property name="name"> + <cstring>rb_windows</cstring> + </property> + <property name="text"> + <string>Microsoft Windows (R)</string> + </property> + </widget> + <widget class="TQRadioButton" row="1" column="1"> + <property name="name"> + <cstring>rb_mac</cstring> + </property> + <property name="text"> + <string>Apple MacOS (R)</string> + </property> + </widget> + </grid> + </widget> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><b>System Behavior</b><br> +Graphical User Interfaces behave differently on various Operating Systems. +Trinity allows you to customize its behavior according to your needs.</string> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>22</width> + <height>10</height> + </size> + </property> + </spacer> + <spacer row="5" column="1"> + <property name="name"> + <cstring>Spacer2</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>22</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="TQLabel" row="6" column="1"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>For motion impaired users, Trinity provides keyboard gestures to activate special keyboard settings.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter</set> + </property> + </widget> + <widget class="TQCheckBox" row="7" column="1"> + <property name="name"> + <cstring>cb_gestures</cstring> + </property> + <property name="text"> + <string>Enable accessibility related keyboard gestures</string> + </property> + </widget> + </grid> +</widget> +<connections> + <connection> + <sender>rb_kde</sender> + <signal>clicked()</signal> + <receiver>KOSPageDlg</receiver> + <slot>slotKDEDescription()</slot> + </connection> + <connection> + <sender>rb_unix</sender> + <signal>clicked()</signal> + <receiver>KOSPageDlg</receiver> + <slot>slotUnixDescription()</slot> + </connection> + <connection> + <sender>rb_windows</sender> + <signal>clicked()</signal> + <receiver>KOSPageDlg</receiver> + <slot>slotWindowsDescription()</slot> + </connection> + <connection> + <sender>rb_mac</sender> + <signal>clicked()</signal> + <receiver>KOSPageDlg</receiver> + <slot>slotMacDescription()</slot> + </connection> +</connections> +<Q_SLOTS> + <slot>slotWindowsDescription()</slot> + <slot>slotKDEDescription()</slot> + <slot>slotMacDescription()</slot> + <slot>slotUnixDescription()</slot> +</Q_SLOTS> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/kpersonalizer.cpp b/kpersonalizer/kpersonalizer.cpp new file mode 100644 index 000000000..86b0a5b4a --- /dev/null +++ b/kpersonalizer/kpersonalizer.cpp @@ -0,0 +1,266 @@ +/*************************************************************************** + kpersonalizer.cpp - description + ------------------- + begin : Die Mai 22 17:24:18 CEST 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute 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. * + * * + ***************************************************************************/ + +#include <unistd.h> + +#include <tqpushbutton.h> +#include <tqlabel.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include <tqfile.h> +#include <tqtimer.h> +#include <tqcursor.h> + +#include <ksimpleconfig.h> +#include <tdeglobal.h> +#include <tdeglobalsettings.h> +#include <kstandarddirs.h> +#include <tdelocale.h> +#include <tdeapplication.h> +#include <tdelistview.h> +#include <krun.h> +#include <tdemessagebox.h> +#include <tdeconfig.h> + +#include <stdlib.h> + +#include <kdebug.h> + +#include "kcountrypage.h" +#include "kospage.h" +#include "keyecandypage.h" +#include "tdestylepage.h" +#include "krefinepage.h" + +#include "kpersonalizer.h" +#include "kpersonalizer.moc" + + + +bool KPersonalizer::before_session = false; + +KPersonalizer::KPersonalizer(TQWidget *parent, const char *name) + : KWizard(parent, name, true) { + + // first, reset the startup from true (see desktop file in share/autostart) to false + setCaption(kapp->caption()); + kapp->config()->setGroup("General"); + os_dirty = eye_dirty = style_dirty=false; + kapp->config()->writeEntry("FirstLogin", false); + kapp->config()->sync(); + + countrypage= new KCountryPage(this); + addPage( countrypage, i18n( "Step 1: Introduction" ) ); + setHelpEnabled(TQWizard::page(0), false); + + ospage= new KOSPage(this); + addPage(ospage, i18n( "Step 2: I want it my Way..." ) ); + setHelpEnabled(TQWizard::page(1), false); + + eyecandy= new KEyeCandyPage(this); + addPage( eyecandy, i18n( "Step 3: Eyecandy-O-Meter" ) ); + setHelpEnabled(TQWizard::page(2), false); + + stylepage= new TDEStylePage(this); + addPage( stylepage, i18n( "Step 4: Everybody loves Themes" ) ); + setHelpEnabled(TQWizard::page(3), false); + + refinepage=new KRefinePage(this); + addPage( refinepage, i18n( "Step 5: Time to Refine" ) ); + setHelpEnabled(TQWizard::page(4), false); + + cancelButton()->setText(i18n("S&kip Wizard")); + + setFinishEnabled(TQWizard::page(4), true); + + locale = new TDELocale("kpersonalizer"); + locale->setLanguage(TDELocale::defaultLanguage()); + + connect(ospage, TQT_SIGNAL(selectedOS(const TQString&)), stylepage, TQT_SLOT(presetStyle(const TQString&))); + connect(ospage, TQT_SIGNAL(selectedOS(const TQString&)), eyecandy, TQT_SLOT(slotPresetSlider(const TQString&))); + connect(refinepage->pb_kcontrol, TQT_SIGNAL(clicked()), this, TQT_SLOT(accept())); + + setPosition(); + + /* hide the detail-box on eyecandypage. we need to call it from here, to be + able, to call it at last. Else we would run into layout-problems later. */ + eyecandy->klv_features->hide(); +} + +KPersonalizer::~KPersonalizer() { +} + + +void KPersonalizer::next() { + if(currentPage()==countrypage) { + // only restart kp, if the new language is different from the one selected in main.cpp + // and none of the later pages is dirty + if ( (countrypage->b_startedLanguageChanged) && !(os_dirty || eye_dirty || style_dirty) ) { + if ( countrypage->save(countrypage->cb_country, countrypage->cb_language) ) + delayedRestart(); + } else { + (void)countrypage->save(countrypage->cb_country, countrypage->cb_language); + TQWizard::next(); + } + } + else if(currentPage()==ospage){ + os_dirty=true; // set the dirty flag, changes done that need reverting + ospage->save(); + TQWizard::next(); + } + else if(currentPage()==eyecandy){ + eye_dirty=true; // set the dirty flag, changes done that need reverting + eyecandy->save(); + TQTimer::singleShot(0, this, TQT_SLOT(slotNext())); + } + else if(currentPage()==stylepage){ + style_dirty=true; // set the dirty flag, changes done that need reverting + stylepage->save(); + TQWizard::next(); + } + if(currentPage()==refinepage) { + finishButton()->setFocus(); + } +} + +void KPersonalizer::slotNext() { + TQWizard::next(); + stylepage->switchPrevStyle(); // We need to update the preview-widget, after the page changed +} + +void KPersonalizer::back() { + TQWizard::back(); +} + +bool KPersonalizer::askClose(){ + TQString text; + if (currentPage()==countrypage) { + text = i18n("<p>Are you sure you want to quit the Desktop Settings Wizard?</p>" + "<p>The Desktop Settings Wizard helps you to configure the Trinity desktop to your personal liking.</p>" + "<p>Click <b>Cancel</b> to return and finish your setup.</p>"); + } else { + text = i18n("<p>Are you sure you want to quit the Desktop Settings Wizard?</p>" + "<p>If yes, click <b>Quit</b> and all changes will be lost." + "<br>If not, click <b>Cancel</b> to return and finish your setup.</p>"); + } + int status = KMessageBox::warningContinueCancel(this, text, i18n("All Changes Will Be Lost"), KStdGuiItem::quit()); + if(status==KMessageBox::Continue){ + setDefaults(); + return true; + } else { + return false; + } +} + +/** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to ask if we + * really want to quit the wizard. + */ +void KPersonalizer::reject(){ + if (askClose()){ + exit(0); + } +} + +void KPersonalizer::closeEvent(TQCloseEvent* e){ + if ( askClose() ) + exit(0); + else + e->ignore(); +} + +/** maybe call a dialog that the wizard has finished. */ +void KPersonalizer::accept(){ + exit(0); +} + +/** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ +void KPersonalizer::setDefaults(){ + // KCountryPage: The user may need his native language anyway + if(os_dirty) + ospage->save(false); + if(eye_dirty) + eyecandy->save(false); + if(style_dirty) + stylepage->save(false); +} + + +/** restart kpersonalizer */ +void KPersonalizer::slotRestart() { + delete countrypage; countrypage = 0; + delete ospage; ospage = 0; + delete eyecandy; eyecandy = 0; + delete stylepage; stylepage = 0; + delete refinepage; refinepage = 0; + + if( !beforeSession() ) + KRun::runCommand("kpersonalizer -r", "kpersonalizer", "kpersonalizer"); + + exit(1); // exit with value 1 +} + +void KPersonalizer::delayedRestart() { + TQTimer::singleShot(0, this, TQT_SLOT(slotRestart())); +} + +/** this session is restarted, so we want to start with ospage */ +void KPersonalizer::restarted(){ + showPage(ospage); +} + +/** when kpersonalizer is started before Trinity session, it doesn't + offer a button for starting KControl, it also doesn't restart + itself automatically and only exits with exitcode 1 */ +void KPersonalizer::setBeforeSession(){ + before_session = true; +} + +/** there seems to be a bug in TQWizard, that makes this evil hack necessary */ +void KPersonalizer::setPosition() { + TQSize hint = countrypage->sizeHint(); + TQSize os_size = ospage->sizeHint(); + TQSize candy_size = eyecandy->sizeHint(); + TQSize style_size = stylepage->sizeHint(); + TQSize refine_size = refinepage->sizeHint(); + + // get the width of the broadest child-widget + if ( hint.width() < os_size.width() ) + hint.setWidth(os_size.width()); + if ( hint.width() < candy_size.width() ) + hint.setWidth(candy_size.width()); + if ( hint.width() < style_size.width() ) + hint.setWidth(style_size.width()); + if ( hint.width() < refine_size.width() ) + hint.setWidth(refine_size.width()); + + // get the height of the highest child-widget + if ( hint.height() < os_size.height() ) + hint.setHeight(os_size.height()); + if ( hint.height() < candy_size.height() ) + hint.setHeight(candy_size.height()); + if ( hint.height() < style_size.height() ) + hint.setHeight(style_size.height()); + if ( hint.height() < refine_size.height() ) + hint.setHeight(refine_size.height()); + + // set the position + TQRect rect = TDEGlobalSettings::desktopGeometry(TQCursor::pos()); + int w = rect.x() + (rect.width() - hint.width())/2 - 9; + int h = rect.y() + (rect.height() - hint.height())/2; + move(w, h); +} diff --git a/kpersonalizer/kpersonalizer.desktop b/kpersonalizer/kpersonalizer.desktop new file mode 100644 index 000000000..33791e740 --- /dev/null +++ b/kpersonalizer/kpersonalizer.desktop @@ -0,0 +1,88 @@ +[Desktop Entry] +Type=Application +Exec=kpersonalizer -caption "%c" %i %m +Icon=kpersonalizer +Terminal=false +Name=KPersonalizer +GenericName=Desktop Settings Wizard +GenericName[af]=Werkskerm Instellings Assistent +GenericName[ar]=مرشد تعيين سطح المكتب +GenericName[az]=Masa Üstü Qurğuları Sehirbazı +GenericName[be]=Чараўнік настаўленняў працоўнага асяроддзя +GenericName[bg]=Настройване на работното място +GenericName[bn]=ডেস্কটপ সেটিংস উইজার্ড +GenericName[br]=Skoazeller kefluniadur ar burev +GenericName[bs]=Podešavanje radne površine +GenericName[ca]=Assistent de configuració de l'escriptori +GenericName[cs]=Průvodce nastavení pracovní plochy +GenericName[csb]=Asystenta nastôwù òkrãżegò +GenericName[cy]=Dewin Gosodiadau Penbwrdd +GenericName[da]=Guide til opsætning af desktoppen +GenericName[de]=Einrichtungsassistent +GenericName[el]=Μάγος ρυθμίσεων της επιφάνειας εργασίας +GenericName[eo]=Asistilo por la tabulagordo +GenericName[es]=Asistente para las preferencias del escritorio +GenericName[et]=Töölaua seadistuste abimees +GenericName[eu]=Mahaigaineko ezarpenetarako morroia +GenericName[fa]=جادوگر تنظیمات رومیزی +GenericName[fi]=Työpöydän ohjattu asettaminen +GenericName[fr]=KPersonalizer +GenericName[fy]=TDE's Ynstellings Assistent +GenericName[gl]=Asistente para a Configuración do Escritório +GenericName[he]=אשף הגדרות שולחן העבודה +GenericName[hi]=डेस्कटॉप विन्यास विजार्ड +GenericName[hr]=Čarobnjak za postavke radne površine +GenericName[hu]=TDE beállításvarázsló +GenericName[is]=Skjáborðsálfur +GenericName[it]=Procedura guidata delle impostazioni del desktop +GenericName[ja]=デスクトップ設定ウィザード +GenericName[ka]=სამუშაო დაფის კონფიგურირების ოსტატი +GenericName[kk]=Үстелді баптау шебері +GenericName[km]=អ្នកជំនួយការការកំណត់ផ្ទៃតុ +GenericName[lo]=ຕົວຊ່ວຍເຫລືອການຕັ້ງຄ່າພື້ນທີ່ທຳງານ +GenericName[lt]=Darbastalio nustatymų asistentas +GenericName[lv]=Darbvirsmas Uzstādījumu Meistars +GenericName[mk]=Волшебник за поставувања на површината +GenericName[mn]=Тохируулга-Туслагч +GenericName[ms]=Wizard Seting Desktop +GenericName[mt]=Saħħar għas-setings tad-desktop +GenericName[nb]=Veiviser for skrivebordsoppsett +GenericName[nds]=Schriefdischinstellen-Hölper +GenericName[ne]=डेस्कटप सेटिङ विजार्ड +GenericName[nl]=TDE's Configuratie Assistent +GenericName[nn]=Vegvisar for skrivebordsoppsett +GenericName[nso]=Wizard ya Dipeakanyo tsa Desktop +GenericName[pa]=ਡੈਸਕਟਾਪ ਸੈਟਿੰਗ ਸਹਾਇਕ +GenericName[pl]=Asystent ustawień środowiska +GenericName[pt]=Assistente de Configuração do Ambiente de Trabalho +GenericName[pt_BR]=Assistente de Configurações para a Área de Trabalho +GenericName[ro]=Expert de setare TDE +GenericName[ru]=Мастер настройки рабочего стола +GenericName[rw]=Inyobora y'Amagenamiterere y'Ibiro +GenericName[se]=Heivehanofelaš čállinbeavddi várás +GenericName[sk]=Sprievodca nastavením plochy +GenericName[sl]=Čarovnik za nastavitve namizja +GenericName[sr]=Чаробњак за подешавање радне површине +GenericName[sr@Latn]=Čarobnjak za podešavanje radne površine +GenericName[sv]=Guide för skrivbordsinställningar +GenericName[ta]=மேல்மேசை அமைப்புகள் பகுதி +GenericName[te]=రంగస్థల అమరికల విజార్డ్ +GenericName[tg]=Танзими устоди мизи корӣ +GenericName[th]=ช่วยตั้งค่าพื้นที่หน้าจอ +GenericName[tr]=Masaüstü Ayarları Sihirbazı +GenericName[tt]=Östäl Caylaw Xikmätçese +GenericName[uk]=Майстер параметрів стільниці +GenericName[uz]=Ish stolini moslash uchun yordamchi +GenericName[uz@cyrillic]=Иш столини мослаш учун ёрдамчи +GenericName[ven]=Wizadi ya mavhekanyele a desikithopo +GenericName[vi]=Trình giúp Thiết lập Màn hình nền +GenericName[wa]=Macrea des apontiaedjes do scribanne +GenericName[xh]=Wizard Yezicwangciso ze Desktop +GenericName[zh_CN]=桌面设置向导 +GenericName[zh_TW]=桌面設定精靈 +GenericName[zu]=I-Wizard yezilungiselelo ze-Desktop +X-TDE-autostart-after=kdesktop +X-TDE-autostart-condition=kpersonalizerrc:General:FirstLogin:true +X-DCOP-ServiceType=Multi +Categories=Qt;TDE;Settings; +OnlyShowIn=TDE; diff --git a/kpersonalizer/kpersonalizer.h b/kpersonalizer/kpersonalizer.h new file mode 100644 index 000000000..78ff71ee4 --- /dev/null +++ b/kpersonalizer/kpersonalizer.h @@ -0,0 +1,96 @@ +/*************************************************************************** + kpersonalizer.h - description + ------------------- + begin : Die Mai 22 17:24:18 CEST 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KPERSONALIZER_H +#define KPERSONALIZER_H + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <tdeapplication.h> +#include <kwizard.h> + + +/** prototypes */ +class KLanguageCombo; +class TDELocale; +class KCountryPage; +class KOSPage; +class KEyeCandyPage; +class TDEStylePage; +class KRefinePage; + +/** KPersonalizer is the base class of the project */ +class KPersonalizer : public KWizard { + Q_OBJECT +public: + /** construtor */ + KPersonalizer(TQWidget* parent=0, const char *name=0); + /** destructor */ + ~KPersonalizer(); + + virtual void next(); + virtual void back(); + + /** this session is restarted, so we want to start with ospage */ + void restarted(); + + /** KPersonalizer is running before Trinity is started */ + static void setBeforeSession(); + static bool beforeSession() { return before_session; } + +public slots: // Public slots + /** calls all save functions after resetting all features/ OS/ theme selections to Trinity default */ + void setDefaults(); + /** the cancel button is connected to the reject() slot of TQDialog, + * so we have to reimplement this here to add a dialogbox to + * ask if we really want to quit the wizard. + */ + void reject(); + /** maybe call a dialog that the wizard has finished. + * Calls applySettings() to save the current selection. + */ + void accept(); + /** We need this to use it in a TQTimer */ + void slotNext(); + +private: + void setPosition(); + void delayedRestart(); + +private: + KCountryPage* countrypage; + KOSPage* ospage; + KEyeCandyPage* eyecandy; + TDEStylePage* stylepage; + KRefinePage* refinepage; + TDELocale* locale; + bool os_dirty, eye_dirty, style_dirty; + static bool before_session; + +protected slots: // Public slots + /** restart kpersonalizer to run it in new language */ + void slotRestart(); + +protected: // Protected methods + // the close button on the titlebar sets e->accept() which we don�t want. + virtual void closeEvent(TQCloseEvent*); + bool askClose(); +}; + +#endif diff --git a/kpersonalizer/krefinepage.cpp b/kpersonalizer/krefinepage.cpp new file mode 100644 index 000000000..568967690 --- /dev/null +++ b/kpersonalizer/krefinepage.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + krefinepage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include <tqlabel.h> +#include <tqpushbutton.h> + +#include <krun.h> +#include <tdeconfig.h> +#include <tdeapplication.h> +#include <tdeglobal.h> +#include <kiconloader.h> +#include "krefinepage.h" +#include "kpersonalizer.h" + + +KRefinePage::KRefinePage(TQWidget *parent, const char *name ) : KRefinePageDlg(parent,name) { + px_finishSidebar->setPixmap(UserIcon("step5.png")); + connect( pb_kcontrol, TQT_SIGNAL(clicked()), TQT_SLOT(startKControl()) ); + if( KPersonalizer::beforeSession()) { + pb_kcontrol->hide(); + lb_kcontrol->hide(); + } + px_kcontrol->setPixmap(TDEGlobal::iconLoader()->loadIcon("kcontrol", TDEIcon::Panel, TDEIcon::SizeMedium)); +} +KRefinePage::~KRefinePage(){ +} +/** starts kcontrol via krun when the user presses the +start control center button on page 5. */ +void KRefinePage::startKControl(){ + KRun::runCommand("kcontrol"); +} +#include "krefinepage.moc" diff --git a/kpersonalizer/krefinepage.h b/kpersonalizer/krefinepage.h new file mode 100644 index 000000000..4065b5a28 --- /dev/null +++ b/kpersonalizer/krefinepage.h @@ -0,0 +1,38 @@ +/*************************************************************************** + krefinepage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KREFINEPAGE_H +#define KREFINEPAGE_H + +#include "krefinepagedlg.h" + +/**Abstract class for the final settings refinement. Intends to call KControl for now + *@author Ralf Nolden + */ + +class KRefinePage : public KRefinePageDlg { + Q_OBJECT +public: + KRefinePage(TQWidget *parent=0, const char *name=0); + ~KRefinePage(); +public slots: // Public slots + /** starts kcontrol via krun when the user presses the +start control center button on page 5. */ + void startKControl(); +}; + +#endif diff --git a/kpersonalizer/krefinepagedlg.ui b/kpersonalizer/krefinepagedlg.ui new file mode 100644 index 000000000..50b30b655 --- /dev/null +++ b/kpersonalizer/krefinepagedlg.ui @@ -0,0 +1,249 @@ +<!DOCTYPE UI><UI version="3.1" stdsetdef="1"> +<class>KRefinePageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>KRefinePageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>555</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel11</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string><h3>Finished</h3> +<p>After closing this dialog you can always restart this Wizard by choosing the entry <b>Desktop Settings Wizard</b> from the Settings menu.</p></string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="TQFrame" row="2" column="1"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>Box</enum> + </property> + <property name="frameShadow"> + <enum>Raised</enum> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel"> + <property name="name"> + <cstring>px_kcontrol</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQLabel"> + <property name="name"> + <cstring>TextLabel1</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>You can refine the settings you made by starting the Trinity Control Center by choosing the entry <b>Control Center</b> in the TDE menu.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignTop|AlignLeft</set> + </property> + </widget> + </hbox> + </widget> + <widget class="TQLabel" row="0" column="0" rowspan="7" colspan="1"> + <property name="name"> + <cstring>px_finishSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="TQLabel" row="4" column="1"> + <property name="name"> + <cstring>lb_kcontrol</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>You can also start the Trinity Control Center using the button below.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignCenter</set> + </property> + </widget> + <spacer row="1" column="1"> + <property name="name"> + <cstring>Spacer5</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>30</width> + <height>16</height> + </size> + </property> + </spacer> + <spacer row="3" column="1"> + <property name="name"> + <cstring>Spacer5_3</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Fixed</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>16</height> + </size> + </property> + </spacer> + <widget class="TQLayoutWidget" row="5" column="1"> + <property name="name"> + <cstring>Layout5</cstring> + </property> + <hbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <spacer> + <property name="name"> + <cstring>Spacer5_2</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + <widget class="TQPushButton"> + <property name="name"> + <cstring>pb_kcontrol</cstring> + </property> + <property name="text"> + <string>&Launch Trinity Control Center</string> + </property> + </widget> + <spacer> + <property name="name"> + <cstring>Spacer10</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </hbox> + </widget> + <spacer row="6" column="1"> + <property name="name"> + <cstring>Spacer11</cstring> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + <property name="sizeType"> + <enum>Expanding</enum> + </property> + <property name="sizeHint"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </grid> +</widget> +<includes> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/ksysinfo.cpp b/kpersonalizer/ksysinfo.cpp new file mode 100644 index 000000000..20a089b8f --- /dev/null +++ b/kpersonalizer/ksysinfo.cpp @@ -0,0 +1,261 @@ +/*************************************************************************** + ksysinfo.cpp - description + ------------------- + begin : Don Jul 11 2002 + copyright : (C) 2002 by Carsten Wolff, Christoph Held + email : [email protected], [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +/* + * Code partly taken from kcontrol/info and kcontrol/fonts + */ + +#include <tqfontdatabase.h> +#include <tqfont.h> +#include <tqstring.h> +#include <tqstringlist.h> + +#include <kdebug.h> + +#include <X11/Xlib.h> + +#include "ksysinfo.h" + +KSysInfo::KSysInfo() { + m_fdb = new TQFontDatabase(); + initXInfo(); + initFontFamilies(); + initHWInfo(); + kdDebug() << "KSysInfo: XServer Vendor: " << m_xvendor << endl + << "KSysInfo: XServer from XFree Inc: " << m_xfree_inc << endl + << "KSysInfo: XServer Release Number: " << m_xrelease << endl + << "KSysInfo: XRENDER support is: " << m_xrender << endl + << "KSysInfo: Chosen normal font: "<< m_normal_font << endl + << "KSysInfo: Chosen fixed width font: "<< m_fixed_font << endl + << "KSysInfo: CPU speed: " << m_cpu_speed << " MHz" << endl; +} + +KSysInfo::~KSysInfo() { + delete m_fdb; +} + +/* + * XServer - Info + */ + +void KSysInfo::initXInfo() { + Display *dpy = XOpenDisplay(0); + // vendor + m_xvendor = !dpy ? TQString::null : (TQString)ServerVendor(dpy); + // XFree-Inc? + m_xfree_inc = m_xvendor.contains("XFree86"); + // X.org ? + m_xorg = m_xvendor.contains("X.Org"); + // release-number + m_xrelease = !dpy ? 0 : VendorRelease(dpy); + // RENDER-support + m_xrender = false; + int extCount; + TQString extension; + char **extensions = XListExtensions( dpy, &extCount ); + for (int i = 0; i < extCount; i++ ) { + extension=TQString( extensions[i] ); + extension=extension.stripWhiteSpace(); + if (!extension.compare("RENDER")) + m_xrender=true; + } + XFreeExtensionList(extensions); + XCloseDisplay (dpy); +} + +bool KSysInfo::isXfromXFreeInc() { + return m_xfree_inc; +} + +bool KSysInfo::isXfromXOrg() { + return m_xorg; +} + +int KSysInfo::getXRelease() { + return m_xrelease; +} + +bool KSysInfo::getRenderSupport(){ + return m_xrender; +} + +/* + * Font - Info + */ + +void KSysInfo::initFontFamilies() { + TQFontDatabase fdb; + TQStringList families = fdb.families(); + m_normal_font = TQString::null; + m_fixed_font = TQString::null; + int normal_priority = 0, fixed_priority = 0; + for (uint i=0; i < families.count(); i++) { + TQString font = *families.at(i); + //add further NORMAL fonts here + if ( (font.contains("Arial [") || font=="Arial") && normal_priority < 15 ) { + m_normal_font = font; + normal_priority = 15; + } else if ( font.contains("Vera Sans") && normal_priority < 12 ) { + m_normal_font = font; + normal_priority = 12; + } else if ( (font.contains("Luxi Sans") || font.contains("Lucidux Sans")) && normal_priority < 10 ) { + m_normal_font = font; + normal_priority = 10; + } else if ( font.contains("Helmet") && normal_priority < 7 ) { + m_normal_font = font; + normal_priority = 7; + } else if ( font.contains("Nimbus Sans") && normal_priority < 5 ) { + m_normal_font = font; + normal_priority = 5; + } else if ( font.contains("Sans") & m_fdb->isSmoothlyScalable(font) && normal_priority < 3 ) { + m_normal_font = font; + normal_priority = 3; + } else if ( m_fdb->isSmoothlyScalable(font) && !(m_fdb->isFixedPitch(font,"Normal") && m_fdb->isFixedPitch(font,"Bold")) && normal_priority < 2) { + m_normal_font = font; + normal_priority = 2; + } else if ( m_fdb->isSmoothlyScalable(font) && normal_priority < 1 ) { + m_normal_font = font; + normal_priority = 1; + } + //add further FIXED fonts here + if (font.contains("Courier New") && fixed_priority < 15){ + m_fixed_font = font; + fixed_priority = 15; + } else if ( (font.contains("Luxi Mono") || font.contains("Lucidux Mono")) && fixed_priority < 10 ) { + m_fixed_font = font; + fixed_priority = 10; + } else if (font.contains("Andale Mono") && fixed_priority < 5) { + m_fixed_font = font; + fixed_priority = 5; + } else if ( font.contains("Mono") && m_fdb->isSmoothlyScalable(font) && fixed_priority < 3 ) { + m_fixed_font = font; + fixed_priority = 3; + } else if ( m_fdb->isSmoothlyScalable(font) && m_fdb->isFixedPitch(font,"Normal") && fixed_priority < 2 ) { + m_fixed_font = font; + fixed_priority = 2; + } else if ( m_fdb->isSmoothlyScalable(font) && fixed_priority < 1 ) { + m_fixed_font = font; + fixed_priority = 1; + } + } +} + +TQFont KSysInfo::getNormalFont() { + return m_fdb->font(m_normal_font,"Normal",12); // this will return the current font, if !m_normal_font +} + +TQFont KSysInfo::getSmallFont(){ + return m_fdb->font(m_normal_font,"Normal",11); +} + +TQFont KSysInfo::getBoldFont(){ + return m_fdb->font(m_normal_font,"Bold",12); +} + +TQFont KSysInfo::getFixedWidthFont(){ + return m_fdb->font(m_fixed_font,"Normal",10); +} + +/** + * Hardware - Info + * (Architecture - dependent code) + */ + +/////////////////// +#ifdef __linux__ +/////////////////// + + #include <tqfile.h> + #include <math.h> + + void KSysInfo::initHWInfo() { + char buf[512]; + TQFile *file = new TQFile("/proc/cpuinfo"); + + m_cpu_speed = 0; + + if (!file->exists()) { //CPU info file does not exist, use default value + delete file; //only the object :o) + return; + } + + if (!file->open(IO_ReadOnly)) { //No read access, use default value + delete file; + return; + } + + // File Parser + while (file->readLine(buf, sizeof(buf) - 1) > 0) { + TQString s1 = TQString::fromLocal8Bit(buf); + TQString s2 = s1.mid(s1.find(":") + 1); + s1.truncate(s1.find(":")); + s1=s1.stripWhiteSpace(); + s2=s2.stripWhiteSpace(); + if(s1.contains("MHz")){ + float fspeed = s2.toFloat(0); + fspeed = floor(fspeed); + m_cpu_speed = (int)fspeed; + } + } + delete file; + } + +/////////////////// +//#elif sgi +/////////////////// + +/////////////////// +//#elif __FreeBSD__ +/////////////////// + +/////////////////// +//#elif hpux +/////////////////// + +/////////////////// +//#elif __NetBSD__ +/////////////////// + +/////////////////// +//#elif __OpenBSD__ +/////////////////// + +/////////////////// +//#elif defined(__svr4__) && defined(sun) +/////////////////// + +/////////////////// +//#elif __svr4__ +/////////////////// + +/////////////////// +//#elif _AIX +/////////////////// + +/////////////////// +#else +/////////////////// + + void KSysInfo::initHWInfo() { + m_cpu_speed = 0; + } + +#endif + +int KSysInfo::getCpuSpeed() { + return m_cpu_speed; +} diff --git a/kpersonalizer/ksysinfo.h b/kpersonalizer/ksysinfo.h new file mode 100644 index 000000000..5ae97c5a2 --- /dev/null +++ b/kpersonalizer/ksysinfo.h @@ -0,0 +1,60 @@ +/*************************************************************************** + ksysinfo.h - description + ------------------- + begin : Don Jul 11 2002 + copyright : (C) 2002 by Carsten Wolff, Christoph Held + email : [email protected], [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef KSYSINFO_H +#define KSYSINFO_H + +class TQString; +class TQFont; +class TQFontDatabase; + +class KSysInfo { +public: + KSysInfo(); + ~KSysInfo(); + /* XServer - info */ + bool isXfromXFreeInc(); + bool isXfromXOrg(); + int getXRelease(); + bool getRenderSupport(); + /* font - info */ + TQFont getNormalFont(); + TQFont getSmallFont(); + TQFont getBoldFont(); + TQFont getFixedWidthFont(); + /* Hardware - info */ + int getCpuSpeed(); +private: + void initXInfo(); + void initFontFamilies(); + void initHWInfo(); +private: + /* XServer - info */ + TQString m_xvendor; + bool m_xfree_inc; + bool m_xorg; + int m_xrelease; + bool m_xrender; + /* font - info */ + TQFontDatabase* m_fdb; + TQString m_normal_font; + TQString m_fixed_font; + /* Hardware - info */ + int m_cpu_speed; +}; + +#endif diff --git a/kpersonalizer/main.cpp b/kpersonalizer/main.cpp new file mode 100644 index 000000000..e03c19038 --- /dev/null +++ b/kpersonalizer/main.cpp @@ -0,0 +1,74 @@ +/*************************************************************************** + main.cpp - description + ------------------- + begin : Die Mai 22 17:24:18 CEST 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#include <tdecmdlineargs.h> +#include <tdeaboutdata.h> +#include <tdelocale.h> +#include <dcopclient.h> +#include <tdeglobal.h> + +#include "kpersonalizer.h" +#include "kfindlanguage.h" + +static const char description[] = I18N_NOOP("KPersonalizer"); + +static TDECmdLineOptions options[] = +{ + { "r", I18N_NOOP("Personalizer is restarted by itself"), 0 }, + { "before-session", I18N_NOOP("Personalizer is running before Trinity session"), 0 }, + TDECmdLineLastOption +}; + +int main(int argc, char *argv[]) +{ + TDEAboutData aboutData( "kpersonalizer", I18N_NOOP("KPersonalizer"), + VERSION, description, TDEAboutData::License_GPL, + "(c) 2001, Ralf Nolden", 0, 0, "[email protected]"); + aboutData.addAuthor("Ralf Nolden",0, "[email protected]"); + aboutData.addAuthor("Carsten Wolff",0, "[email protected]"); + aboutData.addAuthor("qwertz",0, "[email protected]"); + aboutData.addAuthor("Bernhard Rosenkraenzer", 0, "[email protected]"); + TDECmdLineArgs::init( argc, argv, &aboutData ); + TDECmdLineArgs::addCmdLineOptions( options ); // Add our own options. + + TDELocale::setMainCatalogue("kpersonalizer"); + + TDEApplication a; + if ( !kapp->dcopClient()->isAttached() ) + kapp->dcopClient()->attach(); + + TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs(); + + if (args->isSet("before-session")) + KPersonalizer::setBeforeSession(); + + if (!args->isSet("r")) { // we'll first show the first page + KFindLanguage *flang = new KFindLanguage(); + if( !flang->getBestLang().isEmpty()) // if we have the users language, use it + TDEGlobal::locale()->setLanguage( flang->getBestLang() ); + delete flang; + } + + KPersonalizer *kpersonalizer = new KPersonalizer(); + // is personalizer restarted by itself? + if (args->isSet("r")) + kpersonalizer->restarted(); + a.setMainWidget(kpersonalizer); + kpersonalizer->show(); + + return a.exec(); +} diff --git a/kpersonalizer/pics/CMakeLists.txt b/kpersonalizer/pics/CMakeLists.txt new file mode 100644 index 000000000..dc1cdd671 --- /dev/null +++ b/kpersonalizer/pics/CMakeLists.txt @@ -0,0 +1,14 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +install( FILES + step1.png step2.png step3.png step4.png step5.png + DESTINATION ${DATA_INSTALL_DIR}/kpersonalizer/pics ) diff --git a/kpersonalizer/pics/Makefile.am b/kpersonalizer/pics/Makefile.am new file mode 100644 index 000000000..f80acd58f --- /dev/null +++ b/kpersonalizer/pics/Makefile.am @@ -0,0 +1,3 @@ +kpersonalizer_pics_data_DATA = step1.png step2.png step3.png step4.png step5.png +kpersonalizer_pics_datadir = $(kde_datadir)/kpersonalizer/pics + diff --git a/kpersonalizer/pics/step1.png b/kpersonalizer/pics/step1.png Binary files differnew file mode 100644 index 000000000..a71b74bfd --- /dev/null +++ b/kpersonalizer/pics/step1.png diff --git a/kpersonalizer/pics/step2.png b/kpersonalizer/pics/step2.png Binary files differnew file mode 100644 index 000000000..647808f0c --- /dev/null +++ b/kpersonalizer/pics/step2.png diff --git a/kpersonalizer/pics/step3.png b/kpersonalizer/pics/step3.png Binary files differnew file mode 100644 index 000000000..9d22cc8fa --- /dev/null +++ b/kpersonalizer/pics/step3.png diff --git a/kpersonalizer/pics/step4.png b/kpersonalizer/pics/step4.png Binary files differnew file mode 100644 index 000000000..dfeee7872 --- /dev/null +++ b/kpersonalizer/pics/step4.png diff --git a/kpersonalizer/pics/step5.png b/kpersonalizer/pics/step5.png Binary files differnew file mode 100644 index 000000000..908c6a255 --- /dev/null +++ b/kpersonalizer/pics/step5.png diff --git a/kpersonalizer/stylepreview.ui b/kpersonalizer/stylepreview.ui new file mode 100644 index 000000000..7e132c4c7 --- /dev/null +++ b/kpersonalizer/stylepreview.ui @@ -0,0 +1,186 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>StylePreview</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>StylePreview</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>343</width> + <height>231</height> + </rect> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQFrame"> + <property name="name"> + <cstring>Frame3</cstring> + </property> + <property name="frameShape"> + <enum>StyledPanel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQTabWidget" row="0" column="0"> + <property name="name"> + <cstring>TabWidget2</cstring> + </property> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Tab 1</string> + </attribute> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQProgressBar" row="0" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>ProgressBar1</cstring> + </property> + <property name="progress"> + <number>70</number> + </property> + </widget> + <widget class="TQPushButton" row="2" column="2"> + <property name="name"> + <cstring>PushButton1</cstring> + </property> + <property name="text"> + <string>Button</string> + </property> + </widget> + <widget class="TQSpinBox" row="2" column="1"> + <property name="name"> + <cstring>SpinBox1</cstring> + </property> + </widget> + <widget class="TQComboBox" row="3" column="1" rowspan="1" colspan="2"> + <item> + <property name="text"> + <string>ComboBox</string> + </property> + </item> + <property name="name"> + <cstring>ComboBox1</cstring> + </property> + </widget> + <widget class="TQSlider" row="1" column="1" rowspan="1" colspan="2"> + <property name="name"> + <cstring>Slider1</cstring> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQButtonGroup" row="0" column="0" rowspan="4" colspan="1"> + <property name="name"> + <cstring>ButtonGroup1</cstring> + </property> + <property name="title"> + <string>Button Group</string> + </property> + <vbox> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>RadioButton1</cstring> + </property> + <property name="text"> + <string>RadioButton</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + <widget class="TQRadioButton"> + <property name="name"> + <cstring>RadioButton2</cstring> + </property> + <property name="text"> + <string>RadioButton</string> + </property> + </widget> + <widget class="Line"> + <property name="name"> + <cstring>Line1</cstring> + </property> + <property name="frameShape" stdset="0"> + <enum>HLine</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="orientation"> + <enum>Horizontal</enum> + </property> + </widget> + <widget class="TQCheckBox"> + <property name="name"> + <cstring>CheckBox1</cstring> + </property> + <property name="text"> + <string>CheckBox</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + <property name="tristate"> + <bool>false</bool> + </property> + </widget> + </vbox> + </widget> + <widget class="TQScrollBar" row="0" column="3" rowspan="4" colspan="1"> + <property name="name"> + <cstring>ScrollBar1</cstring> + </property> + <property name="maxValue"> + <number>19</number> + </property> + <property name="orientation"> + <enum>Vertical</enum> + </property> + </widget> + </grid> + </widget> + <widget class="TQWidget"> + <property name="name"> + <cstring>tab</cstring> + </property> + <attribute name="title"> + <string>Tab 2</string> + </attribute> + </widget> + </widget> + </grid> + </widget> + </vbox> +</widget> +<connections> +</connections> +<includes> + <include location="local" impldecl="in implementation">stylepreview.ui.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<Q_SLOTS> + <slot>init()</slot> + <slot returnType="bool">eventFilter( TQObject * obj, TQEvent * ev )</slot> +</Q_SLOTS> + +<layoutdefaults spacing="3" margin="6"/> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/stylepreview.ui.h b/kpersonalizer/stylepreview.ui.h new file mode 100644 index 000000000..66388024f --- /dev/null +++ b/kpersonalizer/stylepreview.ui.h @@ -0,0 +1,77 @@ +/* + * Style Preview Widget + * Copyright (C) 2002 Karol Szwed <[email protected]> + * Copyright (C) 2002 Daniel Molkentin <[email protected]> + * + * Portions Copyright (C) 2000 TrollTech AS. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + *************************************************************************** + ** ui.h extension file, included from the uic-generated form implementation. + ** + ** If you wish to add, delete or rename slots use Qt Designer which will + ** update this file, preserving your code. Create an init() slot in place of + ** a constructor, and a destroy() slot in place of a destructor. + *****************************************************************************/ + +#include <tqobjectlist.h> + +#ifdef KeyPress +#undef KeyPress +#endif + +#ifdef KeyRelease +#undef KeyRelease +#endif + +void StylePreview::init() +{ + // Ensure that the user can't toy with the child widgets. + // Method borrowed from Qt's qtconfig. + TQObjectList* l = queryList(TQWIDGET_OBJECT_NAME_STRING); + TQObjectListIt it(*l); + TQObject* obj; + while ((obj = it.current()) != 0) + { + ++it; + obj->installEventFilter(this); + ((TQWidget*)obj)->setFocusPolicy(TQ_NoFocus); + } + delete l; +} + +bool StylePreview::eventFilter( TQObject* /* obj */, TQEvent* ev ) +{ + switch( ev->type() ) + { + case TQEvent::MouseButtonPress: + case TQEvent::MouseButtonRelease: + case TQEvent::MouseButtonDblClick: + case TQEvent::MouseMove: + case TQEvent::KeyPress: + case TQEvent::KeyRelease: + case TQEvent::Enter: + case TQEvent::Leave: + case TQEvent::Wheel: + case TQEvent::ContextMenu: + return TRUE; // ignore + default: + break; + } + return FALSE; +} + +// vim: set noet ts=4: diff --git a/kpersonalizer/tdestylepage.cpp b/kpersonalizer/tdestylepage.cpp new file mode 100644 index 000000000..4995460cb --- /dev/null +++ b/kpersonalizer/tdestylepage.cpp @@ -0,0 +1,584 @@ +/*************************************************************************** + tdestylepage.cpp - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ +#include <stdlib.h> + +#include <tqdir.h> +#include <tqlabel.h> +#include <tqlistview.h> +#include <tqcolor.h> +#include <tqstylefactory.h> +#include <tqpixmapcache.h> +#include <tqstyle.h> +#include <tqobjectlist.h> + +#include <tdeconfig.h> +#include <kstandarddirs.h> +#include <tdeapplication.h> +#include <tdeglobal.h> +#include <kdebug.h> +#include <kdesktopfile.h> +#include <tdelocale.h> +#include <tdelistview.h> +#include <kipc.h> +#include <ksimpleconfig.h> +#include <dcopclient.h> +#include <tdestyle.h> +#include <kicontheme.h> +#include <kiconloader.h> + +#include "stylepreview.h" +#include "tdestylepage.h" + +TDEStylePage::TDEStylePage(TQWidget *parent, const char *name ) : TDEStylePageDlg(parent,name) { + + px_stylesSidebar->setPixmap(UserIcon("step4.png")); + + klv_styles->addColumn(i18n("Style")); + klv_styles->addColumn( i18n( "Description" ) ); + klv_styles->setAllColumnsShowFocus(true); + + kde = new TQListViewItem( klv_styles); + kde->setText( 0, TQPixmap::defaultDepth() > 8 ? i18n( "Plastik" ) : i18n( "Light" ) ); + kde->setText( 1, i18n( "TDE default style" ) ); + + classic = new TQListViewItem( klv_styles); + classic->setText( 0, i18n( "KDE Classic" ) ); + classic->setText( 1, i18n( "Classic KDE style" ) ); + + keramik = new TQListViewItem( klv_styles ); + keramik->setText( 0, i18n( "Keramik" ) ); + keramik->setText( 1, i18n( "The previous default style" ) ); + + cde = new TQListViewItem( klv_styles); + cde->setText( 0, i18n( "Sunshine" ) ); + cde->setText( 1, i18n( "A very common desktop" ) ); + + win = new TQListViewItem( klv_styles ); + win->setText( 0, i18n( "Redmond" ) ); + win->setText( 1, i18n( "A style from the northwest of the USA" ) ); + + platinum = new TQListViewItem( klv_styles ); + platinum->setText( 0, i18n( "Platinum" ) ); + platinum->setText( 1, i18n( "The platinum style" ) ); + + connect(klv_styles, TQT_SIGNAL(selectionChanged()), + this, TQT_SLOT(slotCurrentChanged())); + + // Note: if the default is changed here it needs to be changed in tdebase/twin/plugins.cpp + // and tdebase/twin/kcmtwin/twindecoration/twindecoration.cpp as well. + defaultKWinStyle = TQPixmap::defaultDepth() > 8 ? "twin_plastik" : "twin_quartz"; + appliedStyle = NULL; + + getAvailability(); + getUserDefaults(); + initColors(); +} + +TDEStylePage::~TDEStylePage(){ + delete ctwin; + delete appliedStyle; +} + +void TDEStylePage::save(bool curSettings){ + kdDebug() << "TDEStylePage::save()" << endl; + // First, the style, then the colors as styles overwrite color settings + saveStyle(curSettings); + saveColors(curSettings); + saveKWin(curSettings); + saveIcons(curSettings); + liveUpdate(); +} + +/** save the widget-style */ +void TDEStylePage::saveStyle(bool curSettings){ + TQString style = curSettings ? currentStyle : origStyle; + TDEConfig cfg( "kdeglobals" ); + cfg.setGroup("General"); + cfg.writeEntry( "widgetStyle", style, true, true ); + cfg.sync(); + kdDebug() << "TDEStylePage::saveStyle(): " << style << endl; +} + +/** save the KWin-style*/ +void TDEStylePage::saveKWin(bool curSettings){ + TQString twin = origKWinStyle; + if(curSettings) { + KDesktopFile* kdf = 0L; + TDEStandardDirs* kstd = TDEGlobal::dirs(); + if (cde->isSelected() && twin_cde_exist) + kdf = new KDesktopFile(kstd->findResource("data", "twin/cde.desktop")); + else if (win->isSelected() && twin_win_exist) + kdf = new KDesktopFile(kstd->findResource("data", "twin/redmond.desktop")); + else if (platinum->isSelected() && twin_system_exist) + kdf = new KDesktopFile(kstd->findResource("data", "twin/system.desktop")); + else if (keramik->isSelected() && twin_keramik_exist) + kdf = new KDesktopFile(kstd->findResource("data", "twin/keramik.desktop")); + else if (kde->isSelected()) { + if (twin_plastik_exist && (TQColor::numBitPlanes() > 8)) + kdf = new KDesktopFile(kstd->findResource("data", "twin/plastik.desktop")); + else if (twin_quartz_exist) + kdf = new KDesktopFile(kstd->findResource("data", "twin/quartz.desktop")); + } + + if (kdf) { + kdf->setGroup("Desktop Entry"); + twin = kdf->readEntry("X-TDE-Library", defaultKWinStyle); + delete kdf; + } + else { + // if we get here classic is selected (there's no .desktop file for the + // kde2 twin style), or none of the other twin styles were found. + twin = "twin_default"; + } + } + ctwin->writeEntry("PluginLib", twin); + ctwin->sync(); + kdDebug() << "TDEStylePage::saveKWin(): " << twin << endl; +} + +/** Save the color-scheme */ +void TDEStylePage::saveColors(bool curSettings){ + struct colorSet* toSave; + if(curSettings) + toSave=¤tColors; // set the color struct to save as the style colors + else + toSave=&usrColors; + + // the GLOBAL config entries must be taken from the kcsrc file and written to it. Use the default values + // equals that the file is <default> which is no file. TODO: use the default values in that case (kde selected) + TDEConfig *config = TDEGlobal::config(); + config->setGroup( "General" ); + config->writeEntry("foreground", toSave->foreground, true, true); + config->writeEntry("background", toSave->background, true, true); + config->writeEntry("windowForeground", toSave->windowForeground, true, true); + config->writeEntry("windowBackground", toSave->windowBackground, true, true); + config->writeEntry("selectForeground", toSave->selectForeground, true, true); + config->writeEntry("selectBackground", toSave->selectBackground, true, true); + config->writeEntry("buttonForeground", toSave->buttonForeground, true, true); + config->writeEntry("buttonBackground", toSave->buttonBackground, true, true); + config->writeEntry("linkColor", toSave->linkColor, true, true); + config->writeEntry("visitedLinkColor", toSave->visitedLinkColor, true, true); + + // set to the WM group, *only* the TDEGlobal one, a kcsrc file only has the group "Color Scheme" hmpf... + config->setGroup( "WM" ); + config->writeEntry("activeForeground", toSave->activeForeground, true, true); + config->writeEntry("inactiveForeground", toSave->inactiveForeground, true, true); + config->writeEntry("activeBackground", toSave->activeBackground, true, true); + config->writeEntry("inactiveBackground", toSave->inactiveBackground, true, true); + config->writeEntry("activeBlend", toSave->activeBlend, true, true); + config->writeEntry("inactiveBlend", toSave->inactiveBlend, true, true); + config->writeEntry("activeTitleBtnBg", toSave->activeTitleBtnBg, true, true); + config->writeEntry("inactiveTitleBtnBg", toSave->inactiveTitleBtnBg, true, true); + config->writeEntry("alternateBackground", toSave->alternateBackground, true, true); + + //////////////////////////////////////////////////// + // KDE-1.x support + KSimpleConfig *tdeconfig = + new KSimpleConfig( TQDir::homeDirPath() + "/.tderc" ); + tdeconfig->setGroup( "General" ); + tdeconfig->writeEntry("background", toSave->background ); + tdeconfig->writeEntry("selectBackground", toSave->selectBackground ); + tdeconfig->writeEntry("foreground", toSave->foreground ); + tdeconfig->writeEntry("windowForeground", toSave->windowForeground ); + tdeconfig->writeEntry("windowBackground", toSave->windowBackground ); + tdeconfig->writeEntry("selectForeground", toSave->selectForeground ); + tdeconfig->sync(); + delete tdeconfig; + + config->setGroup("KDE"); + // write the color scheme filename and the contrast, default 7, otherwise from file + config->writeEntry("colorScheme", toSave->colorFile,true, true); + config->writeEntry("contrast", toSave->contrast, true, true); + config->sync(); + + // background color changes + TDEConfig kdesktop("kdesktoprc"); + kdesktop.setGroup("Desktop0"); // we only need to set one desktop + + kdesktop.writeEntry("BackgroundMode", toSave->bgMode); + kdesktop.writeEntry("Color1", toSave->usrCol1); + kdesktop.writeEntry("Color2", toSave->usrCol2); + kdesktop.sync(); + kdDebug() << "TDEStylePage::saveColors(): colorFile: " << toSave->colorFile << endl; +} + +/** save the icon-theme*/ +void TDEStylePage::saveIcons(bool curSettings) { + TQString theme = origIcons; + if (curSettings) { + if ( (kde->isSelected() || platinum->isSelected() || keramik->isSelected()) + && icon_crystalsvg_exist) + theme = "crystalsvg"; + else if ( (classic->isSelected() || cde->isSelected() || win->isSelected()) + && (TQColor::numBitPlanes() > 8) && icon_kdeclassic_exist) + theme = "kdeclassic"; + else if ( (classic->isSelected() || cde->isSelected() || win->isSelected()) + && (TQColor::numBitPlanes() <= 8) && icon_Locolor_exist) + theme = "Locolor"; + } + // save, what we got + TDEGlobal::config()->setGroup("Icons"); + TDEGlobal::config()->writeEntry("Theme", theme, true, true); + TDEIconTheme icontheme(theme); + const char * const groups[] = { "Desktop", "Toolbar", "MainToolbar", "Small", 0L }; + for (TDEIcon::Group i=TDEIcon::FirstGroup; i<TDEIcon::LastGroup; i++) { + if (groups[i] == 0L) + break; + TDEGlobal::config()->setGroup(TQString::fromLatin1(groups[i]) + "Icons"); + TDEGlobal::config()->writeEntry("Size", icontheme.defaultSize(i)); + } + TDEGlobal::config()->sync(); + kdDebug() << "TDEStylePage::saveIcons(): " << theme << endl; +} + +/** called whenever the selection in the listview changes */ +void TDEStylePage::slotCurrentChanged() { + // fill the currentColors-struct with the selected color-scheme + getColors(¤tColors, true); + // fill the currentStyle-string with the selected style-name + changeCurrentStyle(); + switchPrevStyle(); +} + +void TDEStylePage::changeCurrentStyle() { + // set the style + if (cde->isSelected() && cde_exist) { + currentStyle="Motif"; + } + else if (win->isSelected() && win_exist) { + currentStyle="Windows"; + } + else if (platinum->isSelected() && platinum_exist) { + currentStyle="Platinum"; + } + else if (keramik->isSelected() && kde_plastik_exist) { + currentStyle="Keramik"; + } + else if (classic->isSelected()) { + // Use the highcolor style if the display supports it + if ( (TQColor::numBitPlanes() > 8) && kde_hc_exist ) { + currentStyle="HighColor"; + } + else if (kde_def_exist) { + currentStyle="Default"; + } + } + else if (kde->isSelected()) { + // Use the plastik style if the display supports it + if ( (TQColor::numBitPlanes() > 8) && kde_plastik_exist ) { + currentStyle="Plastik"; + } + else if (kde_light_exist) { + currentStyle="Light, 3rd revision"; + } + // We should never get here + else if (kde_def_exist) { + currentStyle="Default"; + } + } + // update the preview-widget + kdDebug() << "TDEStylePage::changeCurrentStyle(): "<< currentStyle << endl; +} + +/** to be connected to the OS page. Catches + * either KDE, CDE, win or mac and pre-sets the style. + */ +void TDEStylePage::presetStyle(const TQString& style){ + kdDebug() << "TDEStylePage::presetStyle(): "<< style << endl; + if(style=="KDE") { + if (kde_plastik_exist) + klv_styles->setSelected(kde,true); + else if (kde_hc_exist || kde_def_exist) + klv_styles->setSelected(classic,true); + } + else if(style=="CDE" && cde_exist) + klv_styles->setSelected(cde,true); + else if(style=="win" && win_exist) + klv_styles->setSelected(win,true); + else if(style=="mac") { + klv_styles->setSelected(platinum,true); + } +} + +/** set the defaults for this page */ +void TDEStylePage::setDefaults(){ +} + +/** Fill a colorSet with a colorfile, or the default. */ +void TDEStylePage::getColors(colorSet *set, bool colorfile ){ + TDEConfig* config; + bool deleteConfig = false; + // get the color scheme file and go to the color scheme group + if(colorfile){ + TDEGlobal::dirs()->addResourceType("colors", TDEStandardDirs::kde_default("data")+"tdedisplay/color-schemes"); + // set the style + if (kde->isSelected()) { + set->bgMode="Flat"; + set->usrCol1.setNamedColor("#003082"); + set->usrCol2.setNamedColor("#6C8BB9"); + set->colorFile="<default>"; + } + else if(classic->isSelected()){ + set->bgMode="VerticalGradient"; + set->usrCol1.setNamedColor ("#1E72A0"); + set->usrCol2.setNamedColor ("#C0C0C0"); + set->colorFile=locate("colors", "KDETwo.kcsrc"); + } + else if(keramik->isSelected()){ + set->bgMode="VerticalGradient"; + set->usrCol1.setNamedColor ("#1E72A0"); + set->usrCol2.setNamedColor ("#C0C0C0"); + set->colorFile=locate("colors","Keramik.kcsrc"); + } + else if(cde->isSelected()){ + set->bgMode="Flat"; + set->usrCol1.setNamedColor("#718BA5"); + set->usrCol2.setNamedColor ("#C0C0C0"); + set->colorFile=locate("colors","SolarisCDE.kcsrc"); + } + else if(win->isSelected()){ + set->bgMode="Flat"; + set->usrCol1.setNamedColor("#008183"); + set->usrCol2.setNamedColor ("#C0C0C0"); + set->colorFile=locate("colors","Windows2000.kcsrc"); + } + else if(platinum->isSelected()){ + set->bgMode="VerticalGradient"; + set->usrCol1.setNamedColor("#2A569D"); + set->usrCol2.setNamedColor("#6C8BB9"); + set->colorFile=locate("colors","EveX.kcsrc"); + } + set->contrast=7; + config = new KSimpleConfig(set->colorFile, true); + config->setGroup("Color Scheme"); + kdDebug() << "TDEStylePage::getColors(): schemefile: " << set->colorFile << endl; + deleteConfig = true; + } + else { + TDEConfig kdesktop("kdesktoprc"); + kdesktop.setGroup("Desktop0"); + // set Background (userSettings if available, else default) + set->bgMode=kdesktop.readEntry("BackgroundMode", "Flat"); + TQColor tmp1("#003082"); + TQColor tmp2("#C0C0C0"); + set->usrCol1=kdesktop.readColorEntry("Color1", &tmp1); + set->usrCol2=kdesktop.readColorEntry("Color2", &tmp2); + // write the color scheme filename and the contrast, default 7, otherwise from file + config=TDEGlobal::config(); + config->setGroup("KDE"); + set->colorFile=config->readEntry("colorScheme", "<default>"); + set->contrast=config->readNumEntry("contrast", 7); + config->setGroup( "General" ); + kdDebug() << "TDEStylePage::getColors(): schemefile: "<< set->colorFile << endl; + } + set->foreground=config->readColorEntry( "foreground", &black ); + set->background=config->readColorEntry( "background", &widget ); + set->windowForeground=config->readColorEntry( "windowForeground", &black ); + set->windowBackground=config->readColorEntry( "windowBackground", &white ); + set->selectForeground=config->readColorEntry( "selectForeground", &white ); + set->selectBackground=config->readColorEntry( "selectBackground", &trinity4Blue ); + set->buttonForeground=config->readColorEntry( "buttonForeground", &black ); + set->buttonBackground=config->readColorEntry( "buttonBackground", &button ); + set->linkColor=config->readColorEntry( "linkColor", &link ); + set->visitedLinkColor=config->readColorEntry( "visitedLinkColor", &visitedLink ); + // it's necessary to set the group, when reading from globalrc + if(!colorfile) + config->setGroup( "WM" ); + set->activeForeground=config->readColorEntry("activeForeground", &white); + set->inactiveForeground=config->readColorEntry("inactiveForeground", &inactiveForeground); + set->activeBackground=config->readColorEntry("activeBackground", &activeBackground); + set->inactiveBackground=config->readColorEntry("inactiveBackground", &inactiveBackground); + set->activeBlend=config->readColorEntry("activeBlend", &activeBlend); + set->inactiveBlend=config->readColorEntry("inactiveBlend", &inactiveBackground); + set->activeTitleBtnBg=config->readColorEntry("activeTitleBtnBg", &activeTitleBtnBg); + set->inactiveTitleBtnBg=config->readColorEntry("inactiveTitleBtnBg", &inactiveTitleBtnBg); + set->alternateBackground=config->readColorEntry("alternateBackground", &alternateBackground); + if ( deleteConfig) + delete config; +} + +/** Test widget- and twin- styles for availability */ +void TDEStylePage::getAvailability() { + // test, wich styles are available + kde_keramik_exist = kde_hc_exist = kde_def_exist = cde_exist + = kde_plastik_exist = win_exist = platinum_exist = false; + TQStringList styles = TQStyleFactory::keys(); + for (TQStringList::iterator it = styles.begin(); it != styles.end(); it++) { + if (*it == "Keramik") kde_keramik_exist = true; + else if (*it == "HighColor") kde_hc_exist = true; + else if (*it == "Default") kde_def_exist = true; + else if (*it == "Plastik") kde_plastik_exist = true; + else if (*it == "Motif") cde_exist = true; + else if (*it == "Windows") win_exist = true; + else if (*it == "Platinum") platinum_exist = true; + else if (*it == "Light, 3rd revision") kde_light_exist = true; + } + // and disable the ListItems, if they are not. + if ( !(kde_plastik_exist || kde_light_exist) ) kde->setVisible(false); + if ( !(kde_hc_exist || kde_def_exist) ) classic->setVisible(false); + if (!kde_keramik_exist || TQPixmap::defaultDepth() <= 8) keramik->setVisible(false); + if (!cde_exist) cde->setVisible(false); + if (!win_exist) win->setVisible(false); + if (!platinum_exist) platinum->setVisible(false); + + // test, wich KWin-styles are available + twin_keramik_exist = twin_system_exist = twin_plastik_exist + = twin_default_exist = twin_win_exist + = twin_cde_exist = twin_quartz_exist = false; + TDEStandardDirs* kstd = TDEGlobal::dirs(); + if (!kstd->findResource("data", "twin/keramik.desktop").isNull()) + twin_keramik_exist = true; + if (!kstd->findResource("data", "twin/plastik.desktop").isNull()) + twin_plastik_exist = true; + if (!kstd->findResource("data", "twin/system.desktop").isNull()) + twin_system_exist = true; + if (!kstd->findResource("data", "twin/redmond.desktop").isNull()) + twin_win_exist = true; + if (!kstd->findResource("data", "twin/cde.desktop").isNull()) + twin_cde_exist = true; + if (!kstd->findResource("data", "twin/quartz.desktop").isNull()) + twin_quartz_exist = true; + twin_default_exist = true; // we can't check for a .desktop-file for the old default because there is none + + // check, wich Icon-themes are available + icon_crystalsvg_exist = icon_kdeclassic_exist = icon_Locolor_exist = false; + TQStringList icons(TDEIconTheme::list()); + for (TQStringList::iterator it=icons.begin(); it != icons.end(); it++) { + TDEIconTheme icontheme(*it); + if (icontheme.isHidden() || !icontheme.isValid()) continue; + if (*it == "crystalsvg") icon_crystalsvg_exist = true; + else if (*it == "kdeclassic") icon_kdeclassic_exist = true; + else if (*it == "Locolor") icon_Locolor_exist = true; + } +} + +/** get the user's former settings */ +void TDEStylePage::getUserDefaults() { + // Get the user's current widget-style + TDEGlobal::config()->setGroup("General"); + origStyle = TDEGlobal::config()->readEntry( "widgetStyle", TDEStyle::defaultStyle() ); + + // get the user's current KWin-style + ctwin = new TDEConfig("twinrc"); + ctwin->setGroup("Style"); + origKWinStyle = ctwin->readEntry("PluginLib", defaultKWinStyle); + + // get the users current colors + getColors(&usrColors, false); + + // Get the user's current iconset + TDEGlobal::config()->setGroup("Icons"); + origIcons = TDEGlobal::config()->readEntry("Theme"); + + kdDebug() << "TDEStylePage::getUserDefaults(): style: " << origStyle << endl; + kdDebug() << "TDEStylePage::getUserDefaults(): KWinStyle: " << origKWinStyle << endl; + kdDebug() << "TDEStylePage::getUserDefaults(): Colors: " << usrColors.colorFile << endl; + kdDebug() << "TDEStylePage::getUserDefaults(): Icons: " << origIcons << endl; +} + +/** initialize KDE default color values */ +void TDEStylePage::initColors() { + widget.setRgb(239, 239, 239); + trinity4Blue.setRgb(103,141,178); + inactiveBackground.setRgb(157,170,186); + activeBackground.setRgb(65,142,220); + inactiveForeground.setRgb(221,221,221); + activeBlend.setRgb(107,145,184); + activeTitleBtnBg.setRgb(127,158,200); + inactiveTitleBtnBg.setRgb(167,181,199); + alternateBackground.setRgb(237,244,249); + + if (TQPixmap::defaultDepth() > 8) + button.setRgb(221, 223, 228); + else + button.setRgb(220, 220, 220); + + link.setRgb(0, 0, 238); + visitedLink.setRgb(82, 24, 139); +} + +/** live-update the system */ +void TDEStylePage::liveUpdate() { + // tell all apps about the changed icons + for (int i=0; i<TDEIcon::LastGroup; i++) { + KIPC::sendMessageAll(KIPC::IconChanged, i); + } + // tell all apps about the changed style + KIPC::sendMessageAll(KIPC::StyleChanged); + // color palette changes + KIPC::sendMessageAll(KIPC::PaletteChanged); + // twin-style + kapp->dcopClient()->send("twin*", "", "reconfigure()", TQString("")); + // kdesktop-background + kapp->dcopClient()->send("kdesktop", "KBackgroundIface", "configure()", TQString("")); +} + +/** show the previewWidget styled with the selected one */ +void TDEStylePage::switchPrevStyle() { + TQStyle* style = TQStyleFactory::create(currentStyle); + if (!style) return; + + stylePreview->unsetPalette(); + TQPalette palette = createPalette(); + style->polish(palette); + stylePreview->setPalette(palette); + + // Prevent Qt from wrongly caching radio button images + TQPixmapCache::clear(); + // go ahead + setStyleRecursive( stylePreview, palette, style ); + // this flickers, but reliably draws the widgets corretly. + stylePreview->resize( stylePreview->sizeHint() ); + + delete appliedStyle; + appliedStyle = style; +} + +void TDEStylePage::setStyleRecursive(TQWidget* w, TQPalette &palette, TQStyle* s) { + // Apply the new style. + w->setStyle(s); + // Recursively update all children. + const TQObjectList children = w->childrenListObject(); + if (children.isEmpty()) + return; + // Apply the style to each child widget. + TQPtrListIterator<TQObject> childit(children); + TQObject *child; + while ((child = childit.current()) != 0) { + ++childit; + if (child->isWidgetType()) + setStyleRecursive((TQWidget *) child, palette, s); + } +} + +/** create a TQPalette of our current colorset */ +TQPalette TDEStylePage::createPalette() { + colorSet *cc = ¤tColors; + TQColorGroup disabledgrp(cc->windowForeground, cc->background, cc->background.light(150), + cc->background.dark(), cc->background.dark(120), cc->background.dark(120), + cc->windowBackground); + TQColorGroup colgrp(cc->windowForeground, cc->background, cc->background.light(150), + cc->background.dark(), cc->background.dark(120), cc->foreground, + cc->windowBackground); + colgrp.setColor(TQColorGroup::Highlight, cc->selectBackground); + colgrp.setColor(TQColorGroup::HighlightedText, cc->selectForeground); + colgrp.setColor(TQColorGroup::Button, cc->buttonBackground); + colgrp.setColor(TQColorGroup::ButtonText, cc->buttonForeground); + return TQPalette( colgrp, disabledgrp, colgrp); +} + +#include "tdestylepage.moc" diff --git a/kpersonalizer/tdestylepage.h b/kpersonalizer/tdestylepage.h new file mode 100644 index 000000000..30b907094 --- /dev/null +++ b/kpersonalizer/tdestylepage.h @@ -0,0 +1,128 @@ +/*************************************************************************** + tdestylepage.h - description + ------------------- + begin : Tue May 22 2001 + copyright : (C) 2001 by Ralf Nolden + email : [email protected] + ***************************************************************************/ + +/*************************************************************************** + * * + * 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. * + * * + ***************************************************************************/ + +#ifndef TDESTYLEPAGE_H +#define TDESTYLEPAGE_H + +#include <tqcolor.h> +#include "tdestylepagedlg.h" + +/**Abstract class for the style page + *@author Ralf Nolden + */ +class TQListViewItem; + +class TDEStylePage : public TDEStylePageDlg { + Q_OBJECT + +public: + TDEStylePage(TQWidget *parent=0, const char *name=0); + ~TDEStylePage(); + void save(bool curSettings=true); + /** resets to KDE style as default */ + void setDefaults(); + /** set the preview-widgets' style to the currently selected */ + void switchPrevStyle(); + +private: + TQString origStyle; + TQString origKWinStyle; + TQString origIcons; + TQString defaultKWinStyle; + TQString currentStyle; + TDEConfig* ctwin; + struct colorSet { + TQString colorFile, bgMode; + int contrast; + TQColor usrCol1, usrCol2; + TQColor foreground; + TQColor background; + TQColor windowForeground; + TQColor windowBackground; + TQColor selectForeground; + TQColor selectBackground; + TQColor buttonForeground; + TQColor buttonBackground; + TQColor linkColor; + TQColor visitedLinkColor; + TQColor activeForeground; + TQColor inactiveForeground; + TQColor activeBackground; + TQColor inactiveBackground; + TQColor activeBlend; + TQColor inactiveBlend; + TQColor activeTitleBtnBg; + TQColor inactiveTitleBtnBg; + TQColor alternateBackground; + } usrColors, currentColors; + // first, the KDE 2 default color values + TQColor widget; + TQColor trinity4Blue; + TQColor inactiveBackground; + TQColor activeBackground; + TQColor button; + TQColor link; + TQColor visitedLink; + TQColor activeBlend; + TQColor activeTitleBtnBg; + TQColor inactiveTitleBtnBg; + TQColor inactiveForeground; + TQColor alternateBackground; + + TQListViewItem * kde; + TQListViewItem * classic; + TQListViewItem * keramik; + TQListViewItem * cde; + TQListViewItem * win; + TQListViewItem * platinum; + + TQStyle *appliedStyle; + + // widget-style existence + bool kde_hc_exist, kde_def_exist, kde_keramik_exist, kde_light_exist, + cde_exist, win_exist, platinum_exist, kde_plastik_exist; + + // twin-style-existence + bool twin_keramik_exist, twin_default_exist, twin_system_exist, + twin_win_exist, twin_cde_exist, twin_quartz_exist, twin_plastik_exist; + + // icon-theme-existence + bool icon_crystalsvg_exist, icon_kdeclassic_exist, icon_Locolor_exist; + +public slots: // Public slots + /** to be connected to the OS page. Catches either KDE, CDE, win or mac and pre-sets the style. */ + void presetStyle(const TQString& style); + +private: + void saveColors(bool curSettings=true); + void saveStyle(bool curSettings=true); + void saveKWin(bool curSettings=true); + void saveIcons(bool curSettings=true); + void getAvailability(); + void getUserDefaults(); + void initColors(); + void liveUpdate(); + void getColors(colorSet *set, bool colorfile ); + void setStyleRecursive(TQWidget* w, TQPalette &, TQStyle* s); + void changeCurrentStyle(); + TQPalette createPalette(); + +private slots: + void slotCurrentChanged(); +}; + +#endif diff --git a/kpersonalizer/tdestylepagedlg.ui b/kpersonalizer/tdestylepagedlg.ui new file mode 100644 index 000000000..65570e542 --- /dev/null +++ b/kpersonalizer/tdestylepagedlg.ui @@ -0,0 +1,127 @@ +<!DOCTYPE UI><UI version="3.0" stdsetdef="1"> +<class>TDEStylePageDlg</class> +<widget class="TQWidget"> + <property name="name"> + <cstring>TDEStylePageDlg</cstring> + </property> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>482</width> + <height>452</height> + </rect> + </property> + <grid> + <property name="name"> + <cstring>unnamed</cstring> + </property> + <widget class="TQLabel" row="0" column="1"> + <property name="name"> + <cstring>TextLabel7</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Please choose the way your computer should look by selecting one of the items below.</string> + </property> + <property name="alignment"> + <set>WordBreak|AlignVCenter|AlignLeft</set> + </property> + <property name="wordwrap" stdset="0"> + </property> + </widget> + <widget class="TQLabel" row="0" column="0" rowspan="4" colspan="1"> + <property name="name"> + <cstring>px_stylesSidebar</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>0</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>170</width> + <height>430</height> + </size> + </property> + <property name="frameShape"> + <enum>Panel</enum> + </property> + <property name="frameShadow"> + <enum>Sunken</enum> + </property> + <property name="scaledContents"> + <bool>true</bool> + </property> + <property name="indent"> + <number>0</number> + </property> + </widget> + <widget class="StylePreview" row="3" column="1"> + <property name="name"> + <cstring>stylePreview</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>1</hsizetype> + <vsizetype>1</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> + <widget class="TQLabel" row="2" column="1"> + <property name="name"> + <cstring>TextLabel2</cstring> + </property> + <property name="text"> + <string>Preview</string> + </property> + </widget> + <widget class="TDEListView" row="1" column="1"> + <property name="name"> + <cstring>klv_styles</cstring> + </property> + </widget> + </grid> +</widget> +<customwidgets> + <customwidget> + <class>StylePreview</class> + <header location="global">stylepreview.h</header> + <sizehint> + <width>-1</width> + <height>-1</height> + </sizehint> + <container>0</container> + <sizepolicy> + <hordata>5</hordata> + <verdata>5</verdata> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + <pixmap>image0</pixmap> + </customwidget> +</customwidgets> +<images> + <image name="image0"> + <data format="XPM.GZ" length="4350">789c6dd7594f23471007f0f7fd14d6d6db2aaaf58c3db647511eb831b7317794879ac30760cc61c010e5bba7dcf5af5688167664fdb66bbaababbb67cccf1f8dab93c3c68f9fdf5e16b298968d7222cf8d1fd5eb6cf6f1e75f7ffcfded7b9a3656ff9aad46fafdb76fdf078b46d9389a3fd42bf04841699e964933b830b79a7019dd0b96955b895b5a703bcd572e08eea576ff6570ae0eedd477b792103f854b8b2fc6d1163f77237e646e37113f89b6f8307e3bf1785a8b0eedbc696eb7ad9db7e01ee6476ee4ffe0c6fd158c7c69182cde4eec6e87fea50dfbf8176e6ba7d07f96669999cfa325ccaf862bcc97a36dbccf60f178cee11cde706761f16917ae30fe6b7488a7851bf14d7327417f676eb4f756eea41e2f57e6d83e83919f6cba117f04235fd9765b3b0fa36dfc398cf973edc67a6fb951ffe768ab6765ee26b8dff213ef5f4630e2b9e7463ea7ee8ee5ff60ee2618af8eb6fe3238437eb91bf1299cdbfacad3cadd5617f5a11738c7fe4adcb8ffd68d7aeec15e8fc3683b9f62ee2518ef33dafa3f75e3bc957086f86eb4d56f3db8e8e6dd56f01a5cc1bbe65e629673d8ebd18d0efdc9058cf9f2c08df9e630ce037db8719ec37c7a9a7fb708f10267b65e7cef46fb3e9ca3fd23dad6ef0cf67abe99f304f95ec3a8871cbb71be52d8d777e8b6fee412f6f958be3adf5ea817b561afe7d86ded7c67ce13c46fc37ede2766c17a17059cd9f38e466e8c3f8eb6fd700f0b9ef7095c37cd3d37de178f2be76dcf876fa343bd790267f012f67a77cc319f69b4ed872e2ca8e732daeabfe3c6fa9cc235f21f9b8bd4f2a5cd687bfedbfd659ee7ede017b842becf6eb44fa3cbd0df8559b0ffe808ceb0ff37e01afba3652e52cc87a26dbe276ecca7097790ff73b4cdef0616ac4fdf6df1c2d1d67ee8c6f80318eb4bd1180ff529513f0ecf7b694b62f5a002ceccb2662e523c2fb7605f9f0fd8fbbf75e3bc2dcd3e9ebcb9f17ce8c05e8f83685bcf701e44eb2db65e4fd1b65eebe62245be53b8c6f3ffdd8dfd3933fbf884761f5f0edcd88f951bf118bf44bde926dae24fe01ae7af76e3f9169e2f45bb143c0f5fdcf6fea23b18f773eac6f3e63ddac6db75e37df5e8c6fbae65aebcde6d37beaf84f528aa52f03c9dc3359ea79939c627d136deab1befaf75b883ef23e76e3ccfaea36d7dc2f795322b05ebfb0ad738af7db7ad371f99fd7e59b8b13f276e9cdf1318f5e54337e6d78cb67cf761ec170efba1acaa1afd9db92d3f3a36d729ea77efc6f33cbccf2beddfe6478fe6d85e45dbfd851bf1577007f5d877e3bc86f5a9ea3a2d6cffdfc1debe116df5db73a39e37b0e777191dda257c7fa83b6e8a2eaae00eeceb13d6b7d69f325b79b058fd32b170c1a55ebffaac2ccae2b9e6118f79c253bd6ef9ee3fd7587fef79c60f7acf3cc617fcc84ffcac6d8ffcc20b7ee5377ee7257ff027aff1bac66ff0269716cf5b1ab7cd3bbcabb17ddee37d3ee0433ee2633ee1019ff290cff89c2ff89229c48b66f1ac3d5df135df7093134eb9c56dcef4b3c35dee71ce393111dbfa8c784a4205955451cd1d1ad1982634a55bbad3f80eddd38c1ef882e66cf52ab5ff2b8d7ea4277aa6175ad06bb866f446efb4d4df0ffad4fed762ffb7b44e1b9cd2266dd142c75e5ddb3cd0bb3e347a477bd9d5f83ee245e3f7689f0ee830f67d44c77412ee186946033aa5e197fecfe85c7bf7be2fe892aee89a6ea84989f6bfa434f4eff9df52c509b5d0779b32ea684d13ea528f728d1e882ebfce37f6cf077422b4ea5b440ad14af1a15452ab473aee52c65ff39789b64fe955f44eb9937b5d858c5b32d377c0c32a7fee7ecd5fe61aff284ff22c2fb290577993775db1443fb53ef2219f5ff2bf93356d5b970dd9d41eb77820dbb223bbab155ed55ffab2f725ffb1eccb81aed6931cca116ab490633909d10339fd5ffdef795d869ae7923bc27226e772415d5986b51d683663b9d4fcfbb1ff190fe54aaec35aeaa577ee20f24673e94b531249a585fc2b69ebfe3ed7dae91f75ba964b5c03e9d344ba1add93bce0826c3f87f3b2a9fb6f18aeba10ba2f563f25eb1b563771a5d17531e2513c5fba538b3111cd690dd73c7ef6a95f4c8aa99de12fe77da4951de9ffffea730be7fd9fdfbffd0b690edc6c</data> + </image> +</images> +<includes> + <include location="global" impldecl="in declaration">tdelistview.h</include> + <include location="local" impldecl="in implementation">kdialog.h</include> +</includes> +<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/> +</UI> diff --git a/kpersonalizer/uninstall.desktop b/kpersonalizer/uninstall.desktop new file mode 100644 index 000000000..e1e3e1732 --- /dev/null +++ b/kpersonalizer/uninstall.desktop @@ -0,0 +1,2 @@ +[Desktop Entry] +Hidden=true |